summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cvsignore28
-rw-r--r--ChangeLog12387
-rw-r--r--Makefile.in103
-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-xconfigure30066
-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--debian/.git-dpm14
-rw-r--r--debian/changelog68
-rw-r--r--debian/patches/auth-log-verbosity.patch26
-rw-r--r--debian/patches/authorized-keys-man-symlink.patch6
-rw-r--r--debian/patches/consolekit.patch221
-rw-r--r--debian/patches/debian-banner.patch48
-rw-r--r--debian/patches/debian-config.patch18
-rw-r--r--debian/patches/dnssec-sshfp.patch8
-rw-r--r--debian/patches/doc-hash-tab-completion.patch6
-rw-r--r--debian/patches/doc-upstart.patch4
-rw-r--r--debian/patches/gnome-ssh-askpass2-icon.patch2
-rw-r--r--debian/patches/gssapi.patch536
-rw-r--r--debian/patches/helpful-wait-terminate.patch4
-rw-r--r--debian/patches/keepalive-extensions.patch34
-rw-r--r--debian/patches/lintian-symlink-pickiness.patch6
-rw-r--r--debian/patches/mention-ssh-keygen-on-keychange.patch8
-rw-r--r--debian/patches/no-openssl-version-status.patch8
-rw-r--r--debian/patches/openbsd-docs.patch22
-rw-r--r--debian/patches/package-versioning.patch14
-rw-r--r--debian/patches/quieter-signals.patch6
-rw-r--r--debian/patches/restore-tcp-wrappers.patch16
-rw-r--r--debian/patches/scp-quoting.patch6
-rw-r--r--debian/patches/selinux-role.patch66
-rw-r--r--debian/patches/shell-path.patch8
-rw-r--r--debian/patches/sigstop.patch6
-rw-r--r--debian/patches/ssh-agent-setgid.patch6
-rw-r--r--debian/patches/ssh-argv0.patch6
-rw-r--r--debian/patches/ssh-vulnkey-compat.patch10
-rw-r--r--debian/patches/ssh1-keepalive.patch12
-rw-r--r--debian/patches/syslog-level-silent.patch6
-rw-r--r--debian/patches/user-group-modes.patch32
-rwxr-xr-xdebian/rules5
-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.h193
-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--kexgssc.c70
-rw-r--r--kexgsss.c57
-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.c407
-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
362 files changed, 52908 insertions, 20676 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 4eab574a7..f52f90389 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -65,29 +65,34 @@ 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 kexgssc.o \
86 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 \
87 ssh-pkcs11.o krl.o smult_curve25519_ref.o \ 88 ssh-pkcs11.o smult_curve25519_ref.o \
88 kexc25519.o kexc25519c.o poly1305.o chacha.o cipher-chachapoly.o \ 89 poly1305.o chacha.o cipher-chachapoly.o \
89 ssh-ed25519.o digest-openssl.o hmac.o \ 90 ssh-ed25519.o digest-openssl.o digest-libc.o hmac.o \
90 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 \
95 kexgssc.o
91 96
92SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \ 97SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \
93 sshconnect.o sshconnect1.o sshconnect2.o mux.o \ 98 sshconnect.o sshconnect1.o sshconnect2.o mux.o \
@@ -100,8 +105,7 @@ SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \
100 auth-chall.o auth2-chall.o groupaccess.o \ 105 auth-chall.o auth2-chall.o groupaccess.o \
101 auth-skey.o auth-bsdauth.o auth2-hostbased.o auth2-kbdint.o \ 106 auth-skey.o auth-bsdauth.o auth2-hostbased.o auth2-kbdint.o \
102 auth2-none.o auth2-passwd.o auth2-pubkey.o \ 107 auth2-none.o auth2-passwd.o auth2-pubkey.o \
103 monitor_mm.o monitor.o monitor_wrap.o kexdhs.o kexgexs.o kexecdhs.o \ 108 monitor_mm.o monitor.o monitor_wrap.o auth-krb5.o \
104 kexc25519s.o auth-krb5.o \
105 auth2-gss.o gss-serv.o gss-serv-krb5.o kexgsss.o \ 109 auth2-gss.o gss-serv.o gss-serv-krb5.o kexgsss.o \
106 loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \ 110 loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \
107 sftp-server.o sftp-common.o \ 111 sftp-server.o sftp-common.o \
@@ -232,6 +236,12 @@ clean: regressclean
232 rm -f regress/unittests/sshbuf/test_sshbuf 236 rm -f regress/unittests/sshbuf/test_sshbuf
233 rm -f regress/unittests/sshkey/*.o 237 rm -f regress/unittests/sshkey/*.o
234 rm -f regress/unittests/sshkey/test_sshkey 238 rm -f regress/unittests/sshkey/test_sshkey
239 rm -f regress/unittests/bitmap/*.o
240 rm -f regress/unittests/bitmap/test_bitmap
241 rm -f regress/unittests/hostkeys/*.o
242 rm -f regress/unittests/hostkeys/test_hostkeys
243 rm -f regress/unittests/kex/*.o
244 rm -f regress/unittests/kex/test_kex
235 (cd openbsd-compat && $(MAKE) clean) 245 (cd openbsd-compat && $(MAKE) clean)
236 246
237distclean: regressclean 247distclean: regressclean
@@ -246,6 +256,12 @@ distclean: regressclean
246 rm -f regress/unittests/sshbuf/test_sshbuf 256 rm -f regress/unittests/sshbuf/test_sshbuf
247 rm -f regress/unittests/sshkey/*.o 257 rm -f regress/unittests/sshkey/*.o
248 rm -f regress/unittests/sshkey/test_sshkey 258 rm -f regress/unittests/sshkey/test_sshkey
259 rm -f regress/unittests/bitmap/*.o
260 rm -f regress/unittests/bitmap/test_bitmap
261 rm -f regress/unittests/hostkeys/*.o
262 rm -f regress/unittests/hostkeys/test_hostkeys
263 rm -f regress/unittests/kex/*.o
264 rm -f regress/unittests/kex/test_kex
249 (cd openbsd-compat && $(MAKE) distclean) 265 (cd openbsd-compat && $(MAKE) distclean)
250 if test -d pkg ; then \ 266 if test -d pkg ; then \
251 rm -fr pkg ; \ 267 rm -fr pkg ; \
@@ -420,15 +436,21 @@ uninstall:
420 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1 436 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
421 437
422regress-prep: 438regress-prep:
423 [ -d `pwd`/regress ] || mkdir -p `pwd`/regress 439 [ -d `pwd`/regress ] || mkdir -p `pwd`/regress
424 [ -d `pwd`/regress/unittests ] || mkdir -p `pwd`/regress/unittests 440 [ -d `pwd`/regress/unittests ] || mkdir -p `pwd`/regress/unittests
425 [ -d `pwd`/regress/unittests/test_helper ] || \ 441 [ -d `pwd`/regress/unittests/test_helper ] || \
426 mkdir -p `pwd`/regress/unittests/test_helper 442 mkdir -p `pwd`/regress/unittests/test_helper
427 [ -d `pwd`/regress/unittests/sshbuf ] || \ 443 [ -d `pwd`/regress/unittests/sshbuf ] || \
428 mkdir -p `pwd`/regress/unittests/sshbuf 444 mkdir -p `pwd`/regress/unittests/sshbuf
429 [ -d `pwd`/regress/unittests/sshkey ] || \ 445 [ -d `pwd`/regress/unittests/sshkey ] || \
430 mkdir -p `pwd`/regress/unittests/sshkey 446 mkdir -p `pwd`/regress/unittests/sshkey
431 [ -f `pwd`/regress/Makefile ] || \ 447 [ -d `pwd`/regress/unittests/bitmap ] || \
448 mkdir -p `pwd`/regress/unittests/bitmap
449 [ -d `pwd`/regress/unittests/hostkeys ] || \
450 mkdir -p `pwd`/regress/unittests/hostkeys
451 [ -d `pwd`/regress/unittests/kex ] || \
452 mkdir -p `pwd`/regress/unittests/kex
453 [ -f `pwd`/regress/Makefile ] || \
432 ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile 454 ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile
433 455
434regress/modpipe$(EXEEXT): $(srcdir)/regress/modpipe.c 456regress/modpipe$(EXEEXT): $(srcdir)/regress/modpipe.c
@@ -439,6 +461,10 @@ regress/setuid-allowed$(EXEEXT): $(srcdir)/regress/setuid-allowed.c
439 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \ 461 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \
440 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) 462 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
441 463
464regress/netcat$(EXEEXT): $(srcdir)/regress/netcat.c
465 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \
466 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
467
442UNITTESTS_TEST_HELPER_OBJS=\ 468UNITTESTS_TEST_HELPER_OBJS=\
443 regress/unittests/test_helper/test_helper.o \ 469 regress/unittests/test_helper/test_helper.o \
444 regress/unittests/test_helper/fuzz.o 470 regress/unittests/test_helper/fuzz.o
@@ -476,11 +502,46 @@ regress/unittests/sshkey/test_sshkey$(EXEEXT): ${UNITTESTS_TEST_SSHKEY_OBJS} \
476 regress/unittests/test_helper/libtest_helper.a \ 502 regress/unittests/test_helper/libtest_helper.a \
477 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) 503 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
478 504
505UNITTESTS_TEST_BITMAP_OBJS=\
506 regress/unittests/bitmap/tests.o
507
508regress/unittests/bitmap/test_bitmap$(EXEEXT): ${UNITTESTS_TEST_BITMAP_OBJS} \
509 regress/unittests/test_helper/libtest_helper.a libssh.a
510 $(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_BITMAP_OBJS) \
511 regress/unittests/test_helper/libtest_helper.a \
512 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
513
514UNITTESTS_TEST_KEX_OBJS=\
515 regress/unittests/kex/tests.o \
516 regress/unittests/kex/test_kex.o \
517 roaming_dummy.o
518
519regress/unittests/kex/test_kex$(EXEEXT): ${UNITTESTS_TEST_KEX_OBJS} \
520 regress/unittests/test_helper/libtest_helper.a libssh.a
521 $(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_KEX_OBJS) \
522 regress/unittests/test_helper/libtest_helper.a \
523 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
524
525UNITTESTS_TEST_HOSTKEYS_OBJS=\
526 regress/unittests/hostkeys/tests.o \
527 regress/unittests/hostkeys/test_iterate.o
528
529regress/unittests/hostkeys/test_hostkeys$(EXEEXT): \
530 ${UNITTESTS_TEST_HOSTKEYS_OBJS} \
531 regress/unittests/test_helper/libtest_helper.a libssh.a
532 $(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_HOSTKEYS_OBJS) \
533 regress/unittests/test_helper/libtest_helper.a \
534 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
535
479REGRESS_BINARIES=\ 536REGRESS_BINARIES=\
480 regress/modpipe$(EXEEXT) \ 537 regress/modpipe$(EXEEXT) \
481 regress/setuid-allowed$(EXEEXT) \ 538 regress/setuid-allowed$(EXEEXT) \
539 regress/netcat$(EXEEXT) \
482 regress/unittests/sshbuf/test_sshbuf$(EXEEXT) \ 540 regress/unittests/sshbuf/test_sshbuf$(EXEEXT) \
483 regress/unittests/sshkey/test_sshkey$(EXEEXT) 541 regress/unittests/sshkey/test_sshkey$(EXEEXT) \
542 regress/unittests/bitmap/test_bitmap$(EXEEXT) \
543 regress/unittests/hostkeys/test_hostkeys$(EXEEXT) \
544 regress/unittests/kex/test_kex$(EXEEXT)
484 545
485tests interop-tests t-exec: regress-prep $(TARGETS) $(REGRESS_BINARIES) 546tests interop-tests t-exec: regress-prep $(TARGETS) $(REGRESS_BINARIES)
486 BUILDDIR=`pwd`; \ 547 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 d4d22d7a5..3fa236eb8 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"
@@ -431,7 +435,7 @@ bad_option:
431#define OPTIONS_CRITICAL 1 435#define OPTIONS_CRITICAL 1
432#define OPTIONS_EXTENSIONS 2 436#define OPTIONS_EXTENSIONS 2
433static int 437static int
434parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw, 438parse_option_list(struct sshbuf *oblob, struct passwd *pw,
435 u_int which, int crit, 439 u_int which, int crit,
436 int *cert_no_port_forwarding_flag, 440 int *cert_no_port_forwarding_flag,
437 int *cert_no_agent_forwarding_flag, 441 int *cert_no_agent_forwarding_flag,
@@ -444,26 +448,25 @@ parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw,
444 char *command, *allowed; 448 char *command, *allowed;
445 const char *remote_ip; 449 const char *remote_ip;
446 char *name = NULL; 450 char *name = NULL;
447 u_char *data_blob = NULL; 451 struct sshbuf *c = NULL, *data = NULL;
448 u_int nlen, dlen, clen; 452 int r, ret = -1, result, found;
449 Buffer c, data;
450 int ret = -1, result, found;
451
452 buffer_init(&data);
453 453
454 /* Make copy to avoid altering original */ 454 if ((c = sshbuf_fromb(oblob)) == NULL) {
455 buffer_init(&c); 455 error("%s: sshbuf_fromb failed", __func__);
456 buffer_append(&c, optblob, optblob_len); 456 goto out;
457 }
457 458
458 while (buffer_len(&c) > 0) { 459 while (sshbuf_len(c) > 0) {
459 if ((name = buffer_get_cstring_ret(&c, &nlen)) == NULL || 460 sshbuf_free(data);
460 (data_blob = buffer_get_string_ret(&c, &dlen)) == NULL) { 461 data = NULL;
461 error("Certificate options corrupt"); 462 if ((r = sshbuf_get_cstring(c, &name, NULL)) != 0 ||
463 (r = sshbuf_froms(c, &data)) != 0) {
464 error("Unable to parse certificate options: %s",
465 ssh_err(r));
462 goto out; 466 goto out;
463 } 467 }
464 buffer_append(&data, data_blob, dlen); 468 debug3("found certificate option \"%.100s\" len %zu",
465 debug3("found certificate option \"%.100s\" len %u", 469 name, sshbuf_len(data));
466 name, dlen);
467 found = 0; 470 found = 0;
468 if ((which & OPTIONS_EXTENSIONS) != 0) { 471 if ((which & OPTIONS_EXTENSIONS) != 0) {
469 if (strcmp(name, "permit-X11-forwarding") == 0) { 472 if (strcmp(name, "permit-X11-forwarding") == 0) {
@@ -487,10 +490,10 @@ parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw,
487 } 490 }
488 if (!found && (which & OPTIONS_CRITICAL) != 0) { 491 if (!found && (which & OPTIONS_CRITICAL) != 0) {
489 if (strcmp(name, "force-command") == 0) { 492 if (strcmp(name, "force-command") == 0) {
490 if ((command = buffer_get_cstring_ret(&data, 493 if ((r = sshbuf_get_cstring(data, &command,
491 &clen)) == NULL) { 494 NULL)) != 0) {
492 error("Certificate constraint \"%s\" " 495 error("Unable to parse \"%s\" "
493 "corrupt", name); 496 "section: %s", name, ssh_err(r));
494 goto out; 497 goto out;
495 } 498 }
496 if (*cert_forced_command != NULL) { 499 if (*cert_forced_command != NULL) {
@@ -503,10 +506,10 @@ parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw,
503 found = 1; 506 found = 1;
504 } 507 }
505 if (strcmp(name, "source-address") == 0) { 508 if (strcmp(name, "source-address") == 0) {
506 if ((allowed = buffer_get_cstring_ret(&data, 509 if ((r = sshbuf_get_cstring(data, &allowed,
507 &clen)) == NULL) { 510 NULL)) != 0) {
508 error("Certificate constraint " 511 error("Unable to parse \"%s\" "
509 "\"%s\" corrupt", name); 512 "section: %s", name, ssh_err(r));
510 goto out; 513 goto out;
511 } 514 }
512 if ((*cert_source_address_done)++) { 515 if ((*cert_source_address_done)++) {
@@ -557,16 +560,13 @@ parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw,
557 logit("Certificate extension \"%s\" " 560 logit("Certificate extension \"%s\" "
558 "is not supported", name); 561 "is not supported", name);
559 } 562 }
560 } else if (buffer_len(&data) != 0) { 563 } else if (sshbuf_len(data) != 0) {
561 error("Certificate option \"%s\" corrupt " 564 error("Certificate option \"%s\" corrupt "
562 "(extra data)", name); 565 "(extra data)", name);
563 goto out; 566 goto out;
564 } 567 }
565 buffer_clear(&data);
566 free(name); 568 free(name);
567 free(data_blob);
568 name = NULL; 569 name = NULL;
569 data_blob = NULL;
570 } 570 }
571 /* successfully parsed all options */ 571 /* successfully parsed all options */
572 ret = 0; 572 ret = 0;
@@ -580,10 +580,8 @@ parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw,
580 } 580 }
581 if (name != NULL) 581 if (name != NULL)
582 free(name); 582 free(name);
583 if (data_blob != NULL) 583 sshbuf_free(data);
584 free(data_blob); 584 sshbuf_free(c);
585 buffer_free(&data);
586 buffer_free(&c);
587 return ret; 585 return ret;
588} 586}
589 587
@@ -592,7 +590,7 @@ parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw,
592 * options so this must be called after auth_parse_options(). 590 * options so this must be called after auth_parse_options().
593 */ 591 */
594int 592int
595auth_cert_options(Key *k, struct passwd *pw) 593auth_cert_options(struct sshkey *k, struct passwd *pw)
596{ 594{
597 int cert_no_port_forwarding_flag = 1; 595 int cert_no_port_forwarding_flag = 1;
598 int cert_no_agent_forwarding_flag = 1; 596 int cert_no_agent_forwarding_flag = 1;
@@ -602,10 +600,9 @@ auth_cert_options(Key *k, struct passwd *pw)
602 char *cert_forced_command = NULL; 600 char *cert_forced_command = NULL;
603 int cert_source_address_done = 0; 601 int cert_source_address_done = 0;
604 602
605 if (key_cert_is_legacy(k)) { 603 if (sshkey_cert_is_legacy(k)) {
606 /* All options are in the one field for v00 certs */ 604 /* All options are in the one field for v00 certs */
607 if (parse_option_list(buffer_ptr(k->cert->critical), 605 if (parse_option_list(k->cert->critical, pw,
608 buffer_len(k->cert->critical), pw,
609 OPTIONS_CRITICAL|OPTIONS_EXTENSIONS, 1, 606 OPTIONS_CRITICAL|OPTIONS_EXTENSIONS, 1,
610 &cert_no_port_forwarding_flag, 607 &cert_no_port_forwarding_flag,
611 &cert_no_agent_forwarding_flag, 608 &cert_no_agent_forwarding_flag,
@@ -617,14 +614,12 @@ auth_cert_options(Key *k, struct passwd *pw)
617 return -1; 614 return -1;
618 } else { 615 } else {
619 /* Separate options and extensions for v01 certs */ 616 /* Separate options and extensions for v01 certs */
620 if (parse_option_list(buffer_ptr(k->cert->critical), 617 if (parse_option_list(k->cert->critical, pw,
621 buffer_len(k->cert->critical), pw,
622 OPTIONS_CRITICAL, 1, NULL, NULL, NULL, NULL, NULL, 618 OPTIONS_CRITICAL, 1, NULL, NULL, NULL, NULL, NULL,
623 &cert_forced_command, 619 &cert_forced_command,
624 &cert_source_address_done) == -1) 620 &cert_source_address_done) == -1)
625 return -1; 621 return -1;
626 if (parse_option_list(buffer_ptr(k->cert->extensions), 622 if (parse_option_list(k->cert->extensions, pw,
627 buffer_len(k->cert->extensions), pw,
628 OPTIONS_EXTENSIONS, 1, 623 OPTIONS_EXTENSIONS, 1,
629 &cert_no_port_forwarding_flag, 624 &cert_no_port_forwarding_flag,
630 &cert_no_agent_forwarding_flag, 625 &cert_no_agent_forwarding_flag,
diff --git a/auth-options.h b/auth-options.h
index a3f0a02da..1653855ee 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>
@@ -36,6 +36,6 @@ extern char *authorized_principals;
36void auth_start_parse_options(void); 36void auth_start_parse_options(void);
37int auth_parse_options(struct passwd *, char *, char *, u_long); 37int auth_parse_options(struct passwd *, char *, char *, u_long);
38void auth_clear_options(void); 38void auth_clear_options(void);
39int auth_cert_options(Key *, struct passwd *); 39int auth_cert_options(struct sshkey *, struct passwd *);
40 40
41#endif 41#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 11fcca643..2ff2cffa9 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.
@@ -288,20 +303,25 @@ auth_rhosts2_raw(struct passwd *pw, const char *client_user, const char *hostnam
288 auth_debug_add("Bad file modes for %.200s", buf); 303 auth_debug_add("Bad file modes for %.200s", buf);
289 continue; 304 continue;
290 } 305 }
291 /* Check if we have been configured to ignore .rhosts and .shosts files. */ 306 /*
307 * Check if we have been configured to ignore .rhosts
308 * and .shosts files.
309 */
292 if (options.ignore_rhosts) { 310 if (options.ignore_rhosts) {
293 auth_debug_add("Server has been configured to ignore %.100s.", 311 auth_debug_add("Server has been configured to "
294 rhosts_files[rhosts_file_index]); 312 "ignore %.100s.", rhosts_files[rhosts_file_index]);
295 continue; 313 continue;
296 } 314 }
297 /* Check if authentication is permitted by the file. */ 315 /* Check if authentication is permitted by the file. */
298 if (check_rhosts_file(buf, hostname, ipaddr, client_user, pw->pw_name)) { 316 if (check_rhosts_file(buf, hostname, ipaddr,
317 client_user, pw->pw_name)) {
299 auth_debug_add("Accepted by %.100s.", 318 auth_debug_add("Accepted by %.100s.",
300 rhosts_files[rhosts_file_index]); 319 rhosts_files[rhosts_file_index]);
301 /* Restore the privileged uid. */ 320 /* Restore the privileged uid. */
302 restore_uid(); 321 restore_uid();
303 auth_debug_add("Accepted host %s ip %s client_user %s server_user %s", 322 auth_debug_add("Accepted host %s ip %s client_user "
304 hostname, ipaddr, client_user, pw->pw_name); 323 "%s server_user %s", hostname, ipaddr,
324 client_user, pw->pw_name);
305 return 1; 325 return 1;
306 } 326 }
307 } 327 }
diff --git a/auth-rsa.c b/auth-rsa.c
index 5d7bdcbfc..4cf2163c7 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
@@ -238,7 +240,9 @@ rsa_key_allowed_in_file(struct passwd *pw, char *file,
238 "actual %d vs. announced %d.", 240 "actual %d vs. announced %d.",
239 file, linenum, BN_num_bits(key->rsa->n), bits); 241 file, linenum, BN_num_bits(key->rsa->n), bits);
240 242
241 fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); 243 if ((fp = sshkey_fingerprint(key, options.fingerprint_hash,
244 SSH_FP_DEFAULT)) == NULL)
245 continue;
242 debug("matching key found: file %s, line %lu %s %s", 246 debug("matching key found: file %s, line %lu %s %s",
243 file, linenum, key_type(key), fp); 247 file, linenum, key_type(key), fp);
244 free(fp); 248 free(fp);
@@ -343,3 +347,5 @@ auth_rsa(Authctxt *authctxt, BIGNUM *client_n)
343 packet_send_debug("RSA authentication accepted."); 347 packet_send_debug("RSA authentication accepted.");
344 return (1); 348 return (1);
345} 349}
350
351#endif /* WITH_SSH1 */
diff --git a/auth.c b/auth.c
index 18de51a29..41e387614 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,
@@ -466,7 +468,7 @@ int
466auth_secure_path(const char *name, struct stat *stp, const char *pw_dir, 468auth_secure_path(const char *name, struct stat *stp, const char *pw_dir,
467 uid_t uid, char *err, size_t errlen) 469 uid_t uid, char *err, size_t errlen)
468{ 470{
469 char buf[MAXPATHLEN], homedir[MAXPATHLEN]; 471 char buf[PATH_MAX], homedir[PATH_MAX];
470 char *cp; 472 char *cp;
471 int comparehome = 0; 473 int comparehome = 0;
472 struct stat st; 474 struct stat st;
@@ -670,43 +672,39 @@ getpwnamallow(const char *user)
670int 672int
671auth_key_is_revoked(Key *key) 673auth_key_is_revoked(Key *key)
672{ 674{
673#ifdef WITH_OPENSSL 675 char *fp = NULL;
674 char *key_fp; 676 int r;
675 677
676 if (options.revoked_keys_file == NULL) 678 if (options.revoked_keys_file == NULL)
677 return 0; 679 return 0;
678 switch (ssh_krl_file_contains_key(options.revoked_keys_file, key)) { 680 if ((fp = sshkey_fingerprint(key, options.fingerprint_hash,
679 case 0: 681 SSH_FP_DEFAULT)) == NULL) {
680 return 0; /* Not revoked */ 682 r = SSH_ERR_ALLOC_FAIL;
681 case -2: 683 error("%s: fingerprint key: %s", __func__, ssh_err(r));
682 break; /* Not a KRL */ 684 goto out;
683 default:
684 goto revoked;
685 } 685 }
686#endif 686
687 debug3("%s: treating %s as a key list", __func__, 687 r = sshkey_check_revoked(key, options.revoked_keys_file);
688 options.revoked_keys_file); 688 switch (r) {
689 switch (key_in_file(key, options.revoked_keys_file, 0)) {
690 case 0: 689 case 0:
691 /* key not revoked */ 690 break; /* not revoked */
692 return 0; 691 case SSH_ERR_KEY_REVOKED:
693 case -1: 692 error("Authentication key %s %s revoked by file %s",
694 /* Error opening revoked_keys_file: refuse all keys */ 693 sshkey_type(key), fp, options.revoked_keys_file);
695 error("Revoked keys file is unreadable: refusing public key " 694 goto out;
696 "authentication"); 695 default:
697 return 1; 696 error("Error checking authentication key %s %s in "
698#ifdef WITH_OPENSSL 697 "revoked keys file %s: %s", sshkey_type(key), fp,
699 case 1: 698 options.revoked_keys_file, ssh_err(r));
700 revoked: 699 goto out;
701 /* Key revoked */
702 key_fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX);
703 error("WARNING: authentication attempt with a revoked "
704 "%s key %s ", key_type(key), key_fp);
705 free(key_fp);
706 return 1;
707#endif
708 } 700 }
709 fatal("key_in_file returned junk"); 701
702 /* Success */
703 r = 0;
704
705 out:
706 free(fp);
707 return r == 0 ? 0 : 1;
710} 708}
711 709
712void 710void
diff --git a/auth.h b/auth.h
index f099e9807..4985cd86c 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;
@@ -76,6 +79,9 @@ struct Authctxt {
76#endif 79#endif
77 Buffer *loginmsg; 80 Buffer *loginmsg;
78 void *methoddata; 81 void *methoddata;
82
83 struct sshkey **prev_userkeys;
84 u_int nprev_userkeys;
79}; 85};
80/* 86/*
81 * Every authentication method has to handle authentication requests for 87 * Every authentication method has to handle authentication requests for
@@ -124,6 +130,8 @@ int hostbased_key_allowed(struct passwd *, const char *, char *, Key *);
124int user_key_allowed(struct passwd *, Key *); 130int user_key_allowed(struct passwd *, Key *);
125void pubkey_auth_info(Authctxt *, const Key *, const char *, ...) 131void pubkey_auth_info(Authctxt *, const Key *, const char *, ...)
126 __attribute__((__format__ (printf, 3, 4))); 132 __attribute__((__format__ (printf, 3, 4)));
133void auth2_record_userkey(Authctxt *, struct sshkey *);
134int auth2_userkey_already_used(Authctxt *, struct sshkey *);
127 135
128struct stat; 136struct stat;
129int auth_secure_path(const char *, struct stat *, const char *, uid_t, 137int auth_secure_path(const char *, struct stat *, const char *, uid_t,
@@ -196,12 +204,13 @@ check_key_in_hostfiles(struct passwd *, Key *, const char *,
196 204
197/* hostkey handling */ 205/* hostkey handling */
198Key *get_hostkey_by_index(int); 206Key *get_hostkey_by_index(int);
199Key *get_hostkey_public_by_index(int); 207Key *get_hostkey_public_by_index(int, struct ssh *);
200Key *get_hostkey_public_by_type(int); 208Key *get_hostkey_public_by_type(int, int, struct ssh *);
201Key *get_hostkey_private_by_type(int); 209Key *get_hostkey_private_by_type(int, int, struct ssh *);
202int get_hostkey_index(Key *); 210int get_hostkey_index(Key *, int, struct ssh *);
203int ssh1_session_key(BIGNUM *); 211int ssh1_session_key(BIGNUM *);
204void sshd_hostkey_sign(Key *, Key *, u_char **, u_int *, u_char *, u_int); 212int sshd_hostkey_sign(Key *, Key *, u_char **, size_t *,
213 const u_char *, size_t, u_int);
205 214
206/* debug messages during authentication */ 215/* debug messages during authentication */
207void auth_debug_add(const char *fmt,...) __attribute__((format(printf, 1, 2))); 216void auth_debug_add(const char *fmt,...) __attribute__((format(printf, 1, 2)));
diff --git a/auth1.c b/auth1.c
index 52b17dbef..dd0064832 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>
@@ -444,3 +446,5 @@ do_authentication(Authctxt *authctxt)
444 packet_send(); 446 packet_send();
445 packet_write_wait(); 447 packet_write_wait();
446} 448}
449
450#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 284f364b0..3b5036dfd 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-2007 Simon Wilkinson. All rights reserved. 4 * Copyright (c) 2001-2007 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 * The 'gssapi_keyex' userauth mechanism. 57 * The 'gssapi_keyex' userauth mechanism.
@@ -160,7 +160,7 @@ userauth_gssapi(Authctxt *authctxt)
160 return (0); 160 return (0);
161} 161}
162 162
163static void 163static int
164input_gssapi_token(int type, u_int32_t plen, void *ctxt) 164input_gssapi_token(int type, u_int32_t plen, void *ctxt)
165{ 165{
166 Authctxt *authctxt = ctxt; 166 Authctxt *authctxt = ctxt;
@@ -212,9 +212,10 @@ input_gssapi_token(int type, u_int32_t plen, void *ctxt)
212 } 212 }
213 213
214 gss_release_buffer(&min_status, &send_tok); 214 gss_release_buffer(&min_status, &send_tok);
215 return 0;
215} 216}
216 217
217static void 218static int
218input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) 219input_gssapi_errtok(int type, u_int32_t plen, void *ctxt)
219{ 220{
220 Authctxt *authctxt = ctxt; 221 Authctxt *authctxt = ctxt;
@@ -246,6 +247,7 @@ input_gssapi_errtok(int type, u_int32_t plen, void *ctxt)
246 /* The client will have already moved on to the next auth */ 247 /* The client will have already moved on to the next auth */
247 248
248 gss_release_buffer(&maj_status, &send_tok); 249 gss_release_buffer(&maj_status, &send_tok);
250 return 0;
249} 251}
250 252
251/* 253/*
@@ -254,7 +256,7 @@ input_gssapi_errtok(int type, u_int32_t plen, void *ctxt)
254 * which only enables it once the GSSAPI exchange is complete. 256 * which only enables it once the GSSAPI exchange is complete.
255 */ 257 */
256 258
257static void 259static int
258input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt) 260input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt)
259{ 261{
260 Authctxt *authctxt = ctxt; 262 Authctxt *authctxt = ctxt;
@@ -279,9 +281,10 @@ input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt)
279 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL); 281 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL);
280 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL); 282 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL);
281 userauth_finish(authctxt, authenticated, "gssapi-with-mic", NULL); 283 userauth_finish(authctxt, authenticated, "gssapi-with-mic", NULL);
284 return 0;
282} 285}
283 286
284static void 287static int
285input_gssapi_mic(int type, u_int32_t plen, void *ctxt) 288input_gssapi_mic(int type, u_int32_t plen, void *ctxt)
286{ 289{
287 Authctxt *authctxt = ctxt; 290 Authctxt *authctxt = ctxt;
@@ -320,6 +323,7 @@ input_gssapi_mic(int type, u_int32_t plen, void *ctxt)
320 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL); 323 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL);
321 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL); 324 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL);
322 userauth_finish(authctxt, authenticated, "gssapi-with-mic", NULL); 325 userauth_finish(authctxt, authenticated, "gssapi-with-mic", NULL);
326 return 0;
323} 327}
324 328
325Authmethod method_gsskeyex = { 329Authmethod method_gsskeyex = {
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 f78b046b8..0bda5c9dd 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 }
@@ -367,8 +386,9 @@ check_authkeys_file(FILE *f, char *file, Key* key, struct passwd *pw)
367 continue; 386 continue;
368 if (!key_is_cert_authority) 387 if (!key_is_cert_authority)
369 continue; 388 continue;
370 fp = key_fingerprint(found, SSH_FP_MD5, 389 if ((fp = sshkey_fingerprint(found,
371 SSH_FP_HEX); 390 options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL)
391 continue;
372 debug("matching CA found: file %s, line %lu, %s %s", 392 debug("matching CA found: file %s, line %lu, %s %s",
373 file, linenum, key_type(found), fp); 393 file, linenum, key_type(found), fp);
374 /* 394 /*
@@ -407,11 +427,13 @@ check_authkeys_file(FILE *f, char *file, Key* key, struct passwd *pw)
407 continue; 427 continue;
408 if (key_is_cert_authority) 428 if (key_is_cert_authority)
409 continue; 429 continue;
410 found_key = 1; 430 if ((fp = sshkey_fingerprint(found,
411 fp = key_fingerprint(found, SSH_FP_MD5, SSH_FP_HEX); 431 options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL)
432 continue;
412 debug("matching key found: file %s, line %lu %s %s", 433 debug("matching key found: file %s, line %lu %s %s",
413 file, linenum, key_type(found), fp); 434 file, linenum, key_type(found), fp);
414 free(fp); 435 free(fp);
436 found_key = 1;
415 break; 437 break;
416 } 438 }
417 } 439 }
@@ -433,11 +455,12 @@ user_cert_trusted_ca(struct passwd *pw, Key *key)
433 if (!key_is_cert(key) || options.trusted_user_ca_keys == NULL) 455 if (!key_is_cert(key) || options.trusted_user_ca_keys == NULL)
434 return 0; 456 return 0;
435 457
436 ca_fp = key_fingerprint(key->cert->signature_key, 458 if ((ca_fp = sshkey_fingerprint(key->cert->signature_key,
437 SSH_FP_MD5, SSH_FP_HEX); 459 options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL)
460 return 0;
438 461
439 if (key_in_file(key->cert->signature_key, 462 if (sshkey_in_file(key->cert->signature_key,
440 options.trusted_user_ca_keys, 1) != 1) { 463 options.trusted_user_ca_keys, 1, 0) != 0) {
441 debug2("%s: CA %s %s is not listed in %s", __func__, 464 debug2("%s: CA %s %s is not listed in %s", __func__,
442 key_type(key->cert->signature_key), ca_fp, 465 key_type(key->cert->signature_key), ca_fp,
443 options.trusted_user_ca_keys); 466 options.trusted_user_ca_keys);
@@ -683,6 +706,35 @@ user_key_allowed(struct passwd *pw, Key *key)
683 return success; 706 return success;
684} 707}
685 708
709/* Records a public key in the list of previously-successful keys */
710void
711auth2_record_userkey(Authctxt *authctxt, struct sshkey *key)
712{
713 struct sshkey **tmp;
714
715 if (authctxt->nprev_userkeys >= INT_MAX ||
716 (tmp = reallocarray(authctxt->prev_userkeys,
717 authctxt->nprev_userkeys + 1, sizeof(*tmp))) == NULL)
718 fatal("%s: reallocarray failed", __func__);
719 authctxt->prev_userkeys = tmp;
720 authctxt->prev_userkeys[authctxt->nprev_userkeys] = key;
721 authctxt->nprev_userkeys++;
722}
723
724/* Checks whether a key has already been used successfully for authentication */
725int
726auth2_userkey_already_used(Authctxt *authctxt, struct sshkey *key)
727{
728 u_int i;
729
730 for (i = 0; i < authctxt->nprev_userkeys; i++) {
731 if (sshkey_equal_public(key, authctxt->prev_userkeys[i])) {
732 return 1;
733 }
734 }
735 return 0;
736}
737
686Authmethod method_pubkey = { 738Authmethod method_pubkey = {
687 "publickey", 739 "publickey",
688 userauth_pubkey, 740 userauth_pubkey,
diff --git a/auth2.c b/auth2.c
index fa1a5886d..6eb3cc7b9 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 *
@@ -89,8 +89,8 @@ Authmethod *authmethods[] = {
89 89
90/* protocol */ 90/* protocol */
91 91
92static void input_service_request(int, u_int32_t, void *); 92static int input_service_request(int, u_int32_t, void *);
93static void input_userauth_request(int, u_int32_t, void *); 93static int input_userauth_request(int, u_int32_t, void *);
94 94
95/* helper */ 95/* helper */
96static Authmethod *authmethod_lookup(Authctxt *, const char *); 96static Authmethod *authmethod_lookup(Authctxt *, const char *);
@@ -153,9 +153,7 @@ userauth_banner(void)
153{ 153{
154 char *banner = NULL; 154 char *banner = NULL;
155 155
156 if (options.banner == NULL || 156 if (options.banner == NULL || (datafellows & SSH_BUG_BANNER) != 0)
157 strcasecmp(options.banner, "none") == 0 ||
158 (datafellows & SSH_BUG_BANNER) != 0)
159 return; 157 return;
160 158
161 if ((banner = PRIVSEP(auth2_read_banner())) == NULL) 159 if ((banner = PRIVSEP(auth2_read_banner())) == NULL)
@@ -178,7 +176,7 @@ do_authentication2(Authctxt *authctxt)
178} 176}
179 177
180/*ARGSUSED*/ 178/*ARGSUSED*/
181static void 179static int
182input_service_request(int type, u_int32_t seq, void *ctxt) 180input_service_request(int type, u_int32_t seq, void *ctxt)
183{ 181{
184 Authctxt *authctxt = ctxt; 182 Authctxt *authctxt = ctxt;
@@ -209,10 +207,11 @@ input_service_request(int type, u_int32_t seq, void *ctxt)
209 packet_disconnect("bad service request %s", service); 207 packet_disconnect("bad service request %s", service);
210 } 208 }
211 free(service); 209 free(service);
210 return 0;
212} 211}
213 212
214/*ARGSUSED*/ 213/*ARGSUSED*/
215static void 214static int
216input_userauth_request(int type, u_int32_t seq, void *ctxt) 215input_userauth_request(int type, u_int32_t seq, void *ctxt)
217{ 216{
218 Authctxt *authctxt = ctxt; 217 Authctxt *authctxt = ctxt;
@@ -294,6 +293,7 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt)
294 free(service); 293 free(service);
295 free(user); 294 free(user);
296 free(method); 295 free(method);
296 return 0;
297} 297}
298 298
299void 299void
@@ -364,7 +364,7 @@ userauth_finish(Authctxt *authctxt, int authenticated, const char *method,
364 } else { 364 } else {
365 365
366 /* Allow initial try of "none" auth without failure penalty */ 366 /* Allow initial try of "none" auth without failure penalty */
367 if (!authctxt->server_caused_failure && 367 if (!partial && !authctxt->server_caused_failure &&
368 (authctxt->attempt > 1 || strcmp(method, "none") != 0)) 368 (authctxt->attempt > 1 || strcmp(method, "none") != 0))
369 authctxt->failures++; 369 authctxt->failures++;
370 if (authctxt->failures >= options.max_authtries) { 370 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 0180774bb..45cef8829 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#ifdef GSSAPI 117#ifdef GSSAPI
115#include "ssh-gss.h" 118#include "ssh-gss.h"
@@ -195,9 +198,6 @@ TAILQ_HEAD(global_confirms, global_confirm);
195static struct global_confirms global_confirms = 198static struct global_confirms global_confirms =
196 TAILQ_HEAD_INITIALIZER(global_confirms); 199 TAILQ_HEAD_INITIALIZER(global_confirms);
197 200
198/*XXX*/
199extern Kex *xxx_kex;
200
201void ssh_process_session2_setup(int, int, int, Buffer *); 201void ssh_process_session2_setup(int, int, int, Buffer *);
202 202
203/* Restores stdin to blocking mode. */ 203/* Restores stdin to blocking mode. */
@@ -345,12 +345,12 @@ client_x11_get_proto(const char *display, const char *xauth_path,
345 display = xdisplay; 345 display = xdisplay;
346 } 346 }
347 if (trusted == 0) { 347 if (trusted == 0) {
348 xauthdir = xmalloc(MAXPATHLEN); 348 xauthdir = xmalloc(PATH_MAX);
349 xauthfile = xmalloc(MAXPATHLEN); 349 xauthfile = xmalloc(PATH_MAX);
350 mktemp_proto(xauthdir, MAXPATHLEN); 350 mktemp_proto(xauthdir, PATH_MAX);
351 if (mkdtemp(xauthdir) != NULL) { 351 if (mkdtemp(xauthdir) != NULL) {
352 do_unlink = 1; 352 do_unlink = 1;
353 snprintf(xauthfile, MAXPATHLEN, "%s/xauthfile", 353 snprintf(xauthfile, PATH_MAX, "%s/xauthfile",
354 xauthdir); 354 xauthdir);
355 snprintf(cmd, sizeof(cmd), 355 snprintf(cmd, sizeof(cmd),
356 "%s -f %s generate %s " SSH_X11_PROTO 356 "%s -f %s generate %s " SSH_X11_PROTO
@@ -542,13 +542,13 @@ client_check_window_change(void)
542 } 542 }
543} 543}
544 544
545static void 545static int
546client_global_request_reply(int type, u_int32_t seq, void *ctxt) 546client_global_request_reply(int type, u_int32_t seq, void *ctxt)
547{ 547{
548 struct global_confirm *gc; 548 struct global_confirm *gc;
549 549
550 if ((gc = TAILQ_FIRST(&global_confirms)) == NULL) 550 if ((gc = TAILQ_FIRST(&global_confirms)) == NULL)
551 return; 551 return 0;
552 if (gc->cb != NULL) 552 if (gc->cb != NULL)
553 gc->cb(type, seq, gc->ctx); 553 gc->cb(type, seq, gc->ctx);
554 if (--gc->ref_count <= 0) { 554 if (--gc->ref_count <= 0) {
@@ -558,6 +558,7 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt)
558 } 558 }
559 559
560 packet_set_alive_timeouts(0); 560 packet_set_alive_timeouts(0);
561 return 0;
561} 562}
562 563
563static void 564static void
@@ -1423,8 +1424,7 @@ client_process_output(fd_set *writeset)
1423static void 1424static void
1424client_process_buffered_input_packets(void) 1425client_process_buffered_input_packets(void)
1425{ 1426{
1426 dispatch_run(DISPATCH_NONBLOCK, &quit_pending, 1427 dispatch_run(DISPATCH_NONBLOCK, &quit_pending, active_state);
1427 compat20 ? xxx_kex : NULL);
1428} 1428}
1429 1429
1430/* scan buf[] for '~' before sending data to the peer */ 1430/* scan buf[] for '~' before sending data to the peer */
@@ -1478,7 +1478,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1478{ 1478{
1479 fd_set *readset = NULL, *writeset = NULL; 1479 fd_set *readset = NULL, *writeset = NULL;
1480 double start_time, total_time; 1480 double start_time, total_time;
1481 int max_fd = 0, max_fd2 = 0, len, rekeying = 0; 1481 int r, max_fd = 0, max_fd2 = 0, len, rekeying = 0;
1482 u_int64_t ibytes, obytes; 1482 u_int64_t ibytes, obytes;
1483 u_int nalloc = 0; 1483 u_int nalloc = 0;
1484 char buf[100]; 1484 char buf[100];
@@ -1563,7 +1563,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1563 if (compat20 && session_closed && !channel_still_open()) 1563 if (compat20 && session_closed && !channel_still_open())
1564 break; 1564 break;
1565 1565
1566 rekeying = (xxx_kex != NULL && !xxx_kex->done); 1566 rekeying = (active_state->kex != NULL && !active_state->kex->done);
1567 1567
1568 if (rekeying) { 1568 if (rekeying) {
1569 debug("rekeying in progress"); 1569 debug("rekeying in progress");
@@ -1616,8 +1616,10 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1616 1616
1617 if (need_rekeying || packet_need_rekeying()) { 1617 if (need_rekeying || packet_need_rekeying()) {
1618 debug("need rekeying"); 1618 debug("need rekeying");
1619 xxx_kex->done = 0; 1619 active_state->kex->done = 0;
1620 kex_send_kexinit(xxx_kex); 1620 if ((r = kex_send_kexinit(active_state)) != 0)
1621 fatal("%s: kex_send_kexinit: %s",
1622 __func__, ssh_err(r));
1621 need_rekeying = 0; 1623 need_rekeying = 0;
1622 } 1624 }
1623 } 1625 }
@@ -1748,8 +1750,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1748 1750
1749 /* Report bytes transferred, and transfer rates. */ 1751 /* Report bytes transferred, and transfer rates. */
1750 total_time = get_current_time() - start_time; 1752 total_time = get_current_time() - start_time;
1751 packet_get_state(MODE_IN, NULL, NULL, NULL, &ibytes); 1753 packet_get_bytes(&ibytes, &obytes);
1752 packet_get_state(MODE_OUT, NULL, NULL, NULL, &obytes);
1753 verbose("Transferred: sent %llu, received %llu bytes, in %.1f seconds", 1754 verbose("Transferred: sent %llu, received %llu bytes, in %.1f seconds",
1754 (unsigned long long)obytes, (unsigned long long)ibytes, total_time); 1755 (unsigned long long)obytes, (unsigned long long)ibytes, total_time);
1755 if (total_time > 0) 1756 if (total_time > 0)
@@ -1762,7 +1763,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1762 1763
1763/*********/ 1764/*********/
1764 1765
1765static void 1766static int
1766client_input_stdout_data(int type, u_int32_t seq, void *ctxt) 1767client_input_stdout_data(int type, u_int32_t seq, void *ctxt)
1767{ 1768{
1768 u_int data_len; 1769 u_int data_len;
@@ -1771,8 +1772,9 @@ client_input_stdout_data(int type, u_int32_t seq, void *ctxt)
1771 buffer_append(&stdout_buffer, data, data_len); 1772 buffer_append(&stdout_buffer, data, data_len);
1772 explicit_bzero(data, data_len); 1773 explicit_bzero(data, data_len);
1773 free(data); 1774 free(data);
1775 return 0;
1774} 1776}
1775static void 1777static int
1776client_input_stderr_data(int type, u_int32_t seq, void *ctxt) 1778client_input_stderr_data(int type, u_int32_t seq, void *ctxt)
1777{ 1779{
1778 u_int data_len; 1780 u_int data_len;
@@ -1781,8 +1783,9 @@ client_input_stderr_data(int type, u_int32_t seq, void *ctxt)
1781 buffer_append(&stderr_buffer, data, data_len); 1783 buffer_append(&stderr_buffer, data, data_len);
1782 explicit_bzero(data, data_len); 1784 explicit_bzero(data, data_len);
1783 free(data); 1785 free(data);
1786 return 0;
1784} 1787}
1785static void 1788static int
1786client_input_exit_status(int type, u_int32_t seq, void *ctxt) 1789client_input_exit_status(int type, u_int32_t seq, void *ctxt)
1787{ 1790{
1788 exit_status = packet_get_int(); 1791 exit_status = packet_get_int();
@@ -1797,12 +1800,14 @@ client_input_exit_status(int type, u_int32_t seq, void *ctxt)
1797 packet_write_wait(); 1800 packet_write_wait();
1798 /* Flag that we want to exit. */ 1801 /* Flag that we want to exit. */
1799 quit_pending = 1; 1802 quit_pending = 1;
1803 return 0;
1800} 1804}
1801static void 1805
1806static int
1802client_input_agent_open(int type, u_int32_t seq, void *ctxt) 1807client_input_agent_open(int type, u_int32_t seq, void *ctxt)
1803{ 1808{
1804 Channel *c = NULL; 1809 Channel *c = NULL;
1805 int remote_id, sock; 1810 int r, remote_id, sock;
1806 1811
1807 /* Read the remote channel number from the message. */ 1812 /* Read the remote channel number from the message. */
1808 remote_id = packet_get_int(); 1813 remote_id = packet_get_int();
@@ -1812,7 +1817,11 @@ client_input_agent_open(int type, u_int32_t seq, void *ctxt)
1812 * Get a connection to the local authentication agent (this may again 1817 * Get a connection to the local authentication agent (this may again
1813 * get forwarded). 1818 * get forwarded).
1814 */ 1819 */
1815 sock = ssh_get_authentication_socket(); 1820 if ((r = ssh_get_authentication_socket(&sock)) != 0 &&
1821 r != SSH_ERR_AGENT_NOT_PRESENT)
1822 debug("%s: ssh_get_authentication_socket: %s",
1823 __func__, ssh_err(r));
1824
1816 1825
1817 /* 1826 /*
1818 * If we could not connect the agent, send an error message back to 1827 * If we could not connect the agent, send an error message back to
@@ -1837,6 +1846,7 @@ client_input_agent_open(int type, u_int32_t seq, void *ctxt)
1837 packet_put_int(c->self); 1846 packet_put_int(c->self);
1838 } 1847 }
1839 packet_send(); 1848 packet_send();
1849 return 0;
1840} 1850}
1841 1851
1842static Channel * 1852static Channel *
@@ -1930,7 +1940,7 @@ static Channel *
1930client_request_agent(const char *request_type, int rchan) 1940client_request_agent(const char *request_type, int rchan)
1931{ 1941{
1932 Channel *c = NULL; 1942 Channel *c = NULL;
1933 int sock; 1943 int r, sock;
1934 1944
1935 if (!options.forward_agent) { 1945 if (!options.forward_agent) {
1936 error("Warning: ssh server tried agent forwarding."); 1946 error("Warning: ssh server tried agent forwarding.");
@@ -1938,9 +1948,12 @@ client_request_agent(const char *request_type, int rchan)
1938 "malicious server."); 1948 "malicious server.");
1939 return NULL; 1949 return NULL;
1940 } 1950 }
1941 sock = ssh_get_authentication_socket(); 1951 if ((r = ssh_get_authentication_socket(&sock)) != 0) {
1942 if (sock < 0) 1952 if (r != SSH_ERR_AGENT_NOT_PRESENT)
1953 debug("%s: ssh_get_authentication_socket: %s",
1954 __func__, ssh_err(r));
1943 return NULL; 1955 return NULL;
1956 }
1944 c = channel_new("authentication agent connection", 1957 c = channel_new("authentication agent connection",
1945 SSH_CHANNEL_OPEN, sock, sock, -1, 1958 SSH_CHANNEL_OPEN, sock, sock, -1,
1946 CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, 1959 CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0,
@@ -1994,7 +2007,7 @@ client_request_tun_fwd(int tun_mode, int local_tun, int remote_tun)
1994} 2007}
1995 2008
1996/* XXXX move to generic input handler */ 2009/* XXXX move to generic input handler */
1997static void 2010static int
1998client_input_channel_open(int type, u_int32_t seq, void *ctxt) 2011client_input_channel_open(int type, u_int32_t seq, void *ctxt)
1999{ 2012{
2000 Channel *c = NULL; 2013 Channel *c = NULL;
@@ -2045,8 +2058,10 @@ client_input_channel_open(int type, u_int32_t seq, void *ctxt)
2045 packet_send(); 2058 packet_send();
2046 } 2059 }
2047 free(ctype); 2060 free(ctype);
2061 return 0;
2048} 2062}
2049static void 2063
2064static int
2050client_input_channel_req(int type, u_int32_t seq, void *ctxt) 2065client_input_channel_req(int type, u_int32_t seq, void *ctxt)
2051{ 2066{
2052 Channel *c = NULL; 2067 Channel *c = NULL;
@@ -2091,18 +2106,395 @@ client_input_channel_req(int type, u_int32_t seq, void *ctxt)
2091 packet_send(); 2106 packet_send();
2092 } 2107 }
2093 free(rtype); 2108 free(rtype);
2109 return 0;
2110}
2111
2112struct hostkeys_update_ctx {
2113 /* The hostname and (optionally) IP address string for the server */
2114 char *host_str, *ip_str;
2115
2116 /*
2117 * Keys received from the server and a flag for each indicating
2118 * whether they already exist in known_hosts.
2119 * keys_seen is filled in by hostkeys_find() and later (for new
2120 * keys) by client_global_hostkeys_private_confirm().
2121 */
2122 struct sshkey **keys;
2123 int *keys_seen;
2124 size_t nkeys;
2125
2126 size_t nnew;
2127
2128 /*
2129 * Keys that are in known_hosts, but were not present in the update
2130 * from the server (i.e. scheduled to be deleted).
2131 * Filled in by hostkeys_find().
2132 */
2133 struct sshkey **old_keys;
2134 size_t nold;
2135};
2136
2137static void
2138hostkeys_update_ctx_free(struct hostkeys_update_ctx *ctx)
2139{
2140 size_t i;
2141
2142 if (ctx == NULL)
2143 return;
2144 for (i = 0; i < ctx->nkeys; i++)
2145 sshkey_free(ctx->keys[i]);
2146 free(ctx->keys);
2147 free(ctx->keys_seen);
2148 for (i = 0; i < ctx->nold; i++)
2149 sshkey_free(ctx->old_keys[i]);
2150 free(ctx->old_keys);
2151 free(ctx->host_str);
2152 free(ctx->ip_str);
2153 free(ctx);
2154}
2155
2156static int
2157hostkeys_find(struct hostkey_foreach_line *l, void *_ctx)
2158{
2159 struct hostkeys_update_ctx *ctx = (struct hostkeys_update_ctx *)_ctx;
2160 size_t i;
2161 struct sshkey **tmp;
2162
2163 if (l->status != HKF_STATUS_MATCHED || l->key == NULL ||
2164 l->key->type == KEY_RSA1)
2165 return 0;
2166
2167 /* Mark off keys we've already seen for this host */
2168 for (i = 0; i < ctx->nkeys; i++) {
2169 if (sshkey_equal(l->key, ctx->keys[i])) {
2170 debug3("%s: found %s key at %s:%ld", __func__,
2171 sshkey_ssh_name(ctx->keys[i]), l->path, l->linenum);
2172 ctx->keys_seen[i] = 1;
2173 return 0;
2174 }
2175 }
2176 /* This line contained a key that not offered by the server */
2177 debug3("%s: deprecated %s key at %s:%ld", __func__,
2178 sshkey_ssh_name(l->key), l->path, l->linenum);
2179 if ((tmp = reallocarray(ctx->old_keys, ctx->nold + 1,
2180 sizeof(*ctx->old_keys))) == NULL)
2181 fatal("%s: reallocarray failed nold = %zu",
2182 __func__, ctx->nold);
2183 ctx->old_keys = tmp;
2184 ctx->old_keys[ctx->nold++] = l->key;
2185 l->key = NULL;
2186
2187 return 0;
2188}
2189
2190static void
2191update_known_hosts(struct hostkeys_update_ctx *ctx)
2192{
2193 int r, was_raw = 0;
2194 int loglevel = options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK ?
2195 SYSLOG_LEVEL_INFO : SYSLOG_LEVEL_VERBOSE;
2196 char *fp, *response;
2197 size_t i;
2198
2199 for (i = 0; i < ctx->nkeys; i++) {
2200 if (ctx->keys_seen[i] != 2)
2201 continue;
2202 if ((fp = sshkey_fingerprint(ctx->keys[i],
2203 options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL)
2204 fatal("%s: sshkey_fingerprint failed", __func__);
2205 do_log2(loglevel, "Learned new hostkey: %s %s",
2206 sshkey_type(ctx->keys[i]), fp);
2207 free(fp);
2208 }
2209 for (i = 0; i < ctx->nold; i++) {
2210 if ((fp = sshkey_fingerprint(ctx->old_keys[i],
2211 options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL)
2212 fatal("%s: sshkey_fingerprint failed", __func__);
2213 do_log2(loglevel, "Deprecating obsolete hostkey: %s %s",
2214 sshkey_type(ctx->old_keys[i]), fp);
2215 free(fp);
2216 }
2217 if (options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK) {
2218 if (get_saved_tio() != NULL) {
2219 leave_raw_mode(1);
2220 was_raw = 1;
2221 }
2222 response = NULL;
2223 for (i = 0; !quit_pending && i < 3; i++) {
2224 free(response);
2225 response = read_passphrase("Accept updated hostkeys? "
2226 "(yes/no): ", RP_ECHO);
2227 if (strcasecmp(response, "yes") == 0)
2228 break;
2229 else if (quit_pending || response == NULL ||
2230 strcasecmp(response, "no") == 0) {
2231 options.update_hostkeys = 0;
2232 break;
2233 } else {
2234 do_log2(loglevel, "Please enter "
2235 "\"yes\" or \"no\"");
2236 }
2237 }
2238 if (quit_pending || i >= 3 || response == NULL)
2239 options.update_hostkeys = 0;
2240 free(response);
2241 if (was_raw)
2242 enter_raw_mode(1);
2243 }
2244
2245 /*
2246 * Now that all the keys are verified, we can go ahead and replace
2247 * them in known_hosts (assuming SSH_UPDATE_HOSTKEYS_ASK didn't
2248 * cancel the operation).
2249 */
2250 if (options.update_hostkeys != 0 &&
2251 (r = hostfile_replace_entries(options.user_hostfiles[0],
2252 ctx->host_str, ctx->ip_str, ctx->keys, ctx->nkeys,
2253 options.hash_known_hosts, 0,
2254 options.fingerprint_hash)) != 0)
2255 error("%s: hostfile_replace_entries failed: %s",
2256 __func__, ssh_err(r));
2094} 2257}
2258
2095static void 2259static void
2260client_global_hostkeys_private_confirm(int type, u_int32_t seq, void *_ctx)
2261{
2262 struct ssh *ssh = active_state; /* XXX */
2263 struct hostkeys_update_ctx *ctx = (struct hostkeys_update_ctx *)_ctx;
2264 size_t i, ndone;
2265 struct sshbuf *signdata;
2266 int r;
2267 const u_char *sig;
2268 size_t siglen;
2269
2270 if (ctx->nnew == 0)
2271 fatal("%s: ctx->nnew == 0", __func__); /* sanity */
2272 if (type != SSH2_MSG_REQUEST_SUCCESS) {
2273 error("Server failed to confirm ownership of "
2274 "private host keys");
2275 hostkeys_update_ctx_free(ctx);
2276 return;
2277 }
2278 if ((signdata = sshbuf_new()) == NULL)
2279 fatal("%s: sshbuf_new failed", __func__);
2280 /* Don't want to accidentally accept an unbound signature */
2281 if (ssh->kex->session_id_len == 0)
2282 fatal("%s: ssh->kex->session_id_len == 0", __func__);
2283 /*
2284 * Expect a signature for each of the ctx->nnew private keys we
2285 * haven't seen before. They will be in the same order as the
2286 * ctx->keys where the corresponding ctx->keys_seen[i] == 0.
2287 */
2288 for (ndone = i = 0; i < ctx->nkeys; i++) {
2289 if (ctx->keys_seen[i])
2290 continue;
2291 /* Prepare data to be signed: session ID, unique string, key */
2292 sshbuf_reset(signdata);
2293 if ( (r = sshbuf_put_cstring(signdata,
2294 "hostkeys-prove-00@openssh.com")) != 0 ||
2295 (r = sshbuf_put_string(signdata, ssh->kex->session_id,
2296 ssh->kex->session_id_len)) != 0 ||
2297 (r = sshkey_puts(ctx->keys[i], signdata)) != 0)
2298 fatal("%s: failed to prepare signature: %s",
2299 __func__, ssh_err(r));
2300 /* Extract and verify signature */
2301 if ((r = sshpkt_get_string_direct(ssh, &sig, &siglen)) != 0) {
2302 error("%s: couldn't parse message: %s",
2303 __func__, ssh_err(r));
2304 goto out;
2305 }
2306 if ((r = sshkey_verify(ctx->keys[i], sig, siglen,
2307 sshbuf_ptr(signdata), sshbuf_len(signdata), 0)) != 0) {
2308 error("%s: server gave bad signature for %s key %zu",
2309 __func__, sshkey_type(ctx->keys[i]), i);
2310 goto out;
2311 }
2312 /* Key is good. Mark it as 'seen' */
2313 ctx->keys_seen[i] = 2;
2314 ndone++;
2315 }
2316 if (ndone != ctx->nnew)
2317 fatal("%s: ndone != ctx->nnew (%zu / %zu)", __func__,
2318 ndone, ctx->nnew); /* Shouldn't happen */
2319 ssh_packet_check_eom(ssh);
2320
2321 /* Make the edits to known_hosts */
2322 update_known_hosts(ctx);
2323 out:
2324 hostkeys_update_ctx_free(ctx);
2325}
2326
2327/*
2328 * Handle hostkeys-00@openssh.com global request to inform the client of all
2329 * the server's hostkeys. The keys are checked against the user's
2330 * HostkeyAlgorithms preference before they are accepted.
2331 */
2332static int
2333client_input_hostkeys(void)
2334{
2335 struct ssh *ssh = active_state; /* XXX */
2336 const u_char *blob = NULL;
2337 size_t i, len = 0;
2338 struct sshbuf *buf = NULL;
2339 struct sshkey *key = NULL, **tmp;
2340 int r;
2341 char *fp;
2342 static int hostkeys_seen = 0; /* XXX use struct ssh */
2343 extern struct sockaddr_storage hostaddr; /* XXX from ssh.c */
2344 struct hostkeys_update_ctx *ctx = NULL;
2345
2346 if (hostkeys_seen)
2347 fatal("%s: server already sent hostkeys", __func__);
2348 if (options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK &&
2349 options.batch_mode)
2350 return 1; /* won't ask in batchmode, so don't even try */
2351 if (!options.update_hostkeys || options.num_user_hostfiles <= 0)
2352 return 1;
2353
2354 ctx = xcalloc(1, sizeof(*ctx));
2355 while (ssh_packet_remaining(ssh) > 0) {
2356 sshkey_free(key);
2357 key = NULL;
2358 if ((r = sshpkt_get_string_direct(ssh, &blob, &len)) != 0) {
2359 error("%s: couldn't parse message: %s",
2360 __func__, ssh_err(r));
2361 goto out;
2362 }
2363 if ((r = sshkey_from_blob(blob, len, &key)) != 0) {
2364 error("%s: parse key: %s", __func__, ssh_err(r));
2365 goto out;
2366 }
2367 fp = sshkey_fingerprint(key, options.fingerprint_hash,
2368 SSH_FP_DEFAULT);
2369 debug3("%s: received %s key %s", __func__,
2370 sshkey_type(key), fp);
2371 free(fp);
2372 /* Check that the key is accepted in HostkeyAlgorithms */
2373 if (options.hostkeyalgorithms != NULL &&
2374 match_pattern_list(sshkey_ssh_name(key),
2375 options.hostkeyalgorithms,
2376 strlen(options.hostkeyalgorithms), 0) != 1) {
2377 debug3("%s: %s key not permitted by HostkeyAlgorithms",
2378 __func__, sshkey_ssh_name(key));
2379 continue;
2380 }
2381 /* Skip certs */
2382 if (sshkey_is_cert(key)) {
2383 debug3("%s: %s key is a certificate; skipping",
2384 __func__, sshkey_ssh_name(key));
2385 continue;
2386 }
2387 /* Ensure keys are unique */
2388 for (i = 0; i < ctx->nkeys; i++) {
2389 if (sshkey_equal(key, ctx->keys[i])) {
2390 error("%s: received duplicated %s host key",
2391 __func__, sshkey_ssh_name(key));
2392 goto out;
2393 }
2394 }
2395 /* Key is good, record it */
2396 if ((tmp = reallocarray(ctx->keys, ctx->nkeys + 1,
2397 sizeof(*ctx->keys))) == NULL)
2398 fatal("%s: reallocarray failed nkeys = %zu",
2399 __func__, ctx->nkeys);
2400 ctx->keys = tmp;
2401 ctx->keys[ctx->nkeys++] = key;
2402 key = NULL;
2403 }
2404
2405 if (ctx->nkeys == 0) {
2406 debug("%s: server sent no hostkeys", __func__);
2407 goto out;
2408 }
2409
2410 if ((ctx->keys_seen = calloc(ctx->nkeys,
2411 sizeof(*ctx->keys_seen))) == NULL)
2412 fatal("%s: calloc failed", __func__);
2413
2414 get_hostfile_hostname_ipaddr(host,
2415 options.check_host_ip ? (struct sockaddr *)&hostaddr : NULL,
2416 options.port, &ctx->host_str,
2417 options.check_host_ip ? &ctx->ip_str : NULL);
2418
2419 /* Find which keys we already know about. */
2420 if ((r = hostkeys_foreach(options.user_hostfiles[0], hostkeys_find,
2421 ctx, ctx->host_str, ctx->ip_str,
2422 HKF_WANT_PARSE_KEY|HKF_WANT_MATCH)) != 0) {
2423 error("%s: hostkeys_foreach failed: %s", __func__, ssh_err(r));
2424 goto out;
2425 }
2426
2427 /* Figure out if we have any new keys to add */
2428 ctx->nnew = 0;
2429 for (i = 0; i < ctx->nkeys; i++) {
2430 if (!ctx->keys_seen[i])
2431 ctx->nnew++;
2432 }
2433
2434 debug3("%s: %zu keys from server: %zu new, %zu retained. %zu to remove",
2435 __func__, ctx->nkeys, ctx->nnew, ctx->nkeys - ctx->nnew, ctx->nold);
2436
2437 if (ctx->nnew == 0 && ctx->nold != 0) {
2438 /* We have some keys to remove. Just do it. */
2439 update_known_hosts(ctx);
2440 } else if (ctx->nnew != 0) {
2441 /*
2442 * We have received hitherto-unseen keys from the server.
2443 * Ask the server to confirm ownership of the private halves.
2444 */
2445 debug3("%s: asking server to prove ownership for %zu keys",
2446 __func__, ctx->nnew);
2447 if ((r = sshpkt_start(ssh, SSH2_MSG_GLOBAL_REQUEST)) != 0 ||
2448 (r = sshpkt_put_cstring(ssh,
2449 "hostkeys-prove-00@openssh.com")) != 0 ||
2450 (r = sshpkt_put_u8(ssh, 1)) != 0) /* bool: want reply */
2451 fatal("%s: cannot prepare packet: %s",
2452 __func__, ssh_err(r));
2453 if ((buf = sshbuf_new()) == NULL)
2454 fatal("%s: sshbuf_new", __func__);
2455 for (i = 0; i < ctx->nkeys; i++) {
2456 if (ctx->keys_seen[i])
2457 continue;
2458 sshbuf_reset(buf);
2459 if ((r = sshkey_putb(ctx->keys[i], buf)) != 0)
2460 fatal("%s: sshkey_putb: %s",
2461 __func__, ssh_err(r));
2462 if ((r = sshpkt_put_stringb(ssh, buf)) != 0)
2463 fatal("%s: sshpkt_put_string: %s",
2464 __func__, ssh_err(r));
2465 }
2466 if ((r = sshpkt_send(ssh)) != 0)
2467 fatal("%s: sshpkt_send: %s", __func__, ssh_err(r));
2468 client_register_global_confirm(
2469 client_global_hostkeys_private_confirm, ctx);
2470 ctx = NULL; /* will be freed in callback */
2471 }
2472
2473 /* Success */
2474 out:
2475 hostkeys_update_ctx_free(ctx);
2476 sshkey_free(key);
2477 sshbuf_free(buf);
2478 /*
2479 * NB. Return success for all cases. The server doesn't need to know
2480 * what the client does with its hosts file.
2481 */
2482 return 1;
2483}
2484
2485static int
2096client_input_global_request(int type, u_int32_t seq, void *ctxt) 2486client_input_global_request(int type, u_int32_t seq, void *ctxt)
2097{ 2487{
2098 char *rtype; 2488 char *rtype;
2099 int want_reply; 2489 int want_reply;
2100 int success = 0; 2490 int success = 0;
2101 2491
2102 rtype = packet_get_string(NULL); 2492 rtype = packet_get_cstring(NULL);
2103 want_reply = packet_get_char(); 2493 want_reply = packet_get_char();
2104 debug("client_input_global_request: rtype %s want_reply %d", 2494 debug("client_input_global_request: rtype %s want_reply %d",
2105 rtype, want_reply); 2495 rtype, want_reply);
2496 if (strcmp(rtype, "hostkeys-00@openssh.com") == 0)
2497 success = client_input_hostkeys();
2106 if (want_reply) { 2498 if (want_reply) {
2107 packet_start(success ? 2499 packet_start(success ?
2108 SSH2_MSG_REQUEST_SUCCESS : SSH2_MSG_REQUEST_FAILURE); 2500 SSH2_MSG_REQUEST_SUCCESS : SSH2_MSG_REQUEST_FAILURE);
@@ -2110,6 +2502,7 @@ client_input_global_request(int type, u_int32_t seq, void *ctxt)
2110 packet_write_wait(); 2502 packet_write_wait();
2111 } 2503 }
2112 free(rtype); 2504 free(rtype);
2505 return 0;
2113} 2506}
2114 2507
2115void 2508void
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 a9a8b7ae3..6c7de98a2 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
@@ -1677,17 +1678,9 @@
1677/* include SSH protocol version 1 support */ 1678/* include SSH protocol version 1 support */
1678#undef WITH_SSH1 1679#undef WITH_SSH1
1679 1680
1680/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most 1681/* Define to 1 if your processor stores words with the most significant byte
1681 significant byte first (like Motorola and SPARC, unlike Intel). */ 1682 first (like Motorola and SPARC, unlike Intel and VAX). */
1682#if defined AC_APPLE_UNIVERSAL_BUILD 1683#undef WORDS_BIGENDIAN
1683# if defined __BIG_ENDIAN__
1684# define WORDS_BIGENDIAN 1
1685# endif
1686#else
1687# ifndef WORDS_BIGENDIAN
1688# undef WORDS_BIGENDIAN
1689# endif
1690#endif
1691 1684
1692/* Define if xauth is found in your path */ 1685/* Define if xauth is found in your path */
1693#undef XAUTH_PATH 1686#undef XAUTH_PATH
diff --git a/configure b/configure
index 7be478a82..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,167 +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_consolekit
743with_privsep_path
744with_xauth
745enable_strip
746with_maildir
747with_mantype
748with_md5_passwords
749with_shadow
750with_ipaddr_display
751enable_etc_default_login
752with_default_path
753with_superuser_path
754with_4in6
755with_bsd_auth
756with_pid_dir
757enable_lastlog
758enable_utmp
759enable_utmpx
760enable_wtmp
761enable_wtmpx
762enable_libutil
763enable_pututline
764enable_pututxline
765with_lastlog
766'
767 ac_precious_vars='build_alias 723 ac_precious_vars='build_alias
768host_alias 724host_alias
769target_alias 725target_alias
@@ -778,8 +734,6 @@ CPP'
778# Initialize some variables set by options. 734# Initialize some variables set by options.
779ac_init_help= 735ac_init_help=
780ac_init_version=false 736ac_init_version=false
781ac_unrecognized_opts=
782ac_unrecognized_sep=
783# The variables have the same names as the options, with 737# The variables have the same names as the options, with
784# dashes changed to underlines. 738# dashes changed to underlines.
785cache_file=/dev/null 739cache_file=/dev/null
@@ -835,9 +789,8 @@ do
835 fi 789 fi
836 790
837 case $ac_option in 791 case $ac_option in
838 *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; 792 *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
839 *=) ac_optarg= ;; 793 *) ac_optarg=yes ;;
840 *) ac_optarg=yes ;;
841 esac 794 esac
842 795
843 # Accept the important Cygnus configure options, so we can diagnose typos. 796 # Accept the important Cygnus configure options, so we can diagnose typos.
@@ -879,20 +832,13 @@ do
879 datarootdir=$ac_optarg ;; 832 datarootdir=$ac_optarg ;;
880 833
881 -disable-* | --disable-*) 834 -disable-* | --disable-*)
882 ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` 835 ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
883 # Reject names that are not valid shell variable names. 836 # Reject names that are not valid shell variable names.
884 expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && 837 expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
885 as_fn_error $? "invalid feature name: $ac_useropt" 838 { echo "$as_me: error: invalid feature name: $ac_feature" >&2
886 ac_useropt_orig=$ac_useropt 839 { (exit 1); exit 1; }; }
887 ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` 840 ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
888 case $ac_user_opts in 841 eval enable_$ac_feature=no ;;
889 *"
890"enable_$ac_useropt"
891"*) ;;
892 *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
893 ac_unrecognized_sep=', ';;
894 esac
895 eval enable_$ac_useropt=no ;;
896 842
897 -docdir | --docdir | --docdi | --doc | --do) 843 -docdir | --docdir | --docdi | --doc | --do)
898 ac_prev=docdir ;; 844 ac_prev=docdir ;;
@@ -905,20 +851,13 @@ do
905 dvidir=$ac_optarg ;; 851 dvidir=$ac_optarg ;;
906 852
907 -enable-* | --enable-*) 853 -enable-* | --enable-*)
908 ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` 854 ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
909 # Reject names that are not valid shell variable names. 855 # Reject names that are not valid shell variable names.
910 expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && 856 expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
911 as_fn_error $? "invalid feature name: $ac_useropt" 857 { echo "$as_me: error: invalid feature name: $ac_feature" >&2
912 ac_useropt_orig=$ac_useropt 858 { (exit 1); exit 1; }; }
913 ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` 859 ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
914 case $ac_user_opts in 860 eval enable_$ac_feature=\$ac_optarg ;;
915 *"
916"enable_$ac_useropt"
917"*) ;;
918 *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
919 ac_unrecognized_sep=', ';;
920 esac
921 eval enable_$ac_useropt=\$ac_optarg ;;
922 861
923 -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ 862 -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
924 | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ 863 | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -1109,36 +1048,22 @@ do
1109 ac_init_version=: ;; 1048 ac_init_version=: ;;
1110 1049
1111 -with-* | --with-*) 1050 -with-* | --with-*)
1112 ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` 1051 ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
1113 # Reject names that are not valid shell variable names. 1052 # Reject names that are not valid shell variable names.
1114 expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && 1053 expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
1115 as_fn_error $? "invalid package name: $ac_useropt" 1054 { echo "$as_me: error: invalid package name: $ac_package" >&2
1116 ac_useropt_orig=$ac_useropt 1055 { (exit 1); exit 1; }; }
1117 ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` 1056 ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
1118 case $ac_user_opts in 1057 eval with_$ac_package=\$ac_optarg ;;
1119 *"
1120"with_$ac_useropt"
1121"*) ;;
1122 *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
1123 ac_unrecognized_sep=', ';;
1124 esac
1125 eval with_$ac_useropt=\$ac_optarg ;;
1126 1058
1127 -without-* | --without-*) 1059 -without-* | --without-*)
1128 ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` 1060 ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
1129 # Reject names that are not valid shell variable names. 1061 # Reject names that are not valid shell variable names.
1130 expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && 1062 expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
1131 as_fn_error $? "invalid package name: $ac_useropt" 1063 { echo "$as_me: error: invalid package name: $ac_package" >&2
1132 ac_useropt_orig=$ac_useropt 1064 { (exit 1); exit 1; }; }
1133 ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` 1065 ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
1134 case $ac_user_opts in 1066 eval with_$ac_package=no ;;
1135 *"
1136"with_$ac_useropt"
1137"*) ;;
1138 *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
1139 ac_unrecognized_sep=', ';;
1140 esac
1141 eval with_$ac_useropt=no ;;
1142 1067
1143 --x) 1068 --x)
1144 # Obsolete; use --with-x. 1069 # Obsolete; use --with-x.
@@ -1158,26 +1083,26 @@ do
1158 | --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=*)
1159 x_libraries=$ac_optarg ;; 1084 x_libraries=$ac_optarg ;;
1160 1085
1161 -*) as_fn_error $? "unrecognized option: \`$ac_option' 1086 -*) { echo "$as_me: error: unrecognized option: $ac_option
1162Try \`$0 --help' for more information" 1087Try \`$0 --help' for more information." >&2
1088 { (exit 1); exit 1; }; }
1163 ;; 1089 ;;
1164 1090
1165 *=*) 1091 *=*)
1166 ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` 1092 ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
1167 # Reject names that are not valid shell variable names. 1093 # Reject names that are not valid shell variable names.
1168 case $ac_envvar in #( 1094 expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
1169 '' | [0-9]* | *[!_$as_cr_alnum]* ) 1095 { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
1170 as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; 1096 { (exit 1); exit 1; }; }
1171 esac
1172 eval $ac_envvar=\$ac_optarg 1097 eval $ac_envvar=\$ac_optarg
1173 export $ac_envvar ;; 1098 export $ac_envvar ;;
1174 1099
1175 *) 1100 *)
1176 # FIXME: should be removed in autoconf 3.0. 1101 # FIXME: should be removed in autoconf 3.0.
1177 $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 1102 echo "$as_me: WARNING: you should use --build, --host, --target" >&2
1178 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && 1103 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
1179 $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 1104 echo "$as_me: WARNING: invalid host type: $ac_option" >&2
1180 : "${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}
1181 ;; 1106 ;;
1182 1107
1183 esac 1108 esac
@@ -1185,36 +1110,23 @@ done
1185 1110
1186if test -n "$ac_prev"; then 1111if test -n "$ac_prev"; then
1187 ac_option=--`echo $ac_prev | sed 's/_/-/g'` 1112 ac_option=--`echo $ac_prev | sed 's/_/-/g'`
1188 as_fn_error $? "missing argument to $ac_option" 1113 { echo "$as_me: error: missing argument to $ac_option" >&2
1189fi 1114 { (exit 1); exit 1; }; }
1190
1191if test -n "$ac_unrecognized_opts"; then
1192 case $enable_option_checking in
1193 no) ;;
1194 fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
1195 *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
1196 esac
1197fi 1115fi
1198 1116
1199# Check all directory arguments for consistency. 1117# Be sure to have absolute directory names.
1200for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ 1118for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
1201 datadir sysconfdir sharedstatedir localstatedir includedir \ 1119 datadir sysconfdir sharedstatedir localstatedir includedir \
1202 oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ 1120 oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1203 libdir localedir mandir 1121 libdir localedir mandir
1204do 1122do
1205 eval ac_val=\$$ac_var 1123 eval ac_val=\$$ac_var
1206 # Remove trailing slashes.
1207 case $ac_val in
1208 */ )
1209 ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
1210 eval $ac_var=\$ac_val;;
1211 esac
1212 # Be sure to have absolute directory names.
1213 case $ac_val in 1124 case $ac_val in
1214 [\\/$]* | ?:[\\/]* ) continue;; 1125 [\\/$]* | ?:[\\/]* ) continue;;
1215 NONE | '' ) case $ac_var in *prefix ) continue;; esac;; 1126 NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
1216 esac 1127 esac
1217 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; }; }
1218done 1130done
1219 1131
1220# 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'
@@ -1228,8 +1140,8 @@ target=$target_alias
1228if test "x$host_alias" != x; then 1140if test "x$host_alias" != x; then
1229 if test "x$build_alias" = x; then 1141 if test "x$build_alias" = x; then
1230 cross_compiling=maybe 1142 cross_compiling=maybe
1231 $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.
1232 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
1233 elif test "x$build_alias" != "x$host_alias"; then 1145 elif test "x$build_alias" != "x$host_alias"; then
1234 cross_compiling=yes 1146 cross_compiling=yes
1235 fi 1147 fi
@@ -1244,21 +1156,23 @@ test "$silent" = yes && exec 6>/dev/null
1244ac_pwd=`pwd` && test -n "$ac_pwd" && 1156ac_pwd=`pwd` && test -n "$ac_pwd" &&
1245ac_ls_di=`ls -di .` && 1157ac_ls_di=`ls -di .` &&
1246ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || 1158ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
1247 as_fn_error $? "working directory cannot be determined" 1159 { echo "$as_me: error: Working directory cannot be determined" >&2
1160 { (exit 1); exit 1; }; }
1248test "X$ac_ls_di" = "X$ac_pwd_ls_di" || 1161test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
1249 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; }; }
1250 1164
1251 1165
1252# Find the source files, if location was not specified. 1166# Find the source files, if location was not specified.
1253if test -z "$srcdir"; then 1167if test -z "$srcdir"; then
1254 ac_srcdir_defaulted=yes 1168 ac_srcdir_defaulted=yes
1255 # Try the directory containing this script, then the parent directory. 1169 # Try the directory containing this script, then the parent directory.
1256 ac_confdir=`$as_dirname -- "$as_myself" || 1170 ac_confdir=`$as_dirname -- "$0" ||
1257$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ 1171$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
1258 X"$as_myself" : 'X\(//\)[^/]' \| \ 1172 X"$0" : 'X\(//\)[^/]' \| \
1259 X"$as_myself" : 'X\(//\)$' \| \ 1173 X"$0" : 'X\(//\)$' \| \
1260 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || 1174 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
1261$as_echo X"$as_myself" | 1175echo X"$0" |
1262 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ 1176 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
1263 s//\1/ 1177 s//\1/
1264 q 1178 q
@@ -1285,11 +1199,13 @@ else
1285fi 1199fi
1286if test ! -r "$srcdir/$ac_unique_file"; then 1200if test ! -r "$srcdir/$ac_unique_file"; then
1287 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." 1201 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
1288 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; }; }
1289fi 1204fi
1290ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" 1205ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
1291ac_abs_confdir=`( 1206ac_abs_confdir=`(
1292 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; }; }
1293 pwd)` 1209 pwd)`
1294# When building in place, set srcdir=. 1210# When building in place, set srcdir=.
1295if test "$ac_abs_confdir" = "$ac_pwd"; then 1211if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1329,7 +1245,7 @@ Configuration:
1329 --help=short display options specific to this package 1245 --help=short display options specific to this package
1330 --help=recursive display the short help of all the included packages 1246 --help=recursive display the short help of all the included packages
1331 -V, --version display version information and exit 1247 -V, --version display version information and exit
1332 -q, --quiet, --silent do not print \`checking ...' messages 1248 -q, --quiet, --silent do not print \`checking...' messages
1333 --cache-file=FILE cache test results in FILE [disabled] 1249 --cache-file=FILE cache test results in FILE [disabled]
1334 -C, --config-cache alias for \`--cache-file=config.cache' 1250 -C, --config-cache alias for \`--cache-file=config.cache'
1335 -n, --no-create do not create output files 1251 -n, --no-create do not create output files
@@ -1337,9 +1253,9 @@ Configuration:
1337 1253
1338Installation directories: 1254Installation directories:
1339 --prefix=PREFIX install architecture-independent files in PREFIX 1255 --prefix=PREFIX install architecture-independent files in PREFIX
1340 [$ac_default_prefix] 1256 [$ac_default_prefix]
1341 --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX 1257 --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
1342 [PREFIX] 1258 [PREFIX]
1343 1259
1344By default, \`make install' will install all the files in 1260By default, \`make install' will install all the files in
1345\`$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
@@ -1349,25 +1265,25 @@ for instance \`--prefix=\$HOME'.
1349For better control, use the options below. 1265For better control, use the options below.
1350 1266
1351Fine tuning of the installation directories: 1267Fine tuning of the installation directories:
1352 --bindir=DIR user executables [EPREFIX/bin] 1268 --bindir=DIR user executables [EPREFIX/bin]
1353 --sbindir=DIR system admin executables [EPREFIX/sbin] 1269 --sbindir=DIR system admin executables [EPREFIX/sbin]
1354 --libexecdir=DIR program executables [EPREFIX/libexec] 1270 --libexecdir=DIR program executables [EPREFIX/libexec]
1355 --sysconfdir=DIR read-only single-machine data [PREFIX/etc] 1271 --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
1356 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] 1272 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
1357 --localstatedir=DIR modifiable single-machine data [PREFIX/var] 1273 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
1358 --libdir=DIR object code libraries [EPREFIX/lib] 1274 --libdir=DIR object code libraries [EPREFIX/lib]
1359 --includedir=DIR C header files [PREFIX/include] 1275 --includedir=DIR C header files [PREFIX/include]
1360 --oldincludedir=DIR C header files for non-gcc [/usr/include] 1276 --oldincludedir=DIR C header files for non-gcc [/usr/include]
1361 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] 1277 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
1362 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] 1278 --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
1363 --infodir=DIR info documentation [DATAROOTDIR/info] 1279 --infodir=DIR info documentation [DATAROOTDIR/info]
1364 --localedir=DIR locale-dependent data [DATAROOTDIR/locale] 1280 --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
1365 --mandir=DIR man documentation [DATAROOTDIR/man] 1281 --mandir=DIR man documentation [DATAROOTDIR/man]
1366 --docdir=DIR documentation root [DATAROOTDIR/doc/openssh] 1282 --docdir=DIR documentation root [DATAROOTDIR/doc/openssh]
1367 --htmldir=DIR html documentation [DOCDIR] 1283 --htmldir=DIR html documentation [DOCDIR]
1368 --dvidir=DIR dvi documentation [DOCDIR] 1284 --dvidir=DIR dvi documentation [DOCDIR]
1369 --pdfdir=DIR pdf documentation [DOCDIR] 1285 --pdfdir=DIR pdf documentation [DOCDIR]
1370 --psdir=DIR ps documentation [DOCDIR] 1286 --psdir=DIR ps documentation [DOCDIR]
1371_ACEOF 1287_ACEOF
1372 1288
1373 cat <<\_ACEOF 1289 cat <<\_ACEOF
@@ -1385,7 +1301,6 @@ if test -n "$ac_init_help"; then
1385 cat <<\_ACEOF 1301 cat <<\_ACEOF
1386 1302
1387Optional Features: 1303Optional Features:
1388 --disable-option-checking ignore unrecognized --enable/--with options
1389 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) 1304 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
1390 --enable-FEATURE[=ARG] include FEATURE [ARG=yes] 1305 --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
1391 --disable-largefile omit support for large files 1306 --disable-largefile omit support for large files
@@ -1403,6 +1318,8 @@ Optional Features:
1403Optional Packages: 1318Optional Packages:
1404 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] 1319 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
1405 --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
1406 --without-stackprotect Don't use compiler's stack protection 1323 --without-stackprotect Don't use compiler's stack protection
1407 --without-hardening Don't use toolchain hardening flags 1324 --without-hardening Don't use toolchain hardening flags
1408 --without-rpath Disable auto-added -R linker paths 1325 --without-rpath Disable auto-added -R linker paths
@@ -1420,7 +1337,7 @@ Optional Packages:
1420 --with-ldns[=PATH] Use ldns for DNSSEC support (optionally in PATH) 1337 --with-ldns[=PATH] Use ldns for DNSSEC support (optionally in PATH)
1421 --with-libedit[=PATH] Enable libedit support for sftp 1338 --with-libedit[=PATH] Enable libedit support for sftp
1422 --with-audit=module Enable audit support (modules=debug,bsm,linux) 1339 --with-audit=module Enable audit support (modules=debug,bsm,linux)
1423 --with-pie Build Position Independent Executables if possible 1340 --with-pie Build Position Independent Executables if possible
1424 --with-ssl-dir=PATH Specify path to OpenSSL installation 1341 --with-ssl-dir=PATH Specify path to OpenSSL installation
1425 --without-openssl-header-check Disable OpenSSL version consistency check 1342 --without-openssl-header-check Disable OpenSSL version consistency check
1426 --with-ssl-engine Enable OpenSSL (hardware) ENGINE support 1343 --with-ssl-engine Enable OpenSSL (hardware) ENGINE support
@@ -1431,7 +1348,6 @@ Optional Packages:
1431 --with-sandbox=style Specify privilege separation sandbox (no, darwin, rlimit, systrace, seccomp_filter, capsicum) 1348 --with-sandbox=style Specify privilege separation sandbox (no, darwin, rlimit, systrace, seccomp_filter, capsicum)
1432 --with-selinux Enable SELinux support 1349 --with-selinux Enable SELinux support
1433 --with-kerberos5=PATH Enable Kerberos 5 support 1350 --with-kerberos5=PATH Enable Kerberos 5 support
1434 --with-consolekit Enable ConsoleKit support
1435 --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty) 1351 --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)
1436 --with-xauth=PATH Specify path to xauth program 1352 --with-xauth=PATH Specify path to xauth program
1437 --with-maildir=/path/to/mail Specify your system mail directory 1353 --with-maildir=/path/to/mail Specify your system mail directory
@@ -1452,7 +1368,7 @@ Some influential environment variables:
1452 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
1453 nonstandard directory <lib dir> 1369 nonstandard directory <lib dir>
1454 LIBS libraries to pass to the linker, e.g. -l<library> 1370 LIBS libraries to pass to the linker, e.g. -l<library>
1455 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
1456 you have headers in a nonstandard directory <include dir> 1372 you have headers in a nonstandard directory <include dir>
1457 CPP C preprocessor 1373 CPP C preprocessor
1458 1374
@@ -1467,17 +1383,15 @@ fi
1467if test "$ac_init_help" = "recursive"; then 1383if test "$ac_init_help" = "recursive"; then
1468 # If there are subdirs, report their specific --help. 1384 # If there are subdirs, report their specific --help.
1469 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
1470 test -d "$ac_dir" || 1386 test -d "$ac_dir" || continue
1471 { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
1472 continue
1473 ac_builddir=. 1387 ac_builddir=.
1474 1388
1475case "$ac_dir" in 1389case "$ac_dir" in
1476.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; 1390.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
1477*) 1391*)
1478 ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` 1392 ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
1479 # A ".." for each directory in $ac_dir_suffix. 1393 # A ".." for each directory in $ac_dir_suffix.
1480 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,/,,'`
1481 case $ac_top_builddir_sub in 1395 case $ac_top_builddir_sub in
1482 "") ac_top_builddir_sub=. ac_top_build_prefix= ;; 1396 "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
1483 *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; 1397 *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -1513,7 +1427,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
1513 echo && 1427 echo &&
1514 $SHELL "$ac_srcdir/configure" --help=recursive 1428 $SHELL "$ac_srcdir/configure" --help=recursive
1515 else 1429 else
1516 $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
1517 fi || ac_status=$? 1431 fi || ac_status=$?
1518 cd "$ac_pwd" || { ac_status=$?; break; } 1432 cd "$ac_pwd" || { ac_status=$?; break; }
1519 done 1433 done
@@ -1523,711 +1437,21 @@ test -n "$ac_init_help" && exit $ac_status
1523if $ac_init_version; then 1437if $ac_init_version; then
1524 cat <<\_ACEOF 1438 cat <<\_ACEOF
1525OpenSSH configure Portable 1439OpenSSH configure Portable
1526generated by GNU Autoconf 2.68 1440generated by GNU Autoconf 2.61
1527 1441
1528Copyright (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.
1529This configure script is free software; the Free Software Foundation 1444This configure script is free software; the Free Software Foundation
1530gives unlimited permission to copy, distribute and modify it. 1445gives unlimited permission to copy, distribute and modify it.
1531_ACEOF 1446_ACEOF
1532 exit 1447 exit
1533fi 1448fi
1534
1535## ------------------------ ##
1536## Autoconf initialization. ##
1537## ------------------------ ##
1538
1539# ac_fn_c_try_compile LINENO
1540# --------------------------
1541# Try to compile conftest.$ac_ext, and return whether this succeeded.
1542ac_fn_c_try_compile ()
1543{
1544 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1545 rm -f conftest.$ac_objext
1546 if { { ac_try="$ac_compile"
1547case "(($ac_try" in
1548 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1549 *) ac_try_echo=$ac_try;;
1550esac
1551eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
1552$as_echo "$ac_try_echo"; } >&5
1553 (eval "$ac_compile") 2>conftest.err
1554 ac_status=$?
1555 if test -s conftest.err; then
1556 grep -v '^ *+' conftest.err >conftest.er1
1557 cat conftest.er1 >&5
1558 mv -f conftest.er1 conftest.err
1559 fi
1560 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1561 test $ac_status = 0; } && {
1562 test -z "$ac_c_werror_flag" ||
1563 test ! -s conftest.err
1564 } && test -s conftest.$ac_objext; then :
1565 ac_retval=0
1566else
1567 $as_echo "$as_me: failed program was:" >&5
1568sed 's/^/| /' conftest.$ac_ext >&5
1569
1570 ac_retval=1
1571fi
1572 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1573 as_fn_set_status $ac_retval
1574
1575} # ac_fn_c_try_compile
1576
1577# ac_fn_c_try_run LINENO
1578# ----------------------
1579# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
1580# that executables *can* be run.
1581ac_fn_c_try_run ()
1582{
1583 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1584 if { { ac_try="$ac_link"
1585case "(($ac_try" in
1586 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1587 *) ac_try_echo=$ac_try;;
1588esac
1589eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
1590$as_echo "$ac_try_echo"; } >&5
1591 (eval "$ac_link") 2>&5
1592 ac_status=$?
1593 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1594 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
1595 { { case "(($ac_try" in
1596 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1597 *) ac_try_echo=$ac_try;;
1598esac
1599eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
1600$as_echo "$ac_try_echo"; } >&5
1601 (eval "$ac_try") 2>&5
1602 ac_status=$?
1603 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1604 test $ac_status = 0; }; }; then :
1605 ac_retval=0
1606else
1607 $as_echo "$as_me: program exited with status $ac_status" >&5
1608 $as_echo "$as_me: failed program was:" >&5
1609sed 's/^/| /' conftest.$ac_ext >&5
1610
1611 ac_retval=$ac_status
1612fi
1613 rm -rf conftest.dSYM conftest_ipa8_conftest.oo
1614 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1615 as_fn_set_status $ac_retval
1616
1617} # ac_fn_c_try_run
1618
1619# ac_fn_c_try_cpp LINENO
1620# ----------------------
1621# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
1622ac_fn_c_try_cpp ()
1623{
1624 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1625 if { { ac_try="$ac_cpp conftest.$ac_ext"
1626case "(($ac_try" in
1627 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1628 *) ac_try_echo=$ac_try;;
1629esac
1630eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
1631$as_echo "$ac_try_echo"; } >&5
1632 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
1633 ac_status=$?
1634 if test -s conftest.err; then
1635 grep -v '^ *+' conftest.err >conftest.er1
1636 cat conftest.er1 >&5
1637 mv -f conftest.er1 conftest.err
1638 fi
1639 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1640 test $ac_status = 0; } > conftest.i && {
1641 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
1642 test ! -s conftest.err
1643 }; then :
1644 ac_retval=0
1645else
1646 $as_echo "$as_me: failed program was:" >&5
1647sed 's/^/| /' conftest.$ac_ext >&5
1648
1649 ac_retval=1
1650fi
1651 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1652 as_fn_set_status $ac_retval
1653
1654} # ac_fn_c_try_cpp
1655
1656# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
1657# -------------------------------------------------------
1658# Tests whether HEADER exists and can be compiled using the include files in
1659# INCLUDES, setting the cache variable VAR accordingly.
1660ac_fn_c_check_header_compile ()
1661{
1662 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1663 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
1664$as_echo_n "checking for $2... " >&6; }
1665if eval \${$3+:} false; then :
1666 $as_echo_n "(cached) " >&6
1667else
1668 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1669/* end confdefs.h. */
1670$4
1671#include <$2>
1672_ACEOF
1673if ac_fn_c_try_compile "$LINENO"; then :
1674 eval "$3=yes"
1675else
1676 eval "$3=no"
1677fi
1678rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1679fi
1680eval ac_res=\$$3
1681 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1682$as_echo "$ac_res" >&6; }
1683 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1684
1685} # ac_fn_c_check_header_compile
1686
1687# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
1688# ---------------------------------------------
1689# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
1690# accordingly.
1691ac_fn_c_check_decl ()
1692{
1693 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1694 as_decl_name=`echo $2|sed 's/ *(.*//'`
1695 as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
1696 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
1697$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
1698if eval \${$3+:} false; then :
1699 $as_echo_n "(cached) " >&6
1700else
1701 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1702/* end confdefs.h. */
1703$4
1704int
1705main ()
1706{
1707#ifndef $as_decl_name
1708#ifdef __cplusplus
1709 (void) $as_decl_use;
1710#else
1711 (void) $as_decl_name;
1712#endif
1713#endif
1714
1715 ;
1716 return 0;
1717}
1718_ACEOF
1719if ac_fn_c_try_compile "$LINENO"; then :
1720 eval "$3=yes"
1721else
1722 eval "$3=no"
1723fi
1724rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1725fi
1726eval ac_res=\$$3
1727 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1728$as_echo "$ac_res" >&6; }
1729 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1730
1731} # ac_fn_c_check_decl
1732
1733# ac_fn_c_try_link LINENO
1734# -----------------------
1735# Try to link conftest.$ac_ext, and return whether this succeeded.
1736ac_fn_c_try_link ()
1737{
1738 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1739 rm -f conftest.$ac_objext conftest$ac_exeext
1740 if { { ac_try="$ac_link"
1741case "(($ac_try" in
1742 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1743 *) ac_try_echo=$ac_try;;
1744esac
1745eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
1746$as_echo "$ac_try_echo"; } >&5
1747 (eval "$ac_link") 2>conftest.err
1748 ac_status=$?
1749 if test -s conftest.err; then
1750 grep -v '^ *+' conftest.err >conftest.er1
1751 cat conftest.er1 >&5
1752 mv -f conftest.er1 conftest.err
1753 fi
1754 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1755 test $ac_status = 0; } && {
1756 test -z "$ac_c_werror_flag" ||
1757 test ! -s conftest.err
1758 } && test -s conftest$ac_exeext && {
1759 test "$cross_compiling" = yes ||
1760 $as_test_x conftest$ac_exeext
1761 }; then :
1762 ac_retval=0
1763else
1764 $as_echo "$as_me: failed program was:" >&5
1765sed 's/^/| /' conftest.$ac_ext >&5
1766
1767 ac_retval=1
1768fi
1769 # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
1770 # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
1771 # interfere with the next link command; also delete a directory that is
1772 # left behind by Apple's compiler. We do this before executing the actions.
1773 rm -rf conftest.dSYM conftest_ipa8_conftest.oo
1774 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1775 as_fn_set_status $ac_retval
1776
1777} # ac_fn_c_try_link
1778
1779# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
1780# -------------------------------------------------------
1781# Tests whether HEADER exists, giving a warning if it cannot be compiled using
1782# the include files in INCLUDES and setting the cache variable VAR
1783# accordingly.
1784ac_fn_c_check_header_mongrel ()
1785{
1786 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1787 if eval \${$3+:} false; then :
1788 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
1789$as_echo_n "checking for $2... " >&6; }
1790if eval \${$3+:} false; then :
1791 $as_echo_n "(cached) " >&6
1792fi
1793eval ac_res=\$$3
1794 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1795$as_echo "$ac_res" >&6; }
1796else
1797 # Is the header compilable?
1798{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
1799$as_echo_n "checking $2 usability... " >&6; }
1800cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1801/* end confdefs.h. */
1802$4
1803#include <$2>
1804_ACEOF
1805if ac_fn_c_try_compile "$LINENO"; then :
1806 ac_header_compiler=yes
1807else
1808 ac_header_compiler=no
1809fi
1810rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1811{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
1812$as_echo "$ac_header_compiler" >&6; }
1813
1814# Is the header present?
1815{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
1816$as_echo_n "checking $2 presence... " >&6; }
1817cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1818/* end confdefs.h. */
1819#include <$2>
1820_ACEOF
1821if ac_fn_c_try_cpp "$LINENO"; then :
1822 ac_header_preproc=yes
1823else
1824 ac_header_preproc=no
1825fi
1826rm -f conftest.err conftest.i conftest.$ac_ext
1827{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
1828$as_echo "$ac_header_preproc" >&6; }
1829
1830# So? What about this header?
1831case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
1832 yes:no: )
1833 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
1834$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
1835 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
1836$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
1837 ;;
1838 no:yes:* )
1839 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
1840$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
1841 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
1842$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
1843 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
1844$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
1845 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
1846$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
1847 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
1848$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
1849( $as_echo "## ------------------------------------------- ##
1850## Report this to openssh-unix-dev@mindrot.org ##
1851## ------------------------------------------- ##"
1852 ) | sed "s/^/$as_me: WARNING: /" >&2
1853 ;;
1854esac
1855 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
1856$as_echo_n "checking for $2... " >&6; }
1857if eval \${$3+:} false; then :
1858 $as_echo_n "(cached) " >&6
1859else
1860 eval "$3=\$ac_header_compiler"
1861fi
1862eval ac_res=\$$3
1863 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1864$as_echo "$ac_res" >&6; }
1865fi
1866 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1867
1868} # ac_fn_c_check_header_mongrel
1869
1870# ac_fn_c_check_func LINENO FUNC VAR
1871# ----------------------------------
1872# Tests whether FUNC exists, setting the cache variable VAR accordingly
1873ac_fn_c_check_func ()
1874{
1875 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1876 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
1877$as_echo_n "checking for $2... " >&6; }
1878if eval \${$3+:} false; then :
1879 $as_echo_n "(cached) " >&6
1880else
1881 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1882/* end confdefs.h. */
1883/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
1884 For example, HP-UX 11i <limits.h> declares gettimeofday. */
1885#define $2 innocuous_$2
1886
1887/* System header to define __stub macros and hopefully few prototypes,
1888 which can conflict with char $2 (); below.
1889 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
1890 <limits.h> exists even on freestanding compilers. */
1891
1892#ifdef __STDC__
1893# include <limits.h>
1894#else
1895# include <assert.h>
1896#endif
1897
1898#undef $2
1899
1900/* Override any GCC internal prototype to avoid an error.
1901 Use char because int might match the return type of a GCC
1902 builtin and then its argument prototype would still apply. */
1903#ifdef __cplusplus
1904extern "C"
1905#endif
1906char $2 ();
1907/* The GNU C library defines this for functions which it implements
1908 to always fail with ENOSYS. Some functions are actually named
1909 something starting with __ and the normal name is an alias. */
1910#if defined __stub_$2 || defined __stub___$2
1911choke me
1912#endif
1913
1914int
1915main ()
1916{
1917return $2 ();
1918 ;
1919 return 0;
1920}
1921_ACEOF
1922if ac_fn_c_try_link "$LINENO"; then :
1923 eval "$3=yes"
1924else
1925 eval "$3=no"
1926fi
1927rm -f core conftest.err conftest.$ac_objext \
1928 conftest$ac_exeext conftest.$ac_ext
1929fi
1930eval ac_res=\$$3
1931 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1932$as_echo "$ac_res" >&6; }
1933 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1934
1935} # ac_fn_c_check_func
1936
1937# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
1938# -------------------------------------------
1939# Tests whether TYPE exists after having included INCLUDES, setting cache
1940# variable VAR accordingly.
1941ac_fn_c_check_type ()
1942{
1943 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1944 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
1945$as_echo_n "checking for $2... " >&6; }
1946if eval \${$3+:} false; then :
1947 $as_echo_n "(cached) " >&6
1948else
1949 eval "$3=no"
1950 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1951/* end confdefs.h. */
1952$4
1953int
1954main ()
1955{
1956if (sizeof ($2))
1957 return 0;
1958 ;
1959 return 0;
1960}
1961_ACEOF
1962if ac_fn_c_try_compile "$LINENO"; then :
1963 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1964/* end confdefs.h. */
1965$4
1966int
1967main ()
1968{
1969if (sizeof (($2)))
1970 return 0;
1971 ;
1972 return 0;
1973}
1974_ACEOF
1975if ac_fn_c_try_compile "$LINENO"; then :
1976
1977else
1978 eval "$3=yes"
1979fi
1980rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1981fi
1982rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1983fi
1984eval ac_res=\$$3
1985 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1986$as_echo "$ac_res" >&6; }
1987 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1988
1989} # ac_fn_c_check_type
1990
1991# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
1992# --------------------------------------------
1993# Tries to find the compile-time value of EXPR in a program that includes
1994# INCLUDES, setting VAR accordingly. Returns whether the value could be
1995# computed
1996ac_fn_c_compute_int ()
1997{
1998 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1999 if test "$cross_compiling" = yes; then
2000 # Depending upon the size, compute the lo and hi bounds.
2001cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2002/* end confdefs.h. */
2003$4
2004int
2005main ()
2006{
2007static int test_array [1 - 2 * !(($2) >= 0)];
2008test_array [0] = 0
2009
2010 ;
2011 return 0;
2012}
2013_ACEOF
2014if ac_fn_c_try_compile "$LINENO"; then :
2015 ac_lo=0 ac_mid=0
2016 while :; do
2017 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2018/* end confdefs.h. */
2019$4
2020int
2021main ()
2022{
2023static int test_array [1 - 2 * !(($2) <= $ac_mid)];
2024test_array [0] = 0
2025
2026 ;
2027 return 0;
2028}
2029_ACEOF
2030if ac_fn_c_try_compile "$LINENO"; then :
2031 ac_hi=$ac_mid; break
2032else
2033 as_fn_arith $ac_mid + 1 && ac_lo=$as_val
2034 if test $ac_lo -le $ac_mid; then
2035 ac_lo= ac_hi=
2036 break
2037 fi
2038 as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
2039fi
2040rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2041 done
2042else
2043 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2044/* end confdefs.h. */
2045$4
2046int
2047main ()
2048{
2049static int test_array [1 - 2 * !(($2) < 0)];
2050test_array [0] = 0
2051
2052 ;
2053 return 0;
2054}
2055_ACEOF
2056if ac_fn_c_try_compile "$LINENO"; then :
2057 ac_hi=-1 ac_mid=-1
2058 while :; do
2059 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2060/* end confdefs.h. */
2061$4
2062int
2063main ()
2064{
2065static int test_array [1 - 2 * !(($2) >= $ac_mid)];
2066test_array [0] = 0
2067
2068 ;
2069 return 0;
2070}
2071_ACEOF
2072if ac_fn_c_try_compile "$LINENO"; then :
2073 ac_lo=$ac_mid; break
2074else
2075 as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
2076 if test $ac_mid -le $ac_hi; then
2077 ac_lo= ac_hi=
2078 break
2079 fi
2080 as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
2081fi
2082rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2083 done
2084else
2085 ac_lo= ac_hi=
2086fi
2087rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2088fi
2089rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2090# Binary search between lo and hi bounds.
2091while test "x$ac_lo" != "x$ac_hi"; do
2092 as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
2093 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2094/* end confdefs.h. */
2095$4
2096int
2097main ()
2098{
2099static int test_array [1 - 2 * !(($2) <= $ac_mid)];
2100test_array [0] = 0
2101
2102 ;
2103 return 0;
2104}
2105_ACEOF
2106if ac_fn_c_try_compile "$LINENO"; then :
2107 ac_hi=$ac_mid
2108else
2109 as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
2110fi
2111rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2112done
2113case $ac_lo in #((
2114?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
2115'') ac_retval=1 ;;
2116esac
2117 else
2118 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2119/* end confdefs.h. */
2120$4
2121static long int longval () { return $2; }
2122static unsigned long int ulongval () { return $2; }
2123#include <stdio.h>
2124#include <stdlib.h>
2125int
2126main ()
2127{
2128
2129 FILE *f = fopen ("conftest.val", "w");
2130 if (! f)
2131 return 1;
2132 if (($2) < 0)
2133 {
2134 long int i = longval ();
2135 if (i != ($2))
2136 return 1;
2137 fprintf (f, "%ld", i);
2138 }
2139 else
2140 {
2141 unsigned long int i = ulongval ();
2142 if (i != ($2))
2143 return 1;
2144 fprintf (f, "%lu", i);
2145 }
2146 /* Do not output a trailing newline, as this causes \r\n confusion
2147 on some platforms. */
2148 return ferror (f) || fclose (f) != 0;
2149
2150 ;
2151 return 0;
2152}
2153_ACEOF
2154if ac_fn_c_try_run "$LINENO"; then :
2155 echo >>conftest.val; read $3 <conftest.val; ac_retval=0
2156else
2157 ac_retval=1
2158fi
2159rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
2160 conftest.$ac_objext conftest.beam conftest.$ac_ext
2161rm -f conftest.val
2162
2163 fi
2164 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
2165 as_fn_set_status $ac_retval
2166
2167} # ac_fn_c_compute_int
2168
2169# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
2170# ----------------------------------------------------
2171# Tries to find if the field MEMBER exists in type AGGR, after including
2172# INCLUDES, setting cache variable VAR accordingly.
2173ac_fn_c_check_member ()
2174{
2175 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
2176 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
2177$as_echo_n "checking for $2.$3... " >&6; }
2178if eval \${$4+:} false; then :
2179 $as_echo_n "(cached) " >&6
2180else
2181 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2182/* end confdefs.h. */
2183$5
2184int
2185main ()
2186{
2187static $2 ac_aggr;
2188if (ac_aggr.$3)
2189return 0;
2190 ;
2191 return 0;
2192}
2193_ACEOF
2194if ac_fn_c_try_compile "$LINENO"; then :
2195 eval "$4=yes"
2196else
2197 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2198/* end confdefs.h. */
2199$5
2200int
2201main ()
2202{
2203static $2 ac_aggr;
2204if (sizeof ac_aggr.$3)
2205return 0;
2206 ;
2207 return 0;
2208}
2209_ACEOF
2210if ac_fn_c_try_compile "$LINENO"; then :
2211 eval "$4=yes"
2212else
2213 eval "$4=no"
2214fi
2215rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2216fi
2217rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
2218fi
2219eval ac_res=\$$4
2220 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
2221$as_echo "$ac_res" >&6; }
2222 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
2223
2224} # ac_fn_c_check_member
2225cat >config.log <<_ACEOF 1449cat >config.log <<_ACEOF
2226This file contains any messages produced by compilers while 1450This file contains any messages produced by compilers while
2227running configure, to aid debugging if configure makes a mistake. 1451running configure, to aid debugging if configure makes a mistake.
2228 1452
2229It was created by OpenSSH $as_me Portable, which was 1453It was created by OpenSSH $as_me Portable, which was
2230generated by GNU Autoconf 2.68. Invocation command line was 1454generated by GNU Autoconf 2.61. Invocation command line was
2231 1455
2232 $ $0 $@ 1456 $ $0 $@
2233 1457
@@ -2263,8 +1487,8 @@ for as_dir in $PATH
2263do 1487do
2264 IFS=$as_save_IFS 1488 IFS=$as_save_IFS
2265 test -z "$as_dir" && as_dir=. 1489 test -z "$as_dir" && as_dir=.
2266 $as_echo "PATH: $as_dir" 1490 echo "PATH: $as_dir"
2267 done 1491done
2268IFS=$as_save_IFS 1492IFS=$as_save_IFS
2269 1493
2270} >&5 1494} >&5
@@ -2298,12 +1522,12 @@ do
2298 | -silent | --silent | --silen | --sile | --sil) 1522 | -silent | --silent | --silen | --sile | --sil)
2299 continue ;; 1523 continue ;;
2300 *\'*) 1524 *\'*)
2301 ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; 1525 ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
2302 esac 1526 esac
2303 case $ac_pass in 1527 case $ac_pass in
2304 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 1528 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
2305 2) 1529 2)
2306 as_fn_append ac_configure_args1 " '$ac_arg'" 1530 ac_configure_args1="$ac_configure_args1 '$ac_arg'"
2307 if test $ac_must_keep_next = true; then 1531 if test $ac_must_keep_next = true; then
2308 ac_must_keep_next=false # Got value, back to normal. 1532 ac_must_keep_next=false # Got value, back to normal.
2309 else 1533 else
@@ -2319,13 +1543,13 @@ do
2319 -* ) ac_must_keep_next=true ;; 1543 -* ) ac_must_keep_next=true ;;
2320 esac 1544 esac
2321 fi 1545 fi
2322 as_fn_append ac_configure_args " '$ac_arg'" 1546 ac_configure_args="$ac_configure_args '$ac_arg'"
2323 ;; 1547 ;;
2324 esac 1548 esac
2325 done 1549 done
2326done 1550done
2327{ 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; }
2328{ 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; }
2329 1553
2330# When interrupted or exit'd, cleanup temporary files, and complete 1554# When interrupted or exit'd, cleanup temporary files, and complete
2331# config.log. We remove comments because anyway the quotes in there 1555# config.log. We remove comments because anyway the quotes in there
@@ -2337,9 +1561,11 @@ trap 'exit_status=$?
2337 { 1561 {
2338 echo 1562 echo
2339 1563
2340 $as_echo "## ---------------- ## 1564 cat <<\_ASBOX
1565## ---------------- ##
2341## Cache variables. ## 1566## Cache variables. ##
2342## ---------------- ##" 1567## ---------------- ##
1568_ASBOX
2343 echo 1569 echo
2344 # The following way of writing the cache mishandles newlines in values, 1570 # The following way of writing the cache mishandles newlines in values,
2345( 1571(
@@ -2348,13 +1574,12 @@ trap 'exit_status=$?
2348 case $ac_val in #( 1574 case $ac_val in #(
2349 *${as_nl}*) 1575 *${as_nl}*)
2350 case $ac_var in #( 1576 case $ac_var in #(
2351 *_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
2352$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;} ;;
2353 esac 1579 esac
2354 case $ac_var in #( 1580 case $ac_var in #(
2355 _ | IFS | as_nl) ;; #( 1581 _ | IFS | as_nl) ;; #(
2356 BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( 1582 *) $as_unset $ac_var ;;
2357 *) { eval $ac_var=; unset $ac_var;} ;;
2358 esac ;; 1583 esac ;;
2359 esac 1584 esac
2360 done 1585 done
@@ -2373,136 +1598,128 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
2373) 1598)
2374 echo 1599 echo
2375 1600
2376 $as_echo "## ----------------- ## 1601 cat <<\_ASBOX
1602## ----------------- ##
2377## Output variables. ## 1603## Output variables. ##
2378## ----------------- ##" 1604## ----------------- ##
1605_ASBOX
2379 echo 1606 echo
2380 for ac_var in $ac_subst_vars 1607 for ac_var in $ac_subst_vars
2381 do 1608 do
2382 eval ac_val=\$$ac_var 1609 eval ac_val=\$$ac_var
2383 case $ac_val in 1610 case $ac_val in
2384 *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; 1611 *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
2385 esac 1612 esac
2386 $as_echo "$ac_var='\''$ac_val'\''" 1613 echo "$ac_var='\''$ac_val'\''"
2387 done | sort 1614 done | sort
2388 echo 1615 echo
2389 1616
2390 if test -n "$ac_subst_files"; then 1617 if test -n "$ac_subst_files"; then
2391 $as_echo "## ------------------- ## 1618 cat <<\_ASBOX
1619## ------------------- ##
2392## File substitutions. ## 1620## File substitutions. ##
2393## ------------------- ##" 1621## ------------------- ##
1622_ASBOX
2394 echo 1623 echo
2395 for ac_var in $ac_subst_files 1624 for ac_var in $ac_subst_files
2396 do 1625 do
2397 eval ac_val=\$$ac_var 1626 eval ac_val=\$$ac_var
2398 case $ac_val in 1627 case $ac_val in
2399 *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; 1628 *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
2400 esac 1629 esac
2401 $as_echo "$ac_var='\''$ac_val'\''" 1630 echo "$ac_var='\''$ac_val'\''"
2402 done | sort 1631 done | sort
2403 echo 1632 echo
2404 fi 1633 fi
2405 1634
2406 if test -s confdefs.h; then 1635 if test -s confdefs.h; then
2407 $as_echo "## ----------- ## 1636 cat <<\_ASBOX
1637## ----------- ##
2408## confdefs.h. ## 1638## confdefs.h. ##
2409## ----------- ##" 1639## ----------- ##
1640_ASBOX
2410 echo 1641 echo
2411 cat confdefs.h 1642 cat confdefs.h
2412 echo 1643 echo
2413 fi 1644 fi
2414 test "$ac_signal" != 0 && 1645 test "$ac_signal" != 0 &&
2415 $as_echo "$as_me: caught signal $ac_signal" 1646 echo "$as_me: caught signal $ac_signal"
2416 $as_echo "$as_me: exit $exit_status" 1647 echo "$as_me: exit $exit_status"
2417 } >&5 1648 } >&5
2418 rm -f core *.core core.conftest.* && 1649 rm -f core *.core core.conftest.* &&
2419 rm -f -r conftest* confdefs* conf$$* $ac_clean_files && 1650 rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
2420 exit $exit_status 1651 exit $exit_status
2421' 0 1652' 0
2422for ac_signal in 1 2 13 15; do 1653for ac_signal in 1 2 13 15; do
2423 trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal 1654 trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
2424done 1655done
2425ac_signal=0 1656ac_signal=0
2426 1657
2427# 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.
2428rm -f -r conftest* confdefs.h 1659rm -f -r conftest* confdefs.h
2429 1660
2430$as_echo "/* confdefs.h */" > confdefs.h
2431
2432# Predefined preprocessor variables. 1661# Predefined preprocessor variables.
2433 1662
2434cat >>confdefs.h <<_ACEOF 1663cat >>confdefs.h <<_ACEOF
2435#define PACKAGE_NAME "$PACKAGE_NAME" 1664#define PACKAGE_NAME "$PACKAGE_NAME"
2436_ACEOF 1665_ACEOF
2437 1666
1667
2438cat >>confdefs.h <<_ACEOF 1668cat >>confdefs.h <<_ACEOF
2439#define PACKAGE_TARNAME "$PACKAGE_TARNAME" 1669#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
2440_ACEOF 1670_ACEOF
2441 1671
1672
2442cat >>confdefs.h <<_ACEOF 1673cat >>confdefs.h <<_ACEOF
2443#define PACKAGE_VERSION "$PACKAGE_VERSION" 1674#define PACKAGE_VERSION "$PACKAGE_VERSION"
2444_ACEOF 1675_ACEOF
2445 1676
1677
2446cat >>confdefs.h <<_ACEOF 1678cat >>confdefs.h <<_ACEOF
2447#define PACKAGE_STRING "$PACKAGE_STRING" 1679#define PACKAGE_STRING "$PACKAGE_STRING"
2448_ACEOF 1680_ACEOF
2449 1681
2450cat >>confdefs.h <<_ACEOF
2451#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
2452_ACEOF
2453 1682
2454cat >>confdefs.h <<_ACEOF 1683cat >>confdefs.h <<_ACEOF
2455#define PACKAGE_URL "$PACKAGE_URL" 1684#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
2456_ACEOF 1685_ACEOF
2457 1686
2458 1687
2459# 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.
2460# Prefer an explicitly selected file to automatically selected ones. 1689# Prefer explicitly selected file to automatically selected ones.
2461ac_site_file1=NONE
2462ac_site_file2=NONE
2463if test -n "$CONFIG_SITE"; then 1690if test -n "$CONFIG_SITE"; then
2464 # We do not want a PATH search for config.site. 1691 set x "$CONFIG_SITE"
2465 case $CONFIG_SITE in #((
2466 -*) ac_site_file1=./$CONFIG_SITE;;
2467 */*) ac_site_file1=$CONFIG_SITE;;
2468 *) ac_site_file1=./$CONFIG_SITE;;
2469 esac
2470elif test "x$prefix" != xNONE; then 1692elif test "x$prefix" != xNONE; then
2471 ac_site_file1=$prefix/share/config.site 1693 set x "$prefix/share/config.site" "$prefix/etc/config.site"
2472 ac_site_file2=$prefix/etc/config.site
2473else 1694else
2474 ac_site_file1=$ac_default_prefix/share/config.site 1695 set x "$ac_default_prefix/share/config.site" \
2475 ac_site_file2=$ac_default_prefix/etc/config.site 1696 "$ac_default_prefix/etc/config.site"
2476fi 1697fi
2477for ac_site_file in "$ac_site_file1" "$ac_site_file2" 1698shift
1699for ac_site_file
2478do 1700do
2479 test "x$ac_site_file" = xNONE && continue 1701 if test -r "$ac_site_file"; then
2480 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
2481 { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 1703echo "$as_me: loading site script $ac_site_file" >&6;}
2482$as_echo "$as_me: loading site script $ac_site_file" >&6;}
2483 sed 's/^/| /' "$ac_site_file" >&5 1704 sed 's/^/| /' "$ac_site_file" >&5
2484 . "$ac_site_file" \ 1705 . "$ac_site_file"
2485 || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
2486$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
2487as_fn_error $? "failed to load site script $ac_site_file
2488See \`config.log' for more details" "$LINENO" 5; }
2489 fi 1706 fi
2490done 1707done
2491 1708
2492if test -r "$cache_file"; then 1709if test -r "$cache_file"; then
2493 # Some versions of bash will fail to source /dev/null (special files 1710 # Some versions of bash will fail to source /dev/null (special
2494 # actually), so we avoid doing that. DJGPP emulates it as a regular file. 1711 # files actually), so we avoid doing that.
2495 if test /dev/null != "$cache_file" && test -f "$cache_file"; then 1712 if test -f "$cache_file"; then
2496 { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 1713 { echo "$as_me:$LINENO: loading cache $cache_file" >&5
2497$as_echo "$as_me: loading cache $cache_file" >&6;} 1714echo "$as_me: loading cache $cache_file" >&6;}
2498 case $cache_file in 1715 case $cache_file in
2499 [\\/]* | ?:[\\/]* ) . "$cache_file";; 1716 [\\/]* | ?:[\\/]* ) . "$cache_file";;
2500 *) . "./$cache_file";; 1717 *) . "./$cache_file";;
2501 esac 1718 esac
2502 fi 1719 fi
2503else 1720else
2504 { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 1721 { echo "$as_me:$LINENO: creating cache $cache_file" >&5
2505$as_echo "$as_me: creating cache $cache_file" >&6;} 1722echo "$as_me: creating cache $cache_file" >&6;}
2506 >$cache_file 1723 >$cache_file
2507fi 1724fi
2508 1725
@@ -2516,56 +1733,68 @@ for ac_var in $ac_precious_vars; do
2516 eval ac_new_val=\$ac_env_${ac_var}_value 1733 eval ac_new_val=\$ac_env_${ac_var}_value
2517 case $ac_old_set,$ac_new_set in 1734 case $ac_old_set,$ac_new_set in
2518 set,) 1735 set,)
2519 { $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
2520$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;}
2521 ac_cache_corrupted=: ;; 1738 ac_cache_corrupted=: ;;
2522 ,set) 1739 ,set)
2523 { $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
2524$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;}
2525 ac_cache_corrupted=: ;; 1742 ac_cache_corrupted=: ;;
2526 ,);; 1743 ,);;
2527 *) 1744 *)
2528 if test "x$ac_old_val" != "x$ac_new_val"; then 1745 if test "x$ac_old_val" != "x$ac_new_val"; then
2529 # differences in whitespace do not lead to failure. 1746 { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
2530 ac_old_val_w=`echo x $ac_old_val` 1747echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
2531 ac_new_val_w=`echo x $ac_new_val` 1748 { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
2532 if test "$ac_old_val_w" != "$ac_new_val_w"; then 1749echo "$as_me: former value: $ac_old_val" >&2;}
2533 { $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
2534$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} 1751echo "$as_me: current value: $ac_new_val" >&2;}
2535 ac_cache_corrupted=: 1752 ac_cache_corrupted=:
2536 else
2537 { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
2538$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
2539 eval $ac_var=\$ac_old_val
2540 fi
2541 { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
2542$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
2543 { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
2544$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
2545 fi;; 1753 fi;;
2546 esac 1754 esac
2547 # Pass precious variables to config.status. 1755 # Pass precious variables to config.status.
2548 if test "$ac_new_set" = set; then 1756 if test "$ac_new_set" = set; then
2549 case $ac_new_val in 1757 case $ac_new_val in
2550 *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; 1758 *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
2551 *) ac_arg=$ac_var=$ac_new_val ;; 1759 *) ac_arg=$ac_var=$ac_new_val ;;
2552 esac 1760 esac
2553 case " $ac_configure_args " in 1761 case " $ac_configure_args " in
2554 *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. 1762 *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
2555 *) as_fn_append ac_configure_args " '$ac_arg'" ;; 1763 *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
2556 esac 1764 esac
2557 fi 1765 fi
2558done 1766done
2559if $ac_cache_corrupted; then 1767if $ac_cache_corrupted; then
2560 { $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
2561$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 1769echo "$as_me: error: changes in the environment can compromise the build" >&2;}
2562 { $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
2563$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;}
2564 as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 1772 { (exit 1); exit 1; }; }
2565fi 1773fi
2566## -------------------- ## 1774
2567## Main body of script. ## 1775
2568## -------------------- ## 1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
2569 1798
2570ac_ext=c 1799ac_ext=c
2571ac_cpp='$CPP $CPPFLAGS' 1800ac_cpp='$CPP $CPPFLAGS'
@@ -2593,10 +1822,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
2593if test -n "$ac_tool_prefix"; then 1822if test -n "$ac_tool_prefix"; then
2594 # 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.
2595set dummy ${ac_tool_prefix}gcc; ac_word=$2 1824set dummy ${ac_tool_prefix}gcc; ac_word=$2
2596{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 1825{ echo "$as_me:$LINENO: checking for $ac_word" >&5
2597$as_echo_n "checking for $ac_word... " >&6; } 1826echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
2598if ${ac_cv_prog_CC+:} false; then : 1827if test "${ac_cv_prog_CC+set}" = set; then
2599 $as_echo_n "(cached) " >&6 1828 echo $ECHO_N "(cached) $ECHO_C" >&6
2600else 1829else
2601 if test -n "$CC"; then 1830 if test -n "$CC"; then
2602 ac_cv_prog_CC="$CC" # Let the user override the test. 1831 ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -2606,25 +1835,25 @@ for as_dir in $PATH
2606do 1835do
2607 IFS=$as_save_IFS 1836 IFS=$as_save_IFS
2608 test -z "$as_dir" && as_dir=. 1837 test -z "$as_dir" && as_dir=.
2609 for ac_exec_ext in '' $ac_executable_extensions; do 1838 for ac_exec_ext in '' $ac_executable_extensions; do
2610 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
2611 ac_cv_prog_CC="${ac_tool_prefix}gcc" 1840 ac_cv_prog_CC="${ac_tool_prefix}gcc"
2612 $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
2613 break 2 1842 break 2
2614 fi 1843 fi
2615done 1844done
2616 done 1845done
2617IFS=$as_save_IFS 1846IFS=$as_save_IFS
2618 1847
2619fi 1848fi
2620fi 1849fi
2621CC=$ac_cv_prog_CC 1850CC=$ac_cv_prog_CC
2622if test -n "$CC"; then 1851if test -n "$CC"; then
2623 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 1852 { echo "$as_me:$LINENO: result: $CC" >&5
2624$as_echo "$CC" >&6; } 1853echo "${ECHO_T}$CC" >&6; }
2625else 1854else
2626 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 1855 { echo "$as_me:$LINENO: result: no" >&5
2627$as_echo "no" >&6; } 1856echo "${ECHO_T}no" >&6; }
2628fi 1857fi
2629 1858
2630 1859
@@ -2633,10 +1862,10 @@ if test -z "$ac_cv_prog_CC"; then
2633 ac_ct_CC=$CC 1862 ac_ct_CC=$CC
2634 # 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.
2635set dummy gcc; ac_word=$2 1864set dummy gcc; ac_word=$2
2636{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 1865{ echo "$as_me:$LINENO: checking for $ac_word" >&5
2637$as_echo_n "checking for $ac_word... " >&6; } 1866echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
2638if ${ac_cv_prog_ac_ct_CC+:} false; then : 1867if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
2639 $as_echo_n "(cached) " >&6 1868 echo $ECHO_N "(cached) $ECHO_C" >&6
2640else 1869else
2641 if test -n "$ac_ct_CC"; then 1870 if test -n "$ac_ct_CC"; then
2642 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.
@@ -2646,25 +1875,25 @@ for as_dir in $PATH
2646do 1875do
2647 IFS=$as_save_IFS 1876 IFS=$as_save_IFS
2648 test -z "$as_dir" && as_dir=. 1877 test -z "$as_dir" && as_dir=.
2649 for ac_exec_ext in '' $ac_executable_extensions; do 1878 for ac_exec_ext in '' $ac_executable_extensions; do
2650 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
2651 ac_cv_prog_ac_ct_CC="gcc" 1880 ac_cv_prog_ac_ct_CC="gcc"
2652 $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
2653 break 2 1882 break 2
2654 fi 1883 fi
2655done 1884done
2656 done 1885done
2657IFS=$as_save_IFS 1886IFS=$as_save_IFS
2658 1887
2659fi 1888fi
2660fi 1889fi
2661ac_ct_CC=$ac_cv_prog_ac_ct_CC 1890ac_ct_CC=$ac_cv_prog_ac_ct_CC
2662if test -n "$ac_ct_CC"; then 1891if test -n "$ac_ct_CC"; then
2663 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 1892 { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
2664$as_echo "$ac_ct_CC" >&6; } 1893echo "${ECHO_T}$ac_ct_CC" >&6; }
2665else 1894else
2666 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 1895 { echo "$as_me:$LINENO: result: no" >&5
2667$as_echo "no" >&6; } 1896echo "${ECHO_T}no" >&6; }
2668fi 1897fi
2669 1898
2670 if test "x$ac_ct_CC" = x; then 1899 if test "x$ac_ct_CC" = x; then
@@ -2672,8 +1901,12 @@ fi
2672 else 1901 else
2673 case $cross_compiling:$ac_tool_warned in 1902 case $cross_compiling:$ac_tool_warned in
2674yes:) 1903yes:)
2675{ $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
2676$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;}
2677ac_tool_warned=yes ;; 1910ac_tool_warned=yes ;;
2678esac 1911esac
2679 CC=$ac_ct_CC 1912 CC=$ac_ct_CC
@@ -2686,10 +1919,10 @@ if test -z "$CC"; then
2686 if test -n "$ac_tool_prefix"; then 1919 if test -n "$ac_tool_prefix"; then
2687 # 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.
2688set dummy ${ac_tool_prefix}cc; ac_word=$2 1921set dummy ${ac_tool_prefix}cc; ac_word=$2
2689{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 1922{ echo "$as_me:$LINENO: checking for $ac_word" >&5
2690$as_echo_n "checking for $ac_word... " >&6; } 1923echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
2691if ${ac_cv_prog_CC+:} false; then : 1924if test "${ac_cv_prog_CC+set}" = set; then
2692 $as_echo_n "(cached) " >&6 1925 echo $ECHO_N "(cached) $ECHO_C" >&6
2693else 1926else
2694 if test -n "$CC"; then 1927 if test -n "$CC"; then
2695 ac_cv_prog_CC="$CC" # Let the user override the test. 1928 ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -2699,25 +1932,25 @@ for as_dir in $PATH
2699do 1932do
2700 IFS=$as_save_IFS 1933 IFS=$as_save_IFS
2701 test -z "$as_dir" && as_dir=. 1934 test -z "$as_dir" && as_dir=.
2702 for ac_exec_ext in '' $ac_executable_extensions; do 1935 for ac_exec_ext in '' $ac_executable_extensions; do
2703 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
2704 ac_cv_prog_CC="${ac_tool_prefix}cc" 1937 ac_cv_prog_CC="${ac_tool_prefix}cc"
2705 $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
2706 break 2 1939 break 2
2707 fi 1940 fi
2708done 1941done
2709 done 1942done
2710IFS=$as_save_IFS 1943IFS=$as_save_IFS
2711 1944
2712fi 1945fi
2713fi 1946fi
2714CC=$ac_cv_prog_CC 1947CC=$ac_cv_prog_CC
2715if test -n "$CC"; then 1948if test -n "$CC"; then
2716 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 1949 { echo "$as_me:$LINENO: result: $CC" >&5
2717$as_echo "$CC" >&6; } 1950echo "${ECHO_T}$CC" >&6; }
2718else 1951else
2719 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 1952 { echo "$as_me:$LINENO: result: no" >&5
2720$as_echo "no" >&6; } 1953echo "${ECHO_T}no" >&6; }
2721fi 1954fi
2722 1955
2723 1956
@@ -2726,10 +1959,10 @@ fi
2726if test -z "$CC"; then 1959if test -z "$CC"; then
2727 # 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.
2728set dummy cc; ac_word=$2 1961set dummy cc; ac_word=$2
2729{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 1962{ echo "$as_me:$LINENO: checking for $ac_word" >&5
2730$as_echo_n "checking for $ac_word... " >&6; } 1963echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
2731if ${ac_cv_prog_CC+:} false; then : 1964if test "${ac_cv_prog_CC+set}" = set; then
2732 $as_echo_n "(cached) " >&6 1965 echo $ECHO_N "(cached) $ECHO_C" >&6
2733else 1966else
2734 if test -n "$CC"; then 1967 if test -n "$CC"; then
2735 ac_cv_prog_CC="$CC" # Let the user override the test. 1968 ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -2740,18 +1973,18 @@ for as_dir in $PATH
2740do 1973do
2741 IFS=$as_save_IFS 1974 IFS=$as_save_IFS
2742 test -z "$as_dir" && as_dir=. 1975 test -z "$as_dir" && as_dir=.
2743 for ac_exec_ext in '' $ac_executable_extensions; do 1976 for ac_exec_ext in '' $ac_executable_extensions; do
2744 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
2745 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
2746 ac_prog_rejected=yes 1979 ac_prog_rejected=yes
2747 continue 1980 continue
2748 fi 1981 fi
2749 ac_cv_prog_CC="cc" 1982 ac_cv_prog_CC="cc"
2750 $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
2751 break 2 1984 break 2
2752 fi 1985 fi
2753done 1986done
2754 done 1987done
2755IFS=$as_save_IFS 1988IFS=$as_save_IFS
2756 1989
2757if test $ac_prog_rejected = yes; then 1990if test $ac_prog_rejected = yes; then
@@ -2770,11 +2003,11 @@ fi
2770fi 2003fi
2771CC=$ac_cv_prog_CC 2004CC=$ac_cv_prog_CC
2772if test -n "$CC"; then 2005if test -n "$CC"; then
2773 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 2006 { echo "$as_me:$LINENO: result: $CC" >&5
2774$as_echo "$CC" >&6; } 2007echo "${ECHO_T}$CC" >&6; }
2775else 2008else
2776 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 2009 { echo "$as_me:$LINENO: result: no" >&5
2777$as_echo "no" >&6; } 2010echo "${ECHO_T}no" >&6; }
2778fi 2011fi
2779 2012
2780 2013
@@ -2785,10 +2018,10 @@ if test -z "$CC"; then
2785 do 2018 do
2786 # 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.
2787set dummy $ac_tool_prefix$ac_prog; ac_word=$2 2020set dummy $ac_tool_prefix$ac_prog; ac_word=$2
2788{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 2021{ echo "$as_me:$LINENO: checking for $ac_word" >&5
2789$as_echo_n "checking for $ac_word... " >&6; } 2022echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
2790if ${ac_cv_prog_CC+:} false; then : 2023if test "${ac_cv_prog_CC+set}" = set; then
2791 $as_echo_n "(cached) " >&6 2024 echo $ECHO_N "(cached) $ECHO_C" >&6
2792else 2025else
2793 if test -n "$CC"; then 2026 if test -n "$CC"; then
2794 ac_cv_prog_CC="$CC" # Let the user override the test. 2027 ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -2798,25 +2031,25 @@ for as_dir in $PATH
2798do 2031do
2799 IFS=$as_save_IFS 2032 IFS=$as_save_IFS
2800 test -z "$as_dir" && as_dir=. 2033 test -z "$as_dir" && as_dir=.
2801 for ac_exec_ext in '' $ac_executable_extensions; do 2034 for ac_exec_ext in '' $ac_executable_extensions; do
2802 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
2803 ac_cv_prog_CC="$ac_tool_prefix$ac_prog" 2036 ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
2804 $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
2805 break 2 2038 break 2
2806 fi 2039 fi
2807done 2040done
2808 done 2041done
2809IFS=$as_save_IFS 2042IFS=$as_save_IFS
2810 2043
2811fi 2044fi
2812fi 2045fi
2813CC=$ac_cv_prog_CC 2046CC=$ac_cv_prog_CC
2814if test -n "$CC"; then 2047if test -n "$CC"; then
2815 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 2048 { echo "$as_me:$LINENO: result: $CC" >&5
2816$as_echo "$CC" >&6; } 2049echo "${ECHO_T}$CC" >&6; }
2817else 2050else
2818 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 2051 { echo "$as_me:$LINENO: result: no" >&5
2819$as_echo "no" >&6; } 2052echo "${ECHO_T}no" >&6; }
2820fi 2053fi
2821 2054
2822 2055
@@ -2829,10 +2062,10 @@ if test -z "$CC"; then
2829do 2062do
2830 # 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.
2831set dummy $ac_prog; ac_word=$2 2064set dummy $ac_prog; ac_word=$2
2832{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 2065{ echo "$as_me:$LINENO: checking for $ac_word" >&5
2833$as_echo_n "checking for $ac_word... " >&6; } 2066echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
2834if ${ac_cv_prog_ac_ct_CC+:} false; then : 2067if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
2835 $as_echo_n "(cached) " >&6 2068 echo $ECHO_N "(cached) $ECHO_C" >&6
2836else 2069else
2837 if test -n "$ac_ct_CC"; then 2070 if test -n "$ac_ct_CC"; then
2838 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.
@@ -2842,25 +2075,25 @@ for as_dir in $PATH
2842do 2075do
2843 IFS=$as_save_IFS 2076 IFS=$as_save_IFS
2844 test -z "$as_dir" && as_dir=. 2077 test -z "$as_dir" && as_dir=.
2845 for ac_exec_ext in '' $ac_executable_extensions; do 2078 for ac_exec_ext in '' $ac_executable_extensions; do
2846 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
2847 ac_cv_prog_ac_ct_CC="$ac_prog" 2080 ac_cv_prog_ac_ct_CC="$ac_prog"
2848 $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
2849 break 2 2082 break 2
2850 fi 2083 fi
2851done 2084done
2852 done 2085done
2853IFS=$as_save_IFS 2086IFS=$as_save_IFS
2854 2087
2855fi 2088fi
2856fi 2089fi
2857ac_ct_CC=$ac_cv_prog_ac_ct_CC 2090ac_ct_CC=$ac_cv_prog_ac_ct_CC
2858if test -n "$ac_ct_CC"; then 2091if test -n "$ac_ct_CC"; then
2859 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 2092 { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
2860$as_echo "$ac_ct_CC" >&6; } 2093echo "${ECHO_T}$ac_ct_CC" >&6; }
2861else 2094else
2862 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 2095 { echo "$as_me:$LINENO: result: no" >&5
2863$as_echo "no" >&6; } 2096echo "${ECHO_T}no" >&6; }
2864fi 2097fi
2865 2098
2866 2099
@@ -2872,8 +2105,12 @@ done
2872 else 2105 else
2873 case $cross_compiling:$ac_tool_warned in 2106 case $cross_compiling:$ac_tool_warned in
2874yes:) 2107yes:)
2875{ $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
2876$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;}
2877ac_tool_warned=yes ;; 2114ac_tool_warned=yes ;;
2878esac 2115esac
2879 CC=$ac_ct_CC 2116 CC=$ac_ct_CC
@@ -2883,37 +2120,51 @@ fi
2883fi 2120fi
2884 2121
2885 2122
2886test -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
2887$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 2124See \`config.log' for more details." >&5
2888as_fn_error $? "no acceptable C compiler found in \$PATH 2125echo "$as_me: error: no acceptable C compiler found in \$PATH
2889See \`config.log' for more details" "$LINENO" 5; } 2126See \`config.log' for more details." >&2;}
2127 { (exit 1); exit 1; }; }
2890 2128
2891# Provide some information about the compiler. 2129# Provide some information about the compiler.
2892$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 2130echo "$as_me:$LINENO: checking for C compiler version" >&5
2893set X $ac_compile 2131ac_compiler=`set X $ac_compile; echo $2`
2894ac_compiler=$2 2132{ (ac_try="$ac_compiler --version >&5"
2895for ac_option in --version -v -V -qversion; do
2896 { { ac_try="$ac_compiler $ac_option >&5"
2897case "(($ac_try" in 2133case "(($ac_try" in
2898 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 2134 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2899 *) ac_try_echo=$ac_try;; 2135 *) ac_try_echo=$ac_try;;
2900esac 2136esac
2901eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" 2137eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2902$as_echo "$ac_try_echo"; } >&5 2138 (eval "$ac_compiler --version >&5") 2>&5
2903 (eval "$ac_compiler $ac_option >&5") 2>conftest.err
2904 ac_status=$? 2139 ac_status=$?
2905 if test -s conftest.err; then 2140 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2906 sed '10a\ 2141 (exit $ac_status); }
2907... rest of stderr output deleted ... 2142{ (ac_try="$ac_compiler -v >&5"
2908 10q' conftest.err >conftest.er1 2143case "(($ac_try" in
2909 cat conftest.er1 >&5 2144 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2910 fi 2145 *) ac_try_echo=$ac_try;;
2911 rm -f conftest.er1 conftest.err 2146esac
2912 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 2147eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2913 test $ac_status = 0; } 2148 (eval "$ac_compiler -v >&5") 2>&5
2914done 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); }
2915 2162
2916cat 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
2917/* end confdefs.h. */ 2168/* end confdefs.h. */
2918 2169
2919int 2170int
@@ -2925,38 +2176,42 @@ main ()
2925} 2176}
2926_ACEOF 2177_ACEOF
2927ac_clean_files_save=$ac_clean_files 2178ac_clean_files_save=$ac_clean_files
2928ac_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"
2929# Try to create an executable without -o first, disregard a.out. 2180# Try to create an executable without -o first, disregard a.out.
2930# 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
2931# of exeext. 2182# of exeext.
2932{ $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
2933$as_echo_n "checking whether the C compiler works... " >&6; } 2184echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
2934ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` 2185ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
2935 2186#
2936# The possible output files: 2187# List of possible output files, starting from the most likely.
2937ac_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.*)
2938 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.
2939ac_rmfiles= 2195ac_rmfiles=
2940for ac_file in $ac_files 2196for ac_file in $ac_files
2941do 2197do
2942 case $ac_file in 2198 case $ac_file in
2943 *.$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 ) ;;
2944 * ) ac_rmfiles="$ac_rmfiles $ac_file";; 2200 * ) ac_rmfiles="$ac_rmfiles $ac_file";;
2945 esac 2201 esac
2946done 2202done
2947rm -f $ac_rmfiles 2203rm -f $ac_rmfiles
2948 2204
2949if { { ac_try="$ac_link_default" 2205if { (ac_try="$ac_link_default"
2950case "(($ac_try" in 2206case "(($ac_try" in
2951 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 2207 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2952 *) ac_try_echo=$ac_try;; 2208 *) ac_try_echo=$ac_try;;
2953esac 2209esac
2954eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" 2210eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2955$as_echo "$ac_try_echo"; } >&5
2956 (eval "$ac_link_default") 2>&5 2211 (eval "$ac_link_default") 2>&5
2957 ac_status=$? 2212 ac_status=$?
2958 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 2213 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2959 test $ac_status = 0; }; then : 2214 (exit $ac_status); }; then
2960 # 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'.
2961# 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'
2962# 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,
@@ -2966,14 +2221,14 @@ for ac_file in $ac_files ''
2966do 2221do
2967 test -f "$ac_file" || continue 2222 test -f "$ac_file" || continue
2968 case $ac_file in 2223 case $ac_file in
2969 *.$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 )
2970 ;; 2225 ;;
2971 [ab].out ) 2226 [ab].out )
2972 # We found the default executable, but exeext='' is most 2227 # We found the default executable, but exeext='' is most
2973 # certainly right. 2228 # certainly right.
2974 break;; 2229 break;;
2975 *.* ) 2230 *.* )
2976 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;
2977 then :; else 2232 then :; else
2978 ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` 2233 ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
2979 fi 2234 fi
@@ -2992,41 +2247,78 @@ test "$ac_cv_exeext" = no && ac_cv_exeext=
2992else 2247else
2993 ac_file='' 2248 ac_file=''
2994fi 2249fi
2995if test -z "$ac_file"; then : 2250
2996 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 2251{ echo "$as_me:$LINENO: result: $ac_file" >&5
2997$as_echo "no" >&6; } 2252echo "${ECHO_T}$ac_file" >&6; }
2998$as_echo "$as_me: failed program was:" >&5 2253if test -z "$ac_file"; then
2254 echo "$as_me: failed program was:" >&5
2999sed 's/^/| /' conftest.$ac_ext >&5 2255sed 's/^/| /' conftest.$ac_ext >&5
3000 2256
3001{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 2257{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
3002$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 2258See \`config.log' for more details." >&5
3003as_fn_error 77 "C compiler cannot create executables 2259echo "$as_me: error: C compiler cannot create executables
3004See \`config.log' for more details" "$LINENO" 5; } 2260See \`config.log' for more details." >&2;}
3005else 2261 { (exit 77); exit 77; }; }
3006 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
3007$as_echo "yes" >&6; }
3008fi 2262fi
3009{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 2263
3010$as_echo_n "checking for C compiler default output file name... " >&6; }
3011{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
3012$as_echo "$ac_file" >&6; }
3013ac_exeext=$ac_cv_exeext 2264ac_exeext=$ac_cv_exeext
3014 2265
3015rm -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
3016ac_clean_files=$ac_clean_files_save 2302ac_clean_files=$ac_clean_files_save
3017{ $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
3018$as_echo_n "checking for suffix of executables... " >&6; } 2304# the compiler is broken, or we cross compile.
3019if { { 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"
3020case "(($ac_try" in 2313case "(($ac_try" in
3021 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 2314 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3022 *) ac_try_echo=$ac_try;; 2315 *) ac_try_echo=$ac_try;;
3023esac 2316esac
3024eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" 2317eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3025$as_echo "$ac_try_echo"; } >&5
3026 (eval "$ac_link") 2>&5 2318 (eval "$ac_link") 2>&5
3027 ac_status=$? 2319 ac_status=$?
3028 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 2320 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3029 test $ac_status = 0; }; then : 2321 (exit $ac_status); }; then
3030 # If both `conftest.exe' and `conftest' are `present' (well, observable) 2322 # If both `conftest.exe' and `conftest' are `present' (well, observable)
3031# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will 2323# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
3032# 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
@@ -3034,90 +2326,37 @@ $as_echo "$ac_try_echo"; } >&5
3034for ac_file in conftest.exe conftest conftest.*; do 2326for ac_file in conftest.exe conftest conftest.*; do
3035 test -f "$ac_file" || continue 2327 test -f "$ac_file" || continue
3036 case $ac_file in 2328 case $ac_file in
3037 *.$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 ) ;;
3038 *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` 2330 *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
3039 break;; 2331 break;;
3040 * ) break;; 2332 * ) break;;
3041 esac 2333 esac
3042done 2334done
3043else 2335else
3044 { { $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
3045$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 2337See \`config.log' for more details." >&5
3046as_fn_error $? "cannot compute suffix of executables: cannot compile and link 2338echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
3047See \`config.log' for more details" "$LINENO" 5; } 2339See \`config.log' for more details." >&2;}
2340 { (exit 1); exit 1; }; }
3048fi 2341fi
3049rm -f conftest conftest$ac_cv_exeext 2342
3050{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 2343rm -f conftest$ac_cv_exeext
3051$as_echo "$ac_cv_exeext" >&6; } 2344{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
2345echo "${ECHO_T}$ac_cv_exeext" >&6; }
3052 2346
3053rm -f conftest.$ac_ext 2347rm -f conftest.$ac_ext
3054EXEEXT=$ac_cv_exeext 2348EXEEXT=$ac_cv_exeext
3055ac_exeext=$EXEEXT 2349ac_exeext=$EXEEXT
3056cat confdefs.h - <<_ACEOF >conftest.$ac_ext 2350{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
3057/* end confdefs.h. */ 2351echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
3058#include <stdio.h> 2352if test "${ac_cv_objext+set}" = set; then
3059int 2353 echo $ECHO_N "(cached) $ECHO_C" >&6
3060main ()
3061{
3062FILE *f = fopen ("conftest.out", "w");
3063 return ferror (f) || fclose (f) != 0;
3064
3065 ;
3066 return 0;
3067}
3068_ACEOF
3069ac_clean_files="$ac_clean_files conftest.out"
3070# Check that the compiler produces executables we can run. If not, either
3071# the compiler is broken, or we cross compile.
3072{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
3073$as_echo_n "checking whether we are cross compiling... " >&6; }
3074if test "$cross_compiling" != yes; then
3075 { { ac_try="$ac_link"
3076case "(($ac_try" in
3077 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3078 *) ac_try_echo=$ac_try;;
3079esac
3080eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
3081$as_echo "$ac_try_echo"; } >&5
3082 (eval "$ac_link") 2>&5
3083 ac_status=$?
3084 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
3085 test $ac_status = 0; }
3086 if { ac_try='./conftest$ac_cv_exeext'
3087 { { case "(($ac_try" in
3088 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3089 *) ac_try_echo=$ac_try;;
3090esac
3091eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
3092$as_echo "$ac_try_echo"; } >&5
3093 (eval "$ac_try") 2>&5
3094 ac_status=$?
3095 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
3096 test $ac_status = 0; }; }; then
3097 cross_compiling=no
3098 else
3099 if test "$cross_compiling" = maybe; then
3100 cross_compiling=yes
3101 else
3102 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
3103$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
3104as_fn_error $? "cannot run C compiled programs.
3105If you meant to cross compile, use \`--host'.
3106See \`config.log' for more details" "$LINENO" 5; }
3107 fi
3108 fi
3109fi
3110{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
3111$as_echo "$cross_compiling" >&6; }
3112
3113rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
3114ac_clean_files=$ac_clean_files_save
3115{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
3116$as_echo_n "checking for suffix of object files... " >&6; }
3117if ${ac_cv_objext+:} false; then :
3118 $as_echo_n "(cached) " >&6
3119else 2354else
3120 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
3121/* end confdefs.h. */ 2360/* end confdefs.h. */
3122 2361
3123int 2362int
@@ -3129,46 +2368,51 @@ main ()
3129} 2368}
3130_ACEOF 2369_ACEOF
3131rm -f conftest.o conftest.obj 2370rm -f conftest.o conftest.obj
3132if { { ac_try="$ac_compile" 2371if { (ac_try="$ac_compile"
3133case "(($ac_try" in 2372case "(($ac_try" in
3134 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 2373 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3135 *) ac_try_echo=$ac_try;; 2374 *) ac_try_echo=$ac_try;;
3136esac 2375esac
3137eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" 2376eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
3138$as_echo "$ac_try_echo"; } >&5
3139 (eval "$ac_compile") 2>&5 2377 (eval "$ac_compile") 2>&5
3140 ac_status=$? 2378 ac_status=$?
3141 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 2379 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3142 test $ac_status = 0; }; then : 2380 (exit $ac_status); }; then
3143 for ac_file in conftest.o conftest.obj conftest.*; do 2381 for ac_file in conftest.o conftest.obj conftest.*; do
3144 test -f "$ac_file" || continue; 2382 test -f "$ac_file" || continue;
3145 case $ac_file in 2383 case $ac_file in
3146 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; 2384 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
3147 *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` 2385 *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
3148 break;; 2386 break;;
3149 esac 2387 esac
3150done 2388done
3151else 2389else
3152 $as_echo "$as_me: failed program was:" >&5 2390 echo "$as_me: failed program was:" >&5
3153sed 's/^/| /' conftest.$ac_ext >&5 2391sed 's/^/| /' conftest.$ac_ext >&5
3154 2392
3155{ { $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
3156$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 2394See \`config.log' for more details." >&5
3157as_fn_error $? "cannot compute suffix of object files: cannot compile 2395echo "$as_me: error: cannot compute suffix of object files: cannot compile
3158See \`config.log' for more details" "$LINENO" 5; } 2396See \`config.log' for more details." >&2;}
2397 { (exit 1); exit 1; }; }
3159fi 2398fi
2399
3160rm -f conftest.$ac_cv_objext conftest.$ac_ext 2400rm -f conftest.$ac_cv_objext conftest.$ac_ext
3161fi 2401fi
3162{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 2402{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
3163$as_echo "$ac_cv_objext" >&6; } 2403echo "${ECHO_T}$ac_cv_objext" >&6; }
3164OBJEXT=$ac_cv_objext 2404OBJEXT=$ac_cv_objext
3165ac_objext=$OBJEXT 2405ac_objext=$OBJEXT
3166{ $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
3167$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; }
3168if ${ac_cv_c_compiler_gnu+:} false; then : 2408if test "${ac_cv_c_compiler_gnu+set}" = set; then
3169 $as_echo_n "(cached) " >&6 2409 echo $ECHO_N "(cached) $ECHO_C" >&6
3170else 2410else
3171 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
3172/* end confdefs.h. */ 2416/* end confdefs.h. */
3173 2417
3174int 2418int
@@ -3182,34 +2426,54 @@ main ()
3182 return 0; 2426 return 0;
3183} 2427}
3184_ACEOF 2428_ACEOF
3185if 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
3186 ac_compiler_gnu=yes 2446 ac_compiler_gnu=yes
3187else 2447else
3188 ac_compiler_gnu=no 2448 echo "$as_me: failed program was:" >&5
2449sed 's/^/| /' conftest.$ac_ext >&5
2450
2451 ac_compiler_gnu=no
3189fi 2452fi
2453
3190rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 2454rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3191ac_cv_c_compiler_gnu=$ac_compiler_gnu 2455ac_cv_c_compiler_gnu=$ac_compiler_gnu
3192 2456
3193fi 2457fi
3194{ $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
3195$as_echo "$ac_cv_c_compiler_gnu" >&6; } 2459echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
3196if test $ac_compiler_gnu = yes; then 2460GCC=`test $ac_compiler_gnu = yes && echo yes`
3197 GCC=yes
3198else
3199 GCC=
3200fi
3201ac_test_CFLAGS=${CFLAGS+set} 2461ac_test_CFLAGS=${CFLAGS+set}
3202ac_save_CFLAGS=$CFLAGS 2462ac_save_CFLAGS=$CFLAGS
3203{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 2463{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
3204$as_echo_n "checking whether $CC accepts -g... " >&6; } 2464echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
3205if ${ac_cv_prog_cc_g+:} false; then : 2465if test "${ac_cv_prog_cc_g+set}" = set; then
3206 $as_echo_n "(cached) " >&6 2466 echo $ECHO_N "(cached) $ECHO_C" >&6
3207else 2467else
3208 ac_save_c_werror_flag=$ac_c_werror_flag 2468 ac_save_c_werror_flag=$ac_c_werror_flag
3209 ac_c_werror_flag=yes 2469 ac_c_werror_flag=yes
3210 ac_cv_prog_cc_g=no 2470 ac_cv_prog_cc_g=no
3211 CFLAGS="-g" 2471 CFLAGS="-g"
3212 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
3213/* end confdefs.h. */ 2477/* end confdefs.h. */
3214 2478
3215int 2479int
@@ -3220,11 +2484,34 @@ main ()
3220 return 0; 2484 return 0;
3221} 2485}
3222_ACEOF 2486_ACEOF
3223if 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
3224 ac_cv_prog_cc_g=yes 2504 ac_cv_prog_cc_g=yes
3225else 2505else
3226 CFLAGS="" 2506 echo "$as_me: failed program was:" >&5
3227 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
3228/* end confdefs.h. */ 2515/* end confdefs.h. */
3229 2516
3230int 2517int
@@ -3235,12 +2522,35 @@ main ()
3235 return 0; 2522 return 0;
3236} 2523}
3237_ACEOF 2524_ACEOF
3238if ac_fn_c_try_compile "$LINENO"; then : 2525rm -f conftest.$ac_objext
3239 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 :
3240else 2543else
3241 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
3242 CFLAGS="-g" 2548 CFLAGS="-g"
3243 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
3244/* end confdefs.h. */ 2554/* end confdefs.h. */
3245 2555
3246int 2556int
@@ -3251,18 +2561,42 @@ main ()
3251 return 0; 2561 return 0;
3252} 2562}
3253_ACEOF 2563_ACEOF
3254if 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
3255 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
3256fi 2587fi
2588
3257rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 2589rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3258fi 2590fi
2591
3259rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 2592rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3260fi 2593fi
2594
3261rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 2595rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3262 ac_c_werror_flag=$ac_save_c_werror_flag 2596 ac_c_werror_flag=$ac_save_c_werror_flag
3263fi 2597fi
3264{ $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
3265$as_echo "$ac_cv_prog_cc_g" >&6; } 2599echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
3266if test "$ac_test_CFLAGS" = set; then 2600if test "$ac_test_CFLAGS" = set; then
3267 CFLAGS=$ac_save_CFLAGS 2601 CFLAGS=$ac_save_CFLAGS
3268elif test $ac_cv_prog_cc_g = yes; then 2602elif test $ac_cv_prog_cc_g = yes; then
@@ -3278,14 +2612,18 @@ else
3278 CFLAGS= 2612 CFLAGS=
3279 fi 2613 fi
3280fi 2614fi
3281{ $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
3282$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; }
3283if ${ac_cv_prog_cc_c89+:} false; then : 2617if test "${ac_cv_prog_cc_c89+set}" = set; then
3284 $as_echo_n "(cached) " >&6 2618 echo $ECHO_N "(cached) $ECHO_C" >&6
3285else 2619else
3286 ac_cv_prog_cc_c89=no 2620 ac_cv_prog_cc_c89=no
3287ac_save_CC=$CC 2621ac_save_CC=$CC
3288cat 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
3289/* end confdefs.h. */ 2627/* end confdefs.h. */
3290#include <stdarg.h> 2628#include <stdarg.h>
3291#include <stdio.h> 2629#include <stdio.h>
@@ -3342,9 +2680,31 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
3342 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" 2680 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
3343do 2681do
3344 CC="$ac_save_CC $ac_arg" 2682 CC="$ac_save_CC $ac_arg"
3345 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
3346 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
3347fi 2706fi
2707
3348rm -f core conftest.err conftest.$ac_objext 2708rm -f core conftest.err conftest.$ac_objext
3349 test "x$ac_cv_prog_cc_c89" != "xno" && break 2709 test "x$ac_cv_prog_cc_c89" != "xno" && break
3350done 2710done
@@ -3355,19 +2715,17 @@ fi
3355# AC_CACHE_VAL 2715# AC_CACHE_VAL
3356case "x$ac_cv_prog_cc_c89" in 2716case "x$ac_cv_prog_cc_c89" in
3357 x) 2717 x)
3358 { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 2718 { echo "$as_me:$LINENO: result: none needed" >&5
3359$as_echo "none needed" >&6; } ;; 2719echo "${ECHO_T}none needed" >&6; } ;;
3360 xno) 2720 xno)
3361 { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 2721 { echo "$as_me:$LINENO: result: unsupported" >&5
3362$as_echo "unsupported" >&6; } ;; 2722echo "${ECHO_T}unsupported" >&6; } ;;
3363 *) 2723 *)
3364 CC="$CC $ac_cv_prog_cc_c89" 2724 CC="$CC $ac_cv_prog_cc_c89"
3365 { $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
3366$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; 2726echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
3367esac 2727esac
3368if test "x$ac_cv_prog_cc_c89" != xno; then :
3369 2728
3370fi
3371 2729
3372ac_ext=c 2730ac_ext=c
3373ac_cpp='$CPP $CPPFLAGS' 2731ac_cpp='$CPP $CPPFLAGS'
@@ -3392,7 +2750,9 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
3392 fi 2750 fi
3393done 2751done
3394if test -z "$ac_aux_dir"; then 2752if test -z "$ac_aux_dir"; then
3395 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; }; }
3396fi 2756fi
3397 2757
3398# These three variables are undocumented and unsupported, 2758# These three variables are undocumented and unsupported,
@@ -3406,27 +2766,35 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
3406 2766
3407# Make sure we can run config.sub. 2767# Make sure we can run config.sub.
3408$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || 2768$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
3409 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; }; }
3410 2772
3411{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 2773{ echo "$as_me:$LINENO: checking build system type" >&5
3412$as_echo_n "checking build system type... " >&6; } 2774echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
3413if ${ac_cv_build+:} false; then : 2775if test "${ac_cv_build+set}" = set; then
3414 $as_echo_n "(cached) " >&6 2776 echo $ECHO_N "(cached) $ECHO_C" >&6
3415else 2777else
3416 ac_build_alias=$build_alias 2778 ac_build_alias=$build_alias
3417test "x$ac_build_alias" = x && 2779test "x$ac_build_alias" = x &&
3418 ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` 2780 ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
3419test "x$ac_build_alias" = x && 2781test "x$ac_build_alias" = x &&
3420 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; }; }
3421ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || 2785ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
3422 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; }; }
3423 2789
3424fi 2790fi
3425{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 2791{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
3426$as_echo "$ac_cv_build" >&6; } 2792echo "${ECHO_T}$ac_cv_build" >&6; }
3427case $ac_cv_build in 2793case $ac_cv_build in
3428*-*-*) ;; 2794*-*-*) ;;
3429*) 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; }; };;
3430esac 2798esac
3431build=$ac_cv_build 2799build=$ac_cv_build
3432ac_save_IFS=$IFS; IFS='-' 2800ac_save_IFS=$IFS; IFS='-'
@@ -3442,24 +2810,28 @@ IFS=$ac_save_IFS
3442case $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
3443 2811
3444 2812
3445{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 2813{ echo "$as_me:$LINENO: checking host system type" >&5
3446$as_echo_n "checking host system type... " >&6; } 2814echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
3447if ${ac_cv_host+:} false; then : 2815if test "${ac_cv_host+set}" = set; then
3448 $as_echo_n "(cached) " >&6 2816 echo $ECHO_N "(cached) $ECHO_C" >&6
3449else 2817else
3450 if test "x$host_alias" = x; then 2818 if test "x$host_alias" = x; then
3451 ac_cv_host=$ac_cv_build 2819 ac_cv_host=$ac_cv_build
3452else 2820else
3453 ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || 2821 ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
3454 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; }; }
3455fi 2825fi
3456 2826
3457fi 2827fi
3458{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 2828{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
3459$as_echo "$ac_cv_host" >&6; } 2829echo "${ECHO_T}$ac_cv_host" >&6; }
3460case $ac_cv_host in 2830case $ac_cv_host in
3461*-*-*) ;; 2831*-*-*) ;;
3462*) 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; }; };;
3463esac 2835esac
3464host=$ac_cv_host 2836host=$ac_cv_host
3465ac_save_IFS=$IFS; IFS='-' 2837ac_save_IFS=$IFS; IFS='-'
@@ -3481,15 +2853,15 @@ ac_cpp='$CPP $CPPFLAGS'
3481ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' 2853ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
3482ac_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'
3483ac_compiler_gnu=$ac_cv_c_compiler_gnu 2855ac_compiler_gnu=$ac_cv_c_compiler_gnu
3484{ $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
3485$as_echo_n "checking how to run the C preprocessor... " >&6; } 2857echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
3486# On Suns, sometimes $CPP names a directory. 2858# On Suns, sometimes $CPP names a directory.
3487if test -n "$CPP" && test -d "$CPP"; then 2859if test -n "$CPP" && test -d "$CPP"; then
3488 CPP= 2860 CPP=
3489fi 2861fi
3490if test -z "$CPP"; then 2862if test -z "$CPP"; then
3491 if ${ac_cv_prog_CPP+:} false; then : 2863 if test "${ac_cv_prog_CPP+set}" = set; then
3492 $as_echo_n "(cached) " >&6 2864 echo $ECHO_N "(cached) $ECHO_C" >&6
3493else 2865else
3494 # Double quotes because CPP needs to be expanded 2866 # Double quotes because CPP needs to be expanded
3495 for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" 2867 for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
@@ -3503,7 +2875,11 @@ do
3503 # <limits.h> exists even on freestanding compilers. 2875 # <limits.h> exists even on freestanding compilers.
3504 # 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,
3505 # 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.
3506 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
3507/* end confdefs.h. */ 2883/* end confdefs.h. */
3508#ifdef __STDC__ 2884#ifdef __STDC__
3509# include <limits.h> 2885# include <limits.h>
@@ -3512,34 +2888,76 @@ do
3512#endif 2888#endif
3513 Syntax error 2889 Syntax error
3514_ACEOF 2890_ACEOF
3515if ac_fn_c_try_cpp "$LINENO"; then : 2891if { (ac_try="$ac_cpp conftest.$ac_ext"
3516 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 :
3517else 2908else
2909 echo "$as_me: failed program was:" >&5
2910sed 's/^/| /' conftest.$ac_ext >&5
2911
3518 # Broken: fails on valid input. 2912 # Broken: fails on valid input.
3519continue 2913continue
3520fi 2914fi
3521rm -f conftest.err conftest.i conftest.$ac_ext 2915
2916rm -f conftest.err conftest.$ac_ext
3522 2917
3523 # OK, works on sane cases. Now check whether nonexistent headers 2918 # OK, works on sane cases. Now check whether nonexistent headers
3524 # can be detected and how. 2919 # can be detected and how.
3525 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
3526/* end confdefs.h. */ 2925/* end confdefs.h. */
3527#include <ac_nonexistent.h> 2926#include <ac_nonexistent.h>
3528_ACEOF 2927_ACEOF
3529if 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
3530 # Broken: success on invalid input. 2944 # Broken: success on invalid input.
3531continue 2945continue
3532else 2946else
2947 echo "$as_me: failed program was:" >&5
2948sed 's/^/| /' conftest.$ac_ext >&5
2949
3533 # Passes both tests. 2950 # Passes both tests.
3534ac_preproc_ok=: 2951ac_preproc_ok=:
3535break 2952break
3536fi 2953fi
3537rm -f conftest.err conftest.i conftest.$ac_ext 2954
2955rm -f conftest.err conftest.$ac_ext
3538 2956
3539done 2957done
3540# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. 2958# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
3541rm -f conftest.i conftest.err conftest.$ac_ext 2959rm -f conftest.err conftest.$ac_ext
3542if $ac_preproc_ok; then : 2960if $ac_preproc_ok; then
3543 break 2961 break
3544fi 2962fi
3545 2963
@@ -3551,8 +2969,8 @@ fi
3551else 2969else
3552 ac_cv_prog_CPP=$CPP 2970 ac_cv_prog_CPP=$CPP
3553fi 2971fi
3554{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 2972{ echo "$as_me:$LINENO: result: $CPP" >&5
3555$as_echo "$CPP" >&6; } 2973echo "${ECHO_T}$CPP" >&6; }
3556ac_preproc_ok=false 2974ac_preproc_ok=false
3557for ac_c_preproc_warn_flag in '' yes 2975for ac_c_preproc_warn_flag in '' yes
3558do 2976do
@@ -3562,7 +2980,11 @@ do
3562 # <limits.h> exists even on freestanding compilers. 2980 # <limits.h> exists even on freestanding compilers.
3563 # 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,
3564 # 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.
3565 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
3566/* end confdefs.h. */ 2988/* end confdefs.h. */
3567#ifdef __STDC__ 2989#ifdef __STDC__
3568# include <limits.h> 2990# include <limits.h>
@@ -3571,40 +2993,83 @@ do
3571#endif 2993#endif
3572 Syntax error 2994 Syntax error
3573_ACEOF 2995_ACEOF
3574if ac_fn_c_try_cpp "$LINENO"; then : 2996if { (ac_try="$ac_cpp conftest.$ac_ext"
3575 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 :
3576else 3013else
3014 echo "$as_me: failed program was:" >&5
3015sed 's/^/| /' conftest.$ac_ext >&5
3016
3577 # Broken: fails on valid input. 3017 # Broken: fails on valid input.
3578continue 3018continue
3579fi 3019fi
3580rm -f conftest.err conftest.i conftest.$ac_ext 3020
3021rm -f conftest.err conftest.$ac_ext
3581 3022
3582 # OK, works on sane cases. Now check whether nonexistent headers 3023 # OK, works on sane cases. Now check whether nonexistent headers
3583 # can be detected and how. 3024 # can be detected and how.
3584 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
3585/* end confdefs.h. */ 3030/* end confdefs.h. */
3586#include <ac_nonexistent.h> 3031#include <ac_nonexistent.h>
3587_ACEOF 3032_ACEOF
3588if 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
3589 # Broken: success on invalid input. 3049 # Broken: success on invalid input.
3590continue 3050continue
3591else 3051else
3052 echo "$as_me: failed program was:" >&5
3053sed 's/^/| /' conftest.$ac_ext >&5
3054
3592 # Passes both tests. 3055 # Passes both tests.
3593ac_preproc_ok=: 3056ac_preproc_ok=:
3594break 3057break
3595fi 3058fi
3596rm -f conftest.err conftest.i conftest.$ac_ext 3059
3060rm -f conftest.err conftest.$ac_ext
3597 3061
3598done 3062done
3599# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. 3063# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
3600rm -f conftest.i conftest.err conftest.$ac_ext 3064rm -f conftest.err conftest.$ac_ext
3601if $ac_preproc_ok; then : 3065if $ac_preproc_ok; then
3602 3066 :
3603else 3067else
3604 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 3068 { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
3605$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 3069See \`config.log' for more details." >&5
3606as_fn_error $? "C preprocessor \"$CPP\" fails sanity check 3070echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
3607See \`config.log' for more details" "$LINENO" 5; } 3071See \`config.log' for more details." >&2;}
3072 { (exit 1); exit 1; }; }
3608fi 3073fi
3609 3074
3610ac_ext=c 3075ac_ext=c
@@ -3614,40 +3079,45 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
3614ac_compiler_gnu=$ac_cv_c_compiler_gnu 3079ac_compiler_gnu=$ac_cv_c_compiler_gnu
3615 3080
3616 3081
3617{ $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
3618$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; }
3619if ${ac_cv_path_GREP+:} false; then : 3084if test "${ac_cv_path_GREP+set}" = set; then
3620 $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
3621else 3092else
3622 if test -z "$GREP"; then
3623 ac_path_GREP_found=false 3093 ac_path_GREP_found=false
3624 # 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
3625 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 3095as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3626for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin 3096for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
3627do 3097do
3628 IFS=$as_save_IFS 3098 IFS=$as_save_IFS
3629 test -z "$as_dir" && as_dir=. 3099 test -z "$as_dir" && as_dir=.
3630 for ac_prog in grep ggrep; do 3100 for ac_prog in grep ggrep; do
3631 for ac_exec_ext in '' $ac_executable_extensions; do 3101 for ac_exec_ext in '' $ac_executable_extensions; do
3632 ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" 3102 ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
3633 { 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
3634# 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.
3635 # Check for GNU $ac_path_GREP 3105 # Check for GNU $ac_path_GREP
3636case `"$ac_path_GREP" --version 2>&1` in 3106case `"$ac_path_GREP" --version 2>&1` in
3637*GNU*) 3107*GNU*)
3638 ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; 3108 ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
3639*) 3109*)
3640 ac_count=0 3110 ac_count=0
3641 $as_echo_n 0123456789 >"conftest.in" 3111 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
3642 while : 3112 while :
3643 do 3113 do
3644 cat "conftest.in" "conftest.in" >"conftest.tmp" 3114 cat "conftest.in" "conftest.in" >"conftest.tmp"
3645 mv "conftest.tmp" "conftest.in" 3115 mv "conftest.tmp" "conftest.in"
3646 cp "conftest.in" "conftest.nl" 3116 cp "conftest.in" "conftest.nl"
3647 $as_echo 'GREP' >> "conftest.nl" 3117 echo 'GREP' >> "conftest.nl"
3648 "$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
3649 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break 3119 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
3650 as_fn_arith $ac_count + 1 && ac_count=$as_val 3120 ac_count=`expr $ac_count + 1`
3651 if test $ac_count -gt ${ac_path_GREP_max-0}; then 3121 if test $ac_count -gt ${ac_path_GREP_max-0}; then
3652 # 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
3653 ac_cv_path_GREP="$ac_path_GREP" 3123 ac_cv_path_GREP="$ac_path_GREP"
@@ -3659,61 +3129,77 @@ case `"$ac_path_GREP" --version 2>&1` in
3659 rm -f conftest.in conftest.tmp conftest.nl conftest.out;; 3129 rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
3660esac 3130esac
3661 3131
3662 $ac_path_GREP_found && break 3 3132
3663 done 3133 $ac_path_GREP_found && break 3
3664 done
3665 done 3134 done
3135done
3136
3137done
3666IFS=$as_save_IFS 3138IFS=$as_save_IFS
3667 if test -z "$ac_cv_path_GREP"; then 3139
3668 as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 3140
3669 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
3670else 3150else
3671 ac_cv_path_GREP=$GREP 3151 ac_cv_path_GREP=$GREP
3672fi 3152fi
3673 3153
3154
3674fi 3155fi
3675{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 3156{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
3676$as_echo "$ac_cv_path_GREP" >&6; } 3157echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
3677 GREP="$ac_cv_path_GREP" 3158 GREP="$ac_cv_path_GREP"
3678 3159
3679 3160
3680{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 3161{ echo "$as_me:$LINENO: checking for egrep" >&5
3681$as_echo_n "checking for egrep... " >&6; } 3162echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
3682if ${ac_cv_path_EGREP+:} false; then : 3163if test "${ac_cv_path_EGREP+set}" = set; then
3683 $as_echo_n "(cached) " >&6 3164 echo $ECHO_N "(cached) $ECHO_C" >&6
3684else 3165else
3685 if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 3166 if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
3686 then ac_cv_path_EGREP="$GREP -E" 3167 then ac_cv_path_EGREP="$GREP -E"
3687 else 3168 else
3688 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
3689 ac_path_EGREP_found=false 3175 ac_path_EGREP_found=false
3690 # 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
3691 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 3177as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3692for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin 3178for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
3693do 3179do
3694 IFS=$as_save_IFS 3180 IFS=$as_save_IFS
3695 test -z "$as_dir" && as_dir=. 3181 test -z "$as_dir" && as_dir=.
3696 for ac_prog in egrep; do 3182 for ac_prog in egrep; do
3697 for ac_exec_ext in '' $ac_executable_extensions; do 3183 for ac_exec_ext in '' $ac_executable_extensions; do
3698 ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" 3184 ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
3699 { 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
3700# 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.
3701 # Check for GNU $ac_path_EGREP 3187 # Check for GNU $ac_path_EGREP
3702case `"$ac_path_EGREP" --version 2>&1` in 3188case `"$ac_path_EGREP" --version 2>&1` in
3703*GNU*) 3189*GNU*)
3704 ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; 3190 ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
3705*) 3191*)
3706 ac_count=0 3192 ac_count=0
3707 $as_echo_n 0123456789 >"conftest.in" 3193 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
3708 while : 3194 while :
3709 do 3195 do
3710 cat "conftest.in" "conftest.in" >"conftest.tmp" 3196 cat "conftest.in" "conftest.in" >"conftest.tmp"
3711 mv "conftest.tmp" "conftest.in" 3197 mv "conftest.tmp" "conftest.in"
3712 cp "conftest.in" "conftest.nl" 3198 cp "conftest.in" "conftest.nl"
3713 $as_echo 'EGREP' >> "conftest.nl" 3199 echo 'EGREP' >> "conftest.nl"
3714 "$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
3715 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break 3201 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
3716 as_fn_arith $ac_count + 1 && ac_count=$as_val 3202 ac_count=`expr $ac_count + 1`
3717 if test $ac_count -gt ${ac_path_EGREP_max-0}; then 3203 if test $ac_count -gt ${ac_path_EGREP_max-0}; then
3718 # 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
3719 ac_cv_path_EGREP="$ac_path_EGREP" 3205 ac_cv_path_EGREP="$ac_path_EGREP"
@@ -3725,31 +3211,46 @@ case `"$ac_path_EGREP" --version 2>&1` in
3725 rm -f conftest.in conftest.tmp conftest.nl conftest.out;; 3211 rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
3726esac 3212esac
3727 3213
3728 $ac_path_EGREP_found && break 3 3214
3729 done 3215 $ac_path_EGREP_found && break 3
3730 done
3731 done 3216 done
3217done
3218
3219done
3732IFS=$as_save_IFS 3220IFS=$as_save_IFS
3733 if test -z "$ac_cv_path_EGREP"; then 3221
3734 as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 3222
3735 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
3736else 3232else
3737 ac_cv_path_EGREP=$EGREP 3233 ac_cv_path_EGREP=$EGREP
3738fi 3234fi
3739 3235
3236
3740 fi 3237 fi
3741fi 3238fi
3742{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 3239{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
3743$as_echo "$ac_cv_path_EGREP" >&6; } 3240echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
3744 EGREP="$ac_cv_path_EGREP" 3241 EGREP="$ac_cv_path_EGREP"
3745 3242
3746 3243
3747{ $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
3748$as_echo_n "checking for ANSI C header files... " >&6; } 3245echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
3749if ${ac_cv_header_stdc+:} false; then : 3246if test "${ac_cv_header_stdc+set}" = set; then
3750 $as_echo_n "(cached) " >&6 3247 echo $ECHO_N "(cached) $ECHO_C" >&6
3751else 3248else
3752 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
3753/* end confdefs.h. */ 3254/* end confdefs.h. */
3754#include <stdlib.h> 3255#include <stdlib.h>
3755#include <stdarg.h> 3256#include <stdarg.h>
@@ -3764,23 +3265,47 @@ main ()
3764 return 0; 3265 return 0;
3765} 3266}
3766_ACEOF 3267_ACEOF
3767if 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
3768 ac_cv_header_stdc=yes 3285 ac_cv_header_stdc=yes
3769else 3286else
3770 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
3771fi 3291fi
3292
3772rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 3293rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3773 3294
3774if test $ac_cv_header_stdc = yes; then 3295if test $ac_cv_header_stdc = yes; then
3775 # 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.
3776 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
3777/* end confdefs.h. */ 3302/* end confdefs.h. */
3778#include <string.h> 3303#include <string.h>
3779 3304
3780_ACEOF 3305_ACEOF
3781if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 3306if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
3782 $EGREP "memchr" >/dev/null 2>&1; then : 3307 $EGREP "memchr" >/dev/null 2>&1; then
3783 3308 :
3784else 3309else
3785 ac_cv_header_stdc=no 3310 ac_cv_header_stdc=no
3786fi 3311fi
@@ -3790,14 +3315,18 @@ fi
3790 3315
3791if test $ac_cv_header_stdc = yes; then 3316if test $ac_cv_header_stdc = yes; then
3792 # 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.
3793 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
3794/* end confdefs.h. */ 3323/* end confdefs.h. */
3795#include <stdlib.h> 3324#include <stdlib.h>
3796 3325
3797_ACEOF 3326_ACEOF
3798if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 3327if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
3799 $EGREP "free" >/dev/null 2>&1; then : 3328 $EGREP "free" >/dev/null 2>&1; then
3800 3329 :
3801else 3330else
3802 ac_cv_header_stdc=no 3331 ac_cv_header_stdc=no
3803fi 3332fi
@@ -3807,10 +3336,14 @@ fi
3807 3336
3808if test $ac_cv_header_stdc = yes; then 3337if test $ac_cv_header_stdc = yes; then
3809 # /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.
3810 if test "$cross_compiling" = yes; then : 3339 if test "$cross_compiling" = yes; then
3811 : 3340 :
3812else 3341else
3813 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
3814/* end confdefs.h. */ 3347/* end confdefs.h. */
3815#include <ctype.h> 3348#include <ctype.h>
3816#include <stdlib.h> 3349#include <stdlib.h>
@@ -3837,35 +3370,113 @@ main ()
3837 return 0; 3370 return 0;
3838} 3371}
3839_ACEOF 3372_ACEOF
3840if ac_fn_c_try_run "$LINENO"; then : 3373rm -f conftest$ac_exeext
3841 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 :
3842else 3394else
3843 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
3844fi 3401fi
3845rm -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
3846 conftest.$ac_objext conftest.beam conftest.$ac_ext
3847fi 3403fi
3848 3404
3405
3849fi 3406fi
3850fi 3407fi
3851{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 3408{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
3852$as_echo "$ac_cv_header_stdc" >&6; } 3409echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
3853if test $ac_cv_header_stdc = yes; then 3410if test $ac_cv_header_stdc = yes; then
3854 3411
3855$as_echo "#define STDC_HEADERS 1" >>confdefs.h 3412cat >>confdefs.h <<\_ACEOF
3413#define STDC_HEADERS 1
3414_ACEOF
3856 3415
3857fi 3416fi
3858 3417
3859# 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
3860for 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 \
3861 inttypes.h stdint.h unistd.h 3429 inttypes.h stdint.h unistd.h
3862do : 3430do
3863 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`
3864ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default 3432{ echo "$as_me:$LINENO: checking for $ac_header" >&5
3865" 3433echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
3866if 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
3867 cat >>confdefs.h <<_ACEOF 3478 cat >>confdefs.h <<_ACEOF
3868#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 3479#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
3869_ACEOF 3480_ACEOF
3870 3481
3871fi 3482fi
@@ -3873,229 +3484,241 @@ fi
3873done 3484done
3874 3485
3875 3486
3876 { $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
3877$as_echo_n "checking whether byte ordering is bigendian... " >&6; } 3488echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; }
3878if ${ac_cv_c_bigendian+:} false; then : 3489if test "${ac_cv_c_bigendian+set}" = set; then
3879 $as_echo_n "(cached) " >&6 3490 echo $ECHO_N "(cached) $ECHO_C" >&6
3880else 3491else
3881 ac_cv_c_bigendian=unknown 3492 # See if sys/param.h defines the BYTE_ORDER macro.
3882 # See if we're dealing with a universal compiler. 3493cat >conftest.$ac_ext <<_ACEOF
3883 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 3494/* confdefs.h. */
3884/* end confdefs.h. */ 3495_ACEOF
3885#ifndef __APPLE_CC__ 3496cat confdefs.h >>conftest.$ac_ext
3886 not a universal capable compiler 3497cat >>conftest.$ac_ext <<_ACEOF
3887 #endif
3888 typedef int dummy;
3889
3890_ACEOF
3891if ac_fn_c_try_compile "$LINENO"; then :
3892
3893 # Check for potential -arch flags. It is not universal unless
3894 # there are at least two -arch flags with different values.
3895 ac_arch=
3896 ac_prev=
3897 for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
3898 if test -n "$ac_prev"; then
3899 case $ac_word in
3900 i?86 | x86_64 | ppc | ppc64)
3901 if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
3902 ac_arch=$ac_word
3903 else
3904 ac_cv_c_bigendian=universal
3905 break
3906 fi
3907 ;;
3908 esac
3909 ac_prev=
3910 elif test "x$ac_word" = "x-arch"; then
3911 ac_prev=arch
3912 fi
3913 done
3914fi
3915rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3916 if test $ac_cv_c_bigendian = unknown; then
3917 # See if sys/param.h defines the BYTE_ORDER macro.
3918 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3919/* end confdefs.h. */ 3498/* end confdefs.h. */
3920#include <sys/types.h> 3499#include <sys/types.h>
3921 #include <sys/param.h> 3500#include <sys/param.h>
3922 3501
3923int 3502int
3924main () 3503main ()
3925{ 3504{
3926#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ 3505#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
3927 && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ 3506 && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
3928 && LITTLE_ENDIAN) 3507 bogus endian macros
3929 bogus endian macros 3508#endif
3930 #endif
3931 3509
3932 ; 3510 ;
3933 return 0; 3511 return 0;
3934} 3512}
3935_ACEOF 3513_ACEOF
3936if 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
3937 # 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.
3938 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
3939/* end confdefs.h. */ 3537/* end confdefs.h. */
3940#include <sys/types.h> 3538#include <sys/types.h>
3941 #include <sys/param.h> 3539#include <sys/param.h>
3942 3540
3943int 3541int
3944main () 3542main ()
3945{ 3543{
3946#if BYTE_ORDER != BIG_ENDIAN 3544#if BYTE_ORDER != BIG_ENDIAN
3947 not big endian 3545 not big endian
3948 #endif 3546#endif
3949 3547
3950 ; 3548 ;
3951 return 0; 3549 return 0;
3952} 3550}
3953_ACEOF 3551_ACEOF
3954if 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
3955 ac_cv_c_bigendian=yes 3569 ac_cv_c_bigendian=yes
3956else 3570else
3957 ac_cv_c_bigendian=no 3571 echo "$as_me: failed program was:" >&5
3958fi 3572sed 's/^/| /' conftest.$ac_ext >&5
3959rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 3573
3574 ac_cv_c_bigendian=no
3960fi 3575fi
3961rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3962 fi
3963 if test $ac_cv_c_bigendian = unknown; then
3964 # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
3965 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3966/* end confdefs.h. */
3967#include <limits.h>
3968 3576
3969int 3577rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3970main () 3578else
3971{ 3579 echo "$as_me: failed program was:" >&5
3972#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) 3580sed 's/^/| /' conftest.$ac_ext >&5
3973 bogus endian macros
3974 #endif
3975 3581
3976 ; 3582 # It does not; compile a test program.
3977 return 0; 3583if test "$cross_compiling" = yes; then
3978} 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. */
3979_ACEOF 3588_ACEOF
3980if ac_fn_c_try_compile "$LINENO"; then : 3589cat confdefs.h >>conftest.$ac_ext
3981 # It does; now see whether it defined to _BIG_ENDIAN or not. 3590cat >>conftest.$ac_ext <<_ACEOF
3982 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3983/* end confdefs.h. */ 3591/* end confdefs.h. */
3984#include <limits.h> 3592short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
3985 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; }
3986int 3598int
3987main () 3599main ()
3988{ 3600{
3989#ifndef _BIG_ENDIAN 3601 _ascii (); _ebcdic ();
3990 not big endian
3991 #endif
3992
3993 ; 3602 ;
3994 return 0; 3603 return 0;
3995} 3604}
3996_ACEOF 3605_ACEOF
3997if 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
3998 ac_cv_c_bigendian=yes 3624 ac_cv_c_bigendian=yes
3999else
4000 ac_cv_c_bigendian=no
4001fi 3625fi
4002rm -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
4003fi 3633fi
4004rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 3634else
4005 fi 3635 echo "$as_me: failed program was:" >&5
4006 if test $ac_cv_c_bigendian = unknown; then 3636sed 's/^/| /' conftest.$ac_ext >&5
4007 # Compile a test program. 3637
4008 if test "$cross_compiling" = yes; then :
4009 # Try to guess by grepping values from an object file.
4010 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4011/* end confdefs.h. */
4012short int ascii_mm[] =
4013 { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
4014 short int ascii_ii[] =
4015 { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
4016 int use_ascii (int i) {
4017 return ascii_mm[i] + ascii_ii[i];
4018 }
4019 short int ebcdic_ii[] =
4020 { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
4021 short int ebcdic_mm[] =
4022 { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
4023 int use_ebcdic (int i) {
4024 return ebcdic_mm[i] + ebcdic_ii[i];
4025 }
4026 extern int foo;
4027 3638
4028int
4029main ()
4030{
4031return use_ascii (foo) == use_ebcdic (foo);
4032 ;
4033 return 0;
4034}
4035_ACEOF
4036if ac_fn_c_try_compile "$LINENO"; then :
4037 if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
4038 ac_cv_c_bigendian=yes
4039 fi
4040 if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
4041 if test "$ac_cv_c_bigendian" = unknown; then
4042 ac_cv_c_bigendian=no
4043 else
4044 # finding both strings is unlikely to happen, but who knows?
4045 ac_cv_c_bigendian=unknown
4046 fi
4047 fi
4048fi 3639fi
3640
4049rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 3641rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4050else 3642else
4051 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
4052/* end confdefs.h. */ 3648/* end confdefs.h. */
4053$ac_includes_default 3649$ac_includes_default
4054int 3650int
4055main () 3651main ()
4056{ 3652{
4057 3653
4058 /* Are we little or big endian? From Harbison&Steele. */ 3654 /* Are we little or big endian? From Harbison&Steele. */
4059 union 3655 union
4060 { 3656 {
4061 long int l; 3657 long int l;
4062 char c[sizeof (long int)]; 3658 char c[sizeof (long int)];
4063 } u; 3659 } u;
4064 u.l = 1; 3660 u.l = 1;
4065 return u.c[sizeof (long int) - 1] == 1; 3661 return u.c[sizeof (long int) - 1] == 1;
4066 3662
4067 ; 3663 ;
4068 return 0; 3664 return 0;
4069} 3665}
4070_ACEOF 3666_ACEOF
4071if 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
4072 ac_cv_c_bigendian=no 3687 ac_cv_c_bigendian=no
4073else 3688else
4074 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
4075fi 3695fi
4076rm -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
4077 conftest.$ac_objext conftest.beam conftest.$ac_ext
4078fi 3697fi
4079 3698
4080 fi 3699
4081fi 3700fi
4082{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
4083$as_echo "$ac_cv_c_bigendian" >&6; }
4084 case $ac_cv_c_bigendian in #(
4085 yes)
4086 $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
4087;; #(
4088 no)
4089 ;; #(
4090 universal)
4091 3701
4092$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)
4093 3708
4094 ;; #( 3709cat >>confdefs.h <<\_ACEOF
4095 *) 3710#define WORDS_BIGENDIAN 1
4096 as_fn_error $? "unknown endianness 3711_ACEOF
4097 presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; 3712 ;;
4098 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
4099 3722
4100 3723
4101# Checks for programs. 3724# Checks for programs.
@@ -4103,10 +3726,10 @@ for ac_prog in gawk mawk nawk awk
4103do 3726do
4104 # 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.
4105set dummy $ac_prog; ac_word=$2 3728set dummy $ac_prog; ac_word=$2
4106{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 3729{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4107$as_echo_n "checking for $ac_word... " >&6; } 3730echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4108if ${ac_cv_prog_AWK+:} false; then : 3731if test "${ac_cv_prog_AWK+set}" = set; then
4109 $as_echo_n "(cached) " >&6 3732 echo $ECHO_N "(cached) $ECHO_C" >&6
4110else 3733else
4111 if test -n "$AWK"; then 3734 if test -n "$AWK"; then
4112 ac_cv_prog_AWK="$AWK" # Let the user override the test. 3735 ac_cv_prog_AWK="$AWK" # Let the user override the test.
@@ -4116,25 +3739,25 @@ for as_dir in $PATH
4116do 3739do
4117 IFS=$as_save_IFS 3740 IFS=$as_save_IFS
4118 test -z "$as_dir" && as_dir=. 3741 test -z "$as_dir" && as_dir=.
4119 for ac_exec_ext in '' $ac_executable_extensions; do 3742 for ac_exec_ext in '' $ac_executable_extensions; do
4120 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
4121 ac_cv_prog_AWK="$ac_prog" 3744 ac_cv_prog_AWK="$ac_prog"
4122 $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
4123 break 2 3746 break 2
4124 fi 3747 fi
4125done 3748done
4126 done 3749done
4127IFS=$as_save_IFS 3750IFS=$as_save_IFS
4128 3751
4129fi 3752fi
4130fi 3753fi
4131AWK=$ac_cv_prog_AWK 3754AWK=$ac_cv_prog_AWK
4132if test -n "$AWK"; then 3755if test -n "$AWK"; then
4133 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 3756 { echo "$as_me:$LINENO: result: $AWK" >&5
4134$as_echo "$AWK" >&6; } 3757echo "${ECHO_T}$AWK" >&6; }
4135else 3758else
4136 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 3759 { echo "$as_me:$LINENO: result: no" >&5
4137$as_echo "no" >&6; } 3760echo "${ECHO_T}no" >&6; }
4138fi 3761fi
4139 3762
4140 3763
@@ -4146,15 +3769,15 @@ ac_cpp='$CPP $CPPFLAGS'
4146ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' 3769ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
4147ac_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'
4148ac_compiler_gnu=$ac_cv_c_compiler_gnu 3771ac_compiler_gnu=$ac_cv_c_compiler_gnu
4149{ $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
4150$as_echo_n "checking how to run the C preprocessor... " >&6; } 3773echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
4151# On Suns, sometimes $CPP names a directory. 3774# On Suns, sometimes $CPP names a directory.
4152if test -n "$CPP" && test -d "$CPP"; then 3775if test -n "$CPP" && test -d "$CPP"; then
4153 CPP= 3776 CPP=
4154fi 3777fi
4155if test -z "$CPP"; then 3778if test -z "$CPP"; then
4156 if ${ac_cv_prog_CPP+:} false; then : 3779 if test "${ac_cv_prog_CPP+set}" = set; then
4157 $as_echo_n "(cached) " >&6 3780 echo $ECHO_N "(cached) $ECHO_C" >&6
4158else 3781else
4159 # Double quotes because CPP needs to be expanded 3782 # Double quotes because CPP needs to be expanded
4160 for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" 3783 for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
@@ -4168,7 +3791,11 @@ do
4168 # <limits.h> exists even on freestanding compilers. 3791 # <limits.h> exists even on freestanding compilers.
4169 # 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,
4170 # 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.
4171 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
4172/* end confdefs.h. */ 3799/* end confdefs.h. */
4173#ifdef __STDC__ 3800#ifdef __STDC__
4174# include <limits.h> 3801# include <limits.h>
@@ -4177,34 +3804,76 @@ do
4177#endif 3804#endif
4178 Syntax error 3805 Syntax error
4179_ACEOF 3806_ACEOF
4180if ac_fn_c_try_cpp "$LINENO"; then : 3807if { (ac_try="$ac_cpp conftest.$ac_ext"
4181 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 :
4182else 3824else
3825 echo "$as_me: failed program was:" >&5
3826sed 's/^/| /' conftest.$ac_ext >&5
3827
4183 # Broken: fails on valid input. 3828 # Broken: fails on valid input.
4184continue 3829continue
4185fi 3830fi
4186rm -f conftest.err conftest.i conftest.$ac_ext 3831
3832rm -f conftest.err conftest.$ac_ext
4187 3833
4188 # OK, works on sane cases. Now check whether nonexistent headers 3834 # OK, works on sane cases. Now check whether nonexistent headers
4189 # can be detected and how. 3835 # can be detected and how.
4190 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
4191/* end confdefs.h. */ 3841/* end confdefs.h. */
4192#include <ac_nonexistent.h> 3842#include <ac_nonexistent.h>
4193_ACEOF 3843_ACEOF
4194if 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
4195 # Broken: success on invalid input. 3860 # Broken: success on invalid input.
4196continue 3861continue
4197else 3862else
3863 echo "$as_me: failed program was:" >&5
3864sed 's/^/| /' conftest.$ac_ext >&5
3865
4198 # Passes both tests. 3866 # Passes both tests.
4199ac_preproc_ok=: 3867ac_preproc_ok=:
4200break 3868break
4201fi 3869fi
4202rm -f conftest.err conftest.i conftest.$ac_ext 3870
3871rm -f conftest.err conftest.$ac_ext
4203 3872
4204done 3873done
4205# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. 3874# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
4206rm -f conftest.i conftest.err conftest.$ac_ext 3875rm -f conftest.err conftest.$ac_ext
4207if $ac_preproc_ok; then : 3876if $ac_preproc_ok; then
4208 break 3877 break
4209fi 3878fi
4210 3879
@@ -4216,8 +3885,8 @@ fi
4216else 3885else
4217 ac_cv_prog_CPP=$CPP 3886 ac_cv_prog_CPP=$CPP
4218fi 3887fi
4219{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 3888{ echo "$as_me:$LINENO: result: $CPP" >&5
4220$as_echo "$CPP" >&6; } 3889echo "${ECHO_T}$CPP" >&6; }
4221ac_preproc_ok=false 3890ac_preproc_ok=false
4222for ac_c_preproc_warn_flag in '' yes 3891for ac_c_preproc_warn_flag in '' yes
4223do 3892do
@@ -4227,7 +3896,11 @@ do
4227 # <limits.h> exists even on freestanding compilers. 3896 # <limits.h> exists even on freestanding compilers.
4228 # 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,
4229 # 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.
4230 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
4231/* end confdefs.h. */ 3904/* end confdefs.h. */
4232#ifdef __STDC__ 3905#ifdef __STDC__
4233# include <limits.h> 3906# include <limits.h>
@@ -4236,40 +3909,83 @@ do
4236#endif 3909#endif
4237 Syntax error 3910 Syntax error
4238_ACEOF 3911_ACEOF
4239if ac_fn_c_try_cpp "$LINENO"; then : 3912if { (ac_try="$ac_cpp conftest.$ac_ext"
4240 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 :
4241else 3929else
3930 echo "$as_me: failed program was:" >&5
3931sed 's/^/| /' conftest.$ac_ext >&5
3932
4242 # Broken: fails on valid input. 3933 # Broken: fails on valid input.
4243continue 3934continue
4244fi 3935fi
4245rm -f conftest.err conftest.i conftest.$ac_ext 3936
3937rm -f conftest.err conftest.$ac_ext
4246 3938
4247 # OK, works on sane cases. Now check whether nonexistent headers 3939 # OK, works on sane cases. Now check whether nonexistent headers
4248 # can be detected and how. 3940 # can be detected and how.
4249 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
4250/* end confdefs.h. */ 3946/* end confdefs.h. */
4251#include <ac_nonexistent.h> 3947#include <ac_nonexistent.h>
4252_ACEOF 3948_ACEOF
4253if 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
4254 # Broken: success on invalid input. 3965 # Broken: success on invalid input.
4255continue 3966continue
4256else 3967else
3968 echo "$as_me: failed program was:" >&5
3969sed 's/^/| /' conftest.$ac_ext >&5
3970
4257 # Passes both tests. 3971 # Passes both tests.
4258ac_preproc_ok=: 3972ac_preproc_ok=:
4259break 3973break
4260fi 3974fi
4261rm -f conftest.err conftest.i conftest.$ac_ext 3975
3976rm -f conftest.err conftest.$ac_ext
4262 3977
4263done 3978done
4264# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. 3979# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
4265rm -f conftest.i conftest.err conftest.$ac_ext 3980rm -f conftest.err conftest.$ac_ext
4266if $ac_preproc_ok; then : 3981if $ac_preproc_ok; then
4267 3982 :
4268else 3983else
4269 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 3984 { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
4270$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 3985See \`config.log' for more details." >&5
4271as_fn_error $? "C preprocessor \"$CPP\" fails sanity check 3986echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
4272See \`config.log' for more details" "$LINENO" 5; } 3987See \`config.log' for more details." >&2;}
3988 { (exit 1); exit 1; }; }
4273fi 3989fi
4274 3990
4275ac_ext=c 3991ac_ext=c
@@ -4281,10 +3997,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
4281if test -n "$ac_tool_prefix"; then 3997if test -n "$ac_tool_prefix"; then
4282 # 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.
4283set dummy ${ac_tool_prefix}ranlib; ac_word=$2 3999set dummy ${ac_tool_prefix}ranlib; ac_word=$2
4284{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4000{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4285$as_echo_n "checking for $ac_word... " >&6; } 4001echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4286if ${ac_cv_prog_RANLIB+:} false; then : 4002if test "${ac_cv_prog_RANLIB+set}" = set; then
4287 $as_echo_n "(cached) " >&6 4003 echo $ECHO_N "(cached) $ECHO_C" >&6
4288else 4004else
4289 if test -n "$RANLIB"; then 4005 if test -n "$RANLIB"; then
4290 ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. 4006 ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
@@ -4294,25 +4010,25 @@ for as_dir in $PATH
4294do 4010do
4295 IFS=$as_save_IFS 4011 IFS=$as_save_IFS
4296 test -z "$as_dir" && as_dir=. 4012 test -z "$as_dir" && as_dir=.
4297 for ac_exec_ext in '' $ac_executable_extensions; do 4013 for ac_exec_ext in '' $ac_executable_extensions; do
4298 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
4299 ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" 4015 ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
4300 $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
4301 break 2 4017 break 2
4302 fi 4018 fi
4303done 4019done
4304 done 4020done
4305IFS=$as_save_IFS 4021IFS=$as_save_IFS
4306 4022
4307fi 4023fi
4308fi 4024fi
4309RANLIB=$ac_cv_prog_RANLIB 4025RANLIB=$ac_cv_prog_RANLIB
4310if test -n "$RANLIB"; then 4026if test -n "$RANLIB"; then
4311 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 4027 { echo "$as_me:$LINENO: result: $RANLIB" >&5
4312$as_echo "$RANLIB" >&6; } 4028echo "${ECHO_T}$RANLIB" >&6; }
4313else 4029else
4314 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4030 { echo "$as_me:$LINENO: result: no" >&5
4315$as_echo "no" >&6; } 4031echo "${ECHO_T}no" >&6; }
4316fi 4032fi
4317 4033
4318 4034
@@ -4321,10 +4037,10 @@ if test -z "$ac_cv_prog_RANLIB"; then
4321 ac_ct_RANLIB=$RANLIB 4037 ac_ct_RANLIB=$RANLIB
4322 # 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.
4323set dummy ranlib; ac_word=$2 4039set dummy ranlib; ac_word=$2
4324{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4040{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4325$as_echo_n "checking for $ac_word... " >&6; } 4041echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4326if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : 4042if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
4327 $as_echo_n "(cached) " >&6 4043 echo $ECHO_N "(cached) $ECHO_C" >&6
4328else 4044else
4329 if test -n "$ac_ct_RANLIB"; then 4045 if test -n "$ac_ct_RANLIB"; then
4330 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.
@@ -4334,25 +4050,25 @@ for as_dir in $PATH
4334do 4050do
4335 IFS=$as_save_IFS 4051 IFS=$as_save_IFS
4336 test -z "$as_dir" && as_dir=. 4052 test -z "$as_dir" && as_dir=.
4337 for ac_exec_ext in '' $ac_executable_extensions; do 4053 for ac_exec_ext in '' $ac_executable_extensions; do
4338 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
4339 ac_cv_prog_ac_ct_RANLIB="ranlib" 4055 ac_cv_prog_ac_ct_RANLIB="ranlib"
4340 $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
4341 break 2 4057 break 2
4342 fi 4058 fi
4343done 4059done
4344 done 4060done
4345IFS=$as_save_IFS 4061IFS=$as_save_IFS
4346 4062
4347fi 4063fi
4348fi 4064fi
4349ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB 4065ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
4350if test -n "$ac_ct_RANLIB"; then 4066if test -n "$ac_ct_RANLIB"; then
4351 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 4067 { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
4352$as_echo "$ac_ct_RANLIB" >&6; } 4068echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
4353else 4069else
4354 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4070 { echo "$as_me:$LINENO: result: no" >&5
4355$as_echo "no" >&6; } 4071echo "${ECHO_T}no" >&6; }
4356fi 4072fi
4357 4073
4358 if test "x$ac_ct_RANLIB" = x; then 4074 if test "x$ac_ct_RANLIB" = x; then
@@ -4360,8 +4076,12 @@ fi
4360 else 4076 else
4361 case $cross_compiling:$ac_tool_warned in 4077 case $cross_compiling:$ac_tool_warned in
4362yes:) 4078yes:)
4363{ $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
4364$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;}
4365ac_tool_warned=yes ;; 4085ac_tool_warned=yes ;;
4366esac 4086esac
4367 RANLIB=$ac_ct_RANLIB 4087 RANLIB=$ac_ct_RANLIB
@@ -4383,23 +4103,22 @@ fi
4383# 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"
4384# OS/2's system install, which has a completely different semantic 4104# OS/2's system install, which has a completely different semantic
4385# ./install, which can be erroneously created by make from ./install.sh. 4105# ./install, which can be erroneously created by make from ./install.sh.
4386# Reject install programs that cannot install multiple files. 4106{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
4387{ $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; }
4388$as_echo_n "checking for a BSD-compatible install... " >&6; }
4389if test -z "$INSTALL"; then 4108if test -z "$INSTALL"; then
4390if ${ac_cv_path_install+:} false; then : 4109if test "${ac_cv_path_install+set}" = set; then
4391 $as_echo_n "(cached) " >&6 4110 echo $ECHO_N "(cached) $ECHO_C" >&6
4392else 4111else
4393 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 4112 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4394for as_dir in $PATH 4113for as_dir in $PATH
4395do 4114do
4396 IFS=$as_save_IFS 4115 IFS=$as_save_IFS
4397 test -z "$as_dir" && as_dir=. 4116 test -z "$as_dir" && as_dir=.
4398 # Account for people who put trailing slashes in PATH elements. 4117 # Account for people who put trailing slashes in PATH elements.
4399case $as_dir/ in #(( 4118case $as_dir/ in
4400 ./ | .// | /[cC]/* | \ 4119 ./ | .// | /cC/* | \
4401 /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ 4120 /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
4402 ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ 4121 ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
4403 /usr/ucb/* ) ;; 4122 /usr/ucb/* ) ;;
4404 *) 4123 *)
4405 # 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.
@@ -4417,29 +4136,17 @@ case $as_dir/ in #((
4417 # program-specific install script used by HP pwplus--don't use. 4136 # program-specific install script used by HP pwplus--don't use.
4418 : 4137 :
4419 else 4138 else
4420 rm -rf conftest.one conftest.two conftest.dir 4139 ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
4421 echo one > conftest.one 4140 break 3
4422 echo two > conftest.two
4423 mkdir conftest.dir
4424 if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
4425 test -s conftest.one && test -s conftest.two &&
4426 test -s conftest.dir/conftest.one &&
4427 test -s conftest.dir/conftest.two
4428 then
4429 ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
4430 break 3
4431 fi
4432 fi 4141 fi
4433 fi 4142 fi
4434 done 4143 done
4435 done 4144 done
4436 ;; 4145 ;;
4437esac 4146esac
4438 4147done
4439 done
4440IFS=$as_save_IFS 4148IFS=$as_save_IFS
4441 4149
4442rm -rf conftest.one conftest.two conftest.dir
4443 4150
4444fi 4151fi
4445 if test "${ac_cv_path_install+set}" = set; then 4152 if test "${ac_cv_path_install+set}" = set; then
@@ -4452,8 +4159,8 @@ fi
4452 INSTALL=$ac_install_sh 4159 INSTALL=$ac_install_sh
4453 fi 4160 fi
4454fi 4161fi
4455{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 4162{ echo "$as_me:$LINENO: result: $INSTALL" >&5
4456$as_echo "$INSTALL" >&6; } 4163echo "${ECHO_T}$INSTALL" >&6; }
4457 4164
4458# Use test -z because SunOS4 sh mishandles braces in ${var-val}. 4165# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
4459# It thinks the first close brace ends the variable substitution. 4166# It thinks the first close brace ends the variable substitution.
@@ -4463,43 +4170,48 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
4463 4170
4464test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' 4171test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
4465 4172
4466{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 4173{ echo "$as_me:$LINENO: checking for egrep" >&5
4467$as_echo_n "checking for egrep... " >&6; } 4174echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
4468if ${ac_cv_path_EGREP+:} false; then : 4175if test "${ac_cv_path_EGREP+set}" = set; then
4469 $as_echo_n "(cached) " >&6 4176 echo $ECHO_N "(cached) $ECHO_C" >&6
4470else 4177else
4471 if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 4178 if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
4472 then ac_cv_path_EGREP="$GREP -E" 4179 then ac_cv_path_EGREP="$GREP -E"
4473 else 4180 else
4474 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
4475 ac_path_EGREP_found=false 4187 ac_path_EGREP_found=false
4476 # 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
4477 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 4189as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4478for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin 4190for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
4479do 4191do
4480 IFS=$as_save_IFS 4192 IFS=$as_save_IFS
4481 test -z "$as_dir" && as_dir=. 4193 test -z "$as_dir" && as_dir=.
4482 for ac_prog in egrep; do 4194 for ac_prog in egrep; do
4483 for ac_exec_ext in '' $ac_executable_extensions; do 4195 for ac_exec_ext in '' $ac_executable_extensions; do
4484 ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" 4196 ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
4485 { 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
4486# 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.
4487 # Check for GNU $ac_path_EGREP 4199 # Check for GNU $ac_path_EGREP
4488case `"$ac_path_EGREP" --version 2>&1` in 4200case `"$ac_path_EGREP" --version 2>&1` in
4489*GNU*) 4201*GNU*)
4490 ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; 4202 ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
4491*) 4203*)
4492 ac_count=0 4204 ac_count=0
4493 $as_echo_n 0123456789 >"conftest.in" 4205 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
4494 while : 4206 while :
4495 do 4207 do
4496 cat "conftest.in" "conftest.in" >"conftest.tmp" 4208 cat "conftest.in" "conftest.in" >"conftest.tmp"
4497 mv "conftest.tmp" "conftest.in" 4209 mv "conftest.tmp" "conftest.in"
4498 cp "conftest.in" "conftest.nl" 4210 cp "conftest.in" "conftest.nl"
4499 $as_echo 'EGREP' >> "conftest.nl" 4211 echo 'EGREP' >> "conftest.nl"
4500 "$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
4501 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break 4213 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
4502 as_fn_arith $ac_count + 1 && ac_count=$as_val 4214 ac_count=`expr $ac_count + 1`
4503 if test $ac_count -gt ${ac_path_EGREP_max-0}; then 4215 if test $ac_count -gt ${ac_path_EGREP_max-0}; then
4504 # 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
4505 ac_cv_path_EGREP="$ac_path_EGREP" 4217 ac_cv_path_EGREP="$ac_path_EGREP"
@@ -4511,31 +4223,42 @@ case `"$ac_path_EGREP" --version 2>&1` in
4511 rm -f conftest.in conftest.tmp conftest.nl conftest.out;; 4223 rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
4512esac 4224esac
4513 4225
4514 $ac_path_EGREP_found && break 3 4226
4515 done 4227 $ac_path_EGREP_found && break 3
4516 done
4517 done 4228 done
4229done
4230
4231done
4518IFS=$as_save_IFS 4232IFS=$as_save_IFS
4519 if test -z "$ac_cv_path_EGREP"; then 4233
4520 as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 4234
4521 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
4522else 4244else
4523 ac_cv_path_EGREP=$EGREP 4245 ac_cv_path_EGREP=$EGREP
4524fi 4246fi
4525 4247
4248
4526 fi 4249 fi
4527fi 4250fi
4528{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 4251{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
4529$as_echo "$ac_cv_path_EGREP" >&6; } 4252echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
4530 EGREP="$ac_cv_path_EGREP" 4253 EGREP="$ac_cv_path_EGREP"
4531 4254
4532 4255
4533# 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.
4534set dummy ar; ac_word=$2 4257set dummy ar; ac_word=$2
4535{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4258{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4536$as_echo_n "checking for $ac_word... " >&6; } 4259echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4537if ${ac_cv_path_AR+:} false; then : 4260if test "${ac_cv_path_AR+set}" = set; then
4538 $as_echo_n "(cached) " >&6 4261 echo $ECHO_N "(cached) $ECHO_C" >&6
4539else 4262else
4540 case $AR in 4263 case $AR in
4541 [\\/]* | ?:[\\/]*) 4264 [\\/]* | ?:[\\/]*)
@@ -4547,14 +4270,14 @@ for as_dir in $PATH
4547do 4270do
4548 IFS=$as_save_IFS 4271 IFS=$as_save_IFS
4549 test -z "$as_dir" && as_dir=. 4272 test -z "$as_dir" && as_dir=.
4550 for ac_exec_ext in '' $ac_executable_extensions; do 4273 for ac_exec_ext in '' $ac_executable_extensions; do
4551 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
4552 ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext" 4275 ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
4553 $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
4554 break 2 4277 break 2
4555 fi 4278 fi
4556done 4279done
4557 done 4280done
4558IFS=$as_save_IFS 4281IFS=$as_save_IFS
4559 4282
4560 ;; 4283 ;;
@@ -4562,20 +4285,20 @@ esac
4562fi 4285fi
4563AR=$ac_cv_path_AR 4286AR=$ac_cv_path_AR
4564if test -n "$AR"; then 4287if test -n "$AR"; then
4565 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 4288 { echo "$as_me:$LINENO: result: $AR" >&5
4566$as_echo "$AR" >&6; } 4289echo "${ECHO_T}$AR" >&6; }
4567else 4290else
4568 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4291 { echo "$as_me:$LINENO: result: no" >&5
4569$as_echo "no" >&6; } 4292echo "${ECHO_T}no" >&6; }
4570fi 4293fi
4571 4294
4572 4295
4573# 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.
4574set dummy cat; ac_word=$2 4297set dummy cat; ac_word=$2
4575{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4298{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4576$as_echo_n "checking for $ac_word... " >&6; } 4299echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4577if ${ac_cv_path_CAT+:} false; then : 4300if test "${ac_cv_path_CAT+set}" = set; then
4578 $as_echo_n "(cached) " >&6 4301 echo $ECHO_N "(cached) $ECHO_C" >&6
4579else 4302else
4580 case $CAT in 4303 case $CAT in
4581 [\\/]* | ?:[\\/]*) 4304 [\\/]* | ?:[\\/]*)
@@ -4587,14 +4310,14 @@ for as_dir in $PATH
4587do 4310do
4588 IFS=$as_save_IFS 4311 IFS=$as_save_IFS
4589 test -z "$as_dir" && as_dir=. 4312 test -z "$as_dir" && as_dir=.
4590 for ac_exec_ext in '' $ac_executable_extensions; do 4313 for ac_exec_ext in '' $ac_executable_extensions; do
4591 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
4592 ac_cv_path_CAT="$as_dir/$ac_word$ac_exec_ext" 4315 ac_cv_path_CAT="$as_dir/$ac_word$ac_exec_ext"
4593 $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
4594 break 2 4317 break 2
4595 fi 4318 fi
4596done 4319done
4597 done 4320done
4598IFS=$as_save_IFS 4321IFS=$as_save_IFS
4599 4322
4600 ;; 4323 ;;
@@ -4602,20 +4325,20 @@ esac
4602fi 4325fi
4603CAT=$ac_cv_path_CAT 4326CAT=$ac_cv_path_CAT
4604if test -n "$CAT"; then 4327if test -n "$CAT"; then
4605 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CAT" >&5 4328 { echo "$as_me:$LINENO: result: $CAT" >&5
4606$as_echo "$CAT" >&6; } 4329echo "${ECHO_T}$CAT" >&6; }
4607else 4330else
4608 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4331 { echo "$as_me:$LINENO: result: no" >&5
4609$as_echo "no" >&6; } 4332echo "${ECHO_T}no" >&6; }
4610fi 4333fi
4611 4334
4612 4335
4613# 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.
4614set dummy kill; ac_word=$2 4337set dummy kill; ac_word=$2
4615{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4338{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4616$as_echo_n "checking for $ac_word... " >&6; } 4339echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4617if ${ac_cv_path_KILL+:} false; then : 4340if test "${ac_cv_path_KILL+set}" = set; then
4618 $as_echo_n "(cached) " >&6 4341 echo $ECHO_N "(cached) $ECHO_C" >&6
4619else 4342else
4620 case $KILL in 4343 case $KILL in
4621 [\\/]* | ?:[\\/]*) 4344 [\\/]* | ?:[\\/]*)
@@ -4627,14 +4350,14 @@ for as_dir in $PATH
4627do 4350do
4628 IFS=$as_save_IFS 4351 IFS=$as_save_IFS
4629 test -z "$as_dir" && as_dir=. 4352 test -z "$as_dir" && as_dir=.
4630 for ac_exec_ext in '' $ac_executable_extensions; do 4353 for ac_exec_ext in '' $ac_executable_extensions; do
4631 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
4632 ac_cv_path_KILL="$as_dir/$ac_word$ac_exec_ext" 4355 ac_cv_path_KILL="$as_dir/$ac_word$ac_exec_ext"
4633 $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
4634 break 2 4357 break 2
4635 fi 4358 fi
4636done 4359done
4637 done 4360done
4638IFS=$as_save_IFS 4361IFS=$as_save_IFS
4639 4362
4640 ;; 4363 ;;
@@ -4642,11 +4365,11 @@ esac
4642fi 4365fi
4643KILL=$ac_cv_path_KILL 4366KILL=$ac_cv_path_KILL
4644if test -n "$KILL"; then 4367if test -n "$KILL"; then
4645 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $KILL" >&5 4368 { echo "$as_me:$LINENO: result: $KILL" >&5
4646$as_echo "$KILL" >&6; } 4369echo "${ECHO_T}$KILL" >&6; }
4647else 4370else
4648 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4371 { echo "$as_me:$LINENO: result: no" >&5
4649$as_echo "no" >&6; } 4372echo "${ECHO_T}no" >&6; }
4650fi 4373fi
4651 4374
4652 4375
@@ -4654,10 +4377,10 @@ for ac_prog in perl5 perl
4654do 4377do
4655 # 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.
4656set dummy $ac_prog; ac_word=$2 4379set dummy $ac_prog; ac_word=$2
4657{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4380{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4658$as_echo_n "checking for $ac_word... " >&6; } 4381echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4659if ${ac_cv_path_PERL+:} false; then : 4382if test "${ac_cv_path_PERL+set}" = set; then
4660 $as_echo_n "(cached) " >&6 4383 echo $ECHO_N "(cached) $ECHO_C" >&6
4661else 4384else
4662 case $PERL in 4385 case $PERL in
4663 [\\/]* | ?:[\\/]*) 4386 [\\/]* | ?:[\\/]*)
@@ -4669,14 +4392,14 @@ for as_dir in $PATH
4669do 4392do
4670 IFS=$as_save_IFS 4393 IFS=$as_save_IFS
4671 test -z "$as_dir" && as_dir=. 4394 test -z "$as_dir" && as_dir=.
4672 for ac_exec_ext in '' $ac_executable_extensions; do 4395 for ac_exec_ext in '' $ac_executable_extensions; do
4673 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
4674 ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" 4397 ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
4675 $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
4676 break 2 4399 break 2
4677 fi 4400 fi
4678done 4401done
4679 done 4402done
4680IFS=$as_save_IFS 4403IFS=$as_save_IFS
4681 4404
4682 ;; 4405 ;;
@@ -4684,11 +4407,11 @@ esac
4684fi 4407fi
4685PERL=$ac_cv_path_PERL 4408PERL=$ac_cv_path_PERL
4686if test -n "$PERL"; then 4409if test -n "$PERL"; then
4687 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 4410 { echo "$as_me:$LINENO: result: $PERL" >&5
4688$as_echo "$PERL" >&6; } 4411echo "${ECHO_T}$PERL" >&6; }
4689else 4412else
4690 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4413 { echo "$as_me:$LINENO: result: no" >&5
4691$as_echo "no" >&6; } 4414echo "${ECHO_T}no" >&6; }
4692fi 4415fi
4693 4416
4694 4417
@@ -4697,10 +4420,10 @@ done
4697 4420
4698# 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.
4699set dummy sed; ac_word=$2 4422set dummy sed; ac_word=$2
4700{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4423{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4701$as_echo_n "checking for $ac_word... " >&6; } 4424echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4702if ${ac_cv_path_SED+:} false; then : 4425if test "${ac_cv_path_SED+set}" = set; then
4703 $as_echo_n "(cached) " >&6 4426 echo $ECHO_N "(cached) $ECHO_C" >&6
4704else 4427else
4705 case $SED in 4428 case $SED in
4706 [\\/]* | ?:[\\/]*) 4429 [\\/]* | ?:[\\/]*)
@@ -4712,14 +4435,14 @@ for as_dir in $PATH
4712do 4435do
4713 IFS=$as_save_IFS 4436 IFS=$as_save_IFS
4714 test -z "$as_dir" && as_dir=. 4437 test -z "$as_dir" && as_dir=.
4715 for ac_exec_ext in '' $ac_executable_extensions; do 4438 for ac_exec_ext in '' $ac_executable_extensions; do
4716 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
4717 ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext" 4440 ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext"
4718 $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
4719 break 2 4442 break 2
4720 fi 4443 fi
4721done 4444done
4722 done 4445done
4723IFS=$as_save_IFS 4446IFS=$as_save_IFS
4724 4447
4725 ;; 4448 ;;
@@ -4727,21 +4450,21 @@ esac
4727fi 4450fi
4728SED=$ac_cv_path_SED 4451SED=$ac_cv_path_SED
4729if test -n "$SED"; then 4452if test -n "$SED"; then
4730 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5 4453 { echo "$as_me:$LINENO: result: $SED" >&5
4731$as_echo "$SED" >&6; } 4454echo "${ECHO_T}$SED" >&6; }
4732else 4455else
4733 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4456 { echo "$as_me:$LINENO: result: no" >&5
4734$as_echo "no" >&6; } 4457echo "${ECHO_T}no" >&6; }
4735fi 4458fi
4736 4459
4737 4460
4738 4461
4739# 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.
4740set dummy ent; ac_word=$2 4463set dummy ent; ac_word=$2
4741{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4464{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4742$as_echo_n "checking for $ac_word... " >&6; } 4465echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4743if ${ac_cv_path_ENT+:} false; then : 4466if test "${ac_cv_path_ENT+set}" = set; then
4744 $as_echo_n "(cached) " >&6 4467 echo $ECHO_N "(cached) $ECHO_C" >&6
4745else 4468else
4746 case $ENT in 4469 case $ENT in
4747 [\\/]* | ?:[\\/]*) 4470 [\\/]* | ?:[\\/]*)
@@ -4753,14 +4476,14 @@ for as_dir in $PATH
4753do 4476do
4754 IFS=$as_save_IFS 4477 IFS=$as_save_IFS
4755 test -z "$as_dir" && as_dir=. 4478 test -z "$as_dir" && as_dir=.
4756 for ac_exec_ext in '' $ac_executable_extensions; do 4479 for ac_exec_ext in '' $ac_executable_extensions; do
4757 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
4758 ac_cv_path_ENT="$as_dir/$ac_word$ac_exec_ext" 4481 ac_cv_path_ENT="$as_dir/$ac_word$ac_exec_ext"
4759 $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
4760 break 2 4483 break 2
4761 fi 4484 fi
4762done 4485done
4763 done 4486done
4764IFS=$as_save_IFS 4487IFS=$as_save_IFS
4765 4488
4766 ;; 4489 ;;
@@ -4768,21 +4491,21 @@ esac
4768fi 4491fi
4769ENT=$ac_cv_path_ENT 4492ENT=$ac_cv_path_ENT
4770if test -n "$ENT"; then 4493if test -n "$ENT"; then
4771 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ENT" >&5 4494 { echo "$as_me:$LINENO: result: $ENT" >&5
4772$as_echo "$ENT" >&6; } 4495echo "${ECHO_T}$ENT" >&6; }
4773else 4496else
4774 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4497 { echo "$as_me:$LINENO: result: no" >&5
4775$as_echo "no" >&6; } 4498echo "${ECHO_T}no" >&6; }
4776fi 4499fi
4777 4500
4778 4501
4779 4502
4780# 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.
4781set dummy bash; ac_word=$2 4504set dummy bash; ac_word=$2
4782{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4505{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4783$as_echo_n "checking for $ac_word... " >&6; } 4506echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4784if ${ac_cv_path_TEST_MINUS_S_SH+:} false; then : 4507if test "${ac_cv_path_TEST_MINUS_S_SH+set}" = set; then
4785 $as_echo_n "(cached) " >&6 4508 echo $ECHO_N "(cached) $ECHO_C" >&6
4786else 4509else
4787 case $TEST_MINUS_S_SH in 4510 case $TEST_MINUS_S_SH in
4788 [\\/]* | ?:[\\/]*) 4511 [\\/]* | ?:[\\/]*)
@@ -4794,14 +4517,14 @@ for as_dir in $PATH
4794do 4517do
4795 IFS=$as_save_IFS 4518 IFS=$as_save_IFS
4796 test -z "$as_dir" && as_dir=. 4519 test -z "$as_dir" && as_dir=.
4797 for ac_exec_ext in '' $ac_executable_extensions; do 4520 for ac_exec_ext in '' $ac_executable_extensions; do
4798 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
4799 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"
4800 $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
4801 break 2 4524 break 2
4802 fi 4525 fi
4803done 4526done
4804 done 4527done
4805IFS=$as_save_IFS 4528IFS=$as_save_IFS
4806 4529
4807 ;; 4530 ;;
@@ -4809,20 +4532,20 @@ esac
4809fi 4532fi
4810TEST_MINUS_S_SH=$ac_cv_path_TEST_MINUS_S_SH 4533TEST_MINUS_S_SH=$ac_cv_path_TEST_MINUS_S_SH
4811if test -n "$TEST_MINUS_S_SH"; then 4534if test -n "$TEST_MINUS_S_SH"; then
4812 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEST_MINUS_S_SH" >&5 4535 { echo "$as_me:$LINENO: result: $TEST_MINUS_S_SH" >&5
4813$as_echo "$TEST_MINUS_S_SH" >&6; } 4536echo "${ECHO_T}$TEST_MINUS_S_SH" >&6; }
4814else 4537else
4815 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4538 { echo "$as_me:$LINENO: result: no" >&5
4816$as_echo "no" >&6; } 4539echo "${ECHO_T}no" >&6; }
4817fi 4540fi
4818 4541
4819 4542
4820# 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.
4821set dummy ksh; ac_word=$2 4544set dummy ksh; ac_word=$2
4822{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4545{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4823$as_echo_n "checking for $ac_word... " >&6; } 4546echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4824if ${ac_cv_path_TEST_MINUS_S_SH+:} false; then : 4547if test "${ac_cv_path_TEST_MINUS_S_SH+set}" = set; then
4825 $as_echo_n "(cached) " >&6 4548 echo $ECHO_N "(cached) $ECHO_C" >&6
4826else 4549else
4827 case $TEST_MINUS_S_SH in 4550 case $TEST_MINUS_S_SH in
4828 [\\/]* | ?:[\\/]*) 4551 [\\/]* | ?:[\\/]*)
@@ -4834,14 +4557,14 @@ for as_dir in $PATH
4834do 4557do
4835 IFS=$as_save_IFS 4558 IFS=$as_save_IFS
4836 test -z "$as_dir" && as_dir=. 4559 test -z "$as_dir" && as_dir=.
4837 for ac_exec_ext in '' $ac_executable_extensions; do 4560 for ac_exec_ext in '' $ac_executable_extensions; do
4838 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
4839 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"
4840 $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
4841 break 2 4564 break 2
4842 fi 4565 fi
4843done 4566done
4844 done 4567done
4845IFS=$as_save_IFS 4568IFS=$as_save_IFS
4846 4569
4847 ;; 4570 ;;
@@ -4849,20 +4572,20 @@ esac
4849fi 4572fi
4850TEST_MINUS_S_SH=$ac_cv_path_TEST_MINUS_S_SH 4573TEST_MINUS_S_SH=$ac_cv_path_TEST_MINUS_S_SH
4851if test -n "$TEST_MINUS_S_SH"; then 4574if test -n "$TEST_MINUS_S_SH"; then
4852 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEST_MINUS_S_SH" >&5 4575 { echo "$as_me:$LINENO: result: $TEST_MINUS_S_SH" >&5
4853$as_echo "$TEST_MINUS_S_SH" >&6; } 4576echo "${ECHO_T}$TEST_MINUS_S_SH" >&6; }
4854else 4577else
4855 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4578 { echo "$as_me:$LINENO: result: no" >&5
4856$as_echo "no" >&6; } 4579echo "${ECHO_T}no" >&6; }
4857fi 4580fi
4858 4581
4859 4582
4860# 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.
4861set dummy sh; ac_word=$2 4584set dummy sh; ac_word=$2
4862{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4585{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4863$as_echo_n "checking for $ac_word... " >&6; } 4586echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4864if ${ac_cv_path_TEST_MINUS_S_SH+:} false; then : 4587if test "${ac_cv_path_TEST_MINUS_S_SH+set}" = set; then
4865 $as_echo_n "(cached) " >&6 4588 echo $ECHO_N "(cached) $ECHO_C" >&6
4866else 4589else
4867 case $TEST_MINUS_S_SH in 4590 case $TEST_MINUS_S_SH in
4868 [\\/]* | ?:[\\/]*) 4591 [\\/]* | ?:[\\/]*)
@@ -4874,14 +4597,14 @@ for as_dir in $PATH
4874do 4597do
4875 IFS=$as_save_IFS 4598 IFS=$as_save_IFS
4876 test -z "$as_dir" && as_dir=. 4599 test -z "$as_dir" && as_dir=.
4877 for ac_exec_ext in '' $ac_executable_extensions; do 4600 for ac_exec_ext in '' $ac_executable_extensions; do
4878 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
4879 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"
4880 $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
4881 break 2 4604 break 2
4882 fi 4605 fi
4883done 4606done
4884 done 4607done
4885IFS=$as_save_IFS 4608IFS=$as_save_IFS
4886 4609
4887 ;; 4610 ;;
@@ -4889,20 +4612,20 @@ esac
4889fi 4612fi
4890TEST_MINUS_S_SH=$ac_cv_path_TEST_MINUS_S_SH 4613TEST_MINUS_S_SH=$ac_cv_path_TEST_MINUS_S_SH
4891if test -n "$TEST_MINUS_S_SH"; then 4614if test -n "$TEST_MINUS_S_SH"; then
4892 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEST_MINUS_S_SH" >&5 4615 { echo "$as_me:$LINENO: result: $TEST_MINUS_S_SH" >&5
4893$as_echo "$TEST_MINUS_S_SH" >&6; } 4616echo "${ECHO_T}$TEST_MINUS_S_SH" >&6; }
4894else 4617else
4895 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4618 { echo "$as_me:$LINENO: result: no" >&5
4896$as_echo "no" >&6; } 4619echo "${ECHO_T}no" >&6; }
4897fi 4620fi
4898 4621
4899 4622
4900# 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.
4901set dummy sh; ac_word=$2 4624set dummy sh; ac_word=$2
4902{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4625{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4903$as_echo_n "checking for $ac_word... " >&6; } 4626echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4904if ${ac_cv_path_SH+:} false; then : 4627if test "${ac_cv_path_SH+set}" = set; then
4905 $as_echo_n "(cached) " >&6 4628 echo $ECHO_N "(cached) $ECHO_C" >&6
4906else 4629else
4907 case $SH in 4630 case $SH in
4908 [\\/]* | ?:[\\/]*) 4631 [\\/]* | ?:[\\/]*)
@@ -4914,14 +4637,14 @@ for as_dir in $PATH
4914do 4637do
4915 IFS=$as_save_IFS 4638 IFS=$as_save_IFS
4916 test -z "$as_dir" && as_dir=. 4639 test -z "$as_dir" && as_dir=.
4917 for ac_exec_ext in '' $ac_executable_extensions; do 4640 for ac_exec_ext in '' $ac_executable_extensions; do
4918 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
4919 ac_cv_path_SH="$as_dir/$ac_word$ac_exec_ext" 4642 ac_cv_path_SH="$as_dir/$ac_word$ac_exec_ext"
4920 $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
4921 break 2 4644 break 2
4922 fi 4645 fi
4923done 4646done
4924 done 4647done
4925IFS=$as_save_IFS 4648IFS=$as_save_IFS
4926 4649
4927 ;; 4650 ;;
@@ -4929,20 +4652,20 @@ esac
4929fi 4652fi
4930SH=$ac_cv_path_SH 4653SH=$ac_cv_path_SH
4931if test -n "$SH"; then 4654if test -n "$SH"; then
4932 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SH" >&5 4655 { echo "$as_me:$LINENO: result: $SH" >&5
4933$as_echo "$SH" >&6; } 4656echo "${ECHO_T}$SH" >&6; }
4934else 4657else
4935 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4658 { echo "$as_me:$LINENO: result: no" >&5
4936$as_echo "no" >&6; } 4659echo "${ECHO_T}no" >&6; }
4937fi 4660fi
4938 4661
4939 4662
4940# 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.
4941set dummy groff; ac_word=$2 4664set dummy groff; ac_word=$2
4942{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4665{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4943$as_echo_n "checking for $ac_word... " >&6; } 4666echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4944if ${ac_cv_path_GROFF+:} false; then : 4667if test "${ac_cv_path_GROFF+set}" = set; then
4945 $as_echo_n "(cached) " >&6 4668 echo $ECHO_N "(cached) $ECHO_C" >&6
4946else 4669else
4947 case $GROFF in 4670 case $GROFF in
4948 [\\/]* | ?:[\\/]*) 4671 [\\/]* | ?:[\\/]*)
@@ -4954,14 +4677,14 @@ for as_dir in $PATH
4954do 4677do
4955 IFS=$as_save_IFS 4678 IFS=$as_save_IFS
4956 test -z "$as_dir" && as_dir=. 4679 test -z "$as_dir" && as_dir=.
4957 for ac_exec_ext in '' $ac_executable_extensions; do 4680 for ac_exec_ext in '' $ac_executable_extensions; do
4958 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
4959 ac_cv_path_GROFF="$as_dir/$ac_word$ac_exec_ext" 4682 ac_cv_path_GROFF="$as_dir/$ac_word$ac_exec_ext"
4960 $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
4961 break 2 4684 break 2
4962 fi 4685 fi
4963done 4686done
4964 done 4687done
4965IFS=$as_save_IFS 4688IFS=$as_save_IFS
4966 4689
4967 ;; 4690 ;;
@@ -4969,20 +4692,20 @@ esac
4969fi 4692fi
4970GROFF=$ac_cv_path_GROFF 4693GROFF=$ac_cv_path_GROFF
4971if test -n "$GROFF"; then 4694if test -n "$GROFF"; then
4972 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GROFF" >&5 4695 { echo "$as_me:$LINENO: result: $GROFF" >&5
4973$as_echo "$GROFF" >&6; } 4696echo "${ECHO_T}$GROFF" >&6; }
4974else 4697else
4975 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4698 { echo "$as_me:$LINENO: result: no" >&5
4976$as_echo "no" >&6; } 4699echo "${ECHO_T}no" >&6; }
4977fi 4700fi
4978 4701
4979 4702
4980# 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.
4981set dummy nroff; ac_word=$2 4704set dummy nroff; ac_word=$2
4982{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4705{ echo "$as_me:$LINENO: checking for $ac_word" >&5
4983$as_echo_n "checking for $ac_word... " >&6; } 4706echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
4984if ${ac_cv_path_NROFF+:} false; then : 4707if test "${ac_cv_path_NROFF+set}" = set; then
4985 $as_echo_n "(cached) " >&6 4708 echo $ECHO_N "(cached) $ECHO_C" >&6
4986else 4709else
4987 case $NROFF in 4710 case $NROFF in
4988 [\\/]* | ?:[\\/]*) 4711 [\\/]* | ?:[\\/]*)
@@ -4994,14 +4717,14 @@ for as_dir in $PATH
4994do 4717do
4995 IFS=$as_save_IFS 4718 IFS=$as_save_IFS
4996 test -z "$as_dir" && as_dir=. 4719 test -z "$as_dir" && as_dir=.
4997 for ac_exec_ext in '' $ac_executable_extensions; do 4720 for ac_exec_ext in '' $ac_executable_extensions; do
4998 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
4999 ac_cv_path_NROFF="$as_dir/$ac_word$ac_exec_ext" 4722 ac_cv_path_NROFF="$as_dir/$ac_word$ac_exec_ext"
5000 $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
5001 break 2 4724 break 2
5002 fi 4725 fi
5003done 4726done
5004 done 4727done
5005IFS=$as_save_IFS 4728IFS=$as_save_IFS
5006 4729
5007 ;; 4730 ;;
@@ -5009,20 +4732,20 @@ esac
5009fi 4732fi
5010NROFF=$ac_cv_path_NROFF 4733NROFF=$ac_cv_path_NROFF
5011if test -n "$NROFF"; then 4734if test -n "$NROFF"; then
5012 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NROFF" >&5 4735 { echo "$as_me:$LINENO: result: $NROFF" >&5
5013$as_echo "$NROFF" >&6; } 4736echo "${ECHO_T}$NROFF" >&6; }
5014else 4737else
5015 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4738 { echo "$as_me:$LINENO: result: no" >&5
5016$as_echo "no" >&6; } 4739echo "${ECHO_T}no" >&6; }
5017fi 4740fi
5018 4741
5019 4742
5020# 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.
5021set dummy mandoc; ac_word=$2 4744set dummy mandoc; ac_word=$2
5022{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4745{ echo "$as_me:$LINENO: checking for $ac_word" >&5
5023$as_echo_n "checking for $ac_word... " >&6; } 4746echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
5024if ${ac_cv_path_MANDOC+:} false; then : 4747if test "${ac_cv_path_MANDOC+set}" = set; then
5025 $as_echo_n "(cached) " >&6 4748 echo $ECHO_N "(cached) $ECHO_C" >&6
5026else 4749else
5027 case $MANDOC in 4750 case $MANDOC in
5028 [\\/]* | ?:[\\/]*) 4751 [\\/]* | ?:[\\/]*)
@@ -5034,14 +4757,14 @@ for as_dir in $PATH
5034do 4757do
5035 IFS=$as_save_IFS 4758 IFS=$as_save_IFS
5036 test -z "$as_dir" && as_dir=. 4759 test -z "$as_dir" && as_dir=.
5037 for ac_exec_ext in '' $ac_executable_extensions; do 4760 for ac_exec_ext in '' $ac_executable_extensions; do
5038 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
5039 ac_cv_path_MANDOC="$as_dir/$ac_word$ac_exec_ext" 4762 ac_cv_path_MANDOC="$as_dir/$ac_word$ac_exec_ext"
5040 $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
5041 break 2 4764 break 2
5042 fi 4765 fi
5043done 4766done
5044 done 4767done
5045IFS=$as_save_IFS 4768IFS=$as_save_IFS
5046 4769
5047 ;; 4770 ;;
@@ -5049,11 +4772,11 @@ esac
5049fi 4772fi
5050MANDOC=$ac_cv_path_MANDOC 4773MANDOC=$ac_cv_path_MANDOC
5051if test -n "$MANDOC"; then 4774if test -n "$MANDOC"; then
5052 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANDOC" >&5 4775 { echo "$as_me:$LINENO: result: $MANDOC" >&5
5053$as_echo "$MANDOC" >&6; } 4776echo "${ECHO_T}$MANDOC" >&6; }
5054else 4777else
5055 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4778 { echo "$as_me:$LINENO: result: no" >&5
5056$as_echo "no" >&6; } 4779echo "${ECHO_T}no" >&6; }
5057fi 4780fi
5058 4781
5059 4782
@@ -5067,18 +4790,18 @@ elif test "x$NROFF" != "x" ; then
5067elif test "x$GROFF" != "x" ; then 4790elif test "x$GROFF" != "x" ; then
5068 MANFMT="$GROFF -mandoc -Tascii" 4791 MANFMT="$GROFF -mandoc -Tascii"
5069else 4792else
5070 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no manpage formatted found" >&5 4793 { echo "$as_me:$LINENO: WARNING: no manpage formatted found" >&5
5071$as_echo "$as_me: WARNING: no manpage formatted found" >&2;} 4794echo "$as_me: WARNING: no manpage formatted found" >&2;}
5072 MANFMT="false" 4795 MANFMT="false"
5073fi 4796fi
5074 4797
5075 4798
5076# 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.
5077set dummy groupadd; ac_word=$2 4800set dummy groupadd; ac_word=$2
5078{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4801{ echo "$as_me:$LINENO: checking for $ac_word" >&5
5079$as_echo_n "checking for $ac_word... " >&6; } 4802echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
5080if ${ac_cv_path_PATH_GROUPADD_PROG+:} false; then : 4803if test "${ac_cv_path_PATH_GROUPADD_PROG+set}" = set; then
5081 $as_echo_n "(cached) " >&6 4804 echo $ECHO_N "(cached) $ECHO_C" >&6
5082else 4805else
5083 case $PATH_GROUPADD_PROG in 4806 case $PATH_GROUPADD_PROG in
5084 [\\/]* | ?:[\\/]*) 4807 [\\/]* | ?:[\\/]*)
@@ -5090,14 +4813,14 @@ for as_dir in /usr/sbin${PATH_SEPARATOR}/etc
5090do 4813do
5091 IFS=$as_save_IFS 4814 IFS=$as_save_IFS
5092 test -z "$as_dir" && as_dir=. 4815 test -z "$as_dir" && as_dir=.
5093 for ac_exec_ext in '' $ac_executable_extensions; do 4816 for ac_exec_ext in '' $ac_executable_extensions; do
5094 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
5095 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"
5096 $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
5097 break 2 4820 break 2
5098 fi 4821 fi
5099done 4822done
5100 done 4823done
5101IFS=$as_save_IFS 4824IFS=$as_save_IFS
5102 4825
5103 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"
@@ -5106,20 +4829,20 @@ esac
5106fi 4829fi
5107PATH_GROUPADD_PROG=$ac_cv_path_PATH_GROUPADD_PROG 4830PATH_GROUPADD_PROG=$ac_cv_path_PATH_GROUPADD_PROG
5108if test -n "$PATH_GROUPADD_PROG"; then 4831if test -n "$PATH_GROUPADD_PROG"; then
5109 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATH_GROUPADD_PROG" >&5 4832 { echo "$as_me:$LINENO: result: $PATH_GROUPADD_PROG" >&5
5110$as_echo "$PATH_GROUPADD_PROG" >&6; } 4833echo "${ECHO_T}$PATH_GROUPADD_PROG" >&6; }
5111else 4834else
5112 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4835 { echo "$as_me:$LINENO: result: no" >&5
5113$as_echo "no" >&6; } 4836echo "${ECHO_T}no" >&6; }
5114fi 4837fi
5115 4838
5116 4839
5117# 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.
5118set dummy useradd; ac_word=$2 4841set dummy useradd; ac_word=$2
5119{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4842{ echo "$as_me:$LINENO: checking for $ac_word" >&5
5120$as_echo_n "checking for $ac_word... " >&6; } 4843echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
5121if ${ac_cv_path_PATH_USERADD_PROG+:} false; then : 4844if test "${ac_cv_path_PATH_USERADD_PROG+set}" = set; then
5122 $as_echo_n "(cached) " >&6 4845 echo $ECHO_N "(cached) $ECHO_C" >&6
5123else 4846else
5124 case $PATH_USERADD_PROG in 4847 case $PATH_USERADD_PROG in
5125 [\\/]* | ?:[\\/]*) 4848 [\\/]* | ?:[\\/]*)
@@ -5131,14 +4854,14 @@ for as_dir in /usr/sbin${PATH_SEPARATOR}/etc
5131do 4854do
5132 IFS=$as_save_IFS 4855 IFS=$as_save_IFS
5133 test -z "$as_dir" && as_dir=. 4856 test -z "$as_dir" && as_dir=.
5134 for ac_exec_ext in '' $ac_executable_extensions; do 4857 for ac_exec_ext in '' $ac_executable_extensions; do
5135 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
5136 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"
5137 $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
5138 break 2 4861 break 2
5139 fi 4862 fi
5140done 4863done
5141 done 4864done
5142IFS=$as_save_IFS 4865IFS=$as_save_IFS
5143 4866
5144 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"
@@ -5147,20 +4870,20 @@ esac
5147fi 4870fi
5148PATH_USERADD_PROG=$ac_cv_path_PATH_USERADD_PROG 4871PATH_USERADD_PROG=$ac_cv_path_PATH_USERADD_PROG
5149if test -n "$PATH_USERADD_PROG"; then 4872if test -n "$PATH_USERADD_PROG"; then
5150 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATH_USERADD_PROG" >&5 4873 { echo "$as_me:$LINENO: result: $PATH_USERADD_PROG" >&5
5151$as_echo "$PATH_USERADD_PROG" >&6; } 4874echo "${ECHO_T}$PATH_USERADD_PROG" >&6; }
5152else 4875else
5153 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4876 { echo "$as_me:$LINENO: result: no" >&5
5154$as_echo "no" >&6; } 4877echo "${ECHO_T}no" >&6; }
5155fi 4878fi
5156 4879
5157 4880
5158# 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.
5159set dummy pkgmk; ac_word=$2 4882set dummy pkgmk; ac_word=$2
5160{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 4883{ echo "$as_me:$LINENO: checking for $ac_word" >&5
5161$as_echo_n "checking for $ac_word... " >&6; } 4884echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
5162if ${ac_cv_prog_MAKE_PACKAGE_SUPPORTED+:} false; then : 4885if test "${ac_cv_prog_MAKE_PACKAGE_SUPPORTED+set}" = set; then
5163 $as_echo_n "(cached) " >&6 4886 echo $ECHO_N "(cached) $ECHO_C" >&6
5164else 4887else
5165 if test -n "$MAKE_PACKAGE_SUPPORTED"; then 4888 if test -n "$MAKE_PACKAGE_SUPPORTED"; then
5166 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.
@@ -5170,14 +4893,14 @@ for as_dir in $PATH
5170do 4893do
5171 IFS=$as_save_IFS 4894 IFS=$as_save_IFS
5172 test -z "$as_dir" && as_dir=. 4895 test -z "$as_dir" && as_dir=.
5173 for ac_exec_ext in '' $ac_executable_extensions; do 4896 for ac_exec_ext in '' $ac_executable_extensions; do
5174 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
5175 ac_cv_prog_MAKE_PACKAGE_SUPPORTED="yes" 4898 ac_cv_prog_MAKE_PACKAGE_SUPPORTED="yes"
5176 $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
5177 break 2 4900 break 2
5178 fi 4901 fi
5179done 4902done
5180 done 4903done
5181IFS=$as_save_IFS 4904IFS=$as_save_IFS
5182 4905
5183 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"
@@ -5185,11 +4908,11 @@ fi
5185fi 4908fi
5186MAKE_PACKAGE_SUPPORTED=$ac_cv_prog_MAKE_PACKAGE_SUPPORTED 4909MAKE_PACKAGE_SUPPORTED=$ac_cv_prog_MAKE_PACKAGE_SUPPORTED
5187if test -n "$MAKE_PACKAGE_SUPPORTED"; then 4910if test -n "$MAKE_PACKAGE_SUPPORTED"; then
5188 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAKE_PACKAGE_SUPPORTED" >&5 4911 { echo "$as_me:$LINENO: result: $MAKE_PACKAGE_SUPPORTED" >&5
5189$as_echo "$MAKE_PACKAGE_SUPPORTED" >&6; } 4912echo "${ECHO_T}$MAKE_PACKAGE_SUPPORTED" >&6; }
5190else 4913else
5191 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 4914 { echo "$as_me:$LINENO: result: no" >&5
5192$as_echo "no" >&6; } 4915echo "${ECHO_T}no" >&6; }
5193fi 4916fi
5194 4917
5195 4918
@@ -5203,16 +4926,16 @@ fi
5203 4926
5204# System features 4927# System features
5205# Check whether --enable-largefile was given. 4928# Check whether --enable-largefile was given.
5206if test "${enable_largefile+set}" = set; then : 4929if test "${enable_largefile+set}" = set; then
5207 enableval=$enable_largefile; 4930 enableval=$enable_largefile;
5208fi 4931fi
5209 4932
5210if test "$enable_largefile" != no; then 4933if test "$enable_largefile" != no; then
5211 4934
5212 { $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
5213$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; }
5214if ${ac_cv_sys_largefile_CC+:} false; then : 4937if test "${ac_cv_sys_largefile_CC+set}" = set; then
5215 $as_echo_n "(cached) " >&6 4938 echo $ECHO_N "(cached) $ECHO_C" >&6
5216else 4939else
5217 ac_cv_sys_largefile_CC=no 4940 ac_cv_sys_largefile_CC=no
5218 if test "$GCC" != yes; then 4941 if test "$GCC" != yes; then
@@ -5220,7 +4943,11 @@ else
5220 while :; do 4943 while :; do
5221 # 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,
5222 # so use the C compiler's -n32 option if that helps. 4945 # so use the C compiler's -n32 option if that helps.
5223 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
5224/* end confdefs.h. */ 4951/* end confdefs.h. */
5225#include <sys/types.h> 4952#include <sys/types.h>
5226 /* Check that off_t can represent 2**63 - 1 correctly. 4953 /* Check that off_t can represent 2**63 - 1 correctly.
@@ -5239,14 +4966,58 @@ main ()
5239 return 0; 4966 return 0;
5240} 4967}
5241_ACEOF 4968_ACEOF
5242 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
5243 break 4986 break
4987else
4988 echo "$as_me: failed program was:" >&5
4989sed 's/^/| /' conftest.$ac_ext >&5
4990
4991
5244fi 4992fi
4993
5245rm -f core conftest.err conftest.$ac_objext 4994rm -f core conftest.err conftest.$ac_objext
5246 CC="$CC -n32" 4995 CC="$CC -n32"
5247 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
5248 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
5249fi 5019fi
5020
5250rm -f core conftest.err conftest.$ac_objext 5021rm -f core conftest.err conftest.$ac_objext
5251 break 5022 break
5252 done 5023 done
@@ -5254,19 +5025,23 @@ rm -f core conftest.err conftest.$ac_objext
5254 rm -f conftest.$ac_ext 5025 rm -f conftest.$ac_ext
5255 fi 5026 fi
5256fi 5027fi
5257{ $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
5258$as_echo "$ac_cv_sys_largefile_CC" >&6; } 5029echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6; }
5259 if test "$ac_cv_sys_largefile_CC" != no; then 5030 if test "$ac_cv_sys_largefile_CC" != no; then
5260 CC=$CC$ac_cv_sys_largefile_CC 5031 CC=$CC$ac_cv_sys_largefile_CC
5261 fi 5032 fi
5262 5033
5263 { $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
5264$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; }
5265if ${ac_cv_sys_file_offset_bits+:} false; then : 5036if test "${ac_cv_sys_file_offset_bits+set}" = set; then
5266 $as_echo_n "(cached) " >&6 5037 echo $ECHO_N "(cached) $ECHO_C" >&6
5267else 5038else
5268 while :; do 5039 while :; do
5269 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
5270/* end confdefs.h. */ 5045/* end confdefs.h. */
5271#include <sys/types.h> 5046#include <sys/types.h>
5272 /* Check that off_t can represent 2**63 - 1 correctly. 5047 /* Check that off_t can represent 2**63 - 1 correctly.
@@ -5285,11 +5060,37 @@ main ()
5285 return 0; 5060 return 0;
5286} 5061}
5287_ACEOF 5062_ACEOF
5288if 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
5289 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
5290fi 5086fi
5087
5291rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5088rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5292 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
5293/* end confdefs.h. */ 5094/* end confdefs.h. */
5294#define _FILE_OFFSET_BITS 64 5095#define _FILE_OFFSET_BITS 64
5295#include <sys/types.h> 5096#include <sys/types.h>
@@ -5309,16 +5110,38 @@ main ()
5309 return 0; 5110 return 0;
5310} 5111}
5311_ACEOF 5112_ACEOF
5312if 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
5313 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
5314fi 5136fi
5137
5315rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5138rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5316 ac_cv_sys_file_offset_bits=unknown 5139 ac_cv_sys_file_offset_bits=unknown
5317 break 5140 break
5318done 5141done
5319fi 5142fi
5320{ $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
5321$as_echo "$ac_cv_sys_file_offset_bits" >&6; } 5144echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6; }
5322case $ac_cv_sys_file_offset_bits in #( 5145case $ac_cv_sys_file_offset_bits in #(
5323 no | unknown) ;; 5146 no | unknown) ;;
5324 *) 5147 *)
@@ -5327,15 +5150,19 @@ cat >>confdefs.h <<_ACEOF
5327_ACEOF 5150_ACEOF
5328;; 5151;;
5329esac 5152esac
5330rm -rf conftest* 5153rm -f conftest*
5331 if test $ac_cv_sys_file_offset_bits = unknown; then 5154 if test $ac_cv_sys_file_offset_bits = unknown; then
5332 { $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
5333$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; }
5334if ${ac_cv_sys_large_files+:} false; then : 5157if test "${ac_cv_sys_large_files+set}" = set; then
5335 $as_echo_n "(cached) " >&6 5158 echo $ECHO_N "(cached) $ECHO_C" >&6
5336else 5159else
5337 while :; do 5160 while :; do
5338 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
5339/* end confdefs.h. */ 5166/* end confdefs.h. */
5340#include <sys/types.h> 5167#include <sys/types.h>
5341 /* Check that off_t can represent 2**63 - 1 correctly. 5168 /* Check that off_t can represent 2**63 - 1 correctly.
@@ -5354,11 +5181,37 @@ main ()
5354 return 0; 5181 return 0;
5355} 5182}
5356_ACEOF 5183_ACEOF
5357if 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
5358 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
5359fi 5207fi
5208
5360rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5209rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5361 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
5362/* end confdefs.h. */ 5215/* end confdefs.h. */
5363#define _LARGE_FILES 1 5216#define _LARGE_FILES 1
5364#include <sys/types.h> 5217#include <sys/types.h>
@@ -5378,16 +5231,38 @@ main ()
5378 return 0; 5231 return 0;
5379} 5232}
5380_ACEOF 5233_ACEOF
5381if 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
5382 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
5383fi 5257fi
5258
5384rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5259rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5385 ac_cv_sys_large_files=unknown 5260 ac_cv_sys_large_files=unknown
5386 break 5261 break
5387done 5262done
5388fi 5263fi
5389{ $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
5390$as_echo "$ac_cv_sys_large_files" >&6; } 5265echo "${ECHO_T}$ac_cv_sys_large_files" >&6; }
5391case $ac_cv_sys_large_files in #( 5266case $ac_cv_sys_large_files in #(
5392 no | unknown) ;; 5267 no | unknown) ;;
5393 *) 5268 *)
@@ -5396,13 +5271,15 @@ cat >>confdefs.h <<_ACEOF
5396_ACEOF 5271_ACEOF
5397;; 5272;;
5398esac 5273esac
5399rm -rf conftest* 5274rm -f conftest*
5400 fi 5275 fi
5401fi 5276fi
5402 5277
5403 5278
5404if test -z "$AR" ; then 5279if test -z "$AR" ; then
5405 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; }; }
5406fi 5283fi
5407 5284
5408# Use LOGIN_PROGRAM from environment if possible 5285# Use LOGIN_PROGRAM from environment if possible
@@ -5416,10 +5293,10 @@ else
5416 # Search for login 5293 # Search for login
5417 # 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.
5418set dummy login; ac_word=$2 5295set dummy login; ac_word=$2
5419{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 5296{ echo "$as_me:$LINENO: checking for $ac_word" >&5
5420$as_echo_n "checking for $ac_word... " >&6; } 5297echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
5421if ${ac_cv_path_LOGIN_PROGRAM_FALLBACK+:} false; then : 5298if test "${ac_cv_path_LOGIN_PROGRAM_FALLBACK+set}" = set; then
5422 $as_echo_n "(cached) " >&6 5299 echo $ECHO_N "(cached) $ECHO_C" >&6
5423else 5300else
5424 case $LOGIN_PROGRAM_FALLBACK in 5301 case $LOGIN_PROGRAM_FALLBACK in
5425 [\\/]* | ?:[\\/]*) 5302 [\\/]* | ?:[\\/]*)
@@ -5431,14 +5308,14 @@ for as_dir in $PATH
5431do 5308do
5432 IFS=$as_save_IFS 5309 IFS=$as_save_IFS
5433 test -z "$as_dir" && as_dir=. 5310 test -z "$as_dir" && as_dir=.
5434 for ac_exec_ext in '' $ac_executable_extensions; do 5311 for ac_exec_ext in '' $ac_executable_extensions; do
5435 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
5436 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"
5437 $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
5438 break 2 5315 break 2
5439 fi 5316 fi
5440done 5317done
5441 done 5318done
5442IFS=$as_save_IFS 5319IFS=$as_save_IFS
5443 5320
5444 ;; 5321 ;;
@@ -5446,11 +5323,11 @@ esac
5446fi 5323fi
5447LOGIN_PROGRAM_FALLBACK=$ac_cv_path_LOGIN_PROGRAM_FALLBACK 5324LOGIN_PROGRAM_FALLBACK=$ac_cv_path_LOGIN_PROGRAM_FALLBACK
5448if test -n "$LOGIN_PROGRAM_FALLBACK"; then 5325if test -n "$LOGIN_PROGRAM_FALLBACK"; then
5449 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LOGIN_PROGRAM_FALLBACK" >&5 5326 { echo "$as_me:$LINENO: result: $LOGIN_PROGRAM_FALLBACK" >&5
5450$as_echo "$LOGIN_PROGRAM_FALLBACK" >&6; } 5327echo "${ECHO_T}$LOGIN_PROGRAM_FALLBACK" >&6; }
5451else 5328else
5452 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 5329 { echo "$as_me:$LINENO: result: no" >&5
5453$as_echo "no" >&6; } 5330echo "${ECHO_T}no" >&6; }
5454fi 5331fi
5455 5332
5456 5333
@@ -5464,10 +5341,10 @@ fi
5464 5341
5465# 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.
5466set dummy passwd; ac_word=$2 5343set dummy passwd; ac_word=$2
5467{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 5344{ echo "$as_me:$LINENO: checking for $ac_word" >&5
5468$as_echo_n "checking for $ac_word... " >&6; } 5345echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
5469if ${ac_cv_path_PATH_PASSWD_PROG+:} false; then : 5346if test "${ac_cv_path_PATH_PASSWD_PROG+set}" = set; then
5470 $as_echo_n "(cached) " >&6 5347 echo $ECHO_N "(cached) $ECHO_C" >&6
5471else 5348else
5472 case $PATH_PASSWD_PROG in 5349 case $PATH_PASSWD_PROG in
5473 [\\/]* | ?:[\\/]*) 5350 [\\/]* | ?:[\\/]*)
@@ -5479,14 +5356,14 @@ for as_dir in $PATH
5479do 5356do
5480 IFS=$as_save_IFS 5357 IFS=$as_save_IFS
5481 test -z "$as_dir" && as_dir=. 5358 test -z "$as_dir" && as_dir=.
5482 for ac_exec_ext in '' $ac_executable_extensions; do 5359 for ac_exec_ext in '' $ac_executable_extensions; do
5483 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
5484 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"
5485 $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
5486 break 2 5363 break 2
5487 fi 5364 fi
5488done 5365done
5489 done 5366done
5490IFS=$as_save_IFS 5367IFS=$as_save_IFS
5491 5368
5492 ;; 5369 ;;
@@ -5494,11 +5371,11 @@ esac
5494fi 5371fi
5495PATH_PASSWD_PROG=$ac_cv_path_PATH_PASSWD_PROG 5372PATH_PASSWD_PROG=$ac_cv_path_PATH_PASSWD_PROG
5496if test -n "$PATH_PASSWD_PROG"; then 5373if test -n "$PATH_PASSWD_PROG"; then
5497 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATH_PASSWD_PROG" >&5 5374 { echo "$as_me:$LINENO: result: $PATH_PASSWD_PROG" >&5
5498$as_echo "$PATH_PASSWD_PROG" >&6; } 5375echo "${ECHO_T}$PATH_PASSWD_PROG" >&6; }
5499else 5376else
5500 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 5377 { echo "$as_me:$LINENO: result: no" >&5
5501$as_echo "no" >&6; } 5378echo "${ECHO_T}no" >&6; }
5502fi 5379fi
5503 5380
5504 5381
@@ -5515,14 +5392,18 @@ if test -z "$LD" ; then
5515fi 5392fi
5516 5393
5517 5394
5518{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 5395{ echo "$as_me:$LINENO: checking for inline" >&5
5519$as_echo_n "checking for inline... " >&6; } 5396echo $ECHO_N "checking for inline... $ECHO_C" >&6; }
5520if ${ac_cv_c_inline+:} false; then : 5397if test "${ac_cv_c_inline+set}" = set; then
5521 $as_echo_n "(cached) " >&6 5398 echo $ECHO_N "(cached) $ECHO_C" >&6
5522else 5399else
5523 ac_cv_c_inline=no 5400 ac_cv_c_inline=no
5524for ac_kw in inline __inline__ __inline; do 5401for ac_kw in inline __inline__ __inline; do
5525 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
5526/* end confdefs.h. */ 5407/* end confdefs.h. */
5527#ifndef __cplusplus 5408#ifndef __cplusplus
5528typedef int foo_t; 5409typedef int foo_t;
@@ -5531,16 +5412,39 @@ $ac_kw foo_t foo () {return 0; }
5531#endif 5412#endif
5532 5413
5533_ACEOF 5414_ACEOF
5534if 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
5535 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
5536fi 5438fi
5439
5537rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5440rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5538 test "$ac_cv_c_inline" != no && break 5441 test "$ac_cv_c_inline" != no && break
5539done 5442done
5540 5443
5541fi 5444fi
5542{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 5445{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
5543$as_echo "$ac_cv_c_inline" >&6; } 5446echo "${ECHO_T}$ac_cv_c_inline" >&6; }
5447
5544 5448
5545case $ac_cv_c_inline in 5449case $ac_cv_c_inline in
5546 inline | yes) ;; 5450 inline | yes) ;;
@@ -5558,48 +5462,312 @@ _ACEOF
5558esac 5462esac
5559 5463
5560 5464
5561ac_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
5562" 5466echo $ECHO_N "checking whether LLONG_MAX is declared... $ECHO_C" >&6; }
5563if 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
5564 have_llong_max=1 5519 have_llong_max=1
5565fi 5520fi
5566 5521
5567ac_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
5568 #include <sys/types.h> 5534 #include <sys/types.h>
5569 #include <sys/param.h> 5535 #include <sys/param.h>
5570 #include <dev/systrace.h> 5536 #include <dev/systrace.h>
5571 5537
5572" 5538
5573if 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
5574 have_systr_policy_kill=1 5580 have_systr_policy_kill=1
5575fi 5581fi
5576 5582
5577ac_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
5578 #include <sys/types.h> 5595 #include <sys/types.h>
5579 #include <sys/resource.h> 5596 #include <sys/resource.h>
5580 5597
5581"
5582if test "x$ac_cv_have_decl_RLIMIT_NPROC" = xyes; then :
5583 5598
5584$as_echo "#define HAVE_RLIMIT_NPROC /**/" >>confdefs.h 5599int
5600main ()
5601{
5602#ifndef RLIMIT_NPROC
5603 (void) RLIMIT_NPROC;
5604#endif
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
5633fi
5585 5634
5635rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5586fi 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. */
5587 5658
5588ac_fn_c_check_decl "$LINENO" "PR_SET_NO_NEW_PRIVS" "ac_cv_have_decl_PR_SET_NO_NEW_PRIVS" "
5589 #include <sys/types.h> 5659 #include <sys/types.h>
5590 #include <linux/prctl.h> 5660 #include <linux/prctl.h>
5591 5661
5592" 5662
5593if 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
5594 have_linux_no_new_privs=1 5704 have_linux_no_new_privs=1
5595fi 5705fi
5596 5706
5597 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
5598use_stack_protector=1 5766use_stack_protector=1
5599use_toolchain_hardening=1 5767use_toolchain_hardening=1
5600 5768
5601# Check whether --with-stackprotect was given. 5769# Check whether --with-stackprotect was given.
5602if test "${with_stackprotect+set}" = set; then : 5770if test "${with_stackprotect+set}" = set; then
5603 withval=$with_stackprotect; 5771 withval=$with_stackprotect;
5604 if test "x$withval" = "xno"; then 5772 if test "x$withval" = "xno"; then
5605 use_stack_protector=0 5773 use_stack_protector=0
@@ -5608,7 +5776,7 @@ fi
5608 5776
5609 5777
5610# Check whether --with-hardening was given. 5778# Check whether --with-hardening was given.
5611if test "${with_hardening+set}" = set; then : 5779if test "${with_hardening+set}" = set; then
5612 withval=$with_hardening; 5780 withval=$with_hardening;
5613 if test "x$withval" = "xno"; then 5781 if test "x$withval" = "xno"; then
5614 use_toolchain_hardening=0 5782 use_toolchain_hardening=0
@@ -5618,36 +5786,64 @@ fi
5618 5786
5619# 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
5620# on by default" for things like -fPIE. 5788# on by default" for things like -fPIE.
5621{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror" >&5 5789{ echo "$as_me:$LINENO: checking if $CC supports -Werror" >&5
5622$as_echo_n "checking if $CC supports -Werror... " >&6; } 5790echo $ECHO_N "checking if $CC supports -Werror... $ECHO_C" >&6; }
5623saved_CFLAGS="$CFLAGS" 5791saved_CFLAGS="$CFLAGS"
5624CFLAGS="$CFLAGS -Werror" 5792CFLAGS="$CFLAGS -Werror"
5625cat 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
5626/* end confdefs.h. */ 5798/* end confdefs.h. */
5627int main(void) { return 0; } 5799int main(void) { return 0; }
5628_ACEOF 5800_ACEOF
5629if ac_fn_c_try_compile "$LINENO"; then : 5801rm -f conftest.$ac_objext
5630 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 5802if { (ac_try="$ac_compile"
5631$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; }
5632 WERROR="-Werror" 5820 WERROR="-Werror"
5633else 5821else
5634 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 5822 echo "$as_me: failed program was:" >&5
5635$as_echo "no" >&6; } 5823sed 's/^/| /' conftest.$ac_ext >&5
5824
5825 { echo "$as_me:$LINENO: result: no" >&5
5826echo "${ECHO_T}no" >&6; }
5636 WERROR="" 5827 WERROR=""
5637 5828
5638fi 5829fi
5830
5639rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5831rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5640CFLAGS="$saved_CFLAGS" 5832CFLAGS="$saved_CFLAGS"
5641 5833
5642if test "$GCC" = "yes" || test "$GCC" = "egcs"; then 5834if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
5643 { 5835 {
5644 { $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
5645$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; }
5646 saved_CFLAGS="$CFLAGS" 5838 saved_CFLAGS="$CFLAGS"
5647 CFLAGS="$CFLAGS $WERROR -Qunused-arguments" 5839 CFLAGS="$CFLAGS $WERROR -Qunused-arguments"
5648 _define_flag="" 5840 _define_flag=""
5649 test "x$_define_flag" = "x" && _define_flag="-Qunused-arguments" 5841 test "x$_define_flag" = "x" && _define_flag="-Qunused-arguments"
5650 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
5651/* end confdefs.h. */ 5847/* end confdefs.h. */
5652 5848
5653#include <stdlib.h> 5849#include <stdlib.h>
@@ -5663,34 +5859,58 @@ int main(int argc, char **argv) {
5663} 5859}
5664 5860
5665_ACEOF 5861_ACEOF
5666if 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
5667 5879
5668if `grep -i "unrecognized option" conftest.err >/dev/null` 5880if `grep -i "unrecognized option" conftest.err >/dev/null`
5669then 5881then
5670 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 5882 { echo "$as_me:$LINENO: result: no" >&5
5671$as_echo "no" >&6; } 5883echo "${ECHO_T}no" >&6; }
5672 CFLAGS="$saved_CFLAGS" 5884 CFLAGS="$saved_CFLAGS"
5673else 5885else
5674 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 5886 { echo "$as_me:$LINENO: result: yes" >&5
5675$as_echo "yes" >&6; } 5887echo "${ECHO_T}yes" >&6; }
5676 CFLAGS="$saved_CFLAGS $_define_flag" 5888 CFLAGS="$saved_CFLAGS $_define_flag"
5677fi 5889fi
5678else 5890else
5679 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 5891 echo "$as_me: failed program was:" >&5
5680$as_echo "no" >&6; } 5892sed 's/^/| /' conftest.$ac_ext >&5
5893
5894 { echo "$as_me:$LINENO: result: no" >&5
5895echo "${ECHO_T}no" >&6; }
5681 CFLAGS="$saved_CFLAGS" 5896 CFLAGS="$saved_CFLAGS"
5682 5897
5683fi 5898fi
5899
5684rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5900rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5685} 5901}
5686 { 5902 {
5687 { $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
5688$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; }
5689 saved_CFLAGS="$CFLAGS" 5905 saved_CFLAGS="$CFLAGS"
5690 CFLAGS="$CFLAGS $WERROR -Wunknown-warning-option" 5906 CFLAGS="$CFLAGS $WERROR -Wunknown-warning-option"
5691 _define_flag="" 5907 _define_flag=""
5692 test "x$_define_flag" = "x" && _define_flag="-Wunknown-warning-option" 5908 test "x$_define_flag" = "x" && _define_flag="-Wunknown-warning-option"
5693 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
5694/* end confdefs.h. */ 5914/* end confdefs.h. */
5695 5915
5696#include <stdlib.h> 5916#include <stdlib.h>
@@ -5706,34 +5926,58 @@ int main(int argc, char **argv) {
5706} 5926}
5707 5927
5708_ACEOF 5928_ACEOF
5709if 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
5710 5946
5711if `grep -i "unrecognized option" conftest.err >/dev/null` 5947if `grep -i "unrecognized option" conftest.err >/dev/null`
5712then 5948then
5713 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 5949 { echo "$as_me:$LINENO: result: no" >&5
5714$as_echo "no" >&6; } 5950echo "${ECHO_T}no" >&6; }
5715 CFLAGS="$saved_CFLAGS" 5951 CFLAGS="$saved_CFLAGS"
5716else 5952else
5717 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 5953 { echo "$as_me:$LINENO: result: yes" >&5
5718$as_echo "yes" >&6; } 5954echo "${ECHO_T}yes" >&6; }
5719 CFLAGS="$saved_CFLAGS $_define_flag" 5955 CFLAGS="$saved_CFLAGS $_define_flag"
5720fi 5956fi
5721else 5957else
5722 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 5958 echo "$as_me: failed program was:" >&5
5723$as_echo "no" >&6; } 5959sed 's/^/| /' conftest.$ac_ext >&5
5960
5961 { echo "$as_me:$LINENO: result: no" >&5
5962echo "${ECHO_T}no" >&6; }
5724 CFLAGS="$saved_CFLAGS" 5963 CFLAGS="$saved_CFLAGS"
5725 5964
5726fi 5965fi
5966
5727rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 5967rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5728} 5968}
5729 { 5969 {
5730 { $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
5731$as_echo_n "checking if $CC supports compile flag -Wall... " >&6; } 5971echo $ECHO_N "checking if $CC supports compile flag -Wall... $ECHO_C" >&6; }
5732 saved_CFLAGS="$CFLAGS" 5972 saved_CFLAGS="$CFLAGS"
5733 CFLAGS="$CFLAGS $WERROR -Wall" 5973 CFLAGS="$CFLAGS $WERROR -Wall"
5734 _define_flag="" 5974 _define_flag=""
5735 test "x$_define_flag" = "x" && _define_flag="-Wall" 5975 test "x$_define_flag" = "x" && _define_flag="-Wall"
5736 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
5737/* end confdefs.h. */ 5981/* end confdefs.h. */
5738 5982
5739#include <stdlib.h> 5983#include <stdlib.h>
@@ -5749,34 +5993,58 @@ int main(int argc, char **argv) {
5749} 5993}
5750 5994
5751_ACEOF 5995_ACEOF
5752if 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
5753 6013
5754if `grep -i "unrecognized option" conftest.err >/dev/null` 6014if `grep -i "unrecognized option" conftest.err >/dev/null`
5755then 6015then
5756 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6016 { echo "$as_me:$LINENO: result: no" >&5
5757$as_echo "no" >&6; } 6017echo "${ECHO_T}no" >&6; }
5758 CFLAGS="$saved_CFLAGS" 6018 CFLAGS="$saved_CFLAGS"
5759else 6019else
5760 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6020 { echo "$as_me:$LINENO: result: yes" >&5
5761$as_echo "yes" >&6; } 6021echo "${ECHO_T}yes" >&6; }
5762 CFLAGS="$saved_CFLAGS $_define_flag" 6022 CFLAGS="$saved_CFLAGS $_define_flag"
5763fi 6023fi
5764else 6024else
5765 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6025 echo "$as_me: failed program was:" >&5
5766$as_echo "no" >&6; } 6026sed 's/^/| /' conftest.$ac_ext >&5
6027
6028 { echo "$as_me:$LINENO: result: no" >&5
6029echo "${ECHO_T}no" >&6; }
5767 CFLAGS="$saved_CFLAGS" 6030 CFLAGS="$saved_CFLAGS"
5768 6031
5769fi 6032fi
6033
5770rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6034rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5771} 6035}
5772 { 6036 {
5773 { $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
5774$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; }
5775 saved_CFLAGS="$CFLAGS" 6039 saved_CFLAGS="$CFLAGS"
5776 CFLAGS="$CFLAGS $WERROR -Wpointer-arith" 6040 CFLAGS="$CFLAGS $WERROR -Wpointer-arith"
5777 _define_flag="" 6041 _define_flag=""
5778 test "x$_define_flag" = "x" && _define_flag="-Wpointer-arith" 6042 test "x$_define_flag" = "x" && _define_flag="-Wpointer-arith"
5779 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
5780/* end confdefs.h. */ 6048/* end confdefs.h. */
5781 6049
5782#include <stdlib.h> 6050#include <stdlib.h>
@@ -5792,34 +6060,58 @@ int main(int argc, char **argv) {
5792} 6060}
5793 6061
5794_ACEOF 6062_ACEOF
5795if 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
5796 6080
5797if `grep -i "unrecognized option" conftest.err >/dev/null` 6081if `grep -i "unrecognized option" conftest.err >/dev/null`
5798then 6082then
5799 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6083 { echo "$as_me:$LINENO: result: no" >&5
5800$as_echo "no" >&6; } 6084echo "${ECHO_T}no" >&6; }
5801 CFLAGS="$saved_CFLAGS" 6085 CFLAGS="$saved_CFLAGS"
5802else 6086else
5803 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6087 { echo "$as_me:$LINENO: result: yes" >&5
5804$as_echo "yes" >&6; } 6088echo "${ECHO_T}yes" >&6; }
5805 CFLAGS="$saved_CFLAGS $_define_flag" 6089 CFLAGS="$saved_CFLAGS $_define_flag"
5806fi 6090fi
5807else 6091else
5808 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6092 echo "$as_me: failed program was:" >&5
5809$as_echo "no" >&6; } 6093sed 's/^/| /' conftest.$ac_ext >&5
6094
6095 { echo "$as_me:$LINENO: result: no" >&5
6096echo "${ECHO_T}no" >&6; }
5810 CFLAGS="$saved_CFLAGS" 6097 CFLAGS="$saved_CFLAGS"
5811 6098
5812fi 6099fi
6100
5813rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6101rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5814} 6102}
5815 { 6103 {
5816 { $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
5817$as_echo_n "checking if $CC supports compile flag -Wuninitialized... " >&6; } 6105echo $ECHO_N "checking if $CC supports compile flag -Wuninitialized... $ECHO_C" >&6; }
5818 saved_CFLAGS="$CFLAGS" 6106 saved_CFLAGS="$CFLAGS"
5819 CFLAGS="$CFLAGS $WERROR -Wuninitialized" 6107 CFLAGS="$CFLAGS $WERROR -Wuninitialized"
5820 _define_flag="" 6108 _define_flag=""
5821 test "x$_define_flag" = "x" && _define_flag="-Wuninitialized" 6109 test "x$_define_flag" = "x" && _define_flag="-Wuninitialized"
5822 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
5823/* end confdefs.h. */ 6115/* end confdefs.h. */
5824 6116
5825#include <stdlib.h> 6117#include <stdlib.h>
@@ -5835,34 +6127,58 @@ int main(int argc, char **argv) {
5835} 6127}
5836 6128
5837_ACEOF 6129_ACEOF
5838if 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
5839 6147
5840if `grep -i "unrecognized option" conftest.err >/dev/null` 6148if `grep -i "unrecognized option" conftest.err >/dev/null`
5841then 6149then
5842 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6150 { echo "$as_me:$LINENO: result: no" >&5
5843$as_echo "no" >&6; } 6151echo "${ECHO_T}no" >&6; }
5844 CFLAGS="$saved_CFLAGS" 6152 CFLAGS="$saved_CFLAGS"
5845else 6153else
5846 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6154 { echo "$as_me:$LINENO: result: yes" >&5
5847$as_echo "yes" >&6; } 6155echo "${ECHO_T}yes" >&6; }
5848 CFLAGS="$saved_CFLAGS $_define_flag" 6156 CFLAGS="$saved_CFLAGS $_define_flag"
5849fi 6157fi
5850else 6158else
5851 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6159 echo "$as_me: failed program was:" >&5
5852$as_echo "no" >&6; } 6160sed 's/^/| /' conftest.$ac_ext >&5
6161
6162 { echo "$as_me:$LINENO: result: no" >&5
6163echo "${ECHO_T}no" >&6; }
5853 CFLAGS="$saved_CFLAGS" 6164 CFLAGS="$saved_CFLAGS"
5854 6165
5855fi 6166fi
6167
5856rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6168rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5857} 6169}
5858 { 6170 {
5859 { $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
5860$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; }
5861 saved_CFLAGS="$CFLAGS" 6173 saved_CFLAGS="$CFLAGS"
5862 CFLAGS="$CFLAGS $WERROR -Wsign-compare" 6174 CFLAGS="$CFLAGS $WERROR -Wsign-compare"
5863 _define_flag="" 6175 _define_flag=""
5864 test "x$_define_flag" = "x" && _define_flag="-Wsign-compare" 6176 test "x$_define_flag" = "x" && _define_flag="-Wsign-compare"
5865 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
5866/* end confdefs.h. */ 6182/* end confdefs.h. */
5867 6183
5868#include <stdlib.h> 6184#include <stdlib.h>
@@ -5878,34 +6194,58 @@ int main(int argc, char **argv) {
5878} 6194}
5879 6195
5880_ACEOF 6196_ACEOF
5881if 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
5882 6214
5883if `grep -i "unrecognized option" conftest.err >/dev/null` 6215if `grep -i "unrecognized option" conftest.err >/dev/null`
5884then 6216then
5885 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6217 { echo "$as_me:$LINENO: result: no" >&5
5886$as_echo "no" >&6; } 6218echo "${ECHO_T}no" >&6; }
5887 CFLAGS="$saved_CFLAGS" 6219 CFLAGS="$saved_CFLAGS"
5888else 6220else
5889 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6221 { echo "$as_me:$LINENO: result: yes" >&5
5890$as_echo "yes" >&6; } 6222echo "${ECHO_T}yes" >&6; }
5891 CFLAGS="$saved_CFLAGS $_define_flag" 6223 CFLAGS="$saved_CFLAGS $_define_flag"
5892fi 6224fi
5893else 6225else
5894 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6226 echo "$as_me: failed program was:" >&5
5895$as_echo "no" >&6; } 6227sed 's/^/| /' conftest.$ac_ext >&5
6228
6229 { echo "$as_me:$LINENO: result: no" >&5
6230echo "${ECHO_T}no" >&6; }
5896 CFLAGS="$saved_CFLAGS" 6231 CFLAGS="$saved_CFLAGS"
5897 6232
5898fi 6233fi
6234
5899rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6235rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5900} 6236}
5901 { 6237 {
5902 { $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
5903$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; }
5904 saved_CFLAGS="$CFLAGS" 6240 saved_CFLAGS="$CFLAGS"
5905 CFLAGS="$CFLAGS $WERROR -Wformat-security" 6241 CFLAGS="$CFLAGS $WERROR -Wformat-security"
5906 _define_flag="" 6242 _define_flag=""
5907 test "x$_define_flag" = "x" && _define_flag="-Wformat-security" 6243 test "x$_define_flag" = "x" && _define_flag="-Wformat-security"
5908 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
5909/* end confdefs.h. */ 6249/* end confdefs.h. */
5910 6250
5911#include <stdlib.h> 6251#include <stdlib.h>
@@ -5921,34 +6261,58 @@ int main(int argc, char **argv) {
5921} 6261}
5922 6262
5923_ACEOF 6263_ACEOF
5924if 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
5925 6281
5926if `grep -i "unrecognized option" conftest.err >/dev/null` 6282if `grep -i "unrecognized option" conftest.err >/dev/null`
5927then 6283then
5928 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6284 { echo "$as_me:$LINENO: result: no" >&5
5929$as_echo "no" >&6; } 6285echo "${ECHO_T}no" >&6; }
5930 CFLAGS="$saved_CFLAGS" 6286 CFLAGS="$saved_CFLAGS"
5931else 6287else
5932 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6288 { echo "$as_me:$LINENO: result: yes" >&5
5933$as_echo "yes" >&6; } 6289echo "${ECHO_T}yes" >&6; }
5934 CFLAGS="$saved_CFLAGS $_define_flag" 6290 CFLAGS="$saved_CFLAGS $_define_flag"
5935fi 6291fi
5936else 6292else
5937 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6293 echo "$as_me: failed program was:" >&5
5938$as_echo "no" >&6; } 6294sed 's/^/| /' conftest.$ac_ext >&5
6295
6296 { echo "$as_me:$LINENO: result: no" >&5
6297echo "${ECHO_T}no" >&6; }
5939 CFLAGS="$saved_CFLAGS" 6298 CFLAGS="$saved_CFLAGS"
5940 6299
5941fi 6300fi
6301
5942rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6302rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5943} 6303}
5944 { 6304 {
5945 { $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
5946$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; }
5947 saved_CFLAGS="$CFLAGS" 6307 saved_CFLAGS="$CFLAGS"
5948 CFLAGS="$CFLAGS $WERROR -Wsizeof-pointer-memaccess" 6308 CFLAGS="$CFLAGS $WERROR -Wsizeof-pointer-memaccess"
5949 _define_flag="" 6309 _define_flag=""
5950 test "x$_define_flag" = "x" && _define_flag="-Wsizeof-pointer-memaccess" 6310 test "x$_define_flag" = "x" && _define_flag="-Wsizeof-pointer-memaccess"
5951 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
5952/* end confdefs.h. */ 6316/* end confdefs.h. */
5953 6317
5954#include <stdlib.h> 6318#include <stdlib.h>
@@ -5964,34 +6328,58 @@ int main(int argc, char **argv) {
5964} 6328}
5965 6329
5966_ACEOF 6330_ACEOF
5967if 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
5968 6348
5969if `grep -i "unrecognized option" conftest.err >/dev/null` 6349if `grep -i "unrecognized option" conftest.err >/dev/null`
5970then 6350then
5971 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6351 { echo "$as_me:$LINENO: result: no" >&5
5972$as_echo "no" >&6; } 6352echo "${ECHO_T}no" >&6; }
5973 CFLAGS="$saved_CFLAGS" 6353 CFLAGS="$saved_CFLAGS"
5974else 6354else
5975 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6355 { echo "$as_me:$LINENO: result: yes" >&5
5976$as_echo "yes" >&6; } 6356echo "${ECHO_T}yes" >&6; }
5977 CFLAGS="$saved_CFLAGS $_define_flag" 6357 CFLAGS="$saved_CFLAGS $_define_flag"
5978fi 6358fi
5979else 6359else
5980 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6360 echo "$as_me: failed program was:" >&5
5981$as_echo "no" >&6; } 6361sed 's/^/| /' conftest.$ac_ext >&5
6362
6363 { echo "$as_me:$LINENO: result: no" >&5
6364echo "${ECHO_T}no" >&6; }
5982 CFLAGS="$saved_CFLAGS" 6365 CFLAGS="$saved_CFLAGS"
5983 6366
5984fi 6367fi
6368
5985rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6369rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5986} 6370}
5987 { 6371 {
5988 { $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
5989$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; }
5990 saved_CFLAGS="$CFLAGS" 6374 saved_CFLAGS="$CFLAGS"
5991 CFLAGS="$CFLAGS $WERROR -Wpointer-sign" 6375 CFLAGS="$CFLAGS $WERROR -Wpointer-sign"
5992 _define_flag="-Wno-pointer-sign" 6376 _define_flag="-Wno-pointer-sign"
5993 test "x$_define_flag" = "x" && _define_flag="-Wpointer-sign" 6377 test "x$_define_flag" = "x" && _define_flag="-Wpointer-sign"
5994 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
5995/* end confdefs.h. */ 6383/* end confdefs.h. */
5996 6384
5997#include <stdlib.h> 6385#include <stdlib.h>
@@ -6007,34 +6395,58 @@ int main(int argc, char **argv) {
6007} 6395}
6008 6396
6009_ACEOF 6397_ACEOF
6010if 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
6011 6415
6012if `grep -i "unrecognized option" conftest.err >/dev/null` 6416if `grep -i "unrecognized option" conftest.err >/dev/null`
6013then 6417then
6014 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6418 { echo "$as_me:$LINENO: result: no" >&5
6015$as_echo "no" >&6; } 6419echo "${ECHO_T}no" >&6; }
6016 CFLAGS="$saved_CFLAGS" 6420 CFLAGS="$saved_CFLAGS"
6017else 6421else
6018 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6422 { echo "$as_me:$LINENO: result: yes" >&5
6019$as_echo "yes" >&6; } 6423echo "${ECHO_T}yes" >&6; }
6020 CFLAGS="$saved_CFLAGS $_define_flag" 6424 CFLAGS="$saved_CFLAGS $_define_flag"
6021fi 6425fi
6022else 6426else
6023 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6427 echo "$as_me: failed program was:" >&5
6024$as_echo "no" >&6; } 6428sed 's/^/| /' conftest.$ac_ext >&5
6429
6430 { echo "$as_me:$LINENO: result: no" >&5
6431echo "${ECHO_T}no" >&6; }
6025 CFLAGS="$saved_CFLAGS" 6432 CFLAGS="$saved_CFLAGS"
6026 6433
6027fi 6434fi
6435
6028rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6436rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6029} 6437}
6030 { 6438 {
6031 { $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
6032$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; }
6033 saved_CFLAGS="$CFLAGS" 6441 saved_CFLAGS="$CFLAGS"
6034 CFLAGS="$CFLAGS $WERROR -Wunused-result" 6442 CFLAGS="$CFLAGS $WERROR -Wunused-result"
6035 _define_flag="-Wno-unused-result" 6443 _define_flag="-Wno-unused-result"
6036 test "x$_define_flag" = "x" && _define_flag="-Wunused-result" 6444 test "x$_define_flag" = "x" && _define_flag="-Wunused-result"
6037 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
6038/* end confdefs.h. */ 6450/* end confdefs.h. */
6039 6451
6040#include <stdlib.h> 6452#include <stdlib.h>
@@ -6050,34 +6462,58 @@ int main(int argc, char **argv) {
6050} 6462}
6051 6463
6052_ACEOF 6464_ACEOF
6053if 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
6054 6482
6055if `grep -i "unrecognized option" conftest.err >/dev/null` 6483if `grep -i "unrecognized option" conftest.err >/dev/null`
6056then 6484then
6057 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6485 { echo "$as_me:$LINENO: result: no" >&5
6058$as_echo "no" >&6; } 6486echo "${ECHO_T}no" >&6; }
6059 CFLAGS="$saved_CFLAGS" 6487 CFLAGS="$saved_CFLAGS"
6060else 6488else
6061 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6489 { echo "$as_me:$LINENO: result: yes" >&5
6062$as_echo "yes" >&6; } 6490echo "${ECHO_T}yes" >&6; }
6063 CFLAGS="$saved_CFLAGS $_define_flag" 6491 CFLAGS="$saved_CFLAGS $_define_flag"
6064fi 6492fi
6065else 6493else
6066 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6494 echo "$as_me: failed program was:" >&5
6067$as_echo "no" >&6; } 6495sed 's/^/| /' conftest.$ac_ext >&5
6496
6497 { echo "$as_me:$LINENO: result: no" >&5
6498echo "${ECHO_T}no" >&6; }
6068 CFLAGS="$saved_CFLAGS" 6499 CFLAGS="$saved_CFLAGS"
6069 6500
6070fi 6501fi
6502
6071rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6503rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6072} 6504}
6073 { 6505 {
6074 { $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
6075$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; }
6076 saved_CFLAGS="$CFLAGS" 6508 saved_CFLAGS="$CFLAGS"
6077 CFLAGS="$CFLAGS $WERROR -fno-strict-aliasing" 6509 CFLAGS="$CFLAGS $WERROR -fno-strict-aliasing"
6078 _define_flag="" 6510 _define_flag=""
6079 test "x$_define_flag" = "x" && _define_flag="-fno-strict-aliasing" 6511 test "x$_define_flag" = "x" && _define_flag="-fno-strict-aliasing"
6080 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
6081/* end confdefs.h. */ 6517/* end confdefs.h. */
6082 6518
6083#include <stdlib.h> 6519#include <stdlib.h>
@@ -6093,34 +6529,58 @@ int main(int argc, char **argv) {
6093} 6529}
6094 6530
6095_ACEOF 6531_ACEOF
6096if 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
6097 6549
6098if `grep -i "unrecognized option" conftest.err >/dev/null` 6550if `grep -i "unrecognized option" conftest.err >/dev/null`
6099then 6551then
6100 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6552 { echo "$as_me:$LINENO: result: no" >&5
6101$as_echo "no" >&6; } 6553echo "${ECHO_T}no" >&6; }
6102 CFLAGS="$saved_CFLAGS" 6554 CFLAGS="$saved_CFLAGS"
6103else 6555else
6104 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6556 { echo "$as_me:$LINENO: result: yes" >&5
6105$as_echo "yes" >&6; } 6557echo "${ECHO_T}yes" >&6; }
6106 CFLAGS="$saved_CFLAGS $_define_flag" 6558 CFLAGS="$saved_CFLAGS $_define_flag"
6107fi 6559fi
6108else 6560else
6109 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6561 echo "$as_me: failed program was:" >&5
6110$as_echo "no" >&6; } 6562sed 's/^/| /' conftest.$ac_ext >&5
6563
6564 { echo "$as_me:$LINENO: result: no" >&5
6565echo "${ECHO_T}no" >&6; }
6111 CFLAGS="$saved_CFLAGS" 6566 CFLAGS="$saved_CFLAGS"
6112 6567
6113fi 6568fi
6569
6114rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6570rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6115} 6571}
6116 { 6572 {
6117 { $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
6118$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; }
6119 saved_CFLAGS="$CFLAGS" 6575 saved_CFLAGS="$CFLAGS"
6120 CFLAGS="$CFLAGS $WERROR -D_FORTIFY_SOURCE=2" 6576 CFLAGS="$CFLAGS $WERROR -D_FORTIFY_SOURCE=2"
6121 _define_flag="" 6577 _define_flag=""
6122 test "x$_define_flag" = "x" && _define_flag="-D_FORTIFY_SOURCE=2" 6578 test "x$_define_flag" = "x" && _define_flag="-D_FORTIFY_SOURCE=2"
6123 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
6124/* end confdefs.h. */ 6584/* end confdefs.h. */
6125 6585
6126#include <stdlib.h> 6586#include <stdlib.h>
@@ -6136,35 +6596,59 @@ int main(int argc, char **argv) {
6136} 6596}
6137 6597
6138_ACEOF 6598_ACEOF
6139if 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
6140 6616
6141if `grep -i "unrecognized option" conftest.err >/dev/null` 6617if `grep -i "unrecognized option" conftest.err >/dev/null`
6142then 6618then
6143 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6619 { echo "$as_me:$LINENO: result: no" >&5
6144$as_echo "no" >&6; } 6620echo "${ECHO_T}no" >&6; }
6145 CFLAGS="$saved_CFLAGS" 6621 CFLAGS="$saved_CFLAGS"
6146else 6622else
6147 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6623 { echo "$as_me:$LINENO: result: yes" >&5
6148$as_echo "yes" >&6; } 6624echo "${ECHO_T}yes" >&6; }
6149 CFLAGS="$saved_CFLAGS $_define_flag" 6625 CFLAGS="$saved_CFLAGS $_define_flag"
6150fi 6626fi
6151else 6627else
6152 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6628 echo "$as_me: failed program was:" >&5
6153$as_echo "no" >&6; } 6629sed 's/^/| /' conftest.$ac_ext >&5
6630
6631 { echo "$as_me:$LINENO: result: no" >&5
6632echo "${ECHO_T}no" >&6; }
6154 CFLAGS="$saved_CFLAGS" 6633 CFLAGS="$saved_CFLAGS"
6155 6634
6156fi 6635fi
6636
6157rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 6637rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6158} 6638}
6159 if test "x$use_toolchain_hardening" = "x1"; then 6639 if test "x$use_toolchain_hardening" = "x1"; then
6160 { 6640 {
6161 { $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
6162$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; }
6163 saved_LDFLAGS="$LDFLAGS" 6643 saved_LDFLAGS="$LDFLAGS"
6164 LDFLAGS="$LDFLAGS $WERROR -Wl,-z,relro" 6644 LDFLAGS="$LDFLAGS $WERROR -Wl,-z,relro"
6165 _define_flag="" 6645 _define_flag=""
6166 test "x$_define_flag" = "x" && _define_flag="-Wl,-z,relro" 6646 test "x$_define_flag" = "x" && _define_flag="-Wl,-z,relro"
6167 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
6168/* end confdefs.h. */ 6652/* end confdefs.h. */
6169 6653
6170#include <stdlib.h> 6654#include <stdlib.h>
@@ -6180,27 +6664,52 @@ int main(int argc, char **argv) {
6180} 6664}
6181 6665
6182_ACEOF 6666_ACEOF
6183if ac_fn_c_try_link "$LINENO"; then : 6667rm -f conftest.$ac_objext conftest$ac_exeext
6184 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6668if { (ac_try="$ac_link"
6185$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; }
6186 LDFLAGS="$saved_LDFLAGS $_define_flag" 6687 LDFLAGS="$saved_LDFLAGS $_define_flag"
6187else 6688else
6188 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6689 echo "$as_me: failed program was:" >&5
6189$as_echo "no" >&6; } 6690sed 's/^/| /' conftest.$ac_ext >&5
6691
6692 { echo "$as_me:$LINENO: result: no" >&5
6693echo "${ECHO_T}no" >&6; }
6190 LDFLAGS="$saved_LDFLAGS" 6694 LDFLAGS="$saved_LDFLAGS"
6191 6695
6192fi 6696fi
6193rm -f core conftest.err conftest.$ac_objext \ 6697
6194 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
6195} 6700}
6196 { 6701 {
6197 { $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
6198$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; }
6199 saved_LDFLAGS="$LDFLAGS" 6704 saved_LDFLAGS="$LDFLAGS"
6200 LDFLAGS="$LDFLAGS $WERROR -Wl,-z,now" 6705 LDFLAGS="$LDFLAGS $WERROR -Wl,-z,now"
6201 _define_flag="" 6706 _define_flag=""
6202 test "x$_define_flag" = "x" && _define_flag="-Wl,-z,now" 6707 test "x$_define_flag" = "x" && _define_flag="-Wl,-z,now"
6203 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
6204/* end confdefs.h. */ 6713/* end confdefs.h. */
6205 6714
6206#include <stdlib.h> 6715#include <stdlib.h>
@@ -6216,27 +6725,52 @@ int main(int argc, char **argv) {
6216} 6725}
6217 6726
6218_ACEOF 6727_ACEOF
6219if ac_fn_c_try_link "$LINENO"; then : 6728rm -f conftest.$ac_objext conftest$ac_exeext
6220 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6729if { (ac_try="$ac_link"
6221$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; }
6222 LDFLAGS="$saved_LDFLAGS $_define_flag" 6748 LDFLAGS="$saved_LDFLAGS $_define_flag"
6223else 6749else
6224 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6750 echo "$as_me: failed program was:" >&5
6225$as_echo "no" >&6; } 6751sed 's/^/| /' conftest.$ac_ext >&5
6752
6753 { echo "$as_me:$LINENO: result: no" >&5
6754echo "${ECHO_T}no" >&6; }
6226 LDFLAGS="$saved_LDFLAGS" 6755 LDFLAGS="$saved_LDFLAGS"
6227 6756
6228fi 6757fi
6229rm -f core conftest.err conftest.$ac_objext \ 6758
6230 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
6231} 6761}
6232 { 6762 {
6233 { $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
6234$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; }
6235 saved_LDFLAGS="$LDFLAGS" 6765 saved_LDFLAGS="$LDFLAGS"
6236 LDFLAGS="$LDFLAGS $WERROR -Wl,-z,noexecstack" 6766 LDFLAGS="$LDFLAGS $WERROR -Wl,-z,noexecstack"
6237 _define_flag="" 6767 _define_flag=""
6238 test "x$_define_flag" = "x" && _define_flag="-Wl,-z,noexecstack" 6768 test "x$_define_flag" = "x" && _define_flag="-Wl,-z,noexecstack"
6239 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
6240/* end confdefs.h. */ 6774/* end confdefs.h. */
6241 6775
6242#include <stdlib.h> 6776#include <stdlib.h>
@@ -6252,18 +6786,39 @@ int main(int argc, char **argv) {
6252} 6786}
6253 6787
6254_ACEOF 6788_ACEOF
6255if ac_fn_c_try_link "$LINENO"; then : 6789rm -f conftest.$ac_objext conftest$ac_exeext
6256 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6790if { (ac_try="$ac_link"
6257$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; }
6258 LDFLAGS="$saved_LDFLAGS $_define_flag" 6809 LDFLAGS="$saved_LDFLAGS $_define_flag"
6259else 6810else
6260 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6811 echo "$as_me: failed program was:" >&5
6261$as_echo "no" >&6; } 6812sed 's/^/| /' conftest.$ac_ext >&5
6813
6814 { echo "$as_me:$LINENO: result: no" >&5
6815echo "${ECHO_T}no" >&6; }
6262 LDFLAGS="$saved_LDFLAGS" 6816 LDFLAGS="$saved_LDFLAGS"
6263 6817
6264fi 6818fi
6265rm -f core conftest.err conftest.$ac_objext \ 6819
6266 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
6267} 6822}
6268 # NB. -ftrapv expects certain support functions to be present in 6823 # NB. -ftrapv expects certain support functions to be present in
6269 # the compiler library (libgcc or similar) to detect integer operations 6824 # the compiler library (libgcc or similar) to detect integer operations
@@ -6271,13 +6826,17 @@ rm -f core conftest.err conftest.$ac_objext \
6271 # actually links. The test program compiled/linked includes a number 6826 # actually links. The test program compiled/linked includes a number
6272 # of integer operations that should exercise this. 6827 # of integer operations that should exercise this.
6273 { 6828 {
6274 { $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
6275$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; }
6276 saved_CFLAGS="$CFLAGS" 6831 saved_CFLAGS="$CFLAGS"
6277 CFLAGS="$CFLAGS $WERROR -ftrapv" 6832 CFLAGS="$CFLAGS $WERROR -ftrapv"
6278 _define_flag="" 6833 _define_flag=""
6279 test "x$_define_flag" = "x" && _define_flag="-ftrapv" 6834 test "x$_define_flag" = "x" && _define_flag="-ftrapv"
6280 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
6281/* end confdefs.h. */ 6840/* end confdefs.h. */
6282 6841
6283#include <stdlib.h> 6842#include <stdlib.h>
@@ -6293,30 +6852,51 @@ int main(int argc, char **argv) {
6293} 6852}
6294 6853
6295_ACEOF 6854_ACEOF
6296if 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
6297 6873
6298if `grep -i "unrecognized option" conftest.err >/dev/null` 6874if `grep -i "unrecognized option" conftest.err >/dev/null`
6299then 6875then
6300 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6876 { echo "$as_me:$LINENO: result: no" >&5
6301$as_echo "no" >&6; } 6877echo "${ECHO_T}no" >&6; }
6302 CFLAGS="$saved_CFLAGS" 6878 CFLAGS="$saved_CFLAGS"
6303else 6879else
6304 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6880 { echo "$as_me:$LINENO: result: yes" >&5
6305$as_echo "yes" >&6; } 6881echo "${ECHO_T}yes" >&6; }
6306 CFLAGS="$saved_CFLAGS $_define_flag" 6882 CFLAGS="$saved_CFLAGS $_define_flag"
6307fi 6883fi
6308else 6884else
6309 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6885 echo "$as_me: failed program was:" >&5
6310$as_echo "no" >&6; } 6886sed 's/^/| /' conftest.$ac_ext >&5
6887
6888 { echo "$as_me:$LINENO: result: no" >&5
6889echo "${ECHO_T}no" >&6; }
6311 CFLAGS="$saved_CFLAGS" 6890 CFLAGS="$saved_CFLAGS"
6312 6891
6313fi 6892fi
6314rm -f core conftest.err conftest.$ac_objext \ 6893
6315 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
6316} 6896}
6317 fi 6897 fi
6318 { $as_echo "$as_me:${as_lineno-$LINENO}: checking gcc version" >&5 6898 { echo "$as_me:$LINENO: checking gcc version" >&5
6319$as_echo_n "checking gcc version... " >&6; } 6899echo $ECHO_N "checking gcc version... $ECHO_C" >&6; }
6320 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'` 6900 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
6321 case $GCC_VER in 6901 case $GCC_VER in
6322 1.*) no_attrib_nonnull=1 ;; 6902 1.*) no_attrib_nonnull=1 ;;
@@ -6326,14 +6906,18 @@ $as_echo_n "checking gcc version... " >&6; }
6326 2.*) no_attrib_nonnull=1 ;; 6906 2.*) no_attrib_nonnull=1 ;;
6327 *) ;; 6907 *) ;;
6328 esac 6908 esac
6329 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCC_VER" >&5 6909 { echo "$as_me:$LINENO: result: $GCC_VER" >&5
6330$as_echo "$GCC_VER" >&6; } 6910echo "${ECHO_T}$GCC_VER" >&6; }
6331 6911
6332 { $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
6333$as_echo_n "checking if $CC accepts -fno-builtin-memset... " >&6; } 6913echo $ECHO_N "checking if $CC accepts -fno-builtin-memset... $ECHO_C" >&6; }
6334 saved_CFLAGS="$CFLAGS" 6914 saved_CFLAGS="$CFLAGS"
6335 CFLAGS="$CFLAGS -fno-builtin-memset" 6915 CFLAGS="$CFLAGS -fno-builtin-memset"
6336 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
6337/* end confdefs.h. */ 6921/* end confdefs.h. */
6338 #include <string.h> 6922 #include <string.h>
6339int 6923int
@@ -6344,17 +6928,38 @@ main ()
6344 return 0; 6928 return 0;
6345} 6929}
6346_ACEOF 6930_ACEOF
6347if ac_fn_c_try_link "$LINENO"; then : 6931rm -f conftest.$ac_objext conftest$ac_exeext
6348 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6932if { (ac_try="$ac_link"
6349$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; }
6350else 6951else
6351 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 6952 echo "$as_me: failed program was:" >&5
6352$as_echo "no" >&6; } 6953sed 's/^/| /' conftest.$ac_ext >&5
6954
6955 { echo "$as_me:$LINENO: result: no" >&5
6956echo "${ECHO_T}no" >&6; }
6353 CFLAGS="$saved_CFLAGS" 6957 CFLAGS="$saved_CFLAGS"
6354 6958
6355fi 6959fi
6356rm -f core conftest.err conftest.$ac_objext \ 6960
6357 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
6358 6963
6359 # -fstack-protector-all doesn't always work for some GCC versions 6964 # -fstack-protector-all doesn't always work for some GCC versions
6360 # 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
@@ -6362,13 +6967,17 @@ rm -f core conftest.err conftest.$ac_objext \
6362 if test "x$use_stack_protector" = "x1"; then 6967 if test "x$use_stack_protector" = "x1"; then
6363 for t in -fstack-protector-strong -fstack-protector-all \ 6968 for t in -fstack-protector-strong -fstack-protector-all \
6364 -fstack-protector; do 6969 -fstack-protector; do
6365 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports $t" >&5 6970 { echo "$as_me:$LINENO: checking if $CC supports $t" >&5
6366$as_echo_n "checking if $CC supports $t... " >&6; } 6971echo $ECHO_N "checking if $CC supports $t... $ECHO_C" >&6; }
6367 saved_CFLAGS="$CFLAGS" 6972 saved_CFLAGS="$CFLAGS"
6368 saved_LDFLAGS="$LDFLAGS" 6973 saved_LDFLAGS="$LDFLAGS"
6369 CFLAGS="$CFLAGS $t -Werror" 6974 CFLAGS="$CFLAGS $t -Werror"
6370 LDFLAGS="$LDFLAGS $t -Werror" 6975 LDFLAGS="$LDFLAGS $t -Werror"
6371 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
6372/* end confdefs.h. */ 6981/* end confdefs.h. */
6373 #include <stdio.h> 6982 #include <stdio.h>
6374int 6983int
@@ -6382,20 +6991,41 @@ main ()
6382 return 0; 6991 return 0;
6383} 6992}
6384_ACEOF 6993_ACEOF
6385if ac_fn_c_try_link "$LINENO"; then : 6994rm -f conftest.$ac_objext conftest$ac_exeext
6386 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 6995if { (ac_try="$ac_link"
6387$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; }
6388 CFLAGS="$saved_CFLAGS $t" 7014 CFLAGS="$saved_CFLAGS $t"
6389 LDFLAGS="$saved_LDFLAGS $t" 7015 LDFLAGS="$saved_LDFLAGS $t"
6390 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $t works" >&5 7016 { echo "$as_me:$LINENO: checking if $t works" >&5
6391$as_echo_n "checking if $t works... " >&6; } 7017echo $ECHO_N "checking if $t works... $ECHO_C" >&6; }
6392 if test "$cross_compiling" = yes; then : 7018 if test "$cross_compiling" = yes; then
6393 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: cannot test" >&5 7019 { echo "$as_me:$LINENO: WARNING: cross compiling: cannot test" >&5
6394$as_echo "$as_me: WARNING: cross compiling: cannot test" >&2;} 7020echo "$as_me: WARNING: cross compiling: cannot test" >&2;}
6395 break 7021 break
6396 7022
6397else 7023else
6398 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
6399/* end confdefs.h. */ 7029/* end confdefs.h. */
6400 #include <stdio.h> 7030 #include <stdio.h>
6401int 7031int
@@ -6409,26 +7039,54 @@ main ()
6409 return 0; 7039 return 0;
6410} 7040}
6411_ACEOF 7041_ACEOF
6412if ac_fn_c_try_run "$LINENO"; then : 7042rm -f conftest$ac_exeext
6413 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 7043if { (ac_try="$ac_link"
6414$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; }
6415 break 7064 break
6416else 7065else
6417 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 7066 echo "$as_me: program exited with status $ac_status" >&5
6418$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; }
6419fi 7073fi
6420rm -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
6421 conftest.$ac_objext conftest.beam conftest.$ac_ext
6422fi 7075fi
6423 7076
6424 7077
7078
6425else 7079else
6426 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 7080 echo "$as_me: failed program was:" >&5
6427$as_echo "no" >&6; } 7081sed 's/^/| /' conftest.$ac_ext >&5
7082
7083 { echo "$as_me:$LINENO: result: no" >&5
7084echo "${ECHO_T}no" >&6; }
6428 7085
6429fi 7086fi
6430rm -f core conftest.err conftest.$ac_objext \ 7087
6431 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
6432 CFLAGS="$saved_CFLAGS" 7090 CFLAGS="$saved_CFLAGS"
6433 LDFLAGS="$saved_LDFLAGS" 7091 LDFLAGS="$saved_LDFLAGS"
6434 done 7092 done
@@ -6439,10 +7097,61 @@ rm -f core conftest.err conftest.$ac_objext \
6439 unset ac_cv_have_decl_LLONG_MAX 7097 unset ac_cv_have_decl_LLONG_MAX
6440 saved_CFLAGS="$CFLAGS" 7098 saved_CFLAGS="$CFLAGS"
6441 CFLAGS="$CFLAGS -std=gnu99" 7099 CFLAGS="$CFLAGS -std=gnu99"
6442 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>
6443 7112
6444" 7113
6445if 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
6446 have_llong_max=1 7155 have_llong_max=1
6447else 7156else
6448 CFLAGS="$saved_CFLAGS" 7157 CFLAGS="$saved_CFLAGS"
@@ -6451,9 +7160,13 @@ fi
6451 fi 7160 fi
6452fi 7161fi
6453 7162
6454{ $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
6455$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; }
6456cat 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
6457/* end confdefs.h. */ 7170/* end confdefs.h. */
6458 7171
6459#include <stdlib.h> 7172#include <stdlib.h>
@@ -6466,28 +7179,52 @@ main ()
6466 return 0; 7179 return 0;
6467} 7180}
6468_ACEOF 7181_ACEOF
6469if ac_fn_c_try_compile "$LINENO"; then : 7182rm -f conftest.$ac_objext
6470 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 7183if { (ac_try="$ac_compile"
6471$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; }
6472else 7201else
6473 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 7202 echo "$as_me: failed program was:" >&5
6474$as_echo "no" >&6; } 7203sed 's/^/| /' conftest.$ac_ext >&5
7204
7205 { echo "$as_me:$LINENO: result: no" >&5
7206echo "${ECHO_T}no" >&6; }
6475 7207
6476$as_echo "#define NO_ATTRIBUTE_ON_RETURN_TYPE 1" >>confdefs.h 7208cat >>confdefs.h <<\_ACEOF
7209#define NO_ATTRIBUTE_ON_RETURN_TYPE 1
7210_ACEOF
6477 7211
6478 7212
6479fi 7213fi
7214
6480rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 7215rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6481 7216
6482if test "x$no_attrib_nonnull" != "x1" ; then 7217if test "x$no_attrib_nonnull" != "x1" ; then
6483 7218
6484$as_echo "#define HAVE_ATTRIBUTE__NONNULL__ 1" >>confdefs.h 7219cat >>confdefs.h <<\_ACEOF
7220#define HAVE_ATTRIBUTE__NONNULL__ 1
7221_ACEOF
6485 7222
6486fi 7223fi
6487 7224
6488 7225
6489# Check whether --with-rpath was given. 7226# Check whether --with-rpath was given.
6490if test "${with_rpath+set}" = set; then : 7227if test "${with_rpath+set}" = set; then
6491 withval=$with_rpath; 7228 withval=$with_rpath;
6492 if test "x$withval" = "xno" ; then 7229 if test "x$withval" = "xno" ; then
6493 need_dash_r="" 7230 need_dash_r=""
@@ -6503,7 +7240,7 @@ fi
6503# Allow user to specify flags 7240# Allow user to specify flags
6504 7241
6505# Check whether --with-cflags was given. 7242# Check whether --with-cflags was given.
6506if test "${with_cflags+set}" = set; then : 7243if test "${with_cflags+set}" = set; then
6507 withval=$with_cflags; 7244 withval=$with_cflags;
6508 if test -n "$withval" && test "x$withval" != "xno" && \ 7245 if test -n "$withval" && test "x$withval" != "xno" && \
6509 test "x${withval}" != "xyes"; then 7246 test "x${withval}" != "xyes"; then
@@ -6515,7 +7252,7 @@ fi
6515 7252
6516 7253
6517# Check whether --with-cppflags was given. 7254# Check whether --with-cppflags was given.
6518if test "${with_cppflags+set}" = set; then : 7255if test "${with_cppflags+set}" = set; then
6519 withval=$with_cppflags; 7256 withval=$with_cppflags;
6520 if test -n "$withval" && test "x$withval" != "xno" && \ 7257 if test -n "$withval" && test "x$withval" != "xno" && \
6521 test "x${withval}" != "xyes"; then 7258 test "x${withval}" != "xyes"; then
@@ -6527,7 +7264,7 @@ fi
6527 7264
6528 7265
6529# Check whether --with-ldflags was given. 7266# Check whether --with-ldflags was given.
6530if test "${with_ldflags+set}" = set; then : 7267if test "${with_ldflags+set}" = set; then
6531 withval=$with_ldflags; 7268 withval=$with_ldflags;
6532 if test -n "$withval" && test "x$withval" != "xno" && \ 7269 if test -n "$withval" && test "x$withval" != "xno" && \
6533 test "x${withval}" != "xyes"; then 7270 test "x${withval}" != "xyes"; then
@@ -6539,7 +7276,7 @@ fi
6539 7276
6540 7277
6541# Check whether --with-libs was given. 7278# Check whether --with-libs was given.
6542if test "${with_libs+set}" = set; then : 7279if test "${with_libs+set}" = set; then
6543 withval=$with_libs; 7280 withval=$with_libs;
6544 if test -n "$withval" && test "x$withval" != "xno" && \ 7281 if test -n "$withval" && test "x$withval" != "xno" && \
6545 test "x${withval}" != "xyes"; then 7282 test "x${withval}" != "xyes"; then
@@ -6551,7 +7288,7 @@ fi
6551 7288
6552 7289
6553# Check whether --with-Werror was given. 7290# Check whether --with-Werror was given.
6554if test "${with_Werror+set}" = set; then : 7291if test "${with_Werror+set}" = set; then
6555 withval=$with_Werror; 7292 withval=$with_Werror;
6556 if test -n "$withval" && test "x$withval" != "xno"; then 7293 if test -n "$withval" && test "x$withval" != "xno"; then
6557 werror_flags="-Werror" 7294 werror_flags="-Werror"
@@ -6564,6 +7301,73 @@ if test "${with_Werror+set}" = set; then :
6564fi 7301fi
6565 7302
6566 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
6567for ac_header in \ 7371for ac_header in \
6568 blf.h \ 7372 blf.h \
6569 bstring.h \ 7373 bstring.h \
@@ -6633,12 +7437,143 @@ for ac_header in \
6633 utmpx.h \ 7437 utmpx.h \
6634 vis.h \ 7438 vis.h \
6635 7439
6636do : 7440do
6637 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`
6638ac_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
6639if 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
6640 cat >>confdefs.h <<_ACEOF 7575 cat >>confdefs.h <<_ACEOF
6641#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 7576#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
6642_ACEOF 7577_ACEOF
6643 7578
6644fi 7579fi
@@ -6647,17 +7582,62 @@ done
6647 7582
6648 7583
6649# 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
6650for ac_header in lastlog.h 7586for ac_header in lastlog.h
6651do : 7587do
6652 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
6653#ifdef HAVE_SYS_TIME_H 7601#ifdef HAVE_SYS_TIME_H
6654# include <sys/time.h> 7602# include <sys/time.h>
6655#endif 7603#endif
6656 7604
6657" 7605
6658if 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
6659 cat >>confdefs.h <<_ACEOF 7639 cat >>confdefs.h <<_ACEOF
6660#define HAVE_LASTLOG_H 1 7640#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
6661_ACEOF 7641_ACEOF
6662 7642
6663fi 7643fi
@@ -6666,17 +7646,62 @@ done
6666 7646
6667 7647
6668# 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
6669for ac_header in sys/ptms.h 7650for ac_header in sys/ptms.h
6670do : 7651do
6671 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
6672#ifdef HAVE_SYS_STREAM_H 7665#ifdef HAVE_SYS_STREAM_H
6673# include <sys/stream.h> 7666# include <sys/stream.h>
6674#endif 7667#endif
6675 7668
6676" 7669
6677if 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
6678 cat >>confdefs.h <<_ACEOF 7703 cat >>confdefs.h <<_ACEOF
6679#define HAVE_SYS_PTMS_H 1 7704#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
6680_ACEOF 7705_ACEOF
6681 7706
6682fi 7707fi
@@ -6685,15 +7710,60 @@ done
6685 7710
6686 7711
6687# login_cap.h requires sys/types.h on NetBSD 7712# login_cap.h requires sys/types.h on NetBSD
7713
6688for ac_header in login_cap.h 7714for ac_header in login_cap.h
6689do : 7715do
6690 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
6691#include <sys/types.h> 7729#include <sys/types.h>
6692 7730
6693" 7731
6694if 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
6695 cat >>confdefs.h <<_ACEOF 7765 cat >>confdefs.h <<_ACEOF
6696#define HAVE_LOGIN_CAP_H 1 7766#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
6697_ACEOF 7767_ACEOF
6698 7768
6699fi 7769fi
@@ -6702,15 +7772,60 @@ done
6702 7772
6703 7773
6704# older BSDs need sys/param.h before sys/mount.h 7774# older BSDs need sys/param.h before sys/mount.h
7775
6705for ac_header in sys/mount.h 7776for ac_header in sys/mount.h
6706do : 7777do
6707 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
6708#include <sys/param.h> 7791#include <sys/param.h>
6709 7792
6710" 7793
6711if 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
6712 cat >>confdefs.h <<_ACEOF 7827 cat >>confdefs.h <<_ACEOF
6713#define HAVE_SYS_MOUNT_H 1 7828#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
6714_ACEOF 7829_ACEOF
6715 7830
6716fi 7831fi
@@ -6719,16 +7834,61 @@ done
6719 7834
6720 7835
6721# 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
6722for ac_header in sys/un.h 7838for ac_header in sys/un.h
6723do : 7839do
6724 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
6725#include <sys/types.h> 7853#include <sys/types.h>
6726#include <sys/socket.h> 7854#include <sys/socket.h>
6727 7855
6728" 7856
6729if 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
6730 cat >>confdefs.h <<_ACEOF 7890 cat >>confdefs.h <<_ACEOF
6731#define HAVE_SYS_UN_H 1 7891#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
6732_ACEOF 7892_ACEOF
6733 7893
6734fi 7894fi
@@ -6749,9 +7909,13 @@ case "$host" in
6749 # particularly with older versions of vac or xlc. 7909 # particularly with older versions of vac or xlc.
6750 # It also throws errors about null macro argments, but these are 7910 # It also throws errors about null macro argments, but these are
6751 # not fatal. 7911 # not fatal.
6752 { $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
6753$as_echo_n "checking if compiler allows macro redefinitions... " >&6; } 7913echo $ECHO_N "checking if compiler allows macro redefinitions... $ECHO_C" >&6; }
6754 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
6755/* end confdefs.h. */ 7919/* end confdefs.h. */
6756 7920
6757#define testmacro foo 7921#define testmacro foo
@@ -6764,12 +7928,31 @@ main ()
6764 return 0; 7928 return 0;
6765} 7929}
6766_ACEOF 7930_ACEOF
6767if ac_fn_c_try_compile "$LINENO"; then : 7931rm -f conftest.$ac_objext
6768 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 7932if { (ac_try="$ac_compile"
6769$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; }
6770else 7950else
6771 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 7951 echo "$as_me: failed program was:" >&5
6772$as_echo "no" >&6; } 7952sed 's/^/| /' conftest.$ac_ext >&5
7953
7954 { echo "$as_me:$LINENO: result: no" >&5
7955echo "${ECHO_T}no" >&6; }
6773 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`" 7956 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
6774 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`" 7957 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
6775 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`" 7958 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
@@ -6777,10 +7960,11 @@ $as_echo "no" >&6; }
6777 7960
6778 7961
6779fi 7962fi
7963
6780rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 7964rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6781 7965
6782 { $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
6783$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; }
6784 if (test -z "$blibpath"); then 7968 if (test -z "$blibpath"); then
6785 blibpath="/usr/lib:/lib" 7969 blibpath="/usr/lib:/lib"
6786 fi 7970 fi
@@ -6793,7 +7977,11 @@ $as_echo_n "checking how to specify blibpath for linker ($LD)... " >&6; }
6793 for tryflags in $flags ;do 7977 for tryflags in $flags ;do
6794 if (test -z "$blibflags"); then 7978 if (test -z "$blibflags"); then
6795 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath" 7979 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
6796 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
6797/* end confdefs.h. */ 7985/* end confdefs.h. */
6798 7986
6799int 7987int
@@ -6804,36 +7992,147 @@ main ()
6804 return 0; 7992 return 0;
6805} 7993}
6806_ACEOF 7994_ACEOF
6807if 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
6808 blibflags=$tryflags 8013 blibflags=$tryflags
8014else
8015 echo "$as_me: failed program was:" >&5
8016sed 's/^/| /' conftest.$ac_ext >&5
8017
8018
6809fi 8019fi
6810rm -f core conftest.err conftest.$ac_objext \ 8020
6811 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
6812 fi 8023 fi
6813 done 8024 done
6814 if (test -z "$blibflags"); then 8025 if (test -z "$blibflags"); then
6815 { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 8026 { echo "$as_me:$LINENO: result: not found" >&5
6816$as_echo "not found" >&6; } 8027echo "${ECHO_T}not found" >&6; }
6817 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; }; }
6818 else 8031 else
6819 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $blibflags" >&5 8032 { echo "$as_me:$LINENO: result: $blibflags" >&5
6820$as_echo "$blibflags" >&6; } 8033echo "${ECHO_T}$blibflags" >&6; }
6821 fi 8034 fi
6822 LDFLAGS="$saved_LDFLAGS" 8035 LDFLAGS="$saved_LDFLAGS"
6823 ac_fn_c_check_func "$LINENO" "authenticate" "ac_cv_func_authenticate" 8036 { echo "$as_me:$LINENO: checking for authenticate" >&5
6824if 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
8077
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
6825 8111
6826$as_echo "#define WITH_AIXAUTHENTICATE 1" >>confdefs.h 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
6827 8122
6828else 8123else
6829 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for authenticate in -ls" >&5 8124 { echo "$as_me:$LINENO: checking for authenticate in -ls" >&5
6830$as_echo_n "checking for authenticate in -ls... " >&6; } 8125echo $ECHO_N "checking for authenticate in -ls... $ECHO_C" >&6; }
6831if ${ac_cv_lib_s_authenticate+:} false; then : 8126if test "${ac_cv_lib_s_authenticate+set}" = set; then
6832 $as_echo_n "(cached) " >&6 8127 echo $ECHO_N "(cached) $ECHO_C" >&6
6833else 8128else
6834 ac_check_lib_save_LIBS=$LIBS 8129 ac_check_lib_save_LIBS=$LIBS
6835LIBS="-ls $LIBS" 8130LIBS="-ls $LIBS"
6836cat 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
6837/* end confdefs.h. */ 8136/* end confdefs.h. */
6838 8137
6839/* Override any GCC internal prototype to avoid an error. 8138/* Override any GCC internal prototype to avoid an error.
@@ -6851,19 +8150,42 @@ return authenticate ();
6851 return 0; 8150 return 0;
6852} 8151}
6853_ACEOF 8152_ACEOF
6854if 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
6855 ac_cv_lib_s_authenticate=yes 8171 ac_cv_lib_s_authenticate=yes
6856else 8172else
6857 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
6858fi 8177fi
6859rm -f core conftest.err conftest.$ac_objext \ 8178
6860 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
6861LIBS=$ac_check_lib_save_LIBS 8181LIBS=$ac_check_lib_save_LIBS
6862fi 8182fi
6863{ $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
6864$as_echo "$ac_cv_lib_s_authenticate" >&6; } 8184echo "${ECHO_T}$ac_cv_lib_s_authenticate" >&6; }
6865if test "x$ac_cv_lib_s_authenticate" = xyes; then : 8185if test $ac_cv_lib_s_authenticate = yes; then
6866 $as_echo "#define WITH_AIXAUTHENTICATE 1" >>confdefs.h 8186 cat >>confdefs.h <<\_ACEOF
8187#define WITH_AIXAUTHENTICATE 1
8188_ACEOF
6867 8189
6868 LIBS="$LIBS -ls" 8190 LIBS="$LIBS -ls"
6869 8191
@@ -6872,78 +8194,410 @@ fi
6872 8194
6873fi 8195fi
6874 8196
6875 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
6876" 8198echo $ECHO_N "checking whether authenticate is declared... $ECHO_C" >&6; }
6877if test "x$ac_cv_have_decl_authenticate" = xyes; then : 8199if test "${ac_cv_have_decl_authenticate+set}" = set; then
6878 ac_have_decl=1 8200 echo $ECHO_N "(cached) $ECHO_C" >&6
8201else
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
6879else 8239else
6880 ac_have_decl=0 8240 echo "$as_me: failed program was:" >&5
8241sed 's/^/| /' conftest.$ac_ext >&5
8242
8243 ac_cv_have_decl_authenticate=no
8244fi
8245
8246rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6881fi 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
6882 8251
6883cat >>confdefs.h <<_ACEOF 8252cat >>confdefs.h <<_ACEOF
6884#define HAVE_DECL_AUTHENTICATE $ac_have_decl 8253#define HAVE_DECL_AUTHENTICATE 1
6885_ACEOF 8254_ACEOF
6886ac_fn_c_check_decl "$LINENO" "loginrestrictions" "ac_cv_have_decl_loginrestrictions" "#include <usersec.h> 8255
6887" 8256
6888if test "x$ac_cv_have_decl_loginrestrictions" = xyes; then : 8257else
6889 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
6890else 8306else
6891 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
6892fi 8311fi
6893 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
6894cat >>confdefs.h <<_ACEOF 8319cat >>confdefs.h <<_ACEOF
6895#define HAVE_DECL_LOGINRESTRICTIONS $ac_have_decl 8320#define HAVE_DECL_LOGINRESTRICTIONS 1
6896_ACEOF 8321_ACEOF
6897ac_fn_c_check_decl "$LINENO" "loginsuccess" "ac_cv_have_decl_loginsuccess" "#include <usersec.h> 8322
6898" 8323
6899if test "x$ac_cv_have_decl_loginsuccess" = xyes; then :
6900 ac_have_decl=1
6901else 8324else
6902 ac_have_decl=0 8325 cat >>confdefs.h <<_ACEOF
8326#define HAVE_DECL_LOGINRESTRICTIONS 0
8327_ACEOF
8328
8329
6903fi 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
8373else
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
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
6904 8385
6905cat >>confdefs.h <<_ACEOF 8386cat >>confdefs.h <<_ACEOF
6906#define HAVE_DECL_LOGINSUCCESS $ac_have_decl 8387#define HAVE_DECL_LOGINSUCCESS 1
6907_ACEOF 8388_ACEOF
6908ac_fn_c_check_decl "$LINENO" "passwdexpired" "ac_cv_have_decl_passwdexpired" "#include <usersec.h> 8389
6909" 8390
6910if test "x$ac_cv_have_decl_passwdexpired" = xyes; then :
6911 ac_have_decl=1
6912else 8391else
6913 ac_have_decl=0 8392 cat >>confdefs.h <<_ACEOF
8393#define HAVE_DECL_LOGINSUCCESS 0
8394_ACEOF
8395
8396
6914fi 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
6915 8452
6916cat >>confdefs.h <<_ACEOF 8453cat >>confdefs.h <<_ACEOF
6917#define HAVE_DECL_PASSWDEXPIRED $ac_have_decl 8454#define HAVE_DECL_PASSWDEXPIRED 1
6918_ACEOF 8455_ACEOF
6919ac_fn_c_check_decl "$LINENO" "setauthdb" "ac_cv_have_decl_setauthdb" "#include <usersec.h> 8456
6920" 8457
6921if test "x$ac_cv_have_decl_setauthdb" = xyes; then : 8458else
6922 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
8469else
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
6923else 8507else
6924 ac_have_decl=0 8508 echo "$as_me: failed program was:" >&5
8509sed 's/^/| /' conftest.$ac_ext >&5
8510
8511 ac_cv_have_decl_setauthdb=no
6925fi 8512fi
6926 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
6927cat >>confdefs.h <<_ACEOF 8520cat >>confdefs.h <<_ACEOF
6928#define HAVE_DECL_SETAUTHDB $ac_have_decl 8521#define HAVE_DECL_SETAUTHDB 1
6929_ACEOF 8522_ACEOF
6930 8523
6931 ac_fn_c_check_decl "$LINENO" "loginfailed" "ac_cv_have_decl_loginfailed" "#include <usersec.h>
6932 8524
6933"
6934if test "x$ac_cv_have_decl_loginfailed" = xyes; then :
6935 ac_have_decl=1
6936else 8525else
6937 ac_have_decl=0 8526 cat >>confdefs.h <<_ACEOF
8527#define HAVE_DECL_SETAUTHDB 0
8528_ACEOF
8529
8530
8531fi
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
6938fi 8582fi
6939 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
6940cat >>confdefs.h <<_ACEOF 8590cat >>confdefs.h <<_ACEOF
6941#define HAVE_DECL_LOGINFAILED $ac_have_decl 8591#define HAVE_DECL_LOGINFAILED 1
8592_ACEOF
8593
8594{ echo "$as_me:$LINENO: checking if loginfailed takes 4 arguments" >&5
8595echo $ECHO_N "checking if loginfailed takes 4 arguments... $ECHO_C" >&6; }
8596 cat >conftest.$ac_ext <<_ACEOF
8597/* confdefs.h. */
6942_ACEOF 8598_ACEOF
6943if test $ac_have_decl = 1; then : 8599cat confdefs.h >>conftest.$ac_ext
6944 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if loginfailed takes 4 arguments" >&5 8600cat >>conftest.$ac_ext <<_ACEOF
6945$as_echo_n "checking if loginfailed takes 4 arguments... " >&6; }
6946 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6947/* end confdefs.h. */ 8601/* end confdefs.h. */
6948 #include <usersec.h> 8602 #include <usersec.h>
6949int 8603int
@@ -6954,119 +8608,328 @@ main ()
6954 return 0; 8608 return 0;
6955} 8609}
6956_ACEOF 8610_ACEOF
6957if ac_fn_c_try_compile "$LINENO"; then : 8611rm -f conftest.$ac_objext
6958 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 8612if { (ac_try="$ac_compile"
6959$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; }
6960 8630
6961$as_echo "#define AIX_LOGINFAILED_4ARG 1" >>confdefs.h 8631cat >>confdefs.h <<\_ACEOF
8632#define AIX_LOGINFAILED_4ARG 1
8633_ACEOF
6962 8634
6963else 8635else
6964 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 8636 echo "$as_me: failed program was:" >&5
6965$as_echo "no" >&6; } 8637sed 's/^/| /' conftest.$ac_ext >&5
8638
8639 { echo "$as_me:$LINENO: result: no" >&5
8640echo "${ECHO_T}no" >&6; }
6966 8641
6967fi 8642fi
8643
6968rm -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
6969fi 8651fi
6970 8652
6971 for ac_func in getgrset setauthdb 8653
6972do : 8654
6973 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 8655
6974ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 8656for ac_func in getgrset setauthdb
6975if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 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"
8733fi
8734
8735rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
8736 conftest$ac_exeext conftest.$ac_ext
8737fi
8738ac_res=`eval echo '${'$as_ac_var'}'`
8739 { echo "$as_me:$LINENO: result: $ac_res" >&5
8740echo "${ECHO_T}$ac_res" >&6; }
8741if test `eval echo '${'$as_ac_var'}'` = yes; then
6976 cat >>confdefs.h <<_ACEOF 8742 cat >>confdefs.h <<_ACEOF
6977#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 8743#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
6978_ACEOF 8744_ACEOF
6979 8745
6980fi 8746fi
6981done 8747done
6982 8748
6983 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>
6984 #include <fcntl.h> 8761 #include <fcntl.h>
6985 8762
6986"
6987if test "x$ac_cv_have_decl_F_CLOSEM" = xyes; then :
6988 8763
6989$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
6990 8809
6991fi 8810fi
6992 8811
6993 check_for_aix_broken_getaddrinfo=1 8812 check_for_aix_broken_getaddrinfo=1
6994 8813
6995$as_echo "#define BROKEN_REALPATH 1" >>confdefs.h 8814cat >>confdefs.h <<\_ACEOF
8815#define BROKEN_REALPATH 1
8816_ACEOF
6996 8817
6997 8818
6998$as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 8819cat >>confdefs.h <<\_ACEOF
8820#define SETEUID_BREAKS_SETUID 1
8821_ACEOF
6999 8822
7000 8823
7001$as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 8824cat >>confdefs.h <<\_ACEOF
8825#define BROKEN_SETREUID 1
8826_ACEOF
7002 8827
7003 8828
7004$as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 8829cat >>confdefs.h <<\_ACEOF
8830#define BROKEN_SETREGID 1
8831_ACEOF
7005 8832
7006 8833
7007$as_echo "#define DISABLE_LASTLOG 1" >>confdefs.h 8834cat >>confdefs.h <<\_ACEOF
8835#define DISABLE_LASTLOG 1
8836_ACEOF
7008 8837
7009 8838
7010$as_echo "#define LOGIN_NEEDS_UTMPX 1" >>confdefs.h 8839cat >>confdefs.h <<\_ACEOF
8840#define LOGIN_NEEDS_UTMPX 1
8841_ACEOF
7011 8842
7012 8843
7013$as_echo "#define SPT_TYPE SPT_REUSEARGV" >>confdefs.h 8844cat >>confdefs.h <<\_ACEOF
8845#define SPT_TYPE SPT_REUSEARGV
8846_ACEOF
7014 8847
7015 8848
7016$as_echo "#define SSHPAM_CHAUTHTOK_NEEDS_RUID 1" >>confdefs.h 8849cat >>confdefs.h <<\_ACEOF
8850#define SSHPAM_CHAUTHTOK_NEEDS_RUID 1
8851_ACEOF
7017 8852
7018 8853
7019$as_echo "#define PTY_ZEROREAD 1" >>confdefs.h 8854cat >>confdefs.h <<\_ACEOF
8855#define PTY_ZEROREAD 1
8856_ACEOF
7020 8857
7021 8858
7022$as_echo "#define PLATFORM_SYS_DIR_UID 2" >>confdefs.h 8859cat >>confdefs.h <<\_ACEOF
8860#define PLATFORM_SYS_DIR_UID 2
8861_ACEOF
7023 8862
7024 ;; 8863 ;;
7025*-*-android*) 8864*-*-android*)
7026 8865
7027$as_echo "#define DISABLE_UTMP 1" >>confdefs.h 8866cat >>confdefs.h <<\_ACEOF
8867#define DISABLE_UTMP 1
8868_ACEOF
7028 8869
7029 8870
7030$as_echo "#define DISABLE_WTMP 1" >>confdefs.h 8871cat >>confdefs.h <<\_ACEOF
8872#define DISABLE_WTMP 1
8873_ACEOF
7031 8874
7032 ;; 8875 ;;
7033*-*-cygwin*) 8876*-*-cygwin*)
7034 check_for_libcrypt_later=1 8877 check_for_libcrypt_later=1
7035 LIBS="$LIBS /usr/lib/textreadmode.o" 8878 LIBS="$LIBS /usr/lib/textreadmode.o"
7036 8879
7037$as_echo "#define HAVE_CYGWIN 1" >>confdefs.h 8880cat >>confdefs.h <<\_ACEOF
8881#define HAVE_CYGWIN 1
8882_ACEOF
7038 8883
7039 8884
7040$as_echo "#define USE_PIPES 1" >>confdefs.h 8885cat >>confdefs.h <<\_ACEOF
8886#define USE_PIPES 1
8887_ACEOF
7041 8888
7042 8889
7043$as_echo "#define DISABLE_SHADOW 1" >>confdefs.h 8890cat >>confdefs.h <<\_ACEOF
8891#define DISABLE_SHADOW 1
8892_ACEOF
7044 8893
7045 8894
7046$as_echo "#define NO_X11_UNIX_SOCKETS 1" >>confdefs.h 8895cat >>confdefs.h <<\_ACEOF
8896#define NO_X11_UNIX_SOCKETS 1
8897_ACEOF
7047 8898
7048 8899
7049$as_echo "#define NO_IPPORT_RESERVED_CONCEPT 1" >>confdefs.h 8900cat >>confdefs.h <<\_ACEOF
8901#define NO_IPPORT_RESERVED_CONCEPT 1
8902_ACEOF
7050 8903
7051 8904
7052$as_echo "#define DISABLE_FD_PASSING 1" >>confdefs.h 8905cat >>confdefs.h <<\_ACEOF
8906#define DISABLE_FD_PASSING 1
8907_ACEOF
7053 8908
7054 8909
7055$as_echo "#define SSH_IOBUFSZ 65535" >>confdefs.h 8910cat >>confdefs.h <<\_ACEOF
8911#define SSH_IOBUFSZ 65535
8912_ACEOF
7056 8913
7057 8914
7058$as_echo "#define FILESYSTEM_NO_BACKSLASH 1" >>confdefs.h 8915cat >>confdefs.h <<\_ACEOF
8916#define FILESYSTEM_NO_BACKSLASH 1
8917_ACEOF
7059 8918
7060 # Cygwin defines optargs, optargs as declspec(dllimport) for historical 8919 # Cygwin defines optargs, optargs as declspec(dllimport) for historical
7061 # reasons which cause compile warnings, so we disable those warnings. 8920 # reasons which cause compile warnings, so we disable those warnings.
7062 { 8921 {
7063 { $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
7064$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; }
7065 saved_CFLAGS="$CFLAGS" 8924 saved_CFLAGS="$CFLAGS"
7066 CFLAGS="$CFLAGS $WERROR -Wno-attributes" 8925 CFLAGS="$CFLAGS $WERROR -Wno-attributes"
7067 _define_flag="" 8926 _define_flag=""
7068 test "x$_define_flag" = "x" && _define_flag="-Wno-attributes" 8927 test "x$_define_flag" = "x" && _define_flag="-Wno-attributes"
7069 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
7070/* end confdefs.h. */ 8933/* end confdefs.h. */
7071 8934
7072#include <stdlib.h> 8935#include <stdlib.h>
@@ -7082,47 +8945,79 @@ int main(int argc, char **argv) {
7082} 8945}
7083 8946
7084_ACEOF 8947_ACEOF
7085if 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
7086 8965
7087if `grep -i "unrecognized option" conftest.err >/dev/null` 8966if `grep -i "unrecognized option" conftest.err >/dev/null`
7088then 8967then
7089 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 8968 { echo "$as_me:$LINENO: result: no" >&5
7090$as_echo "no" >&6; } 8969echo "${ECHO_T}no" >&6; }
7091 CFLAGS="$saved_CFLAGS" 8970 CFLAGS="$saved_CFLAGS"
7092else 8971else
7093 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 8972 { echo "$as_me:$LINENO: result: yes" >&5
7094$as_echo "yes" >&6; } 8973echo "${ECHO_T}yes" >&6; }
7095 CFLAGS="$saved_CFLAGS $_define_flag" 8974 CFLAGS="$saved_CFLAGS $_define_flag"
7096fi 8975fi
7097else 8976else
7098 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 8977 echo "$as_me: failed program was:" >&5
7099$as_echo "no" >&6; } 8978sed 's/^/| /' conftest.$ac_ext >&5
8979
8980 { echo "$as_me:$LINENO: result: no" >&5
8981echo "${ECHO_T}no" >&6; }
7100 CFLAGS="$saved_CFLAGS" 8982 CFLAGS="$saved_CFLAGS"
7101 8983
7102fi 8984fi
8985
7103rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 8986rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7104} 8987}
7105 ;; 8988 ;;
7106*-*-dgux*) 8989*-*-dgux*)
7107 8990
7108$as_echo "#define IP_TOS_IS_BROKEN 1" >>confdefs.h 8991cat >>confdefs.h <<\_ACEOF
8992#define IP_TOS_IS_BROKEN 1
8993_ACEOF
7109 8994
7110 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 8995 cat >>confdefs.h <<\_ACEOF
8996#define SETEUID_BREAKS_SETUID 1
8997_ACEOF
7111 8998
7112 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 8999 cat >>confdefs.h <<\_ACEOF
9000#define BROKEN_SETREUID 1
9001_ACEOF
7113 9002
7114 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 9003 cat >>confdefs.h <<\_ACEOF
9004#define BROKEN_SETREGID 1
9005_ACEOF
7115 9006
7116 ;; 9007 ;;
7117*-*-darwin*) 9008*-*-darwin*)
7118 use_pie=auto 9009 use_pie=auto
7119 { $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
7120$as_echo_n "checking if we have working getaddrinfo... " >&6; } 9011echo $ECHO_N "checking if we have working getaddrinfo... $ECHO_C" >&6; }
7121 if test "$cross_compiling" = yes; then : 9012 if test "$cross_compiling" = yes; then
7122 { $as_echo "$as_me:${as_lineno-$LINENO}: result: assume it is working" >&5 9013 { echo "$as_me:$LINENO: result: assume it is working" >&5
7123$as_echo "assume it is working" >&6; } 9014echo "${ECHO_T}assume it is working" >&6; }
7124else 9015else
7125 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
7126/* end confdefs.h. */ 9021/* end confdefs.h. */
7127 #include <mach-o/dyld.h> 9022 #include <mach-o/dyld.h>
7128main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) 9023main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
@@ -7132,29 +9027,63 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
7132} 9027}
7133 9028
7134_ACEOF 9029_ACEOF
7135if ac_fn_c_try_run "$LINENO"; then : 9030rm -f conftest$ac_exeext
7136 { $as_echo "$as_me:${as_lineno-$LINENO}: result: working" >&5 9031if { (ac_try="$ac_link"
7137$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; }
7138else 9052else
7139 { $as_echo "$as_me:${as_lineno-$LINENO}: result: buggy" >&5 9053 echo "$as_me: program exited with status $ac_status" >&5
7140$as_echo "buggy" >&6; } 9054echo "$as_me: failed program was:" >&5
9055sed 's/^/| /' conftest.$ac_ext >&5
7141 9056
7142$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
7143 9064
7144 9065
7145fi 9066fi
7146rm -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
7147 conftest.$ac_objext conftest.beam conftest.$ac_ext
7148fi 9068fi
7149 9069
7150 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h
7151 9070
7152 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 9071 cat >>confdefs.h <<\_ACEOF
9072#define SETEUID_BREAKS_SETUID 1
9073_ACEOF
7153 9074
7154 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 9075 cat >>confdefs.h <<\_ACEOF
9076#define BROKEN_SETREUID 1
9077_ACEOF
7155 9078
9079 cat >>confdefs.h <<\_ACEOF
9080#define BROKEN_SETREGID 1
9081_ACEOF
7156 9082
7157$as_echo "#define BROKEN_GLOB 1" >>confdefs.h 9083
9084cat >>confdefs.h <<\_ACEOF
9085#define BROKEN_GLOB 1
9086_ACEOF
7158 9087
7159 9088
7160cat >>confdefs.h <<_ACEOF 9089cat >>confdefs.h <<_ACEOF
@@ -7162,106 +9091,328 @@ cat >>confdefs.h <<_ACEOF
7162_ACEOF 9091_ACEOF
7163 9092
7164 9093
7165$as_echo "#define SSH_TUN_FREEBSD 1" >>confdefs.h 9094cat >>confdefs.h <<\_ACEOF
9095#define SSH_TUN_FREEBSD 1
9096_ACEOF
7166 9097
7167 9098
7168$as_echo "#define SSH_TUN_COMPAT_AF 1" >>confdefs.h 9099cat >>confdefs.h <<\_ACEOF
9100#define SSH_TUN_COMPAT_AF 1
9101_ACEOF
7169 9102
7170 9103
7171$as_echo "#define SSH_TUN_PREPEND_AF 1" >>confdefs.h 9104cat >>confdefs.h <<\_ACEOF
9105#define SSH_TUN_PREPEND_AF 1
9106_ACEOF
9107
7172 9108
7173 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have the Security Authorization Session API" >&5 9109 { echo "$as_me:$LINENO: checking whether AU_IPv4 is declared" >&5
7174$as_echo_n "checking if we have the Security Authorization Session API... " >&6; } 9110echo $ECHO_N "checking whether AU_IPv4 is declared... $ECHO_C" >&6; }
7175 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 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
7176/* end confdefs.h. */ 9119/* end confdefs.h. */
7177#include <Security/AuthSession.h> 9120$ac_includes_default
7178int 9121int
7179main () 9122main ()
7180{ 9123{
7181SessionCreate(0, 0); 9124#ifndef AU_IPv4
9125 (void) AU_IPv4;
9126#endif
9127
7182 ; 9128 ;
7183 return 0; 9129 return 0;
7184} 9130}
7185_ACEOF 9131_ACEOF
7186if ac_fn_c_try_compile "$LINENO"; then : 9132rm -f conftest.$ac_objext
7187 ac_cv_use_security_session_api="yes" 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
9150else
9151 echo "$as_me: failed program was:" >&5
9152sed 's/^/| /' conftest.$ac_ext >&5
7188 9153
7189$as_echo "#define USE_SECURITY_SESSION_API 1" >>confdefs.h 9154 ac_cv_have_decl_AU_IPv4=no
9155fi
7190 9156
7191 LIBS="$LIBS -framework Security" 9157rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7192 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 9158fi
7193$as_echo "yes" >&6; } 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 :
7194else 9163else
7195 ac_cv_use_security_session_api="no" 9164
7196 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 9165cat >>confdefs.h <<\_ACEOF
7197$as_echo "no" >&6; } 9166#define AU_IPv4 0
9167_ACEOF
9168
9169 #include <bsm/audit.h>
9170
9171cat >>confdefs.h <<\_ACEOF
9172#define LASTLOG_WRITE_PUTUTXLINE 1
9173_ACEOF
9174
9175
7198fi 9176fi
7199rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 9177
7200 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have an in-memory credentials cache" >&5 9178
7201$as_echo_n "checking if we have an in-memory credentials cache... " >&6; } 9179cat >>confdefs.h <<\_ACEOF
7202 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 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
7203/* end confdefs.h. */ 9197/* end confdefs.h. */
7204#include <Kerberos/Kerberos.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
7205int 9229int
7206main () 9230main ()
7207{ 9231{
7208cc_context_t c; 9232return $ac_func ();
7209 (void) cc_initialize (&c, 0, NULL, NULL);
7210 ; 9233 ;
7211 return 0; 9234 return 0;
7212} 9235}
7213_ACEOF 9236_ACEOF
7214if ac_fn_c_try_compile "$LINENO"; then : 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
7215 9259
7216$as_echo "#define USE_CCAPI 1" >>confdefs.h 9260 eval "$as_ac_var=no"
9261fi
7217 9262
7218 LIBS="$LIBS -framework Security" 9263rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
7219 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 9264 conftest$ac_exeext conftest.$ac_ext
7220$as_echo "yes" >&6; } 9265fi
7221 if test "x$ac_cv_use_security_session_api" = "xno"; then 9266ac_res=`eval echo '${'$as_ac_var'}'`
7222 as_fn_error $? "*** Need a security framework to use the credentials cache API ***" "$LINENO" 5 9267 { echo "$as_me:$LINENO: result: $ac_res" >&5
7223 fi 9268echo "${ECHO_T}$ac_res" >&6; }
7224else 9269if test `eval echo '${'$as_ac_var'}'` = yes; then
7225 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 9270 cat >>confdefs.h <<_ACEOF
7226$as_echo "no" >&6; } 9271#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
9272_ACEOF
7227 9273
7228fi 9274fi
7229rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 9275done
7230 9276
7231 ac_fn_c_check_decl "$LINENO" "AU_IPv4" "ac_cv_have_decl_AU_IPv4" "$ac_includes_default"
7232if test "x$ac_cv_have_decl_AU_IPv4" = xyes; then :
7233 9277
9278for ac_header in sandbox.h
9279do
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; }
7234else 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
7235 9324
7236$as_echo "#define AU_IPv4 0" >>confdefs.h 9325 ac_header_compiler=no
7237 9326fi
7238 #include <bsm/audit.h>
7239 9327
7240$as_echo "#define LASTLOG_WRITE_PUTUTXLINE 1" >>confdefs.h 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; }
7241 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
7242 9363
9364 ac_header_preproc=no
7243fi 9365fi
7244 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; }
7245 9370
7246$as_echo "#define SPT_TYPE SPT_REUSEARGV" >>confdefs.h 9371# So? What about this header?
7247 9372case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
7248 for ac_func in sandbox_init 9373 yes:no: )
7249do : 9374 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
7250 ac_fn_c_check_func "$LINENO" "sandbox_init" "ac_cv_func_sandbox_init" 9375echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
7251if test "x$ac_cv_func_sandbox_init" = xyes; then : 9376 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
7252 cat >>confdefs.h <<_ACEOF 9377echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
7253#define HAVE_SANDBOX_INIT 1 9378 ac_header_preproc=yes
7254_ACEOF 9379 ;;
7255 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"
7256fi 9407fi
7257done 9408ac_res=`eval echo '${'$as_ac_Header'}'`
9409 { echo "$as_me:$LINENO: result: $ac_res" >&5
9410echo "${ECHO_T}$ac_res" >&6; }
7258 9411
7259 for ac_header in sandbox.h 9412fi
7260do : 9413if test `eval echo '${'$as_ac_Header'}'` = yes; then
7261 ac_fn_c_check_header_mongrel "$LINENO" "sandbox.h" "ac_cv_header_sandbox_h" "$ac_includes_default"
7262if test "x$ac_cv_header_sandbox_h" = xyes; then :
7263 cat >>confdefs.h <<_ACEOF 9414 cat >>confdefs.h <<_ACEOF
7264#define HAVE_SANDBOX_H 1 9415#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
7265_ACEOF 9416_ACEOF
7266 9417
7267fi 9418fi
@@ -7275,14 +9426,19 @@ done
7275 ;; 9426 ;;
7276*-*-haiku*) 9427*-*-haiku*)
7277 LIBS="$LIBS -lbsd " 9428 LIBS="$LIBS -lbsd "
7278 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lnetwork" >&5 9429
7279$as_echo_n "checking for socket in -lnetwork... " >&6; } 9430{ echo "$as_me:$LINENO: checking for socket in -lnetwork" >&5
7280if ${ac_cv_lib_network_socket+:} false; then : 9431echo $ECHO_N "checking for socket in -lnetwork... $ECHO_C" >&6; }
7281 $as_echo_n "(cached) " >&6 9432if test "${ac_cv_lib_network_socket+set}" = set; then
9433 echo $ECHO_N "(cached) $ECHO_C" >&6
7282else 9434else
7283 ac_check_lib_save_LIBS=$LIBS 9435 ac_check_lib_save_LIBS=$LIBS
7284LIBS="-lnetwork $LIBS" 9436LIBS="-lnetwork $LIBS"
7285cat 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
7286/* end confdefs.h. */ 9442/* end confdefs.h. */
7287 9443
7288/* Override any GCC internal prototype to avoid an error. 9444/* Override any GCC internal prototype to avoid an error.
@@ -7300,18 +9456,39 @@ return socket ();
7300 return 0; 9456 return 0;
7301} 9457}
7302_ACEOF 9458_ACEOF
7303if 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
7304 ac_cv_lib_network_socket=yes 9477 ac_cv_lib_network_socket=yes
7305else 9478else
7306 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
7307fi 9483fi
7308rm -f core conftest.err conftest.$ac_objext \ 9484
7309 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
7310LIBS=$ac_check_lib_save_LIBS 9487LIBS=$ac_check_lib_save_LIBS
7311fi 9488fi
7312{ $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
7313$as_echo "$ac_cv_lib_network_socket" >&6; } 9490echo "${ECHO_T}$ac_cv_lib_network_socket" >&6; }
7314if test "x$ac_cv_lib_network_socket" = xyes; then : 9491if test $ac_cv_lib_network_socket = yes; then
7315 cat >>confdefs.h <<_ACEOF 9492 cat >>confdefs.h <<_ACEOF
7316#define HAVE_LIBNETWORK 1 9493#define HAVE_LIBNETWORK 1
7317_ACEOF 9494_ACEOF
@@ -7320,7 +9497,9 @@ _ACEOF
7320 9497
7321fi 9498fi
7322 9499
7323 $as_echo "#define HAVE_U_INT64_T 1" >>confdefs.h 9500 cat >>confdefs.h <<\_ACEOF
9501#define HAVE_U_INT64_T 1
9502_ACEOF
7324 9503
7325 MANTYPE=man 9504 MANTYPE=man
7326 ;; 9505 ;;
@@ -7328,31 +9507,48 @@ fi
7328 # 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
7329 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"
7330 IPADDR_IN_DISPLAY=yes 9509 IPADDR_IN_DISPLAY=yes
7331 $as_echo "#define USE_PIPES 1" >>confdefs.h 9510 cat >>confdefs.h <<\_ACEOF
9511#define USE_PIPES 1
9512_ACEOF
7332 9513
7333 9514
7334$as_echo "#define LOGIN_NO_ENDOPT 1" >>confdefs.h 9515cat >>confdefs.h <<\_ACEOF
9516#define LOGIN_NO_ENDOPT 1
9517_ACEOF
7335 9518
7336 $as_echo "#define LOGIN_NEEDS_UTMPX 1" >>confdefs.h 9519 cat >>confdefs.h <<\_ACEOF
9520#define LOGIN_NEEDS_UTMPX 1
9521_ACEOF
7337 9522
7338 9523
7339$as_echo "#define LOCKED_PASSWD_STRING \"*\"" >>confdefs.h 9524cat >>confdefs.h <<\_ACEOF
9525#define LOCKED_PASSWD_STRING "*"
9526_ACEOF
7340 9527
7341 $as_echo "#define SPT_TYPE SPT_PSTAT" >>confdefs.h 9528 cat >>confdefs.h <<\_ACEOF
9529#define SPT_TYPE SPT_PSTAT
9530_ACEOF
7342 9531
7343 9532
7344$as_echo "#define PLATFORM_SYS_DIR_UID 2" >>confdefs.h 9533cat >>confdefs.h <<\_ACEOF
9534#define PLATFORM_SYS_DIR_UID 2
9535_ACEOF
7345 9536
7346 maildir="/var/mail" 9537 maildir="/var/mail"
7347 LIBS="$LIBS -lsec" 9538 LIBS="$LIBS -lsec"
7348 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for t_error in -lxnet" >&5 9539
7349$as_echo_n "checking for t_error in -lxnet... " >&6; } 9540{ echo "$as_me:$LINENO: checking for t_error in -lxnet" >&5
7350if ${ac_cv_lib_xnet_t_error+:} false; then : 9541echo $ECHO_N "checking for t_error in -lxnet... $ECHO_C" >&6; }
7351 $as_echo_n "(cached) " >&6 9542if test "${ac_cv_lib_xnet_t_error+set}" = set; then
9543 echo $ECHO_N "(cached) $ECHO_C" >&6
7352else 9544else
7353 ac_check_lib_save_LIBS=$LIBS 9545 ac_check_lib_save_LIBS=$LIBS
7354LIBS="-lxnet $LIBS" 9546LIBS="-lxnet $LIBS"
7355cat 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
7356/* end confdefs.h. */ 9552/* end confdefs.h. */
7357 9553
7358/* Override any GCC internal prototype to avoid an error. 9554/* Override any GCC internal prototype to avoid an error.
@@ -7370,18 +9566,39 @@ return t_error ();
7370 return 0; 9566 return 0;
7371} 9567}
7372_ACEOF 9568_ACEOF
7373if 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
7374 ac_cv_lib_xnet_t_error=yes 9587 ac_cv_lib_xnet_t_error=yes
7375else 9588else
7376 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
7377fi 9593fi
7378rm -f core conftest.err conftest.$ac_objext \ 9594
7379 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
7380LIBS=$ac_check_lib_save_LIBS 9597LIBS=$ac_check_lib_save_LIBS
7381fi 9598fi
7382{ $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
7383$as_echo "$ac_cv_lib_xnet_t_error" >&6; } 9600echo "${ECHO_T}$ac_cv_lib_xnet_t_error" >&6; }
7384if test "x$ac_cv_lib_xnet_t_error" = xyes; then : 9601if test $ac_cv_lib_xnet_t_error = yes; then
7385 cat >>confdefs.h <<_ACEOF 9602 cat >>confdefs.h <<_ACEOF
7386#define HAVE_LIBXNET 1 9603#define HAVE_LIBXNET 1
7387_ACEOF 9604_ACEOF
@@ -7389,7 +9606,9 @@ _ACEOF
7389 LIBS="-lxnet $LIBS" 9606 LIBS="-lxnet $LIBS"
7390 9607
7391else 9608else
7392 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; }; }
7393fi 9612fi
7394 9613
7395 9614
@@ -7402,13 +9621,19 @@ fi
7402 ;; 9621 ;;
7403 *-*-hpux11*) 9622 *-*-hpux11*)
7404 9623
7405$as_echo "#define PAM_SUN_CODEBASE 1" >>confdefs.h 9624cat >>confdefs.h <<\_ACEOF
9625#define PAM_SUN_CODEBASE 1
9626_ACEOF
7406 9627
7407 9628
7408$as_echo "#define DISABLE_UTMP 1" >>confdefs.h 9629cat >>confdefs.h <<\_ACEOF
9630#define DISABLE_UTMP 1
9631_ACEOF
7409 9632
7410 9633
7411$as_echo "#define USE_BTMP 1" >>confdefs.h 9634cat >>confdefs.h <<\_ACEOF
9635#define USE_BTMP 1
9636_ACEOF
7412 9637
7413 check_for_hpux_broken_getaddrinfo=1 9638 check_for_hpux_broken_getaddrinfo=1
7414 check_for_conflicting_getspnam=1 9639 check_for_conflicting_getspnam=1
@@ -7419,7 +9644,9 @@ $as_echo "#define USE_BTMP 1" >>confdefs.h
7419 case "$host" in 9644 case "$host" in
7420 *-*-hpux10.26) 9645 *-*-hpux10.26)
7421 9646
7422$as_echo "#define HAVE_SECUREWARE 1" >>confdefs.h 9647cat >>confdefs.h <<\_ACEOF
9648#define HAVE_SECUREWARE 1
9649_ACEOF
7423 9650
7424 disable_ptmx_check=yes 9651 disable_ptmx_check=yes
7425 LIBS="$LIBS -lsecpw" 9652 LIBS="$LIBS -lsecpw"
@@ -7429,67 +9656,191 @@ $as_echo "#define HAVE_SECUREWARE 1" >>confdefs.h
7429*-*-irix5*) 9656*-*-irix5*)
7430 PATH="$PATH:/usr/etc" 9657 PATH="$PATH:/usr/etc"
7431 9658
7432$as_echo "#define BROKEN_INET_NTOA 1" >>confdefs.h 9659cat >>confdefs.h <<\_ACEOF
9660#define BROKEN_INET_NTOA 1
9661_ACEOF
7433 9662
7434 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 9663 cat >>confdefs.h <<\_ACEOF
9664#define SETEUID_BREAKS_SETUID 1
9665_ACEOF
7435 9666
7436 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 9667 cat >>confdefs.h <<\_ACEOF
9668#define BROKEN_SETREUID 1
9669_ACEOF
7437 9670
7438 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 9671 cat >>confdefs.h <<\_ACEOF
9672#define BROKEN_SETREGID 1
9673_ACEOF
7439 9674
7440 9675
7441$as_echo "#define WITH_ABBREV_NO_TTY 1" >>confdefs.h 9676cat >>confdefs.h <<\_ACEOF
9677#define WITH_ABBREV_NO_TTY 1
9678_ACEOF
7442 9679
7443 $as_echo "#define LOCKED_PASSWD_STRING \"*LK*\"" >>confdefs.h 9680 cat >>confdefs.h <<\_ACEOF
9681#define LOCKED_PASSWD_STRING "*LK*"
9682_ACEOF
7444 9683
7445 ;; 9684 ;;
7446*-*-irix6*) 9685*-*-irix6*)
7447 PATH="$PATH:/usr/etc" 9686 PATH="$PATH:/usr/etc"
7448 9687
7449$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
9696
9697
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
7450 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. */
7451 9721
7452$as_echo "#define WITH_IRIX_PROJECT 1" >>confdefs.h 9722#ifdef __STDC__
9723# include <limits.h>
9724#else
9725# include <assert.h>
9726#endif
7453 9727
9728#undef jlimit_startjob
7454 9729
7455$as_echo "#define WITH_IRIX_AUDIT 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
7456 9743
7457 ac_fn_c_check_func "$LINENO" "jlimit_startjob" "ac_cv_func_jlimit_startjob" 9744int
7458if test "x$ac_cv_func_jlimit_startjob" = xyes; then : 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
7459 9774
7460$as_echo "#define WITH_IRIX_JOBS 1" >>confdefs.h 9775 ac_cv_func_jlimit_startjob=no
9776fi
7461 9777
9778rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9779 conftest$ac_exeext conftest.$ac_ext
7462fi 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
7463 9784
7464 $as_echo "#define BROKEN_INET_NTOA 1" >>confdefs.h 9785cat >>confdefs.h <<\_ACEOF
9786#define WITH_IRIX_JOBS 1
9787_ACEOF
7465 9788
7466 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 9789fi
7467 9790
7468 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 9791 cat >>confdefs.h <<\_ACEOF
9792#define BROKEN_INET_NTOA 1
9793_ACEOF
7469 9794
7470 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 9795 cat >>confdefs.h <<\_ACEOF
9796#define SETEUID_BREAKS_SETUID 1
9797_ACEOF
7471 9798
9799 cat >>confdefs.h <<\_ACEOF
9800#define BROKEN_SETREUID 1
9801_ACEOF
9802
9803 cat >>confdefs.h <<\_ACEOF
9804#define BROKEN_SETREGID 1
9805_ACEOF
7472 9806
7473$as_echo "#define BROKEN_UPDWTMPX 1" >>confdefs.h
7474 9807
7475 $as_echo "#define WITH_ABBREV_NO_TTY 1" >>confdefs.h 9808cat >>confdefs.h <<\_ACEOF
9809#define BROKEN_UPDWTMPX 1
9810_ACEOF
7476 9811
7477 $as_echo "#define LOCKED_PASSWD_STRING \"*LK*\"" >>confdefs.h 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
7478 9819
7479 ;; 9820 ;;
7480*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu) 9821*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
7481 check_for_libcrypt_later=1 9822 check_for_libcrypt_later=1
7482 $as_echo "#define PAM_TTY_KLUDGE 1" >>confdefs.h 9823 cat >>confdefs.h <<\_ACEOF
9824#define PAM_TTY_KLUDGE 1
9825_ACEOF
7483 9826
7484 $as_echo "#define LOCKED_PASSWD_PREFIX \"!\"" >>confdefs.h 9827 cat >>confdefs.h <<\_ACEOF
9828#define LOCKED_PASSWD_PREFIX "!"
9829_ACEOF
7485 9830
7486 $as_echo "#define SPT_TYPE SPT_REUSEARGV" >>confdefs.h 9831 cat >>confdefs.h <<\_ACEOF
9832#define SPT_TYPE SPT_REUSEARGV
9833_ACEOF
7487 9834
7488 9835
7489$as_echo "#define _PATH_BTMP \"/var/log/btmp\"" >>confdefs.h 9836cat >>confdefs.h <<\_ACEOF
9837#define _PATH_BTMP "/var/log/btmp"
9838_ACEOF
7490 9839
7491 9840
7492$as_echo "#define USE_BTMP 1" >>confdefs.h 9841cat >>confdefs.h <<\_ACEOF
9842#define USE_BTMP 1
9843_ACEOF
7493 9844
7494 ;; 9845 ;;
7495*-*-linux*) 9846*-*-linux*)
@@ -7498,39 +9849,188 @@ $as_echo "#define USE_BTMP 1" >>confdefs.h
7498 check_for_libcrypt_later=1 9849 check_for_libcrypt_later=1
7499 check_for_openpty_ctty_bug=1 9850 check_for_openpty_ctty_bug=1
7500 9851
7501$as_echo "#define PAM_TTY_KLUDGE 1" >>confdefs.h 9852cat >>confdefs.h <<\_ACEOF
9853#define PAM_TTY_KLUDGE 1
9854_ACEOF
7502 9855
7503 9856
7504$as_echo "#define LOCKED_PASSWD_PREFIX \"!\"" >>confdefs.h 9857cat >>confdefs.h <<\_ACEOF
9858#define LOCKED_PASSWD_PREFIX "!"
9859_ACEOF
7505 9860
7506 $as_echo "#define SPT_TYPE SPT_REUSEARGV" >>confdefs.h 9861 cat >>confdefs.h <<\_ACEOF
9862#define SPT_TYPE SPT_REUSEARGV
9863_ACEOF
7507 9864
7508 9865
7509$as_echo "#define LINK_OPNOTSUPP_ERRNO EPERM" >>confdefs.h 9866cat >>confdefs.h <<\_ACEOF
9867#define LINK_OPNOTSUPP_ERRNO EPERM
9868_ACEOF
7510 9869
7511 9870
7512$as_echo "#define _PATH_BTMP \"/var/log/btmp\"" >>confdefs.h 9871cat >>confdefs.h <<\_ACEOF
9872#define _PATH_BTMP "/var/log/btmp"
9873_ACEOF
7513 9874
7514 $as_echo "#define USE_BTMP 1" >>confdefs.h 9875 cat >>confdefs.h <<\_ACEOF
9876#define USE_BTMP 1
9877_ACEOF
7515 9878
7516 9879
7517$as_echo "#define LINUX_OOM_ADJUST 1" >>confdefs.h 9880cat >>confdefs.h <<\_ACEOF
9881#define LINUX_OOM_ADJUST 1
9882_ACEOF
7518 9883
7519 inet6_default_4in6=yes 9884 inet6_default_4in6=yes
7520 case `uname -r` in 9885 case `uname -r` in
7521 1.*|2.0.*) 9886 1.*|2.0.*)
7522 9887
7523$as_echo "#define BROKEN_CMSG_TYPE 1" >>confdefs.h 9888cat >>confdefs.h <<\_ACEOF
9889#define BROKEN_CMSG_TYPE 1
9890_ACEOF
7524 9891
7525 ;; 9892 ;;
7526 esac 9893 esac
7527 # tun(4) forwarding compat code 9894 # tun(4) forwarding compat code
7528 for ac_header in linux/if_tun.h 9895
7529do : 9896for ac_header in linux/if_tun.h
7530 ac_fn_c_check_header_mongrel "$LINENO" "linux/if_tun.h" "ac_cv_header_linux_if_tun_h" "$ac_includes_default" 9897do
7531if 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
7532 cat >>confdefs.h <<_ACEOF 10032 cat >>confdefs.h <<_ACEOF
7533#define HAVE_LINUX_IF_TUN_H 1 10033#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
7534_ACEOF 10034_ACEOF
7535 10035
7536fi 10036fi
@@ -7539,42 +10039,177 @@ done
7539 10039
7540 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
7541 10041
7542$as_echo "#define SSH_TUN_LINUX 1" >>confdefs.h 10042cat >>confdefs.h <<\_ACEOF
10043#define SSH_TUN_LINUX 1
10044_ACEOF
7543 10045
7544 10046
7545$as_echo "#define SSH_TUN_COMPAT_AF 1" >>confdefs.h 10047cat >>confdefs.h <<\_ACEOF
10048#define SSH_TUN_COMPAT_AF 1
10049_ACEOF
7546 10050
7547 10051
7548$as_echo "#define SSH_TUN_PREPEND_AF 1" >>confdefs.h 10052cat >>confdefs.h <<\_ACEOF
10053#define SSH_TUN_PREPEND_AF 1
10054_ACEOF
7549 10055
7550 fi 10056 fi
7551 for ac_header in linux/seccomp.h linux/filter.h linux/audit.h 10057
7552do : 10058
7553 as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` 10059
7554ac_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
7555" 10061do
7556if 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
7557 cat >>confdefs.h <<_ACEOF 10109 cat >>confdefs.h <<_ACEOF
7558#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 10110#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
7559_ACEOF 10111_ACEOF
7560 10112
7561fi 10113fi
7562 10114
7563done 10115done
7564 10116
7565 for ac_func in prctl 10117
7566do : 10118for ac_func in prctl
7567 ac_fn_c_check_func "$LINENO" "prctl" "ac_cv_func_prctl" 10119do
7568if 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
7569 cat >>confdefs.h <<_ACEOF 10204 cat >>confdefs.h <<_ACEOF
7570#define HAVE_PRCTL 1 10205#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
7571_ACEOF 10206_ACEOF
7572 10207
7573fi 10208fi
7574done 10209done
7575 10210
7576 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for seccomp architecture" >&5 10211 { echo "$as_me:$LINENO: checking for seccomp architecture" >&5
7577$as_echo_n "checking for seccomp architecture... " >&6; } 10212echo $ECHO_N "checking for seccomp architecture... $ECHO_C" >&6; }
7578 seccomp_audit_arch= 10213 seccomp_audit_arch=
7579 case "$host" in 10214 case "$host" in
7580 x86_64-*) 10215 x86_64-*)
@@ -7588,21 +10223,23 @@ $as_echo_n "checking for seccomp architecture... " >&6; }
7588 ;; 10223 ;;
7589 esac 10224 esac
7590 if test "x$seccomp_audit_arch" != "x" ; then 10225 if test "x$seccomp_audit_arch" != "x" ; then
7591 { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$seccomp_audit_arch\"" >&5 10226 { echo "$as_me:$LINENO: result: \"$seccomp_audit_arch\"" >&5
7592$as_echo "\"$seccomp_audit_arch\"" >&6; } 10227echo "${ECHO_T}\"$seccomp_audit_arch\"" >&6; }
7593 10228
7594cat >>confdefs.h <<_ACEOF 10229cat >>confdefs.h <<_ACEOF
7595#define SECCOMP_AUDIT_ARCH $seccomp_audit_arch 10230#define SECCOMP_AUDIT_ARCH $seccomp_audit_arch
7596_ACEOF 10231_ACEOF
7597 10232
7598 else 10233 else
7599 { $as_echo "$as_me:${as_lineno-$LINENO}: result: architecture not supported" >&5 10234 { echo "$as_me:$LINENO: result: architecture not supported" >&5
7600$as_echo "architecture not supported" >&6; } 10235echo "${ECHO_T}architecture not supported" >&6; }
7601 fi 10236 fi
7602 ;; 10237 ;;
7603mips-sony-bsd|mips-sony-newsos4) 10238mips-sony-bsd|mips-sony-newsos4)
7604 10239
7605$as_echo "#define NEED_SETPGRP 1" >>confdefs.h 10240cat >>confdefs.h <<\_ACEOF
10241#define NEED_SETPGRP 1
10242_ACEOF
7606 10243
7607 SONY=1 10244 SONY=1
7608 ;; 10245 ;;
@@ -7612,66 +10249,352 @@ $as_echo "#define NEED_SETPGRP 1" >>confdefs.h
7612 need_dash_r=1 10249 need_dash_r=1
7613 fi 10250 fi
7614 10251
7615$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
7616 10298
7617 ac_fn_c_check_header_mongrel "$LINENO" "net/if_tap.h" "ac_cv_header_net_if_tap_h" "$ac_includes_default" 10299 ac_header_compiler=no
7618if test "x$ac_cv_header_net_if_tap_h" = xyes; then : 10300fi
7619 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
7620else 10334else
10335 echo "$as_me: failed program was:" >&5
10336sed 's/^/| /' conftest.$ac_ext >&5
7621 10337
7622$as_echo "#define SSH_TUN_NO_L2 1" >>confdefs.h 10338 ac_header_preproc=no
10339fi
7623 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; }
10344
10345# So? What about this header?
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
7624fi 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; }
7625 10384
10385fi
10386if test $ac_cv_header_net_if_tap_h = yes; then
10387 :
10388else
7626 10389
10390cat >>confdefs.h <<\_ACEOF
10391#define SSH_TUN_NO_L2 1
10392_ACEOF
7627 10393
7628$as_echo "#define SSH_TUN_PREPEND_AF 1" >>confdefs.h 10394fi
10395
10396
10397
10398cat >>confdefs.h <<\_ACEOF
10399#define SSH_TUN_PREPEND_AF 1
10400_ACEOF
7629 10401
7630 TEST_MALLOC_OPTIONS="AJRX" 10402 TEST_MALLOC_OPTIONS="AJRX"
7631 10403
7632$as_echo "#define BROKEN_STRNVIS 1" >>confdefs.h 10404cat >>confdefs.h <<\_ACEOF
10405#define BROKEN_STRNVIS 1
10406_ACEOF
7633 10407
7634 10408
7635$as_echo "#define BROKEN_READ_COMPARISON 1" >>confdefs.h 10409cat >>confdefs.h <<\_ACEOF
10410#define BROKEN_READ_COMPARISON 1
10411_ACEOF
7636 10412
7637 ;; 10413 ;;
7638*-*-freebsd*) 10414*-*-freebsd*)
7639 check_for_libcrypt_later=1 10415 check_for_libcrypt_later=1
7640 10416
7641$as_echo "#define LOCKED_PASSWD_PREFIX \"*LOCKED*\"" >>confdefs.h 10417cat >>confdefs.h <<\_ACEOF
10418#define LOCKED_PASSWD_PREFIX "*LOCKED*"
10419_ACEOF
7642 10420
7643 10421
7644$as_echo "#define SSH_TUN_FREEBSD 1" >>confdefs.h 10422cat >>confdefs.h <<\_ACEOF
10423#define SSH_TUN_FREEBSD 1
10424_ACEOF
7645 10425
7646 ac_fn_c_check_header_mongrel "$LINENO" "net/if_tap.h" "ac_cv_header_net_if_tap_h" "$ac_includes_default" 10426 if test "${ac_cv_header_net_if_tap_h+set}" = set; then
7647if test "x$ac_cv_header_net_if_tap_h" = xyes; 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; }
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
10507
10508 ac_header_preproc=no
10509fi
10510
10511rm -f conftest.err conftest.$ac_ext
10512{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
10513echo "${ECHO_T}$ac_header_preproc" >&6; }
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
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; }
7648 10554
10555fi
10556if test $ac_cv_header_net_if_tap_h = yes; then
10557 :
7649else 10558else
7650 10559
7651$as_echo "#define SSH_TUN_NO_L2 1" >>confdefs.h 10560cat >>confdefs.h <<\_ACEOF
10561#define SSH_TUN_NO_L2 1
10562_ACEOF
7652 10563
7653fi 10564fi
7654 10565
7655 10566
7656 10567
7657$as_echo "#define BROKEN_GLOB 1" >>confdefs.h 10568cat >>confdefs.h <<\_ACEOF
10569#define BROKEN_GLOB 1
10570_ACEOF
7658 10571
7659 10572
7660$as_echo "#define BROKEN_STRNVIS 1" >>confdefs.h 10573cat >>confdefs.h <<\_ACEOF
10574#define BROKEN_STRNVIS 1
10575_ACEOF
7661 10576
7662 TEST_MALLOC_OPTIONS="AJRX" 10577 TEST_MALLOC_OPTIONS="AJRX"
7663 # Preauth crypto occasionally uses file descriptors for crypto offload 10578 # Preauth crypto occasionally uses file descriptors for crypto offload
7664 # and will crash if they cannot be opened. 10579 # and will crash if they cannot be opened.
7665 10580
7666$as_echo "#define SANDBOX_SKIP_RLIMIT_NOFILE 1" >>confdefs.h 10581cat >>confdefs.h <<\_ACEOF
10582#define SANDBOX_SKIP_RLIMIT_NOFILE 1
10583_ACEOF
7667 10584
7668 ;; 10585 ;;
7669*-*-bsdi*) 10586*-*-bsdi*)
7670 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 10587 cat >>confdefs.h <<\_ACEOF
10588#define SETEUID_BREAKS_SETUID 1
10589_ACEOF
7671 10590
7672 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 10591 cat >>confdefs.h <<\_ACEOF
10592#define BROKEN_SETREUID 1
10593_ACEOF
7673 10594
7674 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 10595 cat >>confdefs.h <<\_ACEOF
10596#define BROKEN_SETREGID 1
10597_ACEOF
7675 10598
7676 ;; 10599 ;;
7677*-next-*) 10600*-next-*)
@@ -7680,29 +10603,45 @@ $as_echo "#define SANDBOX_SKIP_RLIMIT_NOFILE 1" >>confdefs.h
7680 conf_wtmp_location=/usr/adm/wtmp 10603 conf_wtmp_location=/usr/adm/wtmp
7681 maildir=/usr/spool/mail 10604 maildir=/usr/spool/mail
7682 10605
7683$as_echo "#define HAVE_NEXT 1" >>confdefs.h 10606cat >>confdefs.h <<\_ACEOF
10607#define HAVE_NEXT 1
10608_ACEOF
7684 10609
7685 $as_echo "#define BROKEN_REALPATH 1" >>confdefs.h 10610 cat >>confdefs.h <<\_ACEOF
10611#define BROKEN_REALPATH 1
10612_ACEOF
7686 10613
7687 $as_echo "#define USE_PIPES 1" >>confdefs.h 10614 cat >>confdefs.h <<\_ACEOF
10615#define USE_PIPES 1
10616_ACEOF
7688 10617
7689 10618
7690$as_echo "#define BROKEN_SAVED_UIDS 1" >>confdefs.h 10619cat >>confdefs.h <<\_ACEOF
10620#define BROKEN_SAVED_UIDS 1
10621_ACEOF
7691 10622
7692 ;; 10623 ;;
7693*-*-openbsd*) 10624*-*-openbsd*)
7694 use_pie=auto 10625 use_pie=auto
7695 10626
7696$as_echo "#define HAVE_ATTRIBUTE__SENTINEL__ 1" >>confdefs.h 10627cat >>confdefs.h <<\_ACEOF
10628#define HAVE_ATTRIBUTE__SENTINEL__ 1
10629_ACEOF
7697 10630
7698 10631
7699$as_echo "#define HAVE_ATTRIBUTE__BOUNDED__ 1" >>confdefs.h 10632cat >>confdefs.h <<\_ACEOF
10633#define HAVE_ATTRIBUTE__BOUNDED__ 1
10634_ACEOF
7700 10635
7701 10636
7702$as_echo "#define SSH_TUN_OPENBSD 1" >>confdefs.h 10637cat >>confdefs.h <<\_ACEOF
10638#define SSH_TUN_OPENBSD 1
10639_ACEOF
7703 10640
7704 10641
7705$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
7706 10645
7707 TEST_MALLOC_OPTIONS="AFGJPRX" 10646 TEST_MALLOC_OPTIONS="AFGJPRX"
7708 ;; 10647 ;;
@@ -7710,60 +10649,86 @@ $as_echo "#define SYSLOG_R_SAFE_IN_SIGHAND 1" >>confdefs.h
7710 if test "x$withval" != "xno" ; then 10649 if test "x$withval" != "xno" ; then
7711 need_dash_r=1 10650 need_dash_r=1
7712 fi 10651 fi
7713 $as_echo "#define PAM_SUN_CODEBASE 1" >>confdefs.h 10652 cat >>confdefs.h <<\_ACEOF
10653#define PAM_SUN_CODEBASE 1
10654_ACEOF
7714 10655
7715 $as_echo "#define LOGIN_NEEDS_UTMPX 1" >>confdefs.h 10656 cat >>confdefs.h <<\_ACEOF
10657#define LOGIN_NEEDS_UTMPX 1
10658_ACEOF
7716 10659
7717 10660
7718$as_echo "#define LOGIN_NEEDS_TERM 1" >>confdefs.h 10661cat >>confdefs.h <<\_ACEOF
10662#define LOGIN_NEEDS_TERM 1
10663_ACEOF
7719 10664
7720 $as_echo "#define PAM_TTY_KLUDGE 1" >>confdefs.h 10665 cat >>confdefs.h <<\_ACEOF
10666#define PAM_TTY_KLUDGE 1
10667_ACEOF
7721 10668
7722 10669
7723$as_echo "#define SSHPAM_CHAUTHTOK_NEEDS_RUID 1" >>confdefs.h 10670cat >>confdefs.h <<\_ACEOF
10671#define SSHPAM_CHAUTHTOK_NEEDS_RUID 1
10672_ACEOF
7724 10673
7725 $as_echo "#define LOCKED_PASSWD_STRING \"*LK*\"" >>confdefs.h 10674 cat >>confdefs.h <<\_ACEOF
10675#define LOCKED_PASSWD_STRING "*LK*"
10676_ACEOF
7726 10677
7727 # Pushing STREAMS modules will cause sshd to acquire a controlling tty. 10678 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
7728 10679
7729$as_echo "#define SSHD_ACQUIRES_CTTY 1" >>confdefs.h 10680cat >>confdefs.h <<\_ACEOF
10681#define SSHD_ACQUIRES_CTTY 1
10682_ACEOF
7730 10683
7731 10684
7732$as_echo "#define PASSWD_NEEDS_USERNAME 1" >>confdefs.h 10685cat >>confdefs.h <<\_ACEOF
10686#define PASSWD_NEEDS_USERNAME 1
10687_ACEOF
7733 10688
7734 10689
7735$as_echo "#define BROKEN_TCGETATTR_ICANON 1" >>confdefs.h 10690cat >>confdefs.h <<\_ACEOF
10691#define BROKEN_TCGETATTR_ICANON 1
10692_ACEOF
7736 10693
7737 external_path_file=/etc/default/login 10694 external_path_file=/etc/default/login
7738 # hardwire lastlog location (can't detect it on some versions) 10695 # hardwire lastlog location (can't detect it on some versions)
7739 conf_lastlog_location="/var/adm/lastlog" 10696 conf_lastlog_location="/var/adm/lastlog"
7740 { $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
7741$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; }
7742 sol2ver=`echo "$host"| sed -e 's/.*[0-9]\.//'` 10699 sol2ver=`echo "$host"| sed -e 's/.*[0-9]\.//'`
7743 if test "$sol2ver" -ge 8; then 10700 if test "$sol2ver" -ge 8; then
7744 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 10701 { echo "$as_me:$LINENO: result: yes" >&5
7745$as_echo "yes" >&6; } 10702echo "${ECHO_T}yes" >&6; }
7746 $as_echo "#define DISABLE_UTMP 1" >>confdefs.h 10703 cat >>confdefs.h <<\_ACEOF
10704#define DISABLE_UTMP 1
10705_ACEOF
7747 10706
7748 10707
7749$as_echo "#define DISABLE_WTMP 1" >>confdefs.h 10708cat >>confdefs.h <<\_ACEOF
10709#define DISABLE_WTMP 1
10710_ACEOF
7750 10711
7751 else 10712 else
7752 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 10713 { echo "$as_me:$LINENO: result: no" >&5
7753$as_echo "no" >&6; } 10714echo "${ECHO_T}no" >&6; }
7754 fi 10715 fi
7755 10716
7756# Check whether --with-solaris-contracts was given. 10717# Check whether --with-solaris-contracts was given.
7757if test "${with_solaris_contracts+set}" = set; then : 10718if test "${with_solaris_contracts+set}" = set; then
7758 withval=$with_solaris_contracts; 10719 withval=$with_solaris_contracts;
7759 { $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
7760$as_echo_n "checking for ct_tmpl_activate in -lcontract... " >&6; } 10721echo $ECHO_N "checking for ct_tmpl_activate in -lcontract... $ECHO_C" >&6; }
7761if ${ac_cv_lib_contract_ct_tmpl_activate+:} false; then : 10722if test "${ac_cv_lib_contract_ct_tmpl_activate+set}" = set; then
7762 $as_echo_n "(cached) " >&6 10723 echo $ECHO_N "(cached) $ECHO_C" >&6
7763else 10724else
7764 ac_check_lib_save_LIBS=$LIBS 10725 ac_check_lib_save_LIBS=$LIBS
7765LIBS="-lcontract $LIBS" 10726LIBS="-lcontract $LIBS"
7766cat 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
7767/* end confdefs.h. */ 10732/* end confdefs.h. */
7768 10733
7769/* Override any GCC internal prototype to avoid an error. 10734/* Override any GCC internal prototype to avoid an error.
@@ -7781,20 +10746,43 @@ return ct_tmpl_activate ();
7781 return 0; 10746 return 0;
7782} 10747}
7783_ACEOF 10748_ACEOF
7784if 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
7785 ac_cv_lib_contract_ct_tmpl_activate=yes 10767 ac_cv_lib_contract_ct_tmpl_activate=yes
7786else 10768else
7787 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
7788fi 10773fi
7789rm -f core conftest.err conftest.$ac_objext \ 10774
7790 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
7791LIBS=$ac_check_lib_save_LIBS 10777LIBS=$ac_check_lib_save_LIBS
7792fi 10778fi
7793{ $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
7794$as_echo "$ac_cv_lib_contract_ct_tmpl_activate" >&6; } 10780echo "${ECHO_T}$ac_cv_lib_contract_ct_tmpl_activate" >&6; }
7795if test "x$ac_cv_lib_contract_ct_tmpl_activate" = xyes; then : 10781if test $ac_cv_lib_contract_ct_tmpl_activate = yes; then
7796 10782
7797$as_echo "#define USE_SOLARIS_PROCESS_CONTRACTS 1" >>confdefs.h 10783cat >>confdefs.h <<\_ACEOF
10784#define USE_SOLARIS_PROCESS_CONTRACTS 1
10785_ACEOF
7798 10786
7799 SSHDLIBS="$SSHDLIBS -lcontract" 10787 SSHDLIBS="$SSHDLIBS -lcontract"
7800 SPC_MSG="yes" 10788 SPC_MSG="yes"
@@ -7805,16 +10793,20 @@ fi
7805 10793
7806 10794
7807# Check whether --with-solaris-projects was given. 10795# Check whether --with-solaris-projects was given.
7808if test "${with_solaris_projects+set}" = set; then : 10796if test "${with_solaris_projects+set}" = set; then
7809 withval=$with_solaris_projects; 10797 withval=$with_solaris_projects;
7810 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setproject in -lproject" >&5 10798 { echo "$as_me:$LINENO: checking for setproject in -lproject" >&5
7811$as_echo_n "checking for setproject in -lproject... " >&6; } 10799echo $ECHO_N "checking for setproject in -lproject... $ECHO_C" >&6; }
7812if ${ac_cv_lib_project_setproject+:} false; then : 10800if test "${ac_cv_lib_project_setproject+set}" = set; then
7813 $as_echo_n "(cached) " >&6 10801 echo $ECHO_N "(cached) $ECHO_C" >&6
7814else 10802else
7815 ac_check_lib_save_LIBS=$LIBS 10803 ac_check_lib_save_LIBS=$LIBS
7816LIBS="-lproject $LIBS" 10804LIBS="-lproject $LIBS"
7817cat 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
7818/* end confdefs.h. */ 10810/* end confdefs.h. */
7819 10811
7820/* Override any GCC internal prototype to avoid an error. 10812/* Override any GCC internal prototype to avoid an error.
@@ -7832,20 +10824,43 @@ return setproject ();
7832 return 0; 10824 return 0;
7833} 10825}
7834_ACEOF 10826_ACEOF
7835if 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
7836 ac_cv_lib_project_setproject=yes 10845 ac_cv_lib_project_setproject=yes
7837else 10846else
7838 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
7839fi 10851fi
7840rm -f core conftest.err conftest.$ac_objext \ 10852
7841 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
7842LIBS=$ac_check_lib_save_LIBS 10855LIBS=$ac_check_lib_save_LIBS
7843fi 10856fi
7844{ $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
7845$as_echo "$ac_cv_lib_project_setproject" >&6; } 10858echo "${ECHO_T}$ac_cv_lib_project_setproject" >&6; }
7846if test "x$ac_cv_lib_project_setproject" = xyes; then : 10859if test $ac_cv_lib_project_setproject = yes; then
7847 10860
7848$as_echo "#define USE_SOLARIS_PROJECTS 1" >>confdefs.h 10861cat >>confdefs.h <<\_ACEOF
10862#define USE_SOLARIS_PROJECTS 1
10863_ACEOF
7849 10864
7850 SSHDLIBS="$SSHDLIBS -lproject" 10865 SSHDLIBS="$SSHDLIBS -lproject"
7851 SP_MSG="yes" 10866 SP_MSG="yes"
@@ -7858,48 +10873,150 @@ fi
7858 ;; 10873 ;;
7859*-*-sunos4*) 10874*-*-sunos4*)
7860 CPPFLAGS="$CPPFLAGS -DSUNOS4" 10875 CPPFLAGS="$CPPFLAGS -DSUNOS4"
7861 for ac_func in getpwanam 10876
7862do : 10877for ac_func in getpwanam
7863 ac_fn_c_check_func "$LINENO" "getpwanam" "ac_cv_func_getpwanam" 10878do
7864if 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
7865 cat >>confdefs.h <<_ACEOF 10963 cat >>confdefs.h <<_ACEOF
7866#define HAVE_GETPWANAM 1 10964#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
7867_ACEOF 10965_ACEOF
7868 10966
7869fi 10967fi
7870done 10968done
7871 10969
7872 $as_echo "#define PAM_SUN_CODEBASE 1" >>confdefs.h 10970 cat >>confdefs.h <<\_ACEOF
10971#define PAM_SUN_CODEBASE 1
10972_ACEOF
7873 10973
7874 conf_utmp_location=/etc/utmp 10974 conf_utmp_location=/etc/utmp
7875 conf_wtmp_location=/var/adm/wtmp 10975 conf_wtmp_location=/var/adm/wtmp
7876 conf_lastlog_location=/var/adm/lastlog 10976 conf_lastlog_location=/var/adm/lastlog
7877 $as_echo "#define USE_PIPES 1" >>confdefs.h 10977 cat >>confdefs.h <<\_ACEOF
10978#define USE_PIPES 1
10979_ACEOF
7878 10980
7879 ;; 10981 ;;
7880*-ncr-sysv*) 10982*-ncr-sysv*)
7881 LIBS="$LIBS -lc89" 10983 LIBS="$LIBS -lc89"
7882 $as_echo "#define USE_PIPES 1" >>confdefs.h 10984 cat >>confdefs.h <<\_ACEOF
10985#define USE_PIPES 1
10986_ACEOF
7883 10987
7884 $as_echo "#define SSHD_ACQUIRES_CTTY 1" >>confdefs.h 10988 cat >>confdefs.h <<\_ACEOF
10989#define SSHD_ACQUIRES_CTTY 1
10990_ACEOF
7885 10991
7886 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 10992 cat >>confdefs.h <<\_ACEOF
10993#define SETEUID_BREAKS_SETUID 1
10994_ACEOF
7887 10995
7888 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 10996 cat >>confdefs.h <<\_ACEOF
10997#define BROKEN_SETREUID 1
10998_ACEOF
7889 10999
7890 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11000 cat >>confdefs.h <<\_ACEOF
11001#define BROKEN_SETREGID 1
11002_ACEOF
7891 11003
7892 ;; 11004 ;;
7893*-sni-sysv*) 11005*-sni-sysv*)
7894 # /usr/ucblib MUST NOT be searched on ReliantUNIX 11006 # /usr/ucblib MUST NOT be searched on ReliantUNIX
7895 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5 11007
7896$as_echo_n "checking for dlsym in -ldl... " >&6; } 11008{ echo "$as_me:$LINENO: checking for dlsym in -ldl" >&5
7897if ${ac_cv_lib_dl_dlsym+:} false; then : 11009echo $ECHO_N "checking for dlsym in -ldl... $ECHO_C" >&6; }
7898 $as_echo_n "(cached) " >&6 11010if test "${ac_cv_lib_dl_dlsym+set}" = set; then
11011 echo $ECHO_N "(cached) $ECHO_C" >&6
7899else 11012else
7900 ac_check_lib_save_LIBS=$LIBS 11013 ac_check_lib_save_LIBS=$LIBS
7901LIBS="-ldl $LIBS" 11014LIBS="-ldl $LIBS"
7902cat 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
7903/* end confdefs.h. */ 11020/* end confdefs.h. */
7904 11021
7905/* Override any GCC internal prototype to avoid an error. 11022/* Override any GCC internal prototype to avoid an error.
@@ -7917,18 +11034,39 @@ return dlsym ();
7917 return 0; 11034 return 0;
7918} 11035}
7919_ACEOF 11036_ACEOF
7920if 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
7921 ac_cv_lib_dl_dlsym=yes 11055 ac_cv_lib_dl_dlsym=yes
7922else 11056else
7923 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
7924fi 11061fi
7925rm -f core conftest.err conftest.$ac_objext \ 11062
7926 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
7927LIBS=$ac_check_lib_save_LIBS 11065LIBS=$ac_check_lib_save_LIBS
7928fi 11066fi
7929{ $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
7930$as_echo "$ac_cv_lib_dl_dlsym" >&6; } 11068echo "${ECHO_T}$ac_cv_lib_dl_dlsym" >&6; }
7931if test "x$ac_cv_lib_dl_dlsym" = xyes; then : 11069if test $ac_cv_lib_dl_dlsym = yes; then
7932 cat >>confdefs.h <<_ACEOF 11070 cat >>confdefs.h <<_ACEOF
7933#define HAVE_LIBDL 1 11071#define HAVE_LIBDL 1
7934_ACEOF 11072_ACEOF
@@ -7938,14 +11076,18 @@ _ACEOF
7938fi 11076fi
7939 11077
7940 # -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
7941 { $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
7942$as_echo_n "checking for res_query in -lresolv... " >&6; } 11080echo $ECHO_N "checking for res_query in -lresolv... $ECHO_C" >&6; }
7943if ${ac_cv_lib_resolv_res_query+:} false; then : 11081if test "${ac_cv_lib_resolv_res_query+set}" = set; then
7944 $as_echo_n "(cached) " >&6 11082 echo $ECHO_N "(cached) $ECHO_C" >&6
7945else 11083else
7946 ac_check_lib_save_LIBS=$LIBS 11084 ac_check_lib_save_LIBS=$LIBS
7947LIBS="-lresolv $LIBS" 11085LIBS="-lresolv $LIBS"
7948cat 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
7949/* end confdefs.h. */ 11091/* end confdefs.h. */
7950 11092
7951/* Override any GCC internal prototype to avoid an error. 11093/* Override any GCC internal prototype to avoid an error.
@@ -7963,33 +11105,66 @@ return res_query ();
7963 return 0; 11105 return 0;
7964} 11106}
7965_ACEOF 11107_ACEOF
7966if 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
7967 ac_cv_lib_resolv_res_query=yes 11126 ac_cv_lib_resolv_res_query=yes
7968else 11127else
7969 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
7970fi 11132fi
7971rm -f core conftest.err conftest.$ac_objext \ 11133
7972 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
7973LIBS=$ac_check_lib_save_LIBS 11136LIBS=$ac_check_lib_save_LIBS
7974fi 11137fi
7975{ $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
7976$as_echo "$ac_cv_lib_resolv_res_query" >&6; } 11139echo "${ECHO_T}$ac_cv_lib_resolv_res_query" >&6; }
7977if test "x$ac_cv_lib_resolv_res_query" = xyes; then : 11140if test $ac_cv_lib_resolv_res_query = yes; then
7978 LIBS="$LIBS -lresolv" 11141 LIBS="$LIBS -lresolv"
7979fi 11142fi
7980 11143
7981 IPADDR_IN_DISPLAY=yes 11144 IPADDR_IN_DISPLAY=yes
7982 $as_echo "#define USE_PIPES 1" >>confdefs.h 11145 cat >>confdefs.h <<\_ACEOF
11146#define USE_PIPES 1
11147_ACEOF
7983 11148
7984 $as_echo "#define IP_TOS_IS_BROKEN 1" >>confdefs.h 11149 cat >>confdefs.h <<\_ACEOF
11150#define IP_TOS_IS_BROKEN 1
11151_ACEOF
7985 11152
7986 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 11153 cat >>confdefs.h <<\_ACEOF
11154#define SETEUID_BREAKS_SETUID 1
11155_ACEOF
7987 11156
7988 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 11157 cat >>confdefs.h <<\_ACEOF
11158#define BROKEN_SETREUID 1
11159_ACEOF
7989 11160
7990 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11161 cat >>confdefs.h <<\_ACEOF
11162#define BROKEN_SETREGID 1
11163_ACEOF
7991 11164
7992 $as_echo "#define SSHD_ACQUIRES_CTTY 1" >>confdefs.h 11165 cat >>confdefs.h <<\_ACEOF
11166#define SSHD_ACQUIRES_CTTY 1
11167_ACEOF
7993 11168
7994 external_path_file=/etc/default/login 11169 external_path_file=/etc/default/login
7995 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX 11170 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
@@ -7998,18 +11173,30 @@ fi
7998 ;; 11173 ;;
7999# 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.
8000*-*-sysv4.2*) 11175*-*-sysv4.2*)
8001 $as_echo "#define USE_PIPES 1" >>confdefs.h 11176 cat >>confdefs.h <<\_ACEOF
11177#define USE_PIPES 1
11178_ACEOF
8002 11179
8003 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 11180 cat >>confdefs.h <<\_ACEOF
11181#define SETEUID_BREAKS_SETUID 1
11182_ACEOF
8004 11183
8005 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 11184 cat >>confdefs.h <<\_ACEOF
11185#define BROKEN_SETREUID 1
11186_ACEOF
8006 11187
8007 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11188 cat >>confdefs.h <<\_ACEOF
11189#define BROKEN_SETREGID 1
11190_ACEOF
8008 11191
8009 11192
8010$as_echo "#define PASSWD_NEEDS_USERNAME 1" >>confdefs.h 11193cat >>confdefs.h <<\_ACEOF
11194#define PASSWD_NEEDS_USERNAME 1
11195_ACEOF
8011 11196
8012 $as_echo "#define LOCKED_PASSWD_STRING \"*LK*\"" >>confdefs.h 11197 cat >>confdefs.h <<\_ACEOF
11198#define LOCKED_PASSWD_STRING "*LK*"
11199_ACEOF
8013 11200
8014 TEST_SHELL=$SHELL # let configure find us a capable shell 11201 TEST_SHELL=$SHELL # let configure find us a capable shell
8015 ;; 11202 ;;
@@ -8017,37 +11204,59 @@ $as_echo "#define PASSWD_NEEDS_USERNAME 1" >>confdefs.h
8017*-*-sysv5*) 11204*-*-sysv5*)
8018 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf" 11205 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
8019 11206
8020$as_echo "#define UNIXWARE_LONG_PASSWORDS 1" >>confdefs.h 11207cat >>confdefs.h <<\_ACEOF
11208#define UNIXWARE_LONG_PASSWORDS 1
11209_ACEOF
8021 11210
8022 $as_echo "#define USE_PIPES 1" >>confdefs.h 11211 cat >>confdefs.h <<\_ACEOF
11212#define USE_PIPES 1
11213_ACEOF
8023 11214
8024 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 11215 cat >>confdefs.h <<\_ACEOF
11216#define SETEUID_BREAKS_SETUID 1
11217_ACEOF
8025 11218
8026 $as_echo "#define BROKEN_GETADDRINFO 1" >>confdefs.h 11219 cat >>confdefs.h <<\_ACEOF
11220#define BROKEN_GETADDRINFO 1
11221_ACEOF
8027 11222
8028 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 11223 cat >>confdefs.h <<\_ACEOF
11224#define BROKEN_SETREUID 1
11225_ACEOF
8029 11226
8030 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11227 cat >>confdefs.h <<\_ACEOF
11228#define BROKEN_SETREGID 1
11229_ACEOF
8031 11230
8032 $as_echo "#define PASSWD_NEEDS_USERNAME 1" >>confdefs.h 11231 cat >>confdefs.h <<\_ACEOF
11232#define PASSWD_NEEDS_USERNAME 1
11233_ACEOF
8033 11234
8034 TEST_SHELL=$SHELL # let configure find us a capable shell 11235 TEST_SHELL=$SHELL # let configure find us a capable shell
8035 case "$host" in 11236 case "$host" in
8036 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x 11237 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
8037 maildir=/var/spool/mail 11238 maildir=/var/spool/mail
8038 11239
8039$as_echo "#define BROKEN_LIBIAF 1" >>confdefs.h 11240cat >>confdefs.h <<\_ACEOF
11241#define BROKEN_LIBIAF 1
11242_ACEOF
8040 11243
8041 $as_echo "#define BROKEN_UPDWTMPX 1" >>confdefs.h 11244 cat >>confdefs.h <<\_ACEOF
11245#define BROKEN_UPDWTMPX 1
11246_ACEOF
8042 11247
8043 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getluid in -lprot" >&5 11248 { echo "$as_me:$LINENO: checking for getluid in -lprot" >&5
8044$as_echo_n "checking for getluid in -lprot... " >&6; } 11249echo $ECHO_N "checking for getluid in -lprot... $ECHO_C" >&6; }
8045if ${ac_cv_lib_prot_getluid+:} false; then : 11250if test "${ac_cv_lib_prot_getluid+set}" = set; then
8046 $as_echo_n "(cached) " >&6 11251 echo $ECHO_N "(cached) $ECHO_C" >&6
8047else 11252else
8048 ac_check_lib_save_LIBS=$LIBS 11253 ac_check_lib_save_LIBS=$LIBS
8049LIBS="-lprot $LIBS" 11254LIBS="-lprot $LIBS"
8050cat 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
8051/* end confdefs.h. */ 11260/* end confdefs.h. */
8052 11261
8053/* Override any GCC internal prototype to avoid an error. 11262/* Override any GCC internal prototype to avoid an error.
@@ -8065,40 +11274,150 @@ return getluid ();
8065 return 0; 11274 return 0;
8066} 11275}
8067_ACEOF 11276_ACEOF
8068if 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
8069 ac_cv_lib_prot_getluid=yes 11295 ac_cv_lib_prot_getluid=yes
8070else 11296else
8071 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
8072fi 11301fi
8073rm -f core conftest.err conftest.$ac_objext \ 11302
8074 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
8075LIBS=$ac_check_lib_save_LIBS 11305LIBS=$ac_check_lib_save_LIBS
8076fi 11306fi
8077{ $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
8078$as_echo "$ac_cv_lib_prot_getluid" >&6; } 11308echo "${ECHO_T}$ac_cv_lib_prot_getluid" >&6; }
8079if test "x$ac_cv_lib_prot_getluid" = xyes; then : 11309if test $ac_cv_lib_prot_getluid = yes; then
8080 LIBS="$LIBS -lprot" 11310 LIBS="$LIBS -lprot"
8081 for ac_func in getluid setluid 11311
8082do : 11312
8083 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 11313for ac_func in getluid setluid
8084ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 11314do
8085if 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
8086 cat >>confdefs.h <<_ACEOF 11399 cat >>confdefs.h <<_ACEOF
8087#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 11400#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
8088_ACEOF 11401_ACEOF
8089 11402
8090fi 11403fi
8091done 11404done
8092 11405
8093 $as_echo "#define HAVE_SECUREWARE 1" >>confdefs.h 11406 cat >>confdefs.h <<\_ACEOF
11407#define HAVE_SECUREWARE 1
11408_ACEOF
8094 11409
8095 $as_echo "#define DISABLE_SHADOW 1" >>confdefs.h 11410 cat >>confdefs.h <<\_ACEOF
11411#define DISABLE_SHADOW 1
11412_ACEOF
8096 11413
8097 11414
8098fi 11415fi
8099 11416
8100 ;; 11417 ;;
8101 *) $as_echo "#define LOCKED_PASSWD_STRING \"*LK*\"" >>confdefs.h 11418 *) cat >>confdefs.h <<\_ACEOF
11419#define LOCKED_PASSWD_STRING "*LK*"
11420_ACEOF
8102 11421
8103 check_for_libcrypt_later=1 11422 check_for_libcrypt_later=1
8104 ;; 11423 ;;
@@ -8108,7 +11427,9 @@ fi
8108 ;; 11427 ;;
8109# SCO UNIX and OEM versions of SCO UNIX 11428# SCO UNIX and OEM versions of SCO UNIX
8110*-*-sco3.2v4*) 11429*-*-sco3.2v4*)
8111 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; }; }
8112 ;; 11433 ;;
8113# SCO OpenServer 5.x 11434# SCO OpenServer 5.x
8114*-*-sco3.2v5*) 11435*-*-sco3.2v5*)
@@ -8117,35 +11438,140 @@ fi
8117 fi 11438 fi
8118 LIBS="$LIBS -lprot -lx -ltinfo -lm" 11439 LIBS="$LIBS -lprot -lx -ltinfo -lm"
8119 no_dev_ptmx=1 11440 no_dev_ptmx=1
8120 $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
11464
11465 cat >>confdefs.h <<\_ACEOF
11466#define BROKEN_SETREUID 1
11467_ACEOF
8121 11468
8122 $as_echo "#define HAVE_SECUREWARE 1" >>confdefs.h 11469 cat >>confdefs.h <<\_ACEOF
11470#define BROKEN_SETREGID 1
11471_ACEOF
8123 11472
8124 $as_echo "#define DISABLE_SHADOW 1" >>confdefs.h 11473 cat >>confdefs.h <<\_ACEOF
11474#define WITH_ABBREV_NO_TTY 1
11475_ACEOF
8125 11476
8126 $as_echo "#define DISABLE_FD_PASSING 1" >>confdefs.h 11477 cat >>confdefs.h <<\_ACEOF
11478#define BROKEN_UPDWTMPX 1
11479_ACEOF
8127 11480
8128 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 11481 cat >>confdefs.h <<\_ACEOF
11482#define PASSWD_NEEDS_USERNAME 1
11483_ACEOF
8129 11484
8130 $as_echo "#define BROKEN_GETADDRINFO 1" >>confdefs.h
8131 11485
8132 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h
8133 11486
8134 $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
8135 11504
8136 $as_echo "#define WITH_ABBREV_NO_TTY 1" >>confdefs.h 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. */
8137 11509
8138 $as_echo "#define BROKEN_UPDWTMPX 1" >>confdefs.h 11510#ifdef __STDC__
11511# include <limits.h>
11512#else
11513# include <assert.h>
11514#endif
8139 11515
8140 $as_echo "#define PASSWD_NEEDS_USERNAME 1" >>confdefs.h 11516#undef $ac_func
8141 11517
8142 for ac_func in getluid setluid 11518/* Override any GCC internal prototype to avoid an error.
8143do : 11519 Use char because int might match the return type of a GCC
8144 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 11520 builtin and then its argument prototype would still apply. */
8145ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 11521#ifdef __cplusplus
8146if eval test \"x\$"$as_ac_var"\" = x"yes"; then : 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
11562
11563 eval "$as_ac_var=no"
11564fi
11565
11566rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
11567 conftest$ac_exeext conftest.$ac_ext
11568fi
11569ac_res=`eval echo '${'$as_ac_var'}'`
11570 { echo "$as_me:$LINENO: result: $ac_res" >&5
11571echo "${ECHO_T}$ac_res" >&6; }
11572if test `eval echo '${'$as_ac_var'}'` = yes; then
8147 cat >>confdefs.h <<_ACEOF 11573 cat >>confdefs.h <<_ACEOF
8148#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 11574#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
8149_ACEOF 11575_ACEOF
8150 11576
8151fi 11577fi
@@ -8157,67 +11583,103 @@ done
8157 ;; 11583 ;;
8158*-*-unicosmk*) 11584*-*-unicosmk*)
8159 11585
8160$as_echo "#define NO_SSH_LASTLOG 1" >>confdefs.h 11586cat >>confdefs.h <<\_ACEOF
11587#define NO_SSH_LASTLOG 1
11588_ACEOF
8161 11589
8162 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 11590 cat >>confdefs.h <<\_ACEOF
11591#define SETEUID_BREAKS_SETUID 1
11592_ACEOF
8163 11593
8164 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 11594 cat >>confdefs.h <<\_ACEOF
11595#define BROKEN_SETREUID 1
11596_ACEOF
8165 11597
8166 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11598 cat >>confdefs.h <<\_ACEOF
11599#define BROKEN_SETREGID 1
11600_ACEOF
8167 11601
8168 $as_echo "#define USE_PIPES 1" >>confdefs.h 11602 cat >>confdefs.h <<\_ACEOF
11603#define USE_PIPES 1
11604_ACEOF
8169 11605
8170 $as_echo "#define DISABLE_FD_PASSING 1" >>confdefs.h 11606 cat >>confdefs.h <<\_ACEOF
11607#define DISABLE_FD_PASSING 1
11608_ACEOF
8171 11609
8172 LDFLAGS="$LDFLAGS" 11610 LDFLAGS="$LDFLAGS"
8173 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm" 11611 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
8174 MANTYPE=cat 11612 MANTYPE=cat
8175 ;; 11613 ;;
8176*-*-unicosmp*) 11614*-*-unicosmp*)
8177 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 11615 cat >>confdefs.h <<\_ACEOF
11616#define SETEUID_BREAKS_SETUID 1
11617_ACEOF
8178 11618
8179 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 11619 cat >>confdefs.h <<\_ACEOF
11620#define BROKEN_SETREUID 1
11621_ACEOF
8180 11622
8181 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11623 cat >>confdefs.h <<\_ACEOF
11624#define BROKEN_SETREGID 1
11625_ACEOF
8182 11626
8183 $as_echo "#define WITH_ABBREV_NO_TTY 1" >>confdefs.h 11627 cat >>confdefs.h <<\_ACEOF
11628#define WITH_ABBREV_NO_TTY 1
11629_ACEOF
8184 11630
8185 $as_echo "#define USE_PIPES 1" >>confdefs.h 11631 cat >>confdefs.h <<\_ACEOF
11632#define USE_PIPES 1
11633_ACEOF
8186 11634
8187 $as_echo "#define DISABLE_FD_PASSING 1" >>confdefs.h 11635 cat >>confdefs.h <<\_ACEOF
11636#define DISABLE_FD_PASSING 1
11637_ACEOF
8188 11638
8189 LDFLAGS="$LDFLAGS" 11639 LDFLAGS="$LDFLAGS"
8190 LIBS="$LIBS -lgen -lacid -ldb" 11640 LIBS="$LIBS -lgen -lacid -ldb"
8191 MANTYPE=cat 11641 MANTYPE=cat
8192 ;; 11642 ;;
8193*-*-unicos*) 11643*-*-unicos*)
8194 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 11644 cat >>confdefs.h <<\_ACEOF
11645#define SETEUID_BREAKS_SETUID 1
11646_ACEOF
8195 11647
8196 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 11648 cat >>confdefs.h <<\_ACEOF
11649#define BROKEN_SETREUID 1
11650_ACEOF
8197 11651
8198 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11652 cat >>confdefs.h <<\_ACEOF
11653#define BROKEN_SETREGID 1
11654_ACEOF
8199 11655
8200 $as_echo "#define USE_PIPES 1" >>confdefs.h 11656 cat >>confdefs.h <<\_ACEOF
11657#define USE_PIPES 1
11658_ACEOF
8201 11659
8202 $as_echo "#define DISABLE_FD_PASSING 1" >>confdefs.h 11660 cat >>confdefs.h <<\_ACEOF
11661#define DISABLE_FD_PASSING 1
11662_ACEOF
8203 11663
8204 $as_echo "#define NO_SSH_LASTLOG 1" >>confdefs.h 11664 cat >>confdefs.h <<\_ACEOF
11665#define NO_SSH_LASTLOG 1
11666_ACEOF
8205 11667
8206 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal" 11668 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
8207 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm" 11669 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
8208 MANTYPE=cat 11670 MANTYPE=cat
8209 ;; 11671 ;;
8210*-dec-osf*) 11672*-dec-osf*)
8211 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Digital Unix SIA" >&5 11673 { echo "$as_me:$LINENO: checking for Digital Unix SIA" >&5
8212$as_echo_n "checking for Digital Unix SIA... " >&6; } 11674echo $ECHO_N "checking for Digital Unix SIA... $ECHO_C" >&6; }
8213 no_osfsia="" 11675 no_osfsia=""
8214 11676
8215# Check whether --with-osfsia was given. 11677# Check whether --with-osfsia was given.
8216if test "${with_osfsia+set}" = set; then : 11678if test "${with_osfsia+set}" = set; then
8217 withval=$with_osfsia; 11679 withval=$with_osfsia;
8218 if test "x$withval" = "xno" ; then 11680 if test "x$withval" = "xno" ; then
8219 { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 11681 { echo "$as_me:$LINENO: result: disabled" >&5
8220$as_echo "disabled" >&6; } 11682echo "${ECHO_T}disabled" >&6; }
8221 no_osfsia=1 11683 no_osfsia=1
8222 fi 11684 fi
8223 11685
@@ -8225,55 +11687,85 @@ fi
8225 11687
8226 if test -z "$no_osfsia" ; then 11688 if test -z "$no_osfsia" ; then
8227 if test -f /etc/sia/matrix.conf; then 11689 if test -f /etc/sia/matrix.conf; then
8228 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 11690 { echo "$as_me:$LINENO: result: yes" >&5
8229$as_echo "yes" >&6; } 11691echo "${ECHO_T}yes" >&6; }
8230 11692
8231$as_echo "#define HAVE_OSF_SIA 1" >>confdefs.h 11693cat >>confdefs.h <<\_ACEOF
11694#define HAVE_OSF_SIA 1
11695_ACEOF
8232 11696
8233 11697
8234$as_echo "#define DISABLE_LOGIN 1" >>confdefs.h 11698cat >>confdefs.h <<\_ACEOF
11699#define DISABLE_LOGIN 1
11700_ACEOF
8235 11701
8236 $as_echo "#define DISABLE_FD_PASSING 1" >>confdefs.h 11702 cat >>confdefs.h <<\_ACEOF
11703#define DISABLE_FD_PASSING 1
11704_ACEOF
8237 11705
8238 LIBS="$LIBS -lsecurity -ldb -lm -laud" 11706 LIBS="$LIBS -lsecurity -ldb -lm -laud"
8239 SIA_MSG="yes" 11707 SIA_MSG="yes"
8240 else 11708 else
8241 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 11709 { echo "$as_me:$LINENO: result: no" >&5
8242$as_echo "no" >&6; } 11710echo "${ECHO_T}no" >&6; }
8243 11711
8244$as_echo "#define LOCKED_PASSWD_SUBSTR \"Nologin\"" >>confdefs.h 11712cat >>confdefs.h <<\_ACEOF
11713#define LOCKED_PASSWD_SUBSTR "Nologin"
11714_ACEOF
8245 11715
8246 fi 11716 fi
8247 fi 11717 fi
8248 $as_echo "#define BROKEN_GETADDRINFO 1" >>confdefs.h 11718 cat >>confdefs.h <<\_ACEOF
11719#define BROKEN_GETADDRINFO 1
11720_ACEOF
8249 11721
8250 $as_echo "#define SETEUID_BREAKS_SETUID 1" >>confdefs.h 11722 cat >>confdefs.h <<\_ACEOF
11723#define SETEUID_BREAKS_SETUID 1
11724_ACEOF
8251 11725
8252 $as_echo "#define BROKEN_SETREUID 1" >>confdefs.h 11726 cat >>confdefs.h <<\_ACEOF
11727#define BROKEN_SETREUID 1
11728_ACEOF
8253 11729
8254 $as_echo "#define BROKEN_SETREGID 1" >>confdefs.h 11730 cat >>confdefs.h <<\_ACEOF
11731#define BROKEN_SETREGID 1
11732_ACEOF
8255 11733
8256 11734
8257$as_echo "#define BROKEN_READV_COMPARISON 1" >>confdefs.h 11735cat >>confdefs.h <<\_ACEOF
11736#define BROKEN_READV_COMPARISON 1
11737_ACEOF
8258 11738
8259 ;; 11739 ;;
8260 11740
8261*-*-nto-qnx*) 11741*-*-nto-qnx*)
8262 $as_echo "#define USE_PIPES 1" >>confdefs.h 11742 cat >>confdefs.h <<\_ACEOF
11743#define USE_PIPES 1
11744_ACEOF
8263 11745
8264 $as_echo "#define NO_X11_UNIX_SOCKETS 1" >>confdefs.h 11746 cat >>confdefs.h <<\_ACEOF
11747#define NO_X11_UNIX_SOCKETS 1
11748_ACEOF
8265 11749
8266 $as_echo "#define DISABLE_LASTLOG 1" >>confdefs.h 11750 cat >>confdefs.h <<\_ACEOF
11751#define DISABLE_LASTLOG 1
11752_ACEOF
8267 11753
8268 $as_echo "#define SSHD_ACQUIRES_CTTY 1" >>confdefs.h 11754 cat >>confdefs.h <<\_ACEOF
11755#define SSHD_ACQUIRES_CTTY 1
11756_ACEOF
8269 11757
8270 11758
8271$as_echo "#define BROKEN_SHADOW_EXPIRE 1" >>confdefs.h 11759cat >>confdefs.h <<\_ACEOF
11760#define BROKEN_SHADOW_EXPIRE 1
11761_ACEOF
8272 11762
8273 enable_etc_default_login=no # has incompatible /etc/default/login 11763 enable_etc_default_login=no # has incompatible /etc/default/login
8274 case "$host" in 11764 case "$host" in
8275 *-*-nto-qnx6*) 11765 *-*-nto-qnx6*)
8276 $as_echo "#define DISABLE_FD_PASSING 1" >>confdefs.h 11766 cat >>confdefs.h <<\_ACEOF
11767#define DISABLE_FD_PASSING 1
11768_ACEOF
8277 11769
8278 ;; 11770 ;;
8279 esac 11771 esac
@@ -8281,34 +11773,48 @@ $as_echo "#define BROKEN_SHADOW_EXPIRE 1" >>confdefs.h
8281 11773
8282*-*-ultrix*) 11774*-*-ultrix*)
8283 11775
8284$as_echo "#define BROKEN_GETGROUPS 1" >>confdefs.h 11776cat >>confdefs.h <<\_ACEOF
11777#define BROKEN_GETGROUPS 1
11778_ACEOF
8285 11779
8286 11780
8287$as_echo "#define BROKEN_MMAP 1" >>confdefs.h 11781cat >>confdefs.h <<\_ACEOF
11782#define BROKEN_MMAP 1
11783_ACEOF
8288 11784
8289 $as_echo "#define NEED_SETPGRP 1" >>confdefs.h 11785 cat >>confdefs.h <<\_ACEOF
11786#define NEED_SETPGRP 1
11787_ACEOF
8290 11788
8291 11789
8292$as_echo "#define HAVE_SYS_SYSLOG_H 1" >>confdefs.h 11790cat >>confdefs.h <<\_ACEOF
11791#define HAVE_SYS_SYSLOG_H 1
11792_ACEOF
8293 11793
8294 ;; 11794 ;;
8295 11795
8296*-*-lynxos) 11796*-*-lynxos)
8297 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__" 11797 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
8298 11798
8299$as_echo "#define BROKEN_SETVBUF 1" >>confdefs.h 11799cat >>confdefs.h <<\_ACEOF
11800#define BROKEN_SETVBUF 1
11801_ACEOF
8300 11802
8301 ;; 11803 ;;
8302esac 11804esac
8303 11805
8304{ $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
8305$as_echo_n "checking compiler and flags for sanity... " >&6; } 11807echo $ECHO_N "checking compiler and flags for sanity... $ECHO_C" >&6; }
8306if test "$cross_compiling" = yes; then : 11808if test "$cross_compiling" = yes; then
8307 { $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
8308$as_echo "$as_me: WARNING: cross compiling: not checking compiler sanity" >&2;} 11810echo "$as_me: WARNING: cross compiling: not checking compiler sanity" >&2;}
8309 11811
8310else 11812else
8311 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
8312/* end confdefs.h. */ 11818/* end confdefs.h. */
8313 #include <stdio.h> 11819 #include <stdio.h>
8314int 11820int
@@ -8319,34 +11825,145 @@ main ()
8319 return 0; 11825 return 0;
8320} 11826}
8321_ACEOF 11827_ACEOF
8322if ac_fn_c_try_run "$LINENO"; then : 11828rm -f conftest$ac_exeext
8323 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 11829if { (ac_try="$ac_link"
8324$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; }
8325else 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 )
8326 11856
8327 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 11857 { echo "$as_me:$LINENO: result: no" >&5
8328$as_echo "no" >&6; } 11858echo "${ECHO_T}no" >&6; }
8329 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; }; }
8330 11862
8331fi 11863fi
8332rm -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
8333 conftest.$ac_objext conftest.beam conftest.$ac_ext
8334fi 11865fi
8335 11866
8336 11867
11868
8337# Checks for libraries. 11869# Checks for libraries.
8338ac_fn_c_check_func "$LINENO" "yp_match" "ac_cv_func_yp_match" 11870{ echo "$as_me:$LINENO: checking for yp_match" >&5
8339if 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
8340 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
8341else 11939else
8342 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for yp_match in -lnsl" >&5 11940 echo "$as_me: failed program was:" >&5
8343$as_echo_n "checking for yp_match in -lnsl... " >&6; } 11941sed 's/^/| /' conftest.$ac_ext >&5
8344if ${ac_cv_lib_nsl_yp_match+:} false; then : 11942
8345 $as_echo_n "(cached) " >&6 11943 ac_cv_func_yp_match=no
11944fi
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 :
11953else
11954
11955{ echo "$as_me:$LINENO: checking for yp_match in -lnsl" >&5
11956echo $ECHO_N "checking for yp_match in -lnsl... $ECHO_C" >&6; }
11957if test "${ac_cv_lib_nsl_yp_match+set}" = set; then
11958 echo $ECHO_N "(cached) $ECHO_C" >&6
8346else 11959else
8347 ac_check_lib_save_LIBS=$LIBS 11960 ac_check_lib_save_LIBS=$LIBS
8348LIBS="-lnsl $LIBS" 11961LIBS="-lnsl $LIBS"
8349cat 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
8350/* end confdefs.h. */ 11967/* end confdefs.h. */
8351 11968
8352/* Override any GCC internal prototype to avoid an error. 11969/* Override any GCC internal prototype to avoid an error.
@@ -8364,18 +11981,39 @@ return yp_match ();
8364 return 0; 11981 return 0;
8365} 11982}
8366_ACEOF 11983_ACEOF
8367if 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
8368 ac_cv_lib_nsl_yp_match=yes 12002 ac_cv_lib_nsl_yp_match=yes
8369else 12003else
8370 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
8371fi 12008fi
8372rm -f core conftest.err conftest.$ac_objext \ 12009
8373 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
8374LIBS=$ac_check_lib_save_LIBS 12012LIBS=$ac_check_lib_save_LIBS
8375fi 12013fi
8376{ $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
8377$as_echo "$ac_cv_lib_nsl_yp_match" >&6; } 12015echo "${ECHO_T}$ac_cv_lib_nsl_yp_match" >&6; }
8378if test "x$ac_cv_lib_nsl_yp_match" = xyes; then : 12016if test $ac_cv_lib_nsl_yp_match = yes; then
8379 cat >>confdefs.h <<_ACEOF 12017 cat >>confdefs.h <<_ACEOF
8380#define HAVE_LIBNSL 1 12018#define HAVE_LIBNSL 1
8381_ACEOF 12019_ACEOF
@@ -8386,18 +12024,103 @@ fi
8386 12024
8387fi 12025fi
8388 12026
8389ac_fn_c_check_func "$LINENO" "setsockopt" "ac_cv_func_setsockopt" 12027{ echo "$as_me:$LINENO: checking for setsockopt" >&5
8390if 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
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
8391 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
8392else 12096else
8393 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setsockopt in -lsocket" >&5 12097 echo "$as_me: failed program was:" >&5
8394$as_echo_n "checking for setsockopt in -lsocket... " >&6; } 12098sed 's/^/| /' conftest.$ac_ext >&5
8395if ${ac_cv_lib_socket_setsockopt+:} false; then : 12099
8396 $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
8397else 12116else
8398 ac_check_lib_save_LIBS=$LIBS 12117 ac_check_lib_save_LIBS=$LIBS
8399LIBS="-lsocket $LIBS" 12118LIBS="-lsocket $LIBS"
8400cat 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
8401/* end confdefs.h. */ 12124/* end confdefs.h. */
8402 12125
8403/* Override any GCC internal prototype to avoid an error. 12126/* Override any GCC internal prototype to avoid an error.
@@ -8415,18 +12138,39 @@ return setsockopt ();
8415 return 0; 12138 return 0;
8416} 12139}
8417_ACEOF 12140_ACEOF
8418if 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
8419 ac_cv_lib_socket_setsockopt=yes 12159 ac_cv_lib_socket_setsockopt=yes
8420else 12160else
8421 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
8422fi 12165fi
8423rm -f core conftest.err conftest.$ac_objext \ 12166
8424 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
8425LIBS=$ac_check_lib_save_LIBS 12169LIBS=$ac_check_lib_save_LIBS
8426fi 12170fi
8427{ $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
8428$as_echo "$ac_cv_lib_socket_setsockopt" >&6; } 12172echo "${ECHO_T}$ac_cv_lib_socket_setsockopt" >&6; }
8429if test "x$ac_cv_lib_socket_setsockopt" = xyes; then : 12173if test $ac_cv_lib_socket_setsockopt = yes; then
8430 cat >>confdefs.h <<_ACEOF 12174 cat >>confdefs.h <<_ACEOF
8431#define HAVE_LIBSOCKET 1 12175#define HAVE_LIBSOCKET 1
8432_ACEOF 12176_ACEOF
@@ -8438,19 +12182,235 @@ fi
8438fi 12182fi
8439 12183
8440 12184
12185
8441for ac_func in dirname 12186for ac_func in dirname
8442do : 12187do
8443 ac_fn_c_check_func "$LINENO" "dirname" "ac_cv_func_dirname" 12188as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
8444if 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
8445 cat >>confdefs.h <<_ACEOF 12272 cat >>confdefs.h <<_ACEOF
8446#define HAVE_DIRNAME 1 12273#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
12274_ACEOF
12275
12276for ac_header in libgen.h
12277do
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. */
8447_ACEOF 12335_ACEOF
8448 for ac_header in libgen.h 12336cat confdefs.h >>conftest.$ac_ext
8449do : 12337cat >>conftest.$ac_ext <<_ACEOF
8450 ac_fn_c_check_header_mongrel "$LINENO" "libgen.h" "ac_cv_header_libgen_h" "$ac_includes_default" 12338/* end confdefs.h. */
8451if test "x$ac_cv_header_libgen_h" = xyes; then : 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
8452 cat >>confdefs.h <<_ACEOF 12412 cat >>confdefs.h <<_ACEOF
8453#define HAVE_LIBGEN_H 1 12413#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
8454_ACEOF 12414_ACEOF
8455 12415
8456fi 12416fi
@@ -8459,14 +12419,18 @@ done
8459 12419
8460else 12420else
8461 12421
8462 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dirname in -lgen" >&5 12422 { echo "$as_me:$LINENO: checking for dirname in -lgen" >&5
8463$as_echo_n "checking for dirname in -lgen... " >&6; } 12423echo $ECHO_N "checking for dirname in -lgen... $ECHO_C" >&6; }
8464if ${ac_cv_lib_gen_dirname+:} false; then : 12424if test "${ac_cv_lib_gen_dirname+set}" = set; then
8465 $as_echo_n "(cached) " >&6 12425 echo $ECHO_N "(cached) $ECHO_C" >&6
8466else 12426else
8467 ac_check_lib_save_LIBS=$LIBS 12427 ac_check_lib_save_LIBS=$LIBS
8468LIBS="-lgen $LIBS" 12428LIBS="-lgen $LIBS"
8469cat 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
8470/* end confdefs.h. */ 12434/* end confdefs.h. */
8471 12435
8472/* Override any GCC internal prototype to avoid an error. 12436/* Override any GCC internal prototype to avoid an error.
@@ -8484,31 +12448,56 @@ return dirname ();
8484 return 0; 12448 return 0;
8485} 12449}
8486_ACEOF 12450_ACEOF
8487if 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
8488 ac_cv_lib_gen_dirname=yes 12469 ac_cv_lib_gen_dirname=yes
8489else 12470else
8490 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
8491fi 12475fi
8492rm -f core conftest.err conftest.$ac_objext \ 12476
8493 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
8494LIBS=$ac_check_lib_save_LIBS 12479LIBS=$ac_check_lib_save_LIBS
8495fi 12480fi
8496{ $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
8497$as_echo "$ac_cv_lib_gen_dirname" >&6; } 12482echo "${ECHO_T}$ac_cv_lib_gen_dirname" >&6; }
8498if test "x$ac_cv_lib_gen_dirname" = xyes; then : 12483if test $ac_cv_lib_gen_dirname = yes; then
8499 12484
8500 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken dirname" >&5 12485 { echo "$as_me:$LINENO: checking for broken dirname" >&5
8501$as_echo_n "checking for broken dirname... " >&6; } 12486echo $ECHO_N "checking for broken dirname... $ECHO_C" >&6; }
8502if ${ac_cv_have_broken_dirname+:} false; then : 12487if test "${ac_cv_have_broken_dirname+set}" = set; then
8503 $as_echo_n "(cached) " >&6 12488 echo $ECHO_N "(cached) $ECHO_C" >&6
8504else 12489else
8505 12490
8506 save_LIBS="$LIBS" 12491 save_LIBS="$LIBS"
8507 LIBS="$LIBS -lgen" 12492 LIBS="$LIBS -lgen"
8508 if test "$cross_compiling" = yes; then : 12493 if test "$cross_compiling" = yes; then
8509 ac_cv_have_broken_dirname="no" 12494 ac_cv_have_broken_dirname="no"
8510else 12495else
8511 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
8512/* end confdefs.h. */ 12501/* end confdefs.h. */
8513 12502
8514#include <libgen.h> 12503#include <libgen.h>
@@ -8527,30 +12516,189 @@ int main(int argc, char **argv) {
8527} 12516}
8528 12517
8529_ACEOF 12518_ACEOF
8530if 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
8531 ac_cv_have_broken_dirname="no" 12539 ac_cv_have_broken_dirname="no"
8532else 12540else
8533 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"
8534fi 12547fi
8535rm -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
8536 conftest.$ac_objext conftest.beam conftest.$ac_ext
8537fi 12549fi
8538 12550
12551
8539 LIBS="$save_LIBS" 12552 LIBS="$save_LIBS"
8540 12553
8541fi 12554fi
8542{ $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
8543$as_echo "$ac_cv_have_broken_dirname" >&6; } 12556echo "${ECHO_T}$ac_cv_have_broken_dirname" >&6; }
8544 if test "x$ac_cv_have_broken_dirname" = "xno" ; then 12557 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
8545 LIBS="$LIBS -lgen" 12558 LIBS="$LIBS -lgen"
8546 $as_echo "#define HAVE_DIRNAME 1" >>confdefs.h 12559 cat >>confdefs.h <<\_ACEOF
12560#define HAVE_DIRNAME 1
12561_ACEOF
12562
8547 12563
8548 for ac_header in libgen.h 12564for ac_header in libgen.h
8549do : 12565do
8550 ac_fn_c_check_header_mongrel "$LINENO" "libgen.h" "ac_cv_header_libgen_h" "$ac_includes_default" 12566as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
8551if test "x$ac_cv_header_libgen_h" = xyes; then : 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
12652
12653rm -f conftest.err conftest.$ac_ext
12654{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
12655echo "${ECHO_T}$ac_header_preproc" >&6; }
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
8552 cat >>confdefs.h <<_ACEOF 12700 cat >>confdefs.h <<_ACEOF
8553#define HAVE_LIBGEN_H 1 12701#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
8554_ACEOF 12702_ACEOF
8555 12703
8556fi 12704fi
@@ -8566,18 +12714,102 @@ fi
8566done 12714done
8567 12715
8568 12716
8569ac_fn_c_check_func "$LINENO" "getspnam" "ac_cv_func_getspnam" 12717{ echo "$as_me:$LINENO: checking for getspnam" >&5
8570if 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
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
12786else
12787 echo "$as_me: failed program was:" >&5
12788sed 's/^/| /' conftest.$ac_ext >&5
12789
12790 ac_cv_func_getspnam=no
12791fi
8571 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 :
8572else 12800else
8573 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getspnam in -lgen" >&5 12801 { echo "$as_me:$LINENO: checking for getspnam in -lgen" >&5
8574$as_echo_n "checking for getspnam in -lgen... " >&6; } 12802echo $ECHO_N "checking for getspnam in -lgen... $ECHO_C" >&6; }
8575if ${ac_cv_lib_gen_getspnam+:} false; then : 12803if test "${ac_cv_lib_gen_getspnam+set}" = set; then
8576 $as_echo_n "(cached) " >&6 12804 echo $ECHO_N "(cached) $ECHO_C" >&6
8577else 12805else
8578 ac_check_lib_save_LIBS=$LIBS 12806 ac_check_lib_save_LIBS=$LIBS
8579LIBS="-lgen $LIBS" 12807LIBS="-lgen $LIBS"
8580cat 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
8581/* end confdefs.h. */ 12813/* end confdefs.h. */
8582 12814
8583/* Override any GCC internal prototype to avoid an error. 12815/* Override any GCC internal prototype to avoid an error.
@@ -8595,30 +12827,55 @@ return getspnam ();
8595 return 0; 12827 return 0;
8596} 12828}
8597_ACEOF 12829_ACEOF
8598if 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
8599 ac_cv_lib_gen_getspnam=yes 12848 ac_cv_lib_gen_getspnam=yes
8600else 12849else
8601 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
8602fi 12854fi
8603rm -f core conftest.err conftest.$ac_objext \ 12855
8604 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
8605LIBS=$ac_check_lib_save_LIBS 12858LIBS=$ac_check_lib_save_LIBS
8606fi 12859fi
8607{ $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
8608$as_echo "$ac_cv_lib_gen_getspnam" >&6; } 12861echo "${ECHO_T}$ac_cv_lib_gen_getspnam" >&6; }
8609if test "x$ac_cv_lib_gen_getspnam" = xyes; then : 12862if test $ac_cv_lib_gen_getspnam = yes; then
8610 LIBS="$LIBS -lgen" 12863 LIBS="$LIBS -lgen"
8611fi 12864fi
8612 12865
8613fi 12866fi
8614 12867
8615{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing basename" >&5 12868{ echo "$as_me:$LINENO: checking for library containing basename" >&5
8616$as_echo_n "checking for library containing basename... " >&6; } 12869echo $ECHO_N "checking for library containing basename... $ECHO_C" >&6; }
8617if ${ac_cv_search_basename+:} false; then : 12870if test "${ac_cv_search_basename+set}" = set; then
8618 $as_echo_n "(cached) " >&6 12871 echo $ECHO_N "(cached) $ECHO_C" >&6
8619else 12872else
8620 ac_func_search_save_LIBS=$LIBS 12873 ac_func_search_save_LIBS=$LIBS
8621cat 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
8622/* end confdefs.h. */ 12879/* end confdefs.h. */
8623 12880
8624/* Override any GCC internal prototype to avoid an error. 12881/* Override any GCC internal prototype to avoid an error.
@@ -8643,39 +12900,66 @@ for ac_lib in '' gen; do
8643 ac_res=-l$ac_lib 12900 ac_res=-l$ac_lib
8644 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 12901 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
8645 fi 12902 fi
8646 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
8647 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
8648fi 12927fi
8649rm -f core conftest.err conftest.$ac_objext \ 12928
8650 conftest$ac_exeext 12929rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
8651 if ${ac_cv_search_basename+:} false; then : 12930 conftest$ac_exeext
12931 if test "${ac_cv_search_basename+set}" = set; then
8652 break 12932 break
8653fi 12933fi
8654done 12934done
8655if ${ac_cv_search_basename+:} false; then : 12935if test "${ac_cv_search_basename+set}" = set; then
8656 12936 :
8657else 12937else
8658 ac_cv_search_basename=no 12938 ac_cv_search_basename=no
8659fi 12939fi
8660rm conftest.$ac_ext 12940rm conftest.$ac_ext
8661LIBS=$ac_func_search_save_LIBS 12941LIBS=$ac_func_search_save_LIBS
8662fi 12942fi
8663{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_basename" >&5 12943{ echo "$as_me:$LINENO: result: $ac_cv_search_basename" >&5
8664$as_echo "$ac_cv_search_basename" >&6; } 12944echo "${ECHO_T}$ac_cv_search_basename" >&6; }
8665ac_res=$ac_cv_search_basename 12945ac_res=$ac_cv_search_basename
8666if test "$ac_res" != no; then : 12946if test "$ac_res" != no; then
8667 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 12947 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
8668 12948
8669$as_echo "#define HAVE_BASENAME 1" >>confdefs.h 12949cat >>confdefs.h <<\_ACEOF
12950#define HAVE_BASENAME 1
12951_ACEOF
8670 12952
8671fi 12953fi
8672 12954
8673 12955
8674 12956
8675# Check whether --with-zlib was given. 12957# Check whether --with-zlib was given.
8676if test "${with_zlib+set}" = set; then : 12958if test "${with_zlib+set}" = set; then
8677 withval=$with_zlib; if test "x$withval" = "xno" ; then 12959 withval=$with_zlib; if test "x$withval" = "xno" ; then
8678 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; }; }
8679 elif test "x$withval" != "xyes"; then 12963 elif test "x$withval" != "xyes"; then
8680 if test -d "$withval/lib"; then 12964 if test -d "$withval/lib"; then
8681 if test -n "${need_dash_r}"; then 12965 if test -n "${need_dash_r}"; then
@@ -8700,22 +12984,158 @@ if test "${with_zlib+set}" = set; then :
8700fi 12984fi
8701 12985
8702 12986
8703ac_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
8704if 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; }
8705 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
8706else 13065else
8707 as_fn_error $? "*** zlib.h missing - please install first or check config.log ***" "$LINENO" 5 13066 echo "$as_me: failed program was:" >&5
13067sed 's/^/| /' conftest.$ac_ext >&5
13068
13069 ac_header_preproc=no
8708fi 13070fi
8709 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; }
8710 13075
8711{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for deflate in -lz" >&5 13076# So? What about this header?
8712$as_echo_n "checking for deflate in -lz... " >&6; } 13077case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
8713if ${ac_cv_lib_z_deflate+:} false; then : 13078 yes:no: )
8714 $as_echo_n "(cached) " >&6 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
13110else
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; }; }
13123fi
13124
13125
13126
13127{ echo "$as_me:$LINENO: checking for deflate in -lz" >&5
13128echo $ECHO_N "checking for deflate in -lz... $ECHO_C" >&6; }
13129if test "${ac_cv_lib_z_deflate+set}" = set; then
13130 echo $ECHO_N "(cached) $ECHO_C" >&6
8715else 13131else
8716 ac_check_lib_save_LIBS=$LIBS 13132 ac_check_lib_save_LIBS=$LIBS
8717LIBS="-lz $LIBS" 13133LIBS="-lz $LIBS"
8718cat 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
8719/* end confdefs.h. */ 13139/* end confdefs.h. */
8720 13140
8721/* Override any GCC internal prototype to avoid an error. 13141/* Override any GCC internal prototype to avoid an error.
@@ -8733,18 +13153,39 @@ return deflate ();
8733 return 0; 13153 return 0;
8734} 13154}
8735_ACEOF 13155_ACEOF
8736if 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
8737 ac_cv_lib_z_deflate=yes 13174 ac_cv_lib_z_deflate=yes
8738else 13175else
8739 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
8740fi 13180fi
8741rm -f core conftest.err conftest.$ac_objext \ 13181
8742 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
8743LIBS=$ac_check_lib_save_LIBS 13184LIBS=$ac_check_lib_save_LIBS
8744fi 13185fi
8745{ $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
8746$as_echo "$ac_cv_lib_z_deflate" >&6; } 13187echo "${ECHO_T}$ac_cv_lib_z_deflate" >&6; }
8747if test "x$ac_cv_lib_z_deflate" = xyes; then : 13188if test $ac_cv_lib_z_deflate = yes; then
8748 cat >>confdefs.h <<_ACEOF 13189 cat >>confdefs.h <<_ACEOF
8749#define HAVE_LIBZ 1 13190#define HAVE_LIBZ 1
8750_ACEOF 13191_ACEOF
@@ -8763,7 +13204,11 @@ else
8763 fi 13204 fi
8764 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}" 13205 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
8765 LIBS="$LIBS -lz" 13206 LIBS="$LIBS -lz"
8766 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
8767/* end confdefs.h. */ 13212/* end confdefs.h. */
8768 13213
8769/* Override any GCC internal prototype to avoid an error. 13214/* Override any GCC internal prototype to avoid an error.
@@ -8781,17 +13226,42 @@ return deflate ();
8781 return 0; 13226 return 0;
8782} 13227}
8783_ACEOF 13228_ACEOF
8784if ac_fn_c_try_link "$LINENO"; then : 13229rm -f conftest.$ac_objext conftest$ac_exeext
8785 $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
8786 13250
8787else 13251else
13252 echo "$as_me: failed program was:" >&5
13253sed 's/^/| /' conftest.$ac_ext >&5
8788 13254
8789 as_fn_error $? "*** zlib missing - please install first or check config.log ***" "$LINENO" 5 13255
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; }; }
8790 13259
8791 13260
8792fi 13261fi
8793rm -f core conftest.err conftest.$ac_objext \ 13262
8794 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
8795 13265
8796 13266
8797fi 13267fi
@@ -8799,7 +13269,7 @@ fi
8799 13269
8800 13270
8801# Check whether --with-zlib-version-check was given. 13271# Check whether --with-zlib-version-check was given.
8802if test "${with_zlib_version_check+set}" = set; then : 13272if test "${with_zlib_version_check+set}" = set; then
8803 withval=$with_zlib_version_check; if test "x$withval" = "xno" ; then 13273 withval=$with_zlib_version_check; if test "x$withval" = "xno" ; then
8804 zlib_check_nonfatal=1 13274 zlib_check_nonfatal=1
8805 fi 13275 fi
@@ -8808,14 +13278,18 @@ if test "${with_zlib_version_check+set}" = set; then :
8808fi 13278fi
8809 13279
8810 13280
8811{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for possibly buggy zlib" >&5 13281{ echo "$as_me:$LINENO: checking for possibly buggy zlib" >&5
8812$as_echo_n "checking for possibly buggy zlib... " >&6; } 13282echo $ECHO_N "checking for possibly buggy zlib... $ECHO_C" >&6; }
8813if test "$cross_compiling" = yes; then : 13283if test "$cross_compiling" = yes; then
8814 { $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
8815$as_echo "$as_me: WARNING: cross compiling: not checking zlib version" >&2;} 13285echo "$as_me: WARNING: cross compiling: not checking zlib version" >&2;}
8816 13286
8817else 13287else
8818 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
8819/* end confdefs.h. */ 13293/* end confdefs.h. */
8820 13294
8821#include <stdio.h> 13295#include <stdio.h>
@@ -8847,43 +13321,159 @@ main ()
8847 return 0; 13321 return 0;
8848} 13322}
8849_ACEOF 13323_ACEOF
8850if ac_fn_c_try_run "$LINENO"; then : 13324rm -f conftest$ac_exeext
8851 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 13325if { (ac_try="$ac_link"
8852$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; }
8853else 13346else
8854 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 13347 echo "$as_me: program exited with status $ac_status" >&5
8855$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; }
8856 if test -z "$zlib_check_nonfatal" ; then 13354 if test -z "$zlib_check_nonfatal" ; then
8857 as_fn_error $? "*** zlib too old - check config.log *** 13355 { { echo "$as_me:$LINENO: error: *** zlib too old - check config.log ***
13356Your reported zlib version has known security problems. It's possible your
13357vendor has fixed these problems without changing the version number. If you
13358are sure this is the case, you can disable the check by running
13359\"./configure --without-zlib-version-check\".
13360If you are in doubt, upgrade zlib to version 1.2.3 or greater.
13361See http://www.gzip.org/zlib/ for details." >&5
13362echo "$as_me: error: *** zlib too old - check config.log ***
8858Your reported zlib version has known security problems. It's possible your 13363Your reported zlib version has known security problems. It's possible your
8859vendor has fixed these problems without changing the version number. If you 13364vendor has fixed these problems without changing the version number. If you
8860are sure this is the case, you can disable the check by running 13365are sure this is the case, you can disable the check by running
8861\"./configure --without-zlib-version-check\". 13366\"./configure --without-zlib-version-check\".
8862If you are in doubt, upgrade zlib to version 1.2.3 or greater. 13367If you are in doubt, upgrade zlib to version 1.2.3 or greater.
8863See http://www.gzip.org/zlib/ for details." "$LINENO" 5 13368See http://www.gzip.org/zlib/ for details." >&2;}
13369 { (exit 1); exit 1; }; }
8864 else 13370 else
8865 { $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
8866$as_echo "$as_me: WARNING: zlib version may have security problems" >&2;} 13372echo "$as_me: WARNING: zlib version may have security problems" >&2;}
8867 fi 13373 fi
8868 13374
8869fi 13375fi
8870rm -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
8871 conftest.$ac_objext conftest.beam conftest.$ac_ext
8872fi 13377fi
8873 13378
8874 13379
8875ac_fn_c_check_func "$LINENO" "strcasecmp" "ac_cv_func_strcasecmp"
8876if test "x$ac_cv_func_strcasecmp" = xyes; then :
8877 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 :
8878else 13464else
8879 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strcasecmp in -lresolv" >&5 13465 { echo "$as_me:$LINENO: checking for strcasecmp in -lresolv" >&5
8880$as_echo_n "checking for strcasecmp in -lresolv... " >&6; } 13466echo $ECHO_N "checking for strcasecmp in -lresolv... $ECHO_C" >&6; }
8881if ${ac_cv_lib_resolv_strcasecmp+:} false; then : 13467if test "${ac_cv_lib_resolv_strcasecmp+set}" = set; then
8882 $as_echo_n "(cached) " >&6 13468 echo $ECHO_N "(cached) $ECHO_C" >&6
8883else 13469else
8884 ac_check_lib_save_LIBS=$LIBS 13470 ac_check_lib_save_LIBS=$LIBS
8885LIBS="-lresolv $LIBS" 13471LIBS="-lresolv $LIBS"
8886cat 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
8887/* end confdefs.h. */ 13477/* end confdefs.h. */
8888 13478
8889/* Override any GCC internal prototype to avoid an error. 13479/* Override any GCC internal prototype to avoid an error.
@@ -8901,41 +13491,149 @@ return strcasecmp ();
8901 return 0; 13491 return 0;
8902} 13492}
8903_ACEOF 13493_ACEOF
8904if 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
8905 ac_cv_lib_resolv_strcasecmp=yes 13512 ac_cv_lib_resolv_strcasecmp=yes
8906else 13513else
8907 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
8908fi 13518fi
8909rm -f core conftest.err conftest.$ac_objext \ 13519
8910 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
8911LIBS=$ac_check_lib_save_LIBS 13522LIBS=$ac_check_lib_save_LIBS
8912fi 13523fi
8913{ $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
8914$as_echo "$ac_cv_lib_resolv_strcasecmp" >&6; } 13525echo "${ECHO_T}$ac_cv_lib_resolv_strcasecmp" >&6; }
8915if test "x$ac_cv_lib_resolv_strcasecmp" = xyes; then : 13526if test $ac_cv_lib_resolv_strcasecmp = yes; then
8916 LIBS="$LIBS -lresolv" 13527 LIBS="$LIBS -lresolv"
8917fi 13528fi
8918 13529
8919 13530
8920fi 13531fi
8921 13532
13533
8922for ac_func in utimes 13534for ac_func in utimes
8923do : 13535do
8924 ac_fn_c_check_func "$LINENO" "utimes" "ac_cv_func_utimes" 13536as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
8925if 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
8926 cat >>confdefs.h <<_ACEOF 13620 cat >>confdefs.h <<_ACEOF
8927#define HAVE_UTIMES 1 13621#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
8928_ACEOF 13622_ACEOF
8929 13623
8930else 13624else
8931 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for utimes in -lc89" >&5 13625 { echo "$as_me:$LINENO: checking for utimes in -lc89" >&5
8932$as_echo_n "checking for utimes in -lc89... " >&6; } 13626echo $ECHO_N "checking for utimes in -lc89... $ECHO_C" >&6; }
8933if ${ac_cv_lib_c89_utimes+:} false; then : 13627if test "${ac_cv_lib_c89_utimes+set}" = set; then
8934 $as_echo_n "(cached) " >&6 13628 echo $ECHO_N "(cached) $ECHO_C" >&6
8935else 13629else
8936 ac_check_lib_save_LIBS=$LIBS 13630 ac_check_lib_save_LIBS=$LIBS
8937LIBS="-lc89 $LIBS" 13631LIBS="-lc89 $LIBS"
8938cat 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
8939/* end confdefs.h. */ 13637/* end confdefs.h. */
8940 13638
8941/* Override any GCC internal prototype to avoid an error. 13639/* Override any GCC internal prototype to avoid an error.
@@ -8953,19 +13651,42 @@ return utimes ();
8953 return 0; 13651 return 0;
8954} 13652}
8955_ACEOF 13653_ACEOF
8956if 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
8957 ac_cv_lib_c89_utimes=yes 13672 ac_cv_lib_c89_utimes=yes
8958else 13673else
8959 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
8960fi 13678fi
8961rm -f core conftest.err conftest.$ac_objext \ 13679
8962 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
8963LIBS=$ac_check_lib_save_LIBS 13682LIBS=$ac_check_lib_save_LIBS
8964fi 13683fi
8965{ $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
8966$as_echo "$ac_cv_lib_c89_utimes" >&6; } 13685echo "${ECHO_T}$ac_cv_lib_c89_utimes" >&6; }
8967if test "x$ac_cv_lib_c89_utimes" = xyes; then : 13686if test $ac_cv_lib_c89_utimes = yes; then
8968 $as_echo "#define HAVE_UTIMES 1" >>confdefs.h 13687 cat >>confdefs.h <<\_ACEOF
13688#define HAVE_UTIMES 1
13689_ACEOF
8969 13690
8970 LIBS="$LIBS -lc89" 13691 LIBS="$LIBS -lc89"
8971fi 13692fi
@@ -8975,26 +13696,163 @@ fi
8975done 13696done
8976 13697
8977 13698
13699
13700
8978for ac_header in bsd/libutil.h libutil.h 13701for ac_header in bsd/libutil.h libutil.h
8979do : 13702do
8980 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`
8981ac_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
8982if 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
8983 cat >>confdefs.h <<_ACEOF 13837 cat >>confdefs.h <<_ACEOF
8984#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 13838#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
8985_ACEOF 13839_ACEOF
8986 13840
8987fi 13841fi
8988 13842
8989done 13843done
8990 13844
8991{ $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
8992$as_echo_n "checking for library containing fmt_scaled... " >&6; } 13846echo $ECHO_N "checking for library containing fmt_scaled... $ECHO_C" >&6; }
8993if ${ac_cv_search_fmt_scaled+:} false; then : 13847if test "${ac_cv_search_fmt_scaled+set}" = set; then
8994 $as_echo_n "(cached) " >&6 13848 echo $ECHO_N "(cached) $ECHO_C" >&6
8995else 13849else
8996 ac_func_search_save_LIBS=$LIBS 13850 ac_func_search_save_LIBS=$LIBS
8997cat 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
8998/* end confdefs.h. */ 13856/* end confdefs.h. */
8999 13857
9000/* Override any GCC internal prototype to avoid an error. 13858/* Override any GCC internal prototype to avoid an error.
@@ -9019,38 +13877,65 @@ for ac_lib in '' util bsd; do
9019 ac_res=-l$ac_lib 13877 ac_res=-l$ac_lib
9020 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 13878 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9021 fi 13879 fi
9022 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
9023 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
9024fi 13904fi
9025rm -f core conftest.err conftest.$ac_objext \ 13905
9026 conftest$ac_exeext 13906rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9027 if ${ac_cv_search_fmt_scaled+:} false; then : 13907 conftest$ac_exeext
13908 if test "${ac_cv_search_fmt_scaled+set}" = set; then
9028 break 13909 break
9029fi 13910fi
9030done 13911done
9031if ${ac_cv_search_fmt_scaled+:} false; then : 13912if test "${ac_cv_search_fmt_scaled+set}" = set; then
9032 13913 :
9033else 13914else
9034 ac_cv_search_fmt_scaled=no 13915 ac_cv_search_fmt_scaled=no
9035fi 13916fi
9036rm conftest.$ac_ext 13917rm conftest.$ac_ext
9037LIBS=$ac_func_search_save_LIBS 13918LIBS=$ac_func_search_save_LIBS
9038fi 13919fi
9039{ $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
9040$as_echo "$ac_cv_search_fmt_scaled" >&6; } 13921echo "${ECHO_T}$ac_cv_search_fmt_scaled" >&6; }
9041ac_res=$ac_cv_search_fmt_scaled 13922ac_res=$ac_cv_search_fmt_scaled
9042if test "$ac_res" != no; then : 13923if test "$ac_res" != no; then
9043 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 13924 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9044 13925
9045fi 13926fi
9046 13927
9047{ $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
9048$as_echo_n "checking for library containing scan_scaled... " >&6; } 13929echo $ECHO_N "checking for library containing scan_scaled... $ECHO_C" >&6; }
9049if ${ac_cv_search_scan_scaled+:} false; then : 13930if test "${ac_cv_search_scan_scaled+set}" = set; then
9050 $as_echo_n "(cached) " >&6 13931 echo $ECHO_N "(cached) $ECHO_C" >&6
9051else 13932else
9052 ac_func_search_save_LIBS=$LIBS 13933 ac_func_search_save_LIBS=$LIBS
9053cat 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
9054/* end confdefs.h. */ 13939/* end confdefs.h. */
9055 13940
9056/* Override any GCC internal prototype to avoid an error. 13941/* Override any GCC internal prototype to avoid an error.
@@ -9075,38 +13960,65 @@ for ac_lib in '' util bsd; do
9075 ac_res=-l$ac_lib 13960 ac_res=-l$ac_lib
9076 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 13961 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9077 fi 13962 fi
9078 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
9079 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
9080fi 13987fi
9081rm -f core conftest.err conftest.$ac_objext \ 13988
9082 conftest$ac_exeext 13989rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9083 if ${ac_cv_search_scan_scaled+:} false; then : 13990 conftest$ac_exeext
13991 if test "${ac_cv_search_scan_scaled+set}" = set; then
9084 break 13992 break
9085fi 13993fi
9086done 13994done
9087if ${ac_cv_search_scan_scaled+:} false; then : 13995if test "${ac_cv_search_scan_scaled+set}" = set; then
9088 13996 :
9089else 13997else
9090 ac_cv_search_scan_scaled=no 13998 ac_cv_search_scan_scaled=no
9091fi 13999fi
9092rm conftest.$ac_ext 14000rm conftest.$ac_ext
9093LIBS=$ac_func_search_save_LIBS 14001LIBS=$ac_func_search_save_LIBS
9094fi 14002fi
9095{ $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
9096$as_echo "$ac_cv_search_scan_scaled" >&6; } 14004echo "${ECHO_T}$ac_cv_search_scan_scaled" >&6; }
9097ac_res=$ac_cv_search_scan_scaled 14005ac_res=$ac_cv_search_scan_scaled
9098if test "$ac_res" != no; then : 14006if test "$ac_res" != no; then
9099 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 14007 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9100 14008
9101fi 14009fi
9102 14010
9103{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing login" >&5 14011{ echo "$as_me:$LINENO: checking for library containing login" >&5
9104$as_echo_n "checking for library containing login... " >&6; } 14012echo $ECHO_N "checking for library containing login... $ECHO_C" >&6; }
9105if ${ac_cv_search_login+:} false; then : 14013if test "${ac_cv_search_login+set}" = set; then
9106 $as_echo_n "(cached) " >&6 14014 echo $ECHO_N "(cached) $ECHO_C" >&6
9107else 14015else
9108 ac_func_search_save_LIBS=$LIBS 14016 ac_func_search_save_LIBS=$LIBS
9109cat 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
9110/* end confdefs.h. */ 14022/* end confdefs.h. */
9111 14023
9112/* Override any GCC internal prototype to avoid an error. 14024/* Override any GCC internal prototype to avoid an error.
@@ -9131,38 +14043,65 @@ for ac_lib in '' util bsd; do
9131 ac_res=-l$ac_lib 14043 ac_res=-l$ac_lib
9132 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 14044 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9133 fi 14045 fi
9134 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
9135 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
9136fi 14070fi
9137rm -f core conftest.err conftest.$ac_objext \ 14071
9138 conftest$ac_exeext 14072rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9139 if ${ac_cv_search_login+:} false; then : 14073 conftest$ac_exeext
14074 if test "${ac_cv_search_login+set}" = set; then
9140 break 14075 break
9141fi 14076fi
9142done 14077done
9143if ${ac_cv_search_login+:} false; then : 14078if test "${ac_cv_search_login+set}" = set; then
9144 14079 :
9145else 14080else
9146 ac_cv_search_login=no 14081 ac_cv_search_login=no
9147fi 14082fi
9148rm conftest.$ac_ext 14083rm conftest.$ac_ext
9149LIBS=$ac_func_search_save_LIBS 14084LIBS=$ac_func_search_save_LIBS
9150fi 14085fi
9151{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_login" >&5 14086{ echo "$as_me:$LINENO: result: $ac_cv_search_login" >&5
9152$as_echo "$ac_cv_search_login" >&6; } 14087echo "${ECHO_T}$ac_cv_search_login" >&6; }
9153ac_res=$ac_cv_search_login 14088ac_res=$ac_cv_search_login
9154if test "$ac_res" != no; then : 14089if test "$ac_res" != no; then
9155 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 14090 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9156 14091
9157fi 14092fi
9158 14093
9159{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing logout" >&5 14094{ echo "$as_me:$LINENO: checking for library containing logout" >&5
9160$as_echo_n "checking for library containing logout... " >&6; } 14095echo $ECHO_N "checking for library containing logout... $ECHO_C" >&6; }
9161if ${ac_cv_search_logout+:} false; then : 14096if test "${ac_cv_search_logout+set}" = set; then
9162 $as_echo_n "(cached) " >&6 14097 echo $ECHO_N "(cached) $ECHO_C" >&6
9163else 14098else
9164 ac_func_search_save_LIBS=$LIBS 14099 ac_func_search_save_LIBS=$LIBS
9165cat 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
9166/* end confdefs.h. */ 14105/* end confdefs.h. */
9167 14106
9168/* Override any GCC internal prototype to avoid an error. 14107/* Override any GCC internal prototype to avoid an error.
@@ -9187,38 +14126,65 @@ for ac_lib in '' util bsd; do
9187 ac_res=-l$ac_lib 14126 ac_res=-l$ac_lib
9188 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 14127 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9189 fi 14128 fi
9190 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
9191 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
9192fi 14153fi
9193rm -f core conftest.err conftest.$ac_objext \ 14154
9194 conftest$ac_exeext 14155rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9195 if ${ac_cv_search_logout+:} false; then : 14156 conftest$ac_exeext
14157 if test "${ac_cv_search_logout+set}" = set; then
9196 break 14158 break
9197fi 14159fi
9198done 14160done
9199if ${ac_cv_search_logout+:} false; then : 14161if test "${ac_cv_search_logout+set}" = set; then
9200 14162 :
9201else 14163else
9202 ac_cv_search_logout=no 14164 ac_cv_search_logout=no
9203fi 14165fi
9204rm conftest.$ac_ext 14166rm conftest.$ac_ext
9205LIBS=$ac_func_search_save_LIBS 14167LIBS=$ac_func_search_save_LIBS
9206fi 14168fi
9207{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_logout" >&5 14169{ echo "$as_me:$LINENO: result: $ac_cv_search_logout" >&5
9208$as_echo "$ac_cv_search_logout" >&6; } 14170echo "${ECHO_T}$ac_cv_search_logout" >&6; }
9209ac_res=$ac_cv_search_logout 14171ac_res=$ac_cv_search_logout
9210if test "$ac_res" != no; then : 14172if test "$ac_res" != no; then
9211 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 14173 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9212 14174
9213fi 14175fi
9214 14176
9215{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing logwtmp" >&5 14177{ echo "$as_me:$LINENO: checking for library containing logwtmp" >&5
9216$as_echo_n "checking for library containing logwtmp... " >&6; } 14178echo $ECHO_N "checking for library containing logwtmp... $ECHO_C" >&6; }
9217if ${ac_cv_search_logwtmp+:} false; then : 14179if test "${ac_cv_search_logwtmp+set}" = set; then
9218 $as_echo_n "(cached) " >&6 14180 echo $ECHO_N "(cached) $ECHO_C" >&6
9219else 14181else
9220 ac_func_search_save_LIBS=$LIBS 14182 ac_func_search_save_LIBS=$LIBS
9221cat 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
9222/* end confdefs.h. */ 14188/* end confdefs.h. */
9223 14189
9224/* Override any GCC internal prototype to avoid an error. 14190/* Override any GCC internal prototype to avoid an error.
@@ -9243,38 +14209,65 @@ for ac_lib in '' util bsd; do
9243 ac_res=-l$ac_lib 14209 ac_res=-l$ac_lib
9244 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 14210 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9245 fi 14211 fi
9246 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
9247 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
9248fi 14236fi
9249rm -f core conftest.err conftest.$ac_objext \ 14237
9250 conftest$ac_exeext 14238rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9251 if ${ac_cv_search_logwtmp+:} false; then : 14239 conftest$ac_exeext
14240 if test "${ac_cv_search_logwtmp+set}" = set; then
9252 break 14241 break
9253fi 14242fi
9254done 14243done
9255if ${ac_cv_search_logwtmp+:} false; then : 14244if test "${ac_cv_search_logwtmp+set}" = set; then
9256 14245 :
9257else 14246else
9258 ac_cv_search_logwtmp=no 14247 ac_cv_search_logwtmp=no
9259fi 14248fi
9260rm conftest.$ac_ext 14249rm conftest.$ac_ext
9261LIBS=$ac_func_search_save_LIBS 14250LIBS=$ac_func_search_save_LIBS
9262fi 14251fi
9263{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_logwtmp" >&5 14252{ echo "$as_me:$LINENO: result: $ac_cv_search_logwtmp" >&5
9264$as_echo "$ac_cv_search_logwtmp" >&6; } 14253echo "${ECHO_T}$ac_cv_search_logwtmp" >&6; }
9265ac_res=$ac_cv_search_logwtmp 14254ac_res=$ac_cv_search_logwtmp
9266if test "$ac_res" != no; then : 14255if test "$ac_res" != no; then
9267 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 14256 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9268 14257
9269fi 14258fi
9270 14259
9271{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing openpty" >&5 14260{ echo "$as_me:$LINENO: checking for library containing openpty" >&5
9272$as_echo_n "checking for library containing openpty... " >&6; } 14261echo $ECHO_N "checking for library containing openpty... $ECHO_C" >&6; }
9273if ${ac_cv_search_openpty+:} false; then : 14262if test "${ac_cv_search_openpty+set}" = set; then
9274 $as_echo_n "(cached) " >&6 14263 echo $ECHO_N "(cached) $ECHO_C" >&6
9275else 14264else
9276 ac_func_search_save_LIBS=$LIBS 14265 ac_func_search_save_LIBS=$LIBS
9277cat 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
9278/* end confdefs.h. */ 14271/* end confdefs.h. */
9279 14272
9280/* Override any GCC internal prototype to avoid an error. 14273/* Override any GCC internal prototype to avoid an error.
@@ -9299,38 +14292,65 @@ for ac_lib in '' util bsd; do
9299 ac_res=-l$ac_lib 14292 ac_res=-l$ac_lib
9300 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 14293 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9301 fi 14294 fi
9302 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
9303 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
9304fi 14319fi
9305rm -f core conftest.err conftest.$ac_objext \ 14320
9306 conftest$ac_exeext 14321rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9307 if ${ac_cv_search_openpty+:} false; then : 14322 conftest$ac_exeext
14323 if test "${ac_cv_search_openpty+set}" = set; then
9308 break 14324 break
9309fi 14325fi
9310done 14326done
9311if ${ac_cv_search_openpty+:} false; then : 14327if test "${ac_cv_search_openpty+set}" = set; then
9312 14328 :
9313else 14329else
9314 ac_cv_search_openpty=no 14330 ac_cv_search_openpty=no
9315fi 14331fi
9316rm conftest.$ac_ext 14332rm conftest.$ac_ext
9317LIBS=$ac_func_search_save_LIBS 14333LIBS=$ac_func_search_save_LIBS
9318fi 14334fi
9319{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_openpty" >&5 14335{ echo "$as_me:$LINENO: result: $ac_cv_search_openpty" >&5
9320$as_echo "$ac_cv_search_openpty" >&6; } 14336echo "${ECHO_T}$ac_cv_search_openpty" >&6; }
9321ac_res=$ac_cv_search_openpty 14337ac_res=$ac_cv_search_openpty
9322if test "$ac_res" != no; then : 14338if test "$ac_res" != no; then
9323 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 14339 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9324 14340
9325fi 14341fi
9326 14342
9327{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing updwtmp" >&5 14343{ echo "$as_me:$LINENO: checking for library containing updwtmp" >&5
9328$as_echo_n "checking for library containing updwtmp... " >&6; } 14344echo $ECHO_N "checking for library containing updwtmp... $ECHO_C" >&6; }
9329if ${ac_cv_search_updwtmp+:} false; then : 14345if test "${ac_cv_search_updwtmp+set}" = set; then
9330 $as_echo_n "(cached) " >&6 14346 echo $ECHO_N "(cached) $ECHO_C" >&6
9331else 14347else
9332 ac_func_search_save_LIBS=$LIBS 14348 ac_func_search_save_LIBS=$LIBS
9333cat 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
9334/* end confdefs.h. */ 14354/* end confdefs.h. */
9335 14355
9336/* Override any GCC internal prototype to avoid an error. 14356/* Override any GCC internal prototype to avoid an error.
@@ -9355,38 +14375,149 @@ for ac_lib in '' util bsd; do
9355 ac_res=-l$ac_lib 14375 ac_res=-l$ac_lib
9356 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 14376 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9357 fi 14377 fi
9358 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
9359 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
9360fi 14402fi
9361rm -f core conftest.err conftest.$ac_objext \ 14403
9362 conftest$ac_exeext 14404rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9363 if ${ac_cv_search_updwtmp+:} false; then : 14405 conftest$ac_exeext
14406 if test "${ac_cv_search_updwtmp+set}" = set; then
9364 break 14407 break
9365fi 14408fi
9366done 14409done
9367if ${ac_cv_search_updwtmp+:} false; then : 14410if test "${ac_cv_search_updwtmp+set}" = set; then
9368 14411 :
9369else 14412else
9370 ac_cv_search_updwtmp=no 14413 ac_cv_search_updwtmp=no
9371fi 14414fi
9372rm conftest.$ac_ext 14415rm conftest.$ac_ext
9373LIBS=$ac_func_search_save_LIBS 14416LIBS=$ac_func_search_save_LIBS
9374fi 14417fi
9375{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_updwtmp" >&5 14418{ echo "$as_me:$LINENO: result: $ac_cv_search_updwtmp" >&5
9376$as_echo "$ac_cv_search_updwtmp" >&6; } 14419echo "${ECHO_T}$ac_cv_search_updwtmp" >&6; }
9377ac_res=$ac_cv_search_updwtmp 14420ac_res=$ac_cv_search_updwtmp
9378if test "$ac_res" != no; then : 14421if test "$ac_res" != no; then
9379 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 14422 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9380 14423
9381fi 14424fi
9382 14425
14426
14427
14428
14429
14430
14431
14432
9383for 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
9384do : 14434do
9385 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`
9386ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 14436{ echo "$as_me:$LINENO: checking for $ac_func" >&5
9387if 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
9388 cat >>confdefs.h <<_ACEOF 14519 cat >>confdefs.h <<_ACEOF
9389#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 14520#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
9390_ACEOF 14521_ACEOF
9391 14522
9392fi 14523fi
@@ -9394,13 +14525,17 @@ done
9394 14525
9395 14526
9396# 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.
9397{ $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
9398$as_echo_n "checking for library containing inet_ntop... " >&6; } 14529echo $ECHO_N "checking for library containing inet_ntop... $ECHO_C" >&6; }
9399if ${ac_cv_search_inet_ntop+:} false; then : 14530if test "${ac_cv_search_inet_ntop+set}" = set; then
9400 $as_echo_n "(cached) " >&6 14531 echo $ECHO_N "(cached) $ECHO_C" >&6
9401else 14532else
9402 ac_func_search_save_LIBS=$LIBS 14533 ac_func_search_save_LIBS=$LIBS
9403cat 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
9404/* end confdefs.h. */ 14539/* end confdefs.h. */
9405 14540
9406/* Override any GCC internal prototype to avoid an error. 14541/* Override any GCC internal prototype to avoid an error.
@@ -9425,50 +14560,160 @@ for ac_lib in '' resolv nsl; do
9425 ac_res=-l$ac_lib 14560 ac_res=-l$ac_lib
9426 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 14561 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9427 fi 14562 fi
9428 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
9429 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
9430fi 14587fi
9431rm -f core conftest.err conftest.$ac_objext \ 14588
9432 conftest$ac_exeext 14589rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9433 if ${ac_cv_search_inet_ntop+:} false; then : 14590 conftest$ac_exeext
14591 if test "${ac_cv_search_inet_ntop+set}" = set; then
9434 break 14592 break
9435fi 14593fi
9436done 14594done
9437if ${ac_cv_search_inet_ntop+:} false; then : 14595if test "${ac_cv_search_inet_ntop+set}" = set; then
9438 14596 :
9439else 14597else
9440 ac_cv_search_inet_ntop=no 14598 ac_cv_search_inet_ntop=no
9441fi 14599fi
9442rm conftest.$ac_ext 14600rm conftest.$ac_ext
9443LIBS=$ac_func_search_save_LIBS 14601LIBS=$ac_func_search_save_LIBS
9444fi 14602fi
9445{ $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
9446$as_echo "$ac_cv_search_inet_ntop" >&6; } 14604echo "${ECHO_T}$ac_cv_search_inet_ntop" >&6; }
9447ac_res=$ac_cv_search_inet_ntop 14605ac_res=$ac_cv_search_inet_ntop
9448if test "$ac_res" != no; then : 14606if test "$ac_res" != no; then
9449 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 14607 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9450 14608
9451fi 14609fi
9452 14610
9453 14611
14612
9454for ac_func in strftime 14613for ac_func in strftime
9455do : 14614do
9456 ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" 14615as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
9457if 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
9458 cat >>confdefs.h <<_ACEOF 14699 cat >>confdefs.h <<_ACEOF
9459#define HAVE_STRFTIME 1 14700#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
9460_ACEOF 14701_ACEOF
9461 14702
9462else 14703else
9463 # strftime is in -lintl on SCO UNIX. 14704 # strftime is in -lintl on SCO UNIX.
9464{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5 14705{ echo "$as_me:$LINENO: checking for strftime in -lintl" >&5
9465$as_echo_n "checking for strftime in -lintl... " >&6; } 14706echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6; }
9466if ${ac_cv_lib_intl_strftime+:} false; then : 14707if test "${ac_cv_lib_intl_strftime+set}" = set; then
9467 $as_echo_n "(cached) " >&6 14708 echo $ECHO_N "(cached) $ECHO_C" >&6
9468else 14709else
9469 ac_check_lib_save_LIBS=$LIBS 14710 ac_check_lib_save_LIBS=$LIBS
9470LIBS="-lintl $LIBS" 14711LIBS="-lintl $LIBS"
9471cat 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
9472/* end confdefs.h. */ 14717/* end confdefs.h. */
9473 14718
9474/* Override any GCC internal prototype to avoid an error. 14719/* Override any GCC internal prototype to avoid an error.
@@ -9486,19 +14731,42 @@ return strftime ();
9486 return 0; 14731 return 0;
9487} 14732}
9488_ACEOF 14733_ACEOF
9489if 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
9490 ac_cv_lib_intl_strftime=yes 14752 ac_cv_lib_intl_strftime=yes
9491else 14753else
9492 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
9493fi 14758fi
9494rm -f core conftest.err conftest.$ac_objext \ 14759
9495 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
9496LIBS=$ac_check_lib_save_LIBS 14762LIBS=$ac_check_lib_save_LIBS
9497fi 14763fi
9498{ $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
9499$as_echo "$ac_cv_lib_intl_strftime" >&6; } 14765echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6; }
9500if test "x$ac_cv_lib_intl_strftime" = xyes; then : 14766if test $ac_cv_lib_intl_strftime = yes; then
9501 $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h 14767 cat >>confdefs.h <<\_ACEOF
14768#define HAVE_STRFTIME 1
14769_ACEOF
9502 14770
9503LIBS="-lintl $LIBS" 14771LIBS="-lintl $LIBS"
9504fi 14772fi
@@ -9508,9 +14776,13 @@ done
9508 14776
9509 14777
9510# Check for ALTDIRFUNC glob() extension 14778# Check for ALTDIRFUNC glob() extension
9511{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_ALTDIRFUNC support" >&5 14779{ echo "$as_me:$LINENO: checking for GLOB_ALTDIRFUNC support" >&5
9512$as_echo_n "checking for GLOB_ALTDIRFUNC support... " >&6; } 14780echo $ECHO_N "checking for GLOB_ALTDIRFUNC support... $ECHO_C" >&6; }
9513cat 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
9514/* end confdefs.h. */ 14786/* end confdefs.h. */
9515 14787
9516 #include <glob.h> 14788 #include <glob.h>
@@ -9520,18 +14792,20 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9520 14792
9521_ACEOF 14793_ACEOF
9522if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 14794if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
9523 $EGREP "FOUNDIT" >/dev/null 2>&1; then : 14795 $EGREP "FOUNDIT" >/dev/null 2>&1; then
9524 14796
9525 14797
9526$as_echo "#define GLOB_HAS_ALTDIRFUNC 1" >>confdefs.h 14798cat >>confdefs.h <<\_ACEOF
14799#define GLOB_HAS_ALTDIRFUNC 1
14800_ACEOF
9527 14801
9528 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 14802 { echo "$as_me:$LINENO: result: yes" >&5
9529$as_echo "yes" >&6; } 14803echo "${ECHO_T}yes" >&6; }
9530 14804
9531else 14805else
9532 14806
9533 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 14807 { echo "$as_me:$LINENO: result: no" >&5
9534$as_echo "no" >&6; } 14808echo "${ECHO_T}no" >&6; }
9535 14809
9536 14810
9537fi 14811fi
@@ -9539,9 +14813,13 @@ rm -f conftest*
9539 14813
9540 14814
9541# Check for g.gl_matchc glob() extension 14815# Check for g.gl_matchc glob() extension
9542{ $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
9543$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; }
9544cat 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
9545/* end confdefs.h. */ 14823/* end confdefs.h. */
9546 #include <glob.h> 14824 #include <glob.h>
9547int 14825int
@@ -9552,26 +14830,52 @@ main ()
9552 return 0; 14830 return 0;
9553} 14831}
9554_ACEOF 14832_ACEOF
9555if 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
9556 14850
9557 14851
9558$as_echo "#define GLOB_HAS_GL_MATCHC 1" >>confdefs.h 14852cat >>confdefs.h <<\_ACEOF
14853#define GLOB_HAS_GL_MATCHC 1
14854_ACEOF
9559 14855
9560 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 14856 { echo "$as_me:$LINENO: result: yes" >&5
9561$as_echo "yes" >&6; } 14857echo "${ECHO_T}yes" >&6; }
9562 14858
9563else 14859else
14860 echo "$as_me: failed program was:" >&5
14861sed 's/^/| /' conftest.$ac_ext >&5
14862
9564 14863
9565 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 14864 { echo "$as_me:$LINENO: result: no" >&5
9566$as_echo "no" >&6; } 14865echo "${ECHO_T}no" >&6; }
9567 14866
9568fi 14867fi
14868
9569rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 14869rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9570 14870
9571# Check for g.gl_statv glob() extension 14871# Check for g.gl_statv glob() extension
9572{ $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
9573$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; }
9574cat 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
9575/* end confdefs.h. */ 14879/* end confdefs.h. */
9576 #include <glob.h> 14880 #include <glob.h>
9577int 14881int
@@ -9588,48 +14892,133 @@ g.gl_statv = NULL;
9588 return 0; 14892 return 0;
9589} 14893}
9590_ACEOF 14894_ACEOF
9591if 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
9592 14912
9593 14913
9594$as_echo "#define GLOB_HAS_GL_STATV 1" >>confdefs.h 14914cat >>confdefs.h <<\_ACEOF
14915#define GLOB_HAS_GL_STATV 1
14916_ACEOF
9595 14917
9596 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 14918 { echo "$as_me:$LINENO: result: yes" >&5
9597$as_echo "yes" >&6; } 14919echo "${ECHO_T}yes" >&6; }
9598 14920
9599else 14921else
14922 echo "$as_me: failed program was:" >&5
14923sed 's/^/| /' conftest.$ac_ext >&5
9600 14924
9601 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 14925
9602$as_echo "no" >&6; } 14926 { echo "$as_me:$LINENO: result: no" >&5
14927echo "${ECHO_T}no" >&6; }
9603 14928
9604 14929
9605fi 14930fi
14931
9606rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 14932rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9607 14933
9608ac_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
9609" 14935echo $ECHO_N "checking whether GLOB_NOMATCH is declared... $ECHO_C" >&6; }
9610if test "x$ac_cv_have_decl_GLOB_NOMATCH" = xyes; then : 14936if test "${ac_cv_have_decl_GLOB_NOMATCH+set}" = set; then
9611 ac_have_decl=1 14937 echo $ECHO_N "(cached) $ECHO_C" >&6
9612else 14938else
9613 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
14981fi
14982
14983rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9614fi 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
9615 14988
9616cat >>confdefs.h <<_ACEOF 14989cat >>confdefs.h <<_ACEOF
9617#define HAVE_DECL_GLOB_NOMATCH $ac_have_decl 14990#define HAVE_DECL_GLOB_NOMATCH 1
9618_ACEOF 14991_ACEOF
9619 14992
9620 14993
9621{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct dirent allocates space for d_name" >&5 14994else
9622$as_echo_n "checking whether struct dirent allocates space for d_name... " >&6; } 14995 cat >>confdefs.h <<_ACEOF
9623if test "$cross_compiling" = yes; then : 14996#define HAVE_DECL_GLOB_NOMATCH 0
14997_ACEOF
9624 14998
9625 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME" >&5 14999
9626$as_echo "$as_me: WARNING: cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME" >&2;} 15000fi
9627 $as_echo "#define BROKEN_ONE_BYTE_DIRENT_D_NAME 1" >>confdefs.h 15001
15002
15003
15004{ echo "$as_me:$LINENO: checking whether struct dirent allocates space for d_name" >&5
15005echo $ECHO_N "checking whether struct dirent allocates space for d_name... $ECHO_C" >&6; }
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
9628 15013
9629 15014
9630 15015
9631else 15016else
9632 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
9633/* end confdefs.h. */ 15022/* end confdefs.h. */
9634 15023
9635#include <sys/types.h> 15024#include <sys/types.h>
@@ -9645,41 +15034,69 @@ main ()
9645 return 0; 15034 return 0;
9646} 15035}
9647_ACEOF 15036_ACEOF
9648if ac_fn_c_try_run "$LINENO"; then : 15037rm -f conftest$ac_exeext
9649 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 15038if { (ac_try="$ac_link"
9650$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; }
9651else 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
9652 15063
9653 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15064( exit $ac_status )
9654$as_echo "no" >&6; }
9655 15065
9656$as_echo "#define BROKEN_ONE_BYTE_DIRENT_D_NAME 1" >>confdefs.h 15066 { echo "$as_me:$LINENO: result: no" >&5
15067echo "${ECHO_T}no" >&6; }
15068
15069cat >>confdefs.h <<\_ACEOF
15070#define BROKEN_ONE_BYTE_DIRENT_D_NAME 1
15071_ACEOF
9657 15072
9658 15073
9659fi 15074fi
9660rm -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
9661 conftest.$ac_objext conftest.beam conftest.$ac_ext
9662fi 15076fi
9663 15077
9664 15078
9665{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /proc/pid/fd directory" >&5 15079
9666$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; }
9667if test -d "/proc/$$/fd" ; then 15082if test -d "/proc/$$/fd" ; then
9668 15083
9669$as_echo "#define HAVE_PROC_PID 1" >>confdefs.h 15084cat >>confdefs.h <<\_ACEOF
15085#define HAVE_PROC_PID 1
15086_ACEOF
9670 15087
9671 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 15088 { echo "$as_me:$LINENO: result: yes" >&5
9672$as_echo "yes" >&6; } 15089echo "${ECHO_T}yes" >&6; }
9673else 15090else
9674 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15091 { echo "$as_me:$LINENO: result: no" >&5
9675$as_echo "no" >&6; } 15092echo "${ECHO_T}no" >&6; }
9676fi 15093fi
9677 15094
9678# Check whether user wants S/Key support 15095# Check whether user wants S/Key support
9679SKEY_MSG="no" 15096SKEY_MSG="no"
9680 15097
9681# Check whether --with-skey was given. 15098# Check whether --with-skey was given.
9682if test "${with_skey+set}" = set; then : 15099if test "${with_skey+set}" = set; then
9683 withval=$with_skey; 15100 withval=$with_skey;
9684 if test "x$withval" != "xno" ; then 15101 if test "x$withval" != "xno" ; then
9685 15102
@@ -9689,14 +15106,20 @@ if test "${with_skey+set}" = set; then :
9689 fi 15106 fi
9690 15107
9691 15108
9692$as_echo "#define SKEY 1" >>confdefs.h 15109cat >>confdefs.h <<\_ACEOF
15110#define SKEY 1
15111_ACEOF
9693 15112
9694 LIBS="-lskey $LIBS" 15113 LIBS="-lskey $LIBS"
9695 SKEY_MSG="yes" 15114 SKEY_MSG="yes"
9696 15115
9697 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for s/key support" >&5 15116 { echo "$as_me:$LINENO: checking for s/key support" >&5
9698$as_echo_n "checking for s/key support... " >&6; } 15117echo $ECHO_N "checking for s/key support... $ECHO_C" >&6; }
9699 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
9700/* end confdefs.h. */ 15123/* end confdefs.h. */
9701 15124
9702#include <stdio.h> 15125#include <stdio.h>
@@ -9713,21 +15136,48 @@ main ()
9713 return 0; 15136 return 0;
9714} 15137}
9715_ACEOF 15138_ACEOF
9716if ac_fn_c_try_link "$LINENO"; then : 15139rm -f conftest.$ac_objext conftest$ac_exeext
9717 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 15140if { (ac_try="$ac_link"
9718$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; }
9719else 15159else
15160 echo "$as_me: failed program was:" >&5
15161sed 's/^/| /' conftest.$ac_ext >&5
9720 15162
9721 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15163
9722$as_echo "no" >&6; } 15164 { echo "$as_me:$LINENO: result: no" >&5
9723 as_fn_error $? "** Incomplete or missing s/key libraries." "$LINENO" 5 15165echo "${ECHO_T}no" >&6; }
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; }; }
9724 15169
9725fi 15170fi
9726rm -f core conftest.err conftest.$ac_objext \ 15171
9727 conftest$ac_exeext conftest.$ac_ext 15172rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9728 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if skeychallenge takes 4 arguments" >&5 15173 conftest$ac_exeext conftest.$ac_ext
9729$as_echo_n "checking if skeychallenge takes 4 arguments... " >&6; } 15174 { echo "$as_me:$LINENO: checking if skeychallenge takes 4 arguments" >&5
9730 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
9731/* end confdefs.h. */ 15181/* end confdefs.h. */
9732 15182
9733#include <stdio.h> 15183#include <stdio.h>
@@ -9743,19 +15193,41 @@ main ()
9743 return 0; 15193 return 0;
9744} 15194}
9745_ACEOF 15195_ACEOF
9746if 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
9747 15213
9748 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 15214 { echo "$as_me:$LINENO: result: yes" >&5
9749$as_echo "yes" >&6; } 15215echo "${ECHO_T}yes" >&6; }
9750 15216
9751$as_echo "#define SKEYCHALLENGE_4ARG 1" >>confdefs.h 15217cat >>confdefs.h <<\_ACEOF
15218#define SKEYCHALLENGE_4ARG 1
15219_ACEOF
9752 15220
9753else 15221else
15222 echo "$as_me: failed program was:" >&5
15223sed 's/^/| /' conftest.$ac_ext >&5
15224
9754 15225
9755 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15226 { echo "$as_me:$LINENO: result: no" >&5
9756$as_echo "no" >&6; } 15227echo "${ECHO_T}no" >&6; }
9757 15228
9758fi 15229fi
15230
9759rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 15231rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9760 fi 15232 fi
9761 15233
@@ -9767,7 +15239,7 @@ fi
9767LDNS_MSG="no" 15239LDNS_MSG="no"
9768 15240
9769# Check whether --with-ldns was given. 15241# Check whether --with-ldns was given.
9770if test "${with_ldns+set}" = set; then : 15242if test "${with_ldns+set}" = set; then
9771 withval=$with_ldns; 15243 withval=$with_ldns;
9772 if test "x$withval" != "xno" ; then 15244 if test "x$withval" != "xno" ; then
9773 15245
@@ -9777,14 +15249,20 @@ if test "${with_ldns+set}" = set; then :
9777 fi 15249 fi
9778 15250
9779 15251
9780$as_echo "#define HAVE_LDNS 1" >>confdefs.h 15252cat >>confdefs.h <<\_ACEOF
15253#define HAVE_LDNS 1
15254_ACEOF
9781 15255
9782 LIBS="-lldns $LIBS" 15256 LIBS="-lldns $LIBS"
9783 LDNS_MSG="yes" 15257 LDNS_MSG="yes"
9784 15258
9785 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns support" >&5 15259 { echo "$as_me:$LINENO: checking for ldns support" >&5
9786$as_echo_n "checking for ldns support... " >&6; } 15260echo $ECHO_N "checking for ldns support... $ECHO_C" >&6; }
9787 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
9788/* end confdefs.h. */ 15266/* end confdefs.h. */
9789 15267
9790#include <stdio.h> 15268#include <stdio.h>
@@ -9795,18 +15273,41 @@ int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); s
9795 15273
9796 15274
9797_ACEOF 15275_ACEOF
9798if ac_fn_c_try_link "$LINENO"; then : 15276rm -f conftest.$ac_objext conftest$ac_exeext
9799 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 15277if { (ac_try="$ac_link"
9800$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; }
9801else 15296else
15297 echo "$as_me: failed program was:" >&5
15298sed 's/^/| /' conftest.$ac_ext >&5
15299
9802 15300
9803 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15301 { echo "$as_me:$LINENO: result: no" >&5
9804$as_echo "no" >&6; } 15302echo "${ECHO_T}no" >&6; }
9805 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; }; }
9806 15306
9807fi 15307fi
9808rm -f core conftest.err conftest.$ac_objext \ 15308
9809 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
9810 fi 15311 fi
9811 15312
9812 15313
@@ -9817,16 +15318,16 @@ fi
9817LIBEDIT_MSG="no" 15318LIBEDIT_MSG="no"
9818 15319
9819# Check whether --with-libedit was given. 15320# Check whether --with-libedit was given.
9820if test "${with_libedit+set}" = set; then : 15321if test "${with_libedit+set}" = set; then
9821 withval=$with_libedit; if test "x$withval" != "xno" ; then 15322 withval=$with_libedit; if test "x$withval" != "xno" ; then
9822 if test "x$withval" = "xyes" ; then 15323 if test "x$withval" = "xyes" ; then
9823 if test -n "$ac_tool_prefix"; then 15324 if test -n "$ac_tool_prefix"; then
9824 # 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.
9825set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 15326set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
9826{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 15327{ echo "$as_me:$LINENO: checking for $ac_word" >&5
9827$as_echo_n "checking for $ac_word... " >&6; } 15328echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
9828if ${ac_cv_path_PKGCONFIG+:} false; then : 15329if test "${ac_cv_path_PKGCONFIG+set}" = set; then
9829 $as_echo_n "(cached) " >&6 15330 echo $ECHO_N "(cached) $ECHO_C" >&6
9830else 15331else
9831 case $PKGCONFIG in 15332 case $PKGCONFIG in
9832 [\\/]* | ?:[\\/]*) 15333 [\\/]* | ?:[\\/]*)
@@ -9838,14 +15339,14 @@ for as_dir in $PATH
9838do 15339do
9839 IFS=$as_save_IFS 15340 IFS=$as_save_IFS
9840 test -z "$as_dir" && as_dir=. 15341 test -z "$as_dir" && as_dir=.
9841 for ac_exec_ext in '' $ac_executable_extensions; do 15342 for ac_exec_ext in '' $ac_executable_extensions; do
9842 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
9843 ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" 15344 ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
9844 $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
9845 break 2 15346 break 2
9846 fi 15347 fi
9847done 15348done
9848 done 15349done
9849IFS=$as_save_IFS 15350IFS=$as_save_IFS
9850 15351
9851 ;; 15352 ;;
@@ -9853,11 +15354,11 @@ esac
9853fi 15354fi
9854PKGCONFIG=$ac_cv_path_PKGCONFIG 15355PKGCONFIG=$ac_cv_path_PKGCONFIG
9855if test -n "$PKGCONFIG"; then 15356if test -n "$PKGCONFIG"; then
9856 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 15357 { echo "$as_me:$LINENO: result: $PKGCONFIG" >&5
9857$as_echo "$PKGCONFIG" >&6; } 15358echo "${ECHO_T}$PKGCONFIG" >&6; }
9858else 15359else
9859 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15360 { echo "$as_me:$LINENO: result: no" >&5
9860$as_echo "no" >&6; } 15361echo "${ECHO_T}no" >&6; }
9861fi 15362fi
9862 15363
9863 15364
@@ -9866,10 +15367,10 @@ if test -z "$ac_cv_path_PKGCONFIG"; then
9866 ac_pt_PKGCONFIG=$PKGCONFIG 15367 ac_pt_PKGCONFIG=$PKGCONFIG
9867 # 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.
9868set dummy pkg-config; ac_word=$2 15369set dummy pkg-config; ac_word=$2
9869{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 15370{ echo "$as_me:$LINENO: checking for $ac_word" >&5
9870$as_echo_n "checking for $ac_word... " >&6; } 15371echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
9871if ${ac_cv_path_ac_pt_PKGCONFIG+:} false; then : 15372if test "${ac_cv_path_ac_pt_PKGCONFIG+set}" = set; then
9872 $as_echo_n "(cached) " >&6 15373 echo $ECHO_N "(cached) $ECHO_C" >&6
9873else 15374else
9874 case $ac_pt_PKGCONFIG in 15375 case $ac_pt_PKGCONFIG in
9875 [\\/]* | ?:[\\/]*) 15376 [\\/]* | ?:[\\/]*)
@@ -9881,14 +15382,14 @@ for as_dir in $PATH
9881do 15382do
9882 IFS=$as_save_IFS 15383 IFS=$as_save_IFS
9883 test -z "$as_dir" && as_dir=. 15384 test -z "$as_dir" && as_dir=.
9884 for ac_exec_ext in '' $ac_executable_extensions; do 15385 for ac_exec_ext in '' $ac_executable_extensions; do
9885 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
9886 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"
9887 $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
9888 break 2 15389 break 2
9889 fi 15390 fi
9890done 15391done
9891 done 15392done
9892IFS=$as_save_IFS 15393IFS=$as_save_IFS
9893 15394
9894 ;; 15395 ;;
@@ -9896,11 +15397,11 @@ esac
9896fi 15397fi
9897ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG 15398ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG
9898if test -n "$ac_pt_PKGCONFIG"; then 15399if test -n "$ac_pt_PKGCONFIG"; then
9899 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5 15400 { echo "$as_me:$LINENO: result: $ac_pt_PKGCONFIG" >&5
9900$as_echo "$ac_pt_PKGCONFIG" >&6; } 15401echo "${ECHO_T}$ac_pt_PKGCONFIG" >&6; }
9901else 15402else
9902 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15403 { echo "$as_me:$LINENO: result: no" >&5
9903$as_echo "no" >&6; } 15404echo "${ECHO_T}no" >&6; }
9904fi 15405fi
9905 15406
9906 if test "x$ac_pt_PKGCONFIG" = x; then 15407 if test "x$ac_pt_PKGCONFIG" = x; then
@@ -9908,8 +15409,12 @@ fi
9908 else 15409 else
9909 case $cross_compiling:$ac_tool_warned in 15410 case $cross_compiling:$ac_tool_warned in
9910yes:) 15411yes:)
9911{ $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
9912$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;}
9913ac_tool_warned=yes ;; 15418ac_tool_warned=yes ;;
9914esac 15419esac
9915 PKGCONFIG=$ac_pt_PKGCONFIG 15420 PKGCONFIG=$ac_pt_PKGCONFIG
@@ -9919,15 +15424,15 @@ else
9919fi 15424fi
9920 15425
9921 if test "x$PKGCONFIG" != "xno"; then 15426 if test "x$PKGCONFIG" != "xno"; then
9922 { $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
9923$as_echo_n "checking if $PKGCONFIG knows about libedit... " >&6; } 15428echo $ECHO_N "checking if $PKGCONFIG knows about libedit... $ECHO_C" >&6; }
9924 if "$PKGCONFIG" libedit; then 15429 if "$PKGCONFIG" libedit; then
9925 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 15430 { echo "$as_me:$LINENO: result: yes" >&5
9926$as_echo "yes" >&6; } 15431echo "${ECHO_T}yes" >&6; }
9927 use_pkgconfig_for_libedit=yes 15432 use_pkgconfig_for_libedit=yes
9928 else 15433 else
9929 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15434 { echo "$as_me:$LINENO: result: no" >&5
9930$as_echo "no" >&6; } 15435echo "${ECHO_T}no" >&6; }
9931 fi 15436 fi
9932 fi 15437 fi
9933 else 15438 else
@@ -9945,15 +15450,19 @@ $as_echo "no" >&6; }
9945 LIBEDIT="-ledit -lcurses" 15450 LIBEDIT="-ledit -lcurses"
9946 fi 15451 fi
9947 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'` 15452 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
9948 { $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
9949$as_echo_n "checking for el_init in -ledit... " >&6; } 15454echo $ECHO_N "checking for el_init in -ledit... $ECHO_C" >&6; }
9950if ${ac_cv_lib_edit_el_init+:} false; then : 15455if test "${ac_cv_lib_edit_el_init+set}" = set; then
9951 $as_echo_n "(cached) " >&6 15456 echo $ECHO_N "(cached) $ECHO_C" >&6
9952else 15457else
9953 ac_check_lib_save_LIBS=$LIBS 15458 ac_check_lib_save_LIBS=$LIBS
9954LIBS="-ledit $OTHERLIBS 15459LIBS="-ledit $OTHERLIBS
9955 $LIBS" 15460 $LIBS"
9956cat 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
9957/* end confdefs.h. */ 15466/* end confdefs.h. */
9958 15467
9959/* Override any GCC internal prototype to avoid an error. 15468/* Override any GCC internal prototype to avoid an error.
@@ -9971,31 +15480,60 @@ return el_init ();
9971 return 0; 15480 return 0;
9972} 15481}
9973_ACEOF 15482_ACEOF
9974if 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
9975 ac_cv_lib_edit_el_init=yes 15501 ac_cv_lib_edit_el_init=yes
9976else 15502else
9977 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
9978fi 15507fi
9979rm -f core conftest.err conftest.$ac_objext \ 15508
9980 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
9981LIBS=$ac_check_lib_save_LIBS 15511LIBS=$ac_check_lib_save_LIBS
9982fi 15512fi
9983{ $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
9984$as_echo "$ac_cv_lib_edit_el_init" >&6; } 15514echo "${ECHO_T}$ac_cv_lib_edit_el_init" >&6; }
9985if test "x$ac_cv_lib_edit_el_init" = xyes; then : 15515if test $ac_cv_lib_edit_el_init = yes; then
9986 15516
9987$as_echo "#define USE_LIBEDIT 1" >>confdefs.h 15517cat >>confdefs.h <<\_ACEOF
15518#define USE_LIBEDIT 1
15519_ACEOF
9988 15520
9989 LIBEDIT_MSG="yes" 15521 LIBEDIT_MSG="yes"
9990 15522
9991 15523
9992else 15524else
9993 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; }; }
9994fi 15528fi
9995 15529
9996 { $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
9997$as_echo_n "checking if libedit version is compatible... " >&6; } 15531echo $ECHO_N "checking if libedit version is compatible... $ECHO_C" >&6; }
9998 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
9999/* end confdefs.h. */ 15537/* end confdefs.h. */
10000 #include <histedit.h> 15538 #include <histedit.h>
10001int 15539int
@@ -10010,15 +15548,37 @@ main ()
10010 return 0; 15548 return 0;
10011} 15549}
10012_ACEOF 15550_ACEOF
10013if ac_fn_c_try_compile "$LINENO"; then : 15551rm -f conftest.$ac_objext
10014 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 15552if { (ac_try="$ac_compile"
10015$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; }
10016else 15570else
10017 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 15571 echo "$as_me: failed program was:" >&5
10018$as_echo "no" >&6; } 15572sed 's/^/| /' conftest.$ac_ext >&5
10019 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; }; }
10020 15579
10021fi 15580fi
15581
10022rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 15582rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10023 fi 15583 fi
10024 15584
@@ -10028,43 +15588,95 @@ fi
10028AUDIT_MODULE=none 15588AUDIT_MODULE=none
10029 15589
10030# Check whether --with-audit was given. 15590# Check whether --with-audit was given.
10031if test "${with_audit+set}" = set; then : 15591if test "${with_audit+set}" = set; then
10032 withval=$with_audit; 15592 withval=$with_audit;
10033 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for supported audit module" >&5 15593 { echo "$as_me:$LINENO: checking for supported audit module" >&5
10034$as_echo_n "checking for supported audit module... " >&6; } 15594echo $ECHO_N "checking for supported audit module... $ECHO_C" >&6; }
10035 case "$withval" in 15595 case "$withval" in
10036 bsm) 15596 bsm)
10037 { $as_echo "$as_me:${as_lineno-$LINENO}: result: bsm" >&5 15597 { echo "$as_me:$LINENO: result: bsm" >&5
10038$as_echo "bsm" >&6; } 15598echo "${ECHO_T}bsm" >&6; }
10039 AUDIT_MODULE=bsm 15599 AUDIT_MODULE=bsm
10040 for ac_header in bsm/audit.h 15600
10041do : 15601for ac_header in bsm/audit.h
10042 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
10043#ifdef HAVE_TIME_H 15616#ifdef HAVE_TIME_H
10044# include <time.h> 15617# include <time.h>
10045#endif 15618#endif
10046 15619
10047 15620
10048" 15621
10049if 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
10050 cat >>confdefs.h <<_ACEOF 15655 cat >>confdefs.h <<_ACEOF
10051#define HAVE_BSM_AUDIT_H 1 15656#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
10052_ACEOF 15657_ACEOF
10053 15658
10054else 15659else
10055 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; }; }
10056fi 15663fi
10057 15664
10058done 15665done
10059 15666
10060 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaudit in -lbsm" >&5 15667
10061$as_echo_n "checking for getaudit in -lbsm... " >&6; } 15668{ echo "$as_me:$LINENO: checking for getaudit in -lbsm" >&5
10062if ${ac_cv_lib_bsm_getaudit+:} false; then : 15669echo $ECHO_N "checking for getaudit in -lbsm... $ECHO_C" >&6; }
10063 $as_echo_n "(cached) " >&6 15670if test "${ac_cv_lib_bsm_getaudit+set}" = set; then
15671 echo $ECHO_N "(cached) $ECHO_C" >&6
10064else 15672else
10065 ac_check_lib_save_LIBS=$LIBS 15673 ac_check_lib_save_LIBS=$LIBS
10066LIBS="-lbsm $LIBS" 15674LIBS="-lbsm $LIBS"
10067cat 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
10068/* end confdefs.h. */ 15680/* end confdefs.h. */
10069 15681
10070/* Override any GCC internal prototype to avoid an error. 15682/* Override any GCC internal prototype to avoid an error.
@@ -10082,18 +15694,39 @@ return getaudit ();
10082 return 0; 15694 return 0;
10083} 15695}
10084_ACEOF 15696_ACEOF
10085if 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
10086 ac_cv_lib_bsm_getaudit=yes 15715 ac_cv_lib_bsm_getaudit=yes
10087else 15716else
10088 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
10089fi 15721fi
10090rm -f core conftest.err conftest.$ac_objext \ 15722
10091 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
10092LIBS=$ac_check_lib_save_LIBS 15725LIBS=$ac_check_lib_save_LIBS
10093fi 15726fi
10094{ $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
10095$as_echo "$ac_cv_lib_bsm_getaudit" >&6; } 15728echo "${ECHO_T}$ac_cv_lib_bsm_getaudit" >&6; }
10096if test "x$ac_cv_lib_bsm_getaudit" = xyes; then : 15729if test $ac_cv_lib_bsm_getaudit = yes; then
10097 cat >>confdefs.h <<_ACEOF 15730 cat >>confdefs.h <<_ACEOF
10098#define HAVE_LIBBSM 1 15731#define HAVE_LIBBSM 1
10099_ACEOF 15732_ACEOF
@@ -10101,55 +15734,362 @@ _ACEOF
10101 LIBS="-lbsm $LIBS" 15734 LIBS="-lbsm $LIBS"
10102 15735
10103else 15736else
10104 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; }; }
10105fi 15740fi
10106 15741
10107 for ac_func in getaudit 15742
10108do : 15743for ac_func in getaudit
10109 ac_fn_c_check_func "$LINENO" "getaudit" "ac_cv_func_getaudit" 15744do
10110if test "x$ac_cv_func_getaudit" = xyes; then : 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"
15820fi
15821
15822rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
15823 conftest$ac_exeext conftest.$ac_ext
15824fi
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
10111 cat >>confdefs.h <<_ACEOF 15829 cat >>confdefs.h <<_ACEOF
10112#define HAVE_GETAUDIT 1 15830#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10113_ACEOF 15831_ACEOF
10114 15832
10115else 15833else
10116 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; }; }
10117fi 15837fi
10118done 15838done
10119 15839
10120 # These are optional 15840 # These are optional
10121 for ac_func in getaudit_addr aug_get_machine 15841
10122do : 15842
10123 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 15843for ac_func in getaudit_addr aug_get_machine
10124ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 15844do
10125if 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
10126 cat >>confdefs.h <<_ACEOF 15929 cat >>confdefs.h <<_ACEOF
10127#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 15930#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10128_ACEOF 15931_ACEOF
10129 15932
10130fi 15933fi
10131done 15934done
10132 15935
10133 15936
10134$as_echo "#define USE_BSM_AUDIT 1" >>confdefs.h 15937cat >>confdefs.h <<\_ACEOF
15938#define USE_BSM_AUDIT 1
15939_ACEOF
10135 15940
10136 if test "$sol2ver" -ge 11; then 15941 if test "$sol2ver" -ge 11; then
10137 SSHDLIBS="$SSHDLIBS -lscf" 15942 SSHDLIBS="$SSHDLIBS -lscf"
10138 15943
10139$as_echo "#define BROKEN_BSM_API 1" >>confdefs.h 15944cat >>confdefs.h <<\_ACEOF
15945#define BROKEN_BSM_API 1
15946_ACEOF
10140 15947
10141 fi 15948 fi
10142 ;; 15949 ;;
10143 linux) 15950 linux)
10144 { $as_echo "$as_me:${as_lineno-$LINENO}: result: linux" >&5 15951 { echo "$as_me:$LINENO: result: linux" >&5
10145$as_echo "linux" >&6; } 15952echo "${ECHO_T}linux" >&6; }
10146 AUDIT_MODULE=linux 15953 AUDIT_MODULE=linux
10147 for ac_header in libaudit.h 15954
10148do : 15955for ac_header in libaudit.h
10149 ac_fn_c_check_header_mongrel "$LINENO" "libaudit.h" "ac_cv_header_libaudit_h" "$ac_includes_default" 15956do
10150if 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
10151 cat >>confdefs.h <<_ACEOF 16091 cat >>confdefs.h <<_ACEOF
10152#define HAVE_LIBAUDIT_H 1 16092#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
10153_ACEOF 16093_ACEOF
10154 16094
10155fi 16095fi
@@ -10158,23 +16098,29 @@ done
10158 16098
10159 SSHDLIBS="$SSHDLIBS -laudit" 16099 SSHDLIBS="$SSHDLIBS -laudit"
10160 16100
10161$as_echo "#define USE_LINUX_AUDIT 1" >>confdefs.h 16101cat >>confdefs.h <<\_ACEOF
16102#define USE_LINUX_AUDIT 1
16103_ACEOF
10162 16104
10163 ;; 16105 ;;
10164 debug) 16106 debug)
10165 AUDIT_MODULE=debug 16107 AUDIT_MODULE=debug
10166 { $as_echo "$as_me:${as_lineno-$LINENO}: result: debug" >&5 16108 { echo "$as_me:$LINENO: result: debug" >&5
10167$as_echo "debug" >&6; } 16109echo "${ECHO_T}debug" >&6; }
10168 16110
10169$as_echo "#define SSH_AUDIT_EVENTS 1" >>confdefs.h 16111cat >>confdefs.h <<\_ACEOF
16112#define SSH_AUDIT_EVENTS 1
16113_ACEOF
10170 16114
10171 ;; 16115 ;;
10172 no) 16116 no)
10173 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 16117 { echo "$as_me:$LINENO: result: no" >&5
10174$as_echo "no" >&6; } 16118echo "${ECHO_T}no" >&6; }
10175 ;; 16119 ;;
10176 *) 16120 *)
10177 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; }; }
10178 ;; 16124 ;;
10179 esac 16125 esac
10180 16126
@@ -10183,7 +16129,7 @@ fi
10183 16129
10184 16130
10185# Check whether --with-pie was given. 16131# Check whether --with-pie was given.
10186if test "${with_pie+set}" = set; then : 16132if test "${with_pie+set}" = set; then
10187 withval=$with_pie; 16133 withval=$with_pie;
10188 if test "x$withval" = "xno"; then 16134 if test "x$withval" = "xno"; then
10189 use_pie=no 16135 use_pie=no
@@ -10204,9 +16150,13 @@ if test "x$use_toolchain_hardening" != "x1" && test "x$use_pie" = "xauto"; then
10204fi 16150fi
10205if test "x$use_pie" = "xauto"; then 16151if test "x$use_pie" = "xauto"; then
10206 # Automatic PIE requires gcc >= 4.x 16152 # Automatic PIE requires gcc >= 4.x
10207 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc >= 4.x" >&5 16153 { echo "$as_me:$LINENO: checking for gcc >= 4.x" >&5
10208$as_echo_n "checking for gcc >= 4.x... " >&6; } 16154echo $ECHO_N "checking for gcc >= 4.x... $ECHO_C" >&6; }
10209 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
10210/* end confdefs.h. */ 16160/* end confdefs.h. */
10211 16161
10212#if !defined(__GNUC__) || __GNUC__ < 4 16162#if !defined(__GNUC__) || __GNUC__ < 4
@@ -10214,28 +16164,52 @@ $as_echo_n "checking for gcc >= 4.x... " >&6; }
10214#endif 16164#endif
10215 16165
10216_ACEOF 16166_ACEOF
10217if ac_fn_c_try_compile "$LINENO"; then : 16167rm -f conftest.$ac_objext
10218 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 16168if { (ac_try="$ac_compile"
10219$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; }
10220else 16186else
10221 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 16187 echo "$as_me: failed program was:" >&5
10222$as_echo "no" >&6; } 16188sed 's/^/| /' conftest.$ac_ext >&5
16189
16190 { echo "$as_me:$LINENO: result: no" >&5
16191echo "${ECHO_T}no" >&6; }
10223 use_pie=no 16192 use_pie=no
10224 16193
10225fi 16194fi
16195
10226rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 16196rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10227fi 16197fi
10228if test "x$use_pie" != "xno"; then 16198if test "x$use_pie" != "xno"; then
10229 SAVED_CFLAGS="$CFLAGS" 16199 SAVED_CFLAGS="$CFLAGS"
10230 SAVED_LDFLAGS="$LDFLAGS" 16200 SAVED_LDFLAGS="$LDFLAGS"
10231 { 16201 {
10232 { $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
10233$as_echo_n "checking if $CC supports compile flag -fPIE... " >&6; } 16203echo $ECHO_N "checking if $CC supports compile flag -fPIE... $ECHO_C" >&6; }
10234 saved_CFLAGS="$CFLAGS" 16204 saved_CFLAGS="$CFLAGS"
10235 CFLAGS="$CFLAGS $WERROR -fPIE" 16205 CFLAGS="$CFLAGS $WERROR -fPIE"
10236 _define_flag="" 16206 _define_flag=""
10237 test "x$_define_flag" = "x" && _define_flag="-fPIE" 16207 test "x$_define_flag" = "x" && _define_flag="-fPIE"
10238 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
10239/* end confdefs.h. */ 16213/* end confdefs.h. */
10240 16214
10241#include <stdlib.h> 16215#include <stdlib.h>
@@ -10251,34 +16225,58 @@ int main(int argc, char **argv) {
10251} 16225}
10252 16226
10253_ACEOF 16227_ACEOF
10254if 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
10255 16245
10256if `grep -i "unrecognized option" conftest.err >/dev/null` 16246if `grep -i "unrecognized option" conftest.err >/dev/null`
10257then 16247then
10258 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 16248 { echo "$as_me:$LINENO: result: no" >&5
10259$as_echo "no" >&6; } 16249echo "${ECHO_T}no" >&6; }
10260 CFLAGS="$saved_CFLAGS" 16250 CFLAGS="$saved_CFLAGS"
10261else 16251else
10262 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 16252 { echo "$as_me:$LINENO: result: yes" >&5
10263$as_echo "yes" >&6; } 16253echo "${ECHO_T}yes" >&6; }
10264 CFLAGS="$saved_CFLAGS $_define_flag" 16254 CFLAGS="$saved_CFLAGS $_define_flag"
10265fi 16255fi
10266else 16256else
10267 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 16257 echo "$as_me: failed program was:" >&5
10268$as_echo "no" >&6; } 16258sed 's/^/| /' conftest.$ac_ext >&5
16259
16260 { echo "$as_me:$LINENO: result: no" >&5
16261echo "${ECHO_T}no" >&6; }
10269 CFLAGS="$saved_CFLAGS" 16262 CFLAGS="$saved_CFLAGS"
10270 16263
10271fi 16264fi
16265
10272rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 16266rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10273} 16267}
10274 { 16268 {
10275 { $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
10276$as_echo_n "checking if $LD supports link flag -pie... " >&6; } 16270echo $ECHO_N "checking if $LD supports link flag -pie... $ECHO_C" >&6; }
10277 saved_LDFLAGS="$LDFLAGS" 16271 saved_LDFLAGS="$LDFLAGS"
10278 LDFLAGS="$LDFLAGS $WERROR -pie" 16272 LDFLAGS="$LDFLAGS $WERROR -pie"
10279 _define_flag="" 16273 _define_flag=""
10280 test "x$_define_flag" = "x" && _define_flag="-pie" 16274 test "x$_define_flag" = "x" && _define_flag="-pie"
10281 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
10282/* end confdefs.h. */ 16280/* end confdefs.h. */
10283 16281
10284#include <stdlib.h> 16282#include <stdlib.h>
@@ -10294,34 +16292,164 @@ int main(int argc, char **argv) {
10294} 16292}
10295 16293
10296_ACEOF 16294_ACEOF
10297if ac_fn_c_try_link "$LINENO"; then : 16295rm -f conftest.$ac_objext conftest$ac_exeext
10298 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 16296if { (ac_try="$ac_link"
10299$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; }
10300 LDFLAGS="$saved_LDFLAGS $_define_flag" 16315 LDFLAGS="$saved_LDFLAGS $_define_flag"
10301else 16316else
10302 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 16317 echo "$as_me: failed program was:" >&5
10303$as_echo "no" >&6; } 16318sed 's/^/| /' conftest.$ac_ext >&5
16319
16320 { echo "$as_me:$LINENO: result: no" >&5
16321echo "${ECHO_T}no" >&6; }
10304 LDFLAGS="$saved_LDFLAGS" 16322 LDFLAGS="$saved_LDFLAGS"
10305 16323
10306fi 16324fi
10307rm -f core conftest.err conftest.$ac_objext \ 16325
10308 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
10309} 16328}
10310 # We use both -fPIE and -pie or neither. 16329 # We use both -fPIE and -pie or neither.
10311 { $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
10312$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; }
10313 if echo "x $CFLAGS" | grep ' -fPIE' >/dev/null 2>&1 && \ 16332 if echo "x $CFLAGS" | grep ' -fPIE' >/dev/null 2>&1 && \
10314 echo "x $LDFLAGS" | grep ' -pie' >/dev/null 2>&1 ; then 16333 echo "x $LDFLAGS" | grep ' -pie' >/dev/null 2>&1 ; then
10315 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 16334 { echo "$as_me:$LINENO: result: yes" >&5
10316$as_echo "yes" >&6; } 16335echo "${ECHO_T}yes" >&6; }
10317 else 16336 else
10318 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 16337 { echo "$as_me:$LINENO: result: no" >&5
10319$as_echo "no" >&6; } 16338echo "${ECHO_T}no" >&6; }
10320 CFLAGS="$SAVED_CFLAGS" 16339 CFLAGS="$SAVED_CFLAGS"
10321 LDFLAGS="$SAVED_LDFLAGS" 16340 LDFLAGS="$SAVED_LDFLAGS"
10322 fi 16341 fi
10323fi 16342fi
10324 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
10325for ac_func in \ 16453for ac_func in \
10326 Blowfish_initstate \ 16454 Blowfish_initstate \
10327 Blowfish_expandstate \ 16455 Blowfish_expandstate \
@@ -10381,6 +16509,7 @@ for ac_func in \
10381 prctl \ 16509 prctl \
10382 pstat \ 16510 pstat \
10383 readpassphrase \ 16511 readpassphrase \
16512 reallocarray \
10384 realpath \ 16513 realpath \
10385 recvmsg \ 16514 recvmsg \
10386 rresvport_af \ 16515 rresvport_af \
@@ -10432,19 +16561,104 @@ for ac_func in \
10432 vsnprintf \ 16561 vsnprintf \
10433 waitpid \ 16562 waitpid \
10434 16563
10435do : 16564do
10436 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`
10437ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 16566{ echo "$as_me:$LINENO: checking for $ac_func" >&5
10438if 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
10439 cat >>confdefs.h <<_ACEOF 16649 cat >>confdefs.h <<_ACEOF
10440#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 16650#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10441_ACEOF 16651_ACEOF
10442 16652
10443fi 16653fi
10444done 16654done
10445 16655
10446 16656
10447cat 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
10448/* end confdefs.h. */ 16662/* end confdefs.h. */
10449 #include <ctype.h> 16663 #include <ctype.h>
10450int 16664int
@@ -10455,23 +16669,54 @@ main ()
10455 return 0; 16669 return 0;
10456} 16670}
10457_ACEOF 16671_ACEOF
10458if 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
10459 16694
10460$as_echo "#define HAVE_ISBLANK 1" >>confdefs.h 16695
16696else
16697 echo "$as_me: failed program was:" >&5
16698sed 's/^/| /' conftest.$ac_ext >&5
10461 16699
10462 16700
10463fi 16701fi
10464rm -f core conftest.err conftest.$ac_objext \
10465 conftest$ac_exeext conftest.$ac_ext
10466 16702
10467# PKCS#11 support requires dlopen() and co 16703rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
10468{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 16704 conftest$ac_exeext conftest.$ac_ext
10469$as_echo_n "checking for library containing dlopen... " >&6; } 16705
10470if ${ac_cv_search_dlopen+:} false; then : 16706# PKCS11 depends on OpenSSL.
10471 $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
10472else 16713else
10473 ac_func_search_save_LIBS=$LIBS 16714 ac_func_search_save_LIBS=$LIBS
10474cat 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
10475/* end confdefs.h. */ 16720/* end confdefs.h. */
10476 16721
10477/* Override any GCC internal prototype to avoid an error. 16722/* Override any GCC internal prototype to avoid an error.
@@ -10496,47 +16741,162 @@ for ac_lib in '' dl; do
10496 ac_res=-l$ac_lib 16741 ac_res=-l$ac_lib
10497 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 16742 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
10498 fi 16743 fi
10499 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
10500 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
10501fi 16768fi
10502rm -f core conftest.err conftest.$ac_objext \ 16769
10503 conftest$ac_exeext 16770rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
10504 if ${ac_cv_search_dlopen+:} false; then : 16771 conftest$ac_exeext
16772 if test "${ac_cv_search_dlopen+set}" = set; then
10505 break 16773 break
10506fi 16774fi
10507done 16775done
10508if ${ac_cv_search_dlopen+:} false; then : 16776if test "${ac_cv_search_dlopen+set}" = set; then
10509 16777 :
10510else 16778else
10511 ac_cv_search_dlopen=no 16779 ac_cv_search_dlopen=no
10512fi 16780fi
10513rm conftest.$ac_ext 16781rm conftest.$ac_ext
10514LIBS=$ac_func_search_save_LIBS 16782LIBS=$ac_func_search_save_LIBS
10515fi 16783fi
10516{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 16784{ echo "$as_me:$LINENO: result: $ac_cv_search_dlopen" >&5
10517$as_echo "$ac_cv_search_dlopen" >&6; } 16785echo "${ECHO_T}$ac_cv_search_dlopen" >&6; }
10518ac_res=$ac_cv_search_dlopen 16786ac_res=$ac_cv_search_dlopen
10519if test "$ac_res" != no; then : 16787if test "$ac_res" != no; then
10520 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 16788 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
10521 16789
10522$as_echo "#define ENABLE_PKCS11 /**/" >>confdefs.h 16790cat >>confdefs.h <<\_ACEOF
16791#define ENABLE_PKCS11
16792_ACEOF
10523 16793
10524 16794
10525fi 16795fi
10526 16796
16797fi
10527 16798
10528# IRIX has a const char return value for gai_strerror() 16799# IRIX has a const char return value for gai_strerror()
16800
10529for ac_func in gai_strerror 16801for ac_func in gai_strerror
10530do : 16802do
10531 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`
10532if 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
10533 cat >>confdefs.h <<_ACEOF 16887 cat >>confdefs.h <<_ACEOF
10534#define HAVE_GAI_STRERROR 1 16888#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10535_ACEOF 16889_ACEOF
10536 16890
10537 $as_echo "#define HAVE_GAI_STRERROR 1" >>confdefs.h 16891 cat >>confdefs.h <<\_ACEOF
16892#define HAVE_GAI_STRERROR 1
16893_ACEOF
10538 16894
10539 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
10540/* end confdefs.h. */ 16900/* end confdefs.h. */
10541 16901
10542#include <sys/types.h> 16902#include <sys/types.h>
@@ -10556,24 +16916,52 @@ main ()
10556 return 0; 16916 return 0;
10557} 16917}
10558_ACEOF 16918_ACEOF
10559if 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
10560 16936
10561 16937
10562$as_echo "#define HAVE_CONST_GAI_STRERROR_PROTO 1" >>confdefs.h 16938cat >>confdefs.h <<\_ACEOF
16939#define HAVE_CONST_GAI_STRERROR_PROTO 1
16940_ACEOF
16941
16942else
16943 echo "$as_me: failed program was:" >&5
16944sed 's/^/| /' conftest.$ac_ext >&5
16945
10563 16946
10564fi 16947fi
16948
10565rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 16949rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10566fi 16950fi
10567done 16951done
10568 16952
10569 16953
10570{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nanosleep" >&5 16954{ echo "$as_me:$LINENO: checking for library containing nanosleep" >&5
10571$as_echo_n "checking for library containing nanosleep... " >&6; } 16955echo $ECHO_N "checking for library containing nanosleep... $ECHO_C" >&6; }
10572if ${ac_cv_search_nanosleep+:} false; then : 16956if test "${ac_cv_search_nanosleep+set}" = set; then
10573 $as_echo_n "(cached) " >&6 16957 echo $ECHO_N "(cached) $ECHO_C" >&6
10574else 16958else
10575 ac_func_search_save_LIBS=$LIBS 16959 ac_func_search_save_LIBS=$LIBS
10576cat 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
10577/* end confdefs.h. */ 16965/* end confdefs.h. */
10578 16966
10579/* Override any GCC internal prototype to avoid an error. 16967/* Override any GCC internal prototype to avoid an error.
@@ -10598,41 +16986,70 @@ for ac_lib in '' rt posix4; do
10598 ac_res=-l$ac_lib 16986 ac_res=-l$ac_lib
10599 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 16987 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
10600 fi 16988 fi
10601 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
10602 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
10603fi 17013fi
10604rm -f core conftest.err conftest.$ac_objext \ 17014
10605 conftest$ac_exeext 17015rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
10606 if ${ac_cv_search_nanosleep+:} false; then : 17016 conftest$ac_exeext
17017 if test "${ac_cv_search_nanosleep+set}" = set; then
10607 break 17018 break
10608fi 17019fi
10609done 17020done
10610if ${ac_cv_search_nanosleep+:} false; then : 17021if test "${ac_cv_search_nanosleep+set}" = set; then
10611 17022 :
10612else 17023else
10613 ac_cv_search_nanosleep=no 17024 ac_cv_search_nanosleep=no
10614fi 17025fi
10615rm conftest.$ac_ext 17026rm conftest.$ac_ext
10616LIBS=$ac_func_search_save_LIBS 17027LIBS=$ac_func_search_save_LIBS
10617fi 17028fi
10618{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nanosleep" >&5 17029{ echo "$as_me:$LINENO: result: $ac_cv_search_nanosleep" >&5
10619$as_echo "$ac_cv_search_nanosleep" >&6; } 17030echo "${ECHO_T}$ac_cv_search_nanosleep" >&6; }
10620ac_res=$ac_cv_search_nanosleep 17031ac_res=$ac_cv_search_nanosleep
10621if test "$ac_res" != no; then : 17032if test "$ac_res" != no; then
10622 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 17033 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
10623 17034
10624$as_echo "#define HAVE_NANOSLEEP 1" >>confdefs.h 17035cat >>confdefs.h <<\_ACEOF
17036#define HAVE_NANOSLEEP 1
17037_ACEOF
10625 17038
10626fi 17039fi
10627 17040
10628 17041
10629{ $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
10630$as_echo_n "checking for library containing clock_gettime... " >&6; } 17043echo $ECHO_N "checking for library containing clock_gettime... $ECHO_C" >&6; }
10631if ${ac_cv_search_clock_gettime+:} false; then : 17044if test "${ac_cv_search_clock_gettime+set}" = set; then
10632 $as_echo_n "(cached) " >&6 17045 echo $ECHO_N "(cached) $ECHO_C" >&6
10633else 17046else
10634 ac_func_search_save_LIBS=$LIBS 17047 ac_func_search_save_LIBS=$LIBS
10635cat 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
10636/* end confdefs.h. */ 17053/* end confdefs.h. */
10637 17054
10638/* Override any GCC internal prototype to avoid an error. 17055/* Override any GCC internal prototype to avoid an error.
@@ -10657,42 +17074,201 @@ for ac_lib in '' rt; do
10657 ac_res=-l$ac_lib 17074 ac_res=-l$ac_lib
10658 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 17075 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
10659 fi 17076 fi
10660 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
10661 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
10662fi 17101fi
10663rm -f core conftest.err conftest.$ac_objext \ 17102
10664 conftest$ac_exeext 17103rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
10665 if ${ac_cv_search_clock_gettime+:} false; then : 17104 conftest$ac_exeext
17105 if test "${ac_cv_search_clock_gettime+set}" = set; then
10666 break 17106 break
10667fi 17107fi
10668done 17108done
10669if ${ac_cv_search_clock_gettime+:} false; then : 17109if test "${ac_cv_search_clock_gettime+set}" = set; then
10670 17110 :
10671else 17111else
10672 ac_cv_search_clock_gettime=no 17112 ac_cv_search_clock_gettime=no
10673fi 17113fi
10674rm conftest.$ac_ext 17114rm conftest.$ac_ext
10675LIBS=$ac_func_search_save_LIBS 17115LIBS=$ac_func_search_save_LIBS
10676fi 17116fi
10677{ $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
10678$as_echo "$ac_cv_search_clock_gettime" >&6; } 17118echo "${ECHO_T}$ac_cv_search_clock_gettime" >&6; }
10679ac_res=$ac_cv_search_clock_gettime 17119ac_res=$ac_cv_search_clock_gettime
10680if test "$ac_res" != no; then : 17120if test "$ac_res" != no; then
10681 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 17121 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
10682 17122
10683$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h 17123cat >>confdefs.h <<\_ACEOF
17124#define HAVE_CLOCK_GETTIME 1
17125_ACEOF
17126
17127fi
17128
17129
17130{ echo "$as_me:$LINENO: checking whether getrusage is declared" >&5
17131echo $ECHO_N "checking whether getrusage is declared... $ECHO_C" >&6; }
17132if test "${ac_cv_have_decl_getrusage+set}" = set; then
17133 echo $ECHO_N "(cached) $ECHO_C" >&6
17134else
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
10684 17177
17178rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10685fi 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
10686 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
10687 17228
10688ac_fn_c_check_decl "$LINENO" "getrusage" "ac_cv_have_decl_getrusage" "$ac_includes_default" 17229int
10689if test "x$ac_cv_have_decl_getrusage" = xyes; then : 17230main ()
10690 for ac_func in getrusage 17231{
10691do : 17232return $ac_func ();
10692 ac_fn_c_check_func "$LINENO" "getrusage" "ac_cv_func_getrusage" 17233 ;
10693if test "x$ac_cv_func_getrusage" = xyes; then : 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
10694 cat >>confdefs.h <<_ACEOF 17270 cat >>confdefs.h <<_ACEOF
10695#define HAVE_GETRUSAGE 1 17271#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10696_ACEOF 17272_ACEOF
10697 17273
10698fi 17274fi
@@ -10700,19 +17276,153 @@ done
10700 17276
10701fi 17277fi
10702 17278
10703ac_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
10704#ifdef HAVE_STRING_H 17291#ifdef HAVE_STRING_H
10705# include <string.h> 17292# include <string.h>
10706#endif 17293#endif
10707 17294
10708" 17295
10709if test "x$ac_cv_have_decl_strsep" = xyes; then : 17296int
10710 for ac_func in strsep 17297main ()
10711do : 17298{
10712 ac_fn_c_check_func "$LINENO" "strsep" "ac_cv_func_strsep" 17299#ifndef strsep
10713if 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
10714 cat >>confdefs.h <<_ACEOF 17424 cat >>confdefs.h <<_ACEOF
10715#define HAVE_STRSEP 1 17425#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10716_ACEOF 17426_ACEOF
10717 17427
10718fi 17428fi
@@ -10721,57 +17431,318 @@ done
10721fi 17431fi
10722 17432
10723 17433
10724ac_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>
10725 17446
10726"
10727if test "x$ac_cv_have_decl_tcsendbreak" = xyes; then :
10728 $as_echo "#define HAVE_TCSENDBREAK 1" >>confdefs.h
10729 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
10730else 17477else
10731 for ac_func in tcsendbreak 17478 echo "$as_me: failed program was:" >&5
10732do : 17479sed 's/^/| /' conftest.$ac_ext >&5
10733 ac_fn_c_check_func "$LINENO" "tcsendbreak" "ac_cv_func_tcsendbreak" 17480
10734if test "x$ac_cv_func_tcsendbreak" = xyes; then : 17481 ac_cv_have_decl_tcsendbreak=no
10735 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
10736#define HAVE_TCSENDBREAK 1 17490#define HAVE_TCSENDBREAK 1
10737_ACEOF 17491_ACEOF
10738 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
10739fi 17585fi
10740done 17586done
10741 17587
10742fi 17588fi
10743 17589
10744 17590
10745ac_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
10746" 17592echo $ECHO_N "checking whether h_errno is declared... $ECHO_C" >&6; }
10747if test "x$ac_cv_have_decl_h_errno" = xyes; then : 17593if test "${ac_cv_have_decl_h_errno+set}" = set; then
10748 ac_have_decl=1 17594 echo $ECHO_N "(cached) $ECHO_C" >&6
10749else 17595else
10750 ac_have_decl=0 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
17633else
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
10751fi 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
10752 17645
10753cat >>confdefs.h <<_ACEOF 17646cat >>confdefs.h <<_ACEOF
10754#define HAVE_DECL_H_ERRNO $ac_have_decl 17647#define HAVE_DECL_H_ERRNO 1
10755_ACEOF 17648_ACEOF
10756 17649
10757 17650
10758ac_fn_c_check_decl "$LINENO" "SHUT_RD" "ac_cv_have_decl_SHUT_RD" " 17651else
17652 cat >>confdefs.h <<_ACEOF
17653#define HAVE_DECL_H_ERRNO 0
17654_ACEOF
17655
17656
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
10759#include <sys/types.h> 17673#include <sys/types.h>
10760#include <sys/socket.h> 17674#include <sys/socket.h>
10761 17675
10762" 17676
10763if test "x$ac_cv_have_decl_SHUT_RD" = xyes; then : 17677int
10764 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
10765else 17706else
10766 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
10767fi 17711fi
10768 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
10769cat >>confdefs.h <<_ACEOF 17719cat >>confdefs.h <<_ACEOF
10770#define HAVE_DECL_SHUT_RD $ac_have_decl 17720#define HAVE_DECL_SHUT_RD 1
10771_ACEOF 17721_ACEOF
10772 17722
10773 17723
10774ac_fn_c_check_decl "$LINENO" "O_NONBLOCK" "ac_cv_have_decl_O_NONBLOCK" " 17724else
17725 cat >>confdefs.h <<_ACEOF
17726#define HAVE_DECL_SHUT_RD 0
17727_ACEOF
17728
17729
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
10775#include <sys/types.h> 17746#include <sys/types.h>
10776#ifdef HAVE_SYS_STAT_H 17747#ifdef HAVE_SYS_STAT_H
10777# include <sys/stat.h> 17748# include <sys/stat.h>
@@ -10780,67 +17751,295 @@ ac_fn_c_check_decl "$LINENO" "O_NONBLOCK" "ac_cv_have_decl_O_NONBLOCK" "
10780# include <fcntl.h> 17751# include <fcntl.h>
10781#endif 17752#endif
10782 17753
10783" 17754
10784if test "x$ac_cv_have_decl_O_NONBLOCK" = xyes; then : 17755int
10785 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
10786else 17784else
10787 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
17789fi
17790
17791rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10788fi 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
10789 17796
10790cat >>confdefs.h <<_ACEOF 17797cat >>confdefs.h <<_ACEOF
10791#define HAVE_DECL_O_NONBLOCK $ac_have_decl 17798#define HAVE_DECL_O_NONBLOCK 1
17799_ACEOF
17800
17801
17802else
17803 cat >>confdefs.h <<_ACEOF
17804#define HAVE_DECL_O_NONBLOCK 0
10792_ACEOF 17805_ACEOF
10793 17806
10794 17807
10795ac_fn_c_check_decl "$LINENO" "writev" "ac_cv_have_decl_writev" " 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
10796#include <sys/types.h> 17824#include <sys/types.h>
10797#include <sys/uio.h> 17825#include <sys/uio.h>
10798#include <unistd.h> 17826#include <unistd.h>
10799 17827
10800" 17828
10801if test "x$ac_cv_have_decl_writev" = xyes; then : 17829int
10802 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
10803else 17858else
10804 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
10805fi 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
10806 17870
10807cat >>confdefs.h <<_ACEOF 17871cat >>confdefs.h <<_ACEOF
10808#define HAVE_DECL_WRITEV $ac_have_decl 17872#define HAVE_DECL_WRITEV 1
10809_ACEOF 17873_ACEOF
10810 17874
10811 17875
10812ac_fn_c_check_decl "$LINENO" "MAXSYMLINKS" "ac_cv_have_decl_MAXSYMLINKS" " 17876else
17877 cat >>confdefs.h <<_ACEOF
17878#define HAVE_DECL_WRITEV 0
17879_ACEOF
17880
17881
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
10813#include <sys/param.h> 17898#include <sys/param.h>
10814 17899
10815" 17900
10816if test "x$ac_cv_have_decl_MAXSYMLINKS" = xyes; then : 17901int
10817 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
10818else 17930else
10819 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
10820fi 17935fi
10821 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
10822cat >>confdefs.h <<_ACEOF 17943cat >>confdefs.h <<_ACEOF
10823#define HAVE_DECL_MAXSYMLINKS $ac_have_decl 17944#define HAVE_DECL_MAXSYMLINKS 1
10824_ACEOF 17945_ACEOF
10825 17946
10826 17947
10827ac_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
10828#include <stddef.h> 17970#include <stddef.h>
10829 17971
10830" 17972
10831if test "x$ac_cv_have_decl_offsetof" = xyes; then : 17973int
10832 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
10833else 18002else
10834 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
18007fi
18008
18009rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10835fi 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
10836 18014
10837cat >>confdefs.h <<_ACEOF 18015cat >>confdefs.h <<_ACEOF
10838#define HAVE_DECL_OFFSETOF $ac_have_decl 18016#define HAVE_DECL_OFFSETOF 1
10839_ACEOF 18017_ACEOF
10840 18018
10841 18019
18020else
18021 cat >>confdefs.h <<_ACEOF
18022#define HAVE_DECL_OFFSETOF 0
18023_ACEOF
18024
18025
18026fi
18027
18028
18029
10842# extra bits for select(2) 18030# extra bits for select(2)
10843ac_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
10844#include <sys/param.h> 18043#include <sys/param.h>
10845#include <sys/types.h> 18044#include <sys/types.h>
10846#ifdef HAVE_SYS_SYSMACROS_H 18045#ifdef HAVE_SYS_SYSMACROS_H
@@ -10856,17 +18055,73 @@ ac_fn_c_check_decl "$LINENO" "howmany" "ac_cv_have_decl_howmany" "
10856#include <unistd.h> 18055#include <unistd.h>
10857#endif 18056#endif
10858 18057
10859" 18058
10860if test "x$ac_cv_have_decl_howmany" = xyes; then : 18059int
10861 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
10862else 18088else
10863 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
18093fi
18094
18095rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
10864fi 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
10865 18100
10866cat >>confdefs.h <<_ACEOF 18101cat >>confdefs.h <<_ACEOF
10867#define HAVE_DECL_HOWMANY $ac_have_decl 18102#define HAVE_DECL_HOWMANY 1
10868_ACEOF 18103_ACEOF
10869ac_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
10870#include <sys/param.h> 18125#include <sys/param.h>
10871#include <sys/types.h> 18126#include <sys/types.h>
10872#ifdef HAVE_SYS_SYSMACROS_H 18127#ifdef HAVE_SYS_SYSMACROS_H
@@ -10882,18 +18137,75 @@ ac_fn_c_check_decl "$LINENO" "NFDBITS" "ac_cv_have_decl_NFDBITS" "
10882#include <unistd.h> 18137#include <unistd.h>
10883#endif 18138#endif
10884 18139
10885" 18140
10886if test "x$ac_cv_have_decl_NFDBITS" = xyes; then : 18141int
10887 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
10888else 18170else
10889 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
10890fi 18175fi
10891 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
10892cat >>confdefs.h <<_ACEOF 18183cat >>confdefs.h <<_ACEOF
10893#define HAVE_DECL_NFDBITS $ac_have_decl 18184#define HAVE_DECL_NFDBITS 1
10894_ACEOF 18185_ACEOF
10895 18186
10896ac_fn_c_check_type "$LINENO" "fd_mask" "ac_cv_type_fd_mask" " 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. */
18204_ACEOF
18205cat confdefs.h >>conftest.$ac_ext
18206cat >>conftest.$ac_ext <<_ACEOF
18207/* end confdefs.h. */
18208
10897#include <sys/param.h> 18209#include <sys/param.h>
10898#include <sys/types.h> 18210#include <sys/types.h>
10899#ifdef HAVE_SYS_SELECT_H 18211#ifdef HAVE_SYS_SELECT_H
@@ -10906,8 +18218,49 @@ ac_fn_c_check_type "$LINENO" "fd_mask" "ac_cv_type_fd_mask" "
10906#include <unistd.h> 18218#include <unistd.h>
10907#endif 18219#endif
10908 18220
10909" 18221
10910if 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
10911 18264
10912cat >>confdefs.h <<_ACEOF 18265cat >>confdefs.h <<_ACEOF
10913#define HAVE_FD_MASK 1 18266#define HAVE_FD_MASK 1
@@ -10917,22 +18270,109 @@ _ACEOF
10917fi 18270fi
10918 18271
10919 18272
18273
10920for ac_func in setresuid 18274for ac_func in setresuid
10921do : 18275do
10922 ac_fn_c_check_func "$LINENO" "setresuid" "ac_cv_func_setresuid" 18276as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
10923if 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
10924 cat >>confdefs.h <<_ACEOF 18360 cat >>confdefs.h <<_ACEOF
10925#define HAVE_SETRESUID 1 18361#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10926_ACEOF 18362_ACEOF
10927 18363
10928 { $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
10929$as_echo_n "checking if setresuid seems to work... " >&6; } 18365echo $ECHO_N "checking if setresuid seems to work... $ECHO_C" >&6; }
10930 if test "$cross_compiling" = yes; then : 18366 if test "$cross_compiling" = yes; then
10931 { $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
10932$as_echo "$as_me: WARNING: cross compiling: not checking setresuid" >&2;} 18368echo "$as_me: WARNING: cross compiling: not checking setresuid" >&2;}
10933 18369
10934else 18370else
10935 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
10936/* end confdefs.h. */ 18376/* end confdefs.h. */
10937 18377
10938#include <stdlib.h> 18378#include <stdlib.h>
@@ -10953,41 +18393,154 @@ main ()
10953 return 0; 18393 return 0;
10954} 18394}
10955_ACEOF 18395_ACEOF
10956if ac_fn_c_try_run "$LINENO"; then : 18396rm -f conftest$ac_exeext
10957 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 18397if { (ac_try="$ac_link"
10958$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; }
10959else 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
10960 18422
10961$as_echo "#define BROKEN_SETRESUID 1" >>confdefs.h 18423( exit $ac_status )
10962 18424
10963 { $as_echo "$as_me:${as_lineno-$LINENO}: result: not implemented" >&5 18425cat >>confdefs.h <<\_ACEOF
10964$as_echo "not implemented" >&6; } 18426#define BROKEN_SETRESUID 1
18427_ACEOF
18428
18429 { echo "$as_me:$LINENO: result: not implemented" >&5
18430echo "${ECHO_T}not implemented" >&6; }
10965fi 18431fi
10966rm -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
10967 conftest.$ac_objext conftest.beam conftest.$ac_ext
10968fi 18433fi
10969 18434
10970 18435
18436
10971fi 18437fi
10972done 18438done
10973 18439
10974 18440
18441
10975for ac_func in setresgid 18442for ac_func in setresgid
10976do : 18443do
10977 ac_fn_c_check_func "$LINENO" "setresgid" "ac_cv_func_setresgid" 18444as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
10978if 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
10979 cat >>confdefs.h <<_ACEOF 18528 cat >>confdefs.h <<_ACEOF
10980#define HAVE_SETRESGID 1 18529#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
10981_ACEOF 18530_ACEOF
10982 18531
10983 { $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
10984$as_echo_n "checking if setresgid seems to work... " >&6; } 18533echo $ECHO_N "checking if setresgid seems to work... $ECHO_C" >&6; }
10985 if test "$cross_compiling" = yes; then : 18534 if test "$cross_compiling" = yes; then
10986 { $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
10987$as_echo "$as_me: WARNING: cross compiling: not checking setresuid" >&2;} 18536echo "$as_me: WARNING: cross compiling: not checking setresuid" >&2;}
10988 18537
10989else 18538else
10990 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
10991/* end confdefs.h. */ 18544/* end confdefs.h. */
10992 18545
10993#include <stdlib.h> 18546#include <stdlib.h>
@@ -11008,110 +18561,729 @@ main ()
11008 return 0; 18561 return 0;
11009} 18562}
11010_ACEOF 18563_ACEOF
11011if ac_fn_c_try_run "$LINENO"; then : 18564rm -f conftest$ac_exeext
11012 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 18565if { (ac_try="$ac_link"
11013$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; }
11014else 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
11015 18590
11016$as_echo "#define BROKEN_SETRESGID 1" >>confdefs.h 18591( exit $ac_status )
11017 18592
11018 { $as_echo "$as_me:${as_lineno-$LINENO}: result: not implemented" >&5 18593cat >>confdefs.h <<\_ACEOF
11019$as_echo "not implemented" >&6; } 18594#define BROKEN_SETRESGID 1
18595_ACEOF
18596
18597 { echo "$as_me:$LINENO: result: not implemented" >&5
18598echo "${ECHO_T}not implemented" >&6; }
11020fi 18599fi
11021rm -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
11022 conftest.$ac_objext conftest.beam conftest.$ac_ext
11023fi 18601fi
11024 18602
11025 18603
18604
11026fi 18605fi
11027done 18606done
11028 18607
11029 18608
18609
18610
11030for ac_func in gettimeofday time 18611for ac_func in gettimeofday time
11031do : 18612do
11032 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`
11033ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 18614{ echo "$as_me:$LINENO: checking for $ac_func" >&5
11034if 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
11035 cat >>confdefs.h <<_ACEOF 18697 cat >>confdefs.h <<_ACEOF
11036#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 18698#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
11037_ACEOF 18699_ACEOF
11038 18700
11039fi 18701fi
11040done 18702done
11041 18703
18704
18705
18706
18707
18708
18709
11042for ac_func in endutent getutent getutid getutline pututline setutent 18710for ac_func in endutent getutent getutid getutline pututline setutent
11043do : 18711do
11044 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`
11045ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 18713{ echo "$as_me:$LINENO: checking for $ac_func" >&5
11046if 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
11047 cat >>confdefs.h <<_ACEOF 18796 cat >>confdefs.h <<_ACEOF
11048#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 18797#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
11049_ACEOF 18798_ACEOF
11050 18799
11051fi 18800fi
11052done 18801done
11053 18802
18803
11054for ac_func in utmpname 18804for ac_func in utmpname
11055do : 18805do
11056 ac_fn_c_check_func "$LINENO" "utmpname" "ac_cv_func_utmpname" 18806as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
11057if 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
11058 cat >>confdefs.h <<_ACEOF 18890 cat >>confdefs.h <<_ACEOF
11059#define HAVE_UTMPNAME 1 18891#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
11060_ACEOF 18892_ACEOF
11061 18893
11062fi 18894fi
11063done 18895done
11064 18896
18897
18898
18899
18900
18901
18902
11065for ac_func in endutxent getutxent getutxid getutxline getutxuser pututxline 18903for ac_func in endutxent getutxent getutxid getutxline getutxuser pututxline
11066do : 18904do
11067 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`
11068ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 18906{ echo "$as_me:$LINENO: checking for $ac_func" >&5
11069if 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
11070 cat >>confdefs.h <<_ACEOF 18989 cat >>confdefs.h <<_ACEOF
11071#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 18990#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
11072_ACEOF 18991_ACEOF
11073 18992
11074fi 18993fi
11075done 18994done
11076 18995
18996
18997
18998
11077for ac_func in setutxdb setutxent utmpxname 18999for ac_func in setutxdb setutxent utmpxname
11078do : 19000do
11079 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`
11080ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 19002{ echo "$as_me:$LINENO: checking for $ac_func" >&5
11081if 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
11082 cat >>confdefs.h <<_ACEOF 19085 cat >>confdefs.h <<_ACEOF
11083#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 19086#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
11084_ACEOF 19087_ACEOF
11085 19088
11086fi 19089fi
11087done 19090done
11088 19091
19092
11089for ac_func in getlastlogxbyname 19093for ac_func in getlastlogxbyname
11090do : 19094do
11091 ac_fn_c_check_func "$LINENO" "getlastlogxbyname" "ac_cv_func_getlastlogxbyname" 19095as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
11092if 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
11093 cat >>confdefs.h <<_ACEOF 19179 cat >>confdefs.h <<_ACEOF
11094#define HAVE_GETLASTLOGXBYNAME 1 19180#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
11095_ACEOF 19181_ACEOF
11096 19182
11097fi 19183fi
11098done 19184done
11099 19185
11100 19186
11101ac_fn_c_check_func "$LINENO" "daemon" "ac_cv_func_daemon" 19187{ echo "$as_me:$LINENO: checking for daemon" >&5
11102if 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
11103 19262
11104$as_echo "#define HAVE_DAEMON 1" >>confdefs.h 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
19269
19270cat >>confdefs.h <<\_ACEOF
19271#define HAVE_DAEMON 1
19272_ACEOF
11105 19273
11106else 19274else
11107 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for daemon in -lbsd" >&5 19275 { echo "$as_me:$LINENO: checking for daemon in -lbsd" >&5
11108$as_echo_n "checking for daemon in -lbsd... " >&6; } 19276echo $ECHO_N "checking for daemon in -lbsd... $ECHO_C" >&6; }
11109if ${ac_cv_lib_bsd_daemon+:} false; then : 19277if test "${ac_cv_lib_bsd_daemon+set}" = set; then
11110 $as_echo_n "(cached) " >&6 19278 echo $ECHO_N "(cached) $ECHO_C" >&6
11111else 19279else
11112 ac_check_lib_save_LIBS=$LIBS 19280 ac_check_lib_save_LIBS=$LIBS
11113LIBS="-lbsd $LIBS" 19281LIBS="-lbsd $LIBS"
11114cat 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
11115/* end confdefs.h. */ 19287/* end confdefs.h. */
11116 19288
11117/* Override any GCC internal prototype to avoid an error. 19289/* Override any GCC internal prototype to avoid an error.
@@ -11129,19 +19301,42 @@ return daemon ();
11129 return 0; 19301 return 0;
11130} 19302}
11131_ACEOF 19303_ACEOF
11132if 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
11133 ac_cv_lib_bsd_daemon=yes 19322 ac_cv_lib_bsd_daemon=yes
11134else 19323else
11135 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
11136fi 19328fi
11137rm -f core conftest.err conftest.$ac_objext \ 19329
11138 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
11139LIBS=$ac_check_lib_save_LIBS 19332LIBS=$ac_check_lib_save_LIBS
11140fi 19333fi
11141{ $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
11142$as_echo "$ac_cv_lib_bsd_daemon" >&6; } 19335echo "${ECHO_T}$ac_cv_lib_bsd_daemon" >&6; }
11143if test "x$ac_cv_lib_bsd_daemon" = xyes; then : 19336if test $ac_cv_lib_bsd_daemon = yes; then
11144 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
11145 19340
11146fi 19341fi
11147 19342
@@ -11149,20 +19344,106 @@ fi
11149fi 19344fi
11150 19345
11151 19346
11152ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" 19347{ echo "$as_me:$LINENO: checking for getpagesize" >&5
11153if 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
11154 19374
11155$as_echo "#define HAVE_GETPAGESIZE 1" >>confdefs.h 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
11156 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
11157else 19416else
11158 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpagesize in -lucb" >&5 19417 echo "$as_me: failed program was:" >&5
11159$as_echo_n "checking for getpagesize in -lucb... " >&6; } 19418sed 's/^/| /' conftest.$ac_ext >&5
11160if ${ac_cv_lib_ucb_getpagesize+:} false; then : 19419
11161 $as_echo_n "(cached) " >&6 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
19429
19430cat >>confdefs.h <<\_ACEOF
19431#define HAVE_GETPAGESIZE 1
19432_ACEOF
19433
19434else
19435 { echo "$as_me:$LINENO: checking for getpagesize in -lucb" >&5
19436echo $ECHO_N "checking for getpagesize in -lucb... $ECHO_C" >&6; }
19437if test "${ac_cv_lib_ucb_getpagesize+set}" = set; then
19438 echo $ECHO_N "(cached) $ECHO_C" >&6
11162else 19439else
11163 ac_check_lib_save_LIBS=$LIBS 19440 ac_check_lib_save_LIBS=$LIBS
11164LIBS="-lucb $LIBS" 19441LIBS="-lucb $LIBS"
11165cat 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
11166/* end confdefs.h. */ 19447/* end confdefs.h. */
11167 19448
11168/* Override any GCC internal prototype to avoid an error. 19449/* Override any GCC internal prototype to avoid an error.
@@ -11180,19 +19461,42 @@ return getpagesize ();
11180 return 0; 19461 return 0;
11181} 19462}
11182_ACEOF 19463_ACEOF
11183if 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
11184 ac_cv_lib_ucb_getpagesize=yes 19482 ac_cv_lib_ucb_getpagesize=yes
11185else 19483else
11186 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
11187fi 19488fi
11188rm -f core conftest.err conftest.$ac_objext \ 19489
11189 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
11190LIBS=$ac_check_lib_save_LIBS 19492LIBS=$ac_check_lib_save_LIBS
11191fi 19493fi
11192{ $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
11193$as_echo "$ac_cv_lib_ucb_getpagesize" >&6; } 19495echo "${ECHO_T}$ac_cv_lib_ucb_getpagesize" >&6; }
11194if test "x$ac_cv_lib_ucb_getpagesize" = xyes; then : 19496if test $ac_cv_lib_ucb_getpagesize = yes; then
11195 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
11196 19500
11197fi 19501fi
11198 19502
@@ -11202,14 +19506,18 @@ fi
11202 19506
11203# Check for broken snprintf 19507# Check for broken snprintf
11204if test "x$ac_cv_func_snprintf" = "xyes" ; then 19508if test "x$ac_cv_func_snprintf" = "xyes" ; then
11205 { $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
11206$as_echo_n "checking whether snprintf correctly terminates long strings... " >&6; } 19510echo $ECHO_N "checking whether snprintf correctly terminates long strings... $ECHO_C" >&6; }
11207 if test "$cross_compiling" = yes; then : 19511 if test "$cross_compiling" = yes; then
11208 { $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
11209$as_echo "$as_me: WARNING: cross compiling: Assuming working snprintf()" >&2;} 19513echo "$as_me: WARNING: cross compiling: Assuming working snprintf()" >&2;}
11210 19514
11211else 19515else
11212 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
11213/* end confdefs.h. */ 19521/* end confdefs.h. */
11214 #include <stdio.h> 19522 #include <stdio.h>
11215int 19523int
@@ -11224,37 +19532,67 @@ main ()
11224 return 0; 19532 return 0;
11225} 19533}
11226_ACEOF 19534_ACEOF
11227if ac_fn_c_try_run "$LINENO"; then : 19535rm -f conftest$ac_exeext
11228 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 19536if { (ac_try="$ac_link"
11229$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; }
11230else 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
11231 19561
11232 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 19562( exit $ac_status )
11233$as_echo "no" >&6; }
11234 19563
11235$as_echo "#define BROKEN_SNPRINTF 1" >>confdefs.h 19564 { echo "$as_me:$LINENO: result: no" >&5
19565echo "${ECHO_T}no" >&6; }
11236 19566
11237 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ****** Your snprintf() function is broken, complain to your vendor" >&5 19567cat >>confdefs.h <<\_ACEOF
11238$as_echo "$as_me: WARNING: ****** Your snprintf() function is broken, complain to your vendor" >&2;} 19568#define BROKEN_SNPRINTF 1
19569_ACEOF
19570
19571 { echo "$as_me:$LINENO: WARNING: ****** Your snprintf() function is broken, complain to your vendor" >&5
19572echo "$as_me: WARNING: ****** Your snprintf() function is broken, complain to your vendor" >&2;}
11239 19573
11240fi 19574fi
11241rm -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
11242 conftest.$ac_objext conftest.beam conftest.$ac_ext
11243fi 19576fi
11244 19577
19578
11245fi 19579fi
11246 19580
11247# We depend on vsnprintf returning the right thing on overflow: the 19581# We depend on vsnprintf returning the right thing on overflow: the
11248# number of characters it tried to create (as per SUSv3) 19582# number of characters it tried to create (as per SUSv3)
11249if test "x$ac_cv_func_vsnprintf" = "xyes" ; then 19583if test "x$ac_cv_func_vsnprintf" = "xyes" ; then
11250 { $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
11251$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; }
11252 if test "$cross_compiling" = yes; then : 19586 if test "$cross_compiling" = yes; then
11253 { $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
11254$as_echo "$as_me: WARNING: cross compiling: Assuming working vsnprintf()" >&2;} 19588echo "$as_me: WARNING: cross compiling: Assuming working vsnprintf()" >&2;}
11255 19589
11256else 19590else
11257 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
11258/* end confdefs.h. */ 19596/* end confdefs.h. */
11259 19597
11260#include <sys/types.h> 19598#include <sys/types.h>
@@ -11287,32 +19625,62 @@ return 0;
11287 return 0; 19625 return 0;
11288} 19626}
11289_ACEOF 19627_ACEOF
11290if ac_fn_c_try_run "$LINENO"; then : 19628rm -f conftest$ac_exeext
11291 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 19629if { (ac_try="$ac_link"
11292$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; }
11293else 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
11294 19654
11295 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 19655( exit $ac_status )
11296$as_echo "no" >&6; }
11297 19656
11298$as_echo "#define BROKEN_SNPRINTF 1" >>confdefs.h 19657 { echo "$as_me:$LINENO: result: no" >&5
19658echo "${ECHO_T}no" >&6; }
11299 19659
11300 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ****** Your vsnprintf() function is broken, complain to your vendor" >&5 19660cat >>confdefs.h <<\_ACEOF
11301$as_echo "$as_me: WARNING: ****** Your vsnprintf() function is broken, complain to your vendor" >&2;} 19661#define BROKEN_SNPRINTF 1
19662_ACEOF
19663
19664 { echo "$as_me:$LINENO: WARNING: ****** Your vsnprintf() function is broken, complain to your vendor" >&5
19665echo "$as_me: WARNING: ****** Your vsnprintf() function is broken, complain to your vendor" >&2;}
11302 19666
11303fi 19667fi
11304rm -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
11305 conftest.$ac_objext conftest.beam conftest.$ac_ext
11306fi 19669fi
11307 19670
19671
11308fi 19672fi
11309 19673
11310# 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,
11311# check that the fmt argument is const char * or just char *. 19675# check that the fmt argument is const char * or just char *.
11312# This is only useful for when BROKEN_SNPRINTF 19676# This is only useful for when BROKEN_SNPRINTF
11313{ $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
11314$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; }
11315cat 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
11316/* end confdefs.h. */ 19684/* end confdefs.h. */
11317 19685
11318#include <stdio.h> 19686#include <stdio.h>
@@ -11328,26 +19696,54 @@ main ()
11328 return 0; 19696 return 0;
11329} 19697}
11330_ACEOF 19698_ACEOF
11331if ac_fn_c_try_compile "$LINENO"; then : 19699rm -f conftest.$ac_objext
11332 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 19700if { (ac_try="$ac_compile"
11333$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; }
11334 19718
11335$as_echo "#define SNPRINTF_CONST const" >>confdefs.h 19719cat >>confdefs.h <<\_ACEOF
19720#define SNPRINTF_CONST const
19721_ACEOF
11336 19722
11337else 19723else
11338 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 19724 echo "$as_me: failed program was:" >&5
11339$as_echo "no" >&6; } 19725sed 's/^/| /' conftest.$ac_ext >&5
11340 $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
11341 19732
11342fi 19733fi
19734
11343rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 19735rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
11344 19736
11345# Check for missing getpeereid (or equiv) support 19737# Check for missing getpeereid (or equiv) support
11346NO_PEERCHECK="" 19738NO_PEERCHECK=""
11347if 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
11348 { $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
11349$as_echo_n "checking whether system supports SO_PEERCRED getsockopt... " >&6; } 19741echo $ECHO_N "checking whether system supports SO_PEERCRED getsockopt... $ECHO_C" >&6; }
11350 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
11351/* end confdefs.h. */ 19747/* end confdefs.h. */
11352 19748
11353#include <sys/types.h> 19749#include <sys/types.h>
@@ -11360,35 +19756,63 @@ int i = SO_PEERCRED;
11360 return 0; 19756 return 0;
11361} 19757}
11362_ACEOF 19758_ACEOF
11363if ac_fn_c_try_compile "$LINENO"; then : 19759rm -f conftest.$ac_objext
11364 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 19760if { (ac_try="$ac_compile"
11365$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; }
11366 19778
11367$as_echo "#define HAVE_SO_PEERCRED 1" >>confdefs.h 19779cat >>confdefs.h <<\_ACEOF
19780#define HAVE_SO_PEERCRED 1
19781_ACEOF
11368 19782
11369 19783
11370else 19784else
11371 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 19785 echo "$as_me: failed program was:" >&5
11372$as_echo "no" >&6; } 19786sed 's/^/| /' conftest.$ac_ext >&5
19787
19788 { echo "$as_me:$LINENO: result: no" >&5
19789echo "${ECHO_T}no" >&6; }
11373 NO_PEERCHECK=1 19790 NO_PEERCHECK=1
11374 19791
11375fi 19792fi
19793
11376rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 19794rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
11377fi 19795fi
11378 19796
11379if test "x$ac_cv_func_mkdtemp" = "xyes" ; then 19797if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
11380{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for (overly) strict mkstemp" >&5 19798{ echo "$as_me:$LINENO: checking for (overly) strict mkstemp" >&5
11381$as_echo_n "checking for (overly) strict mkstemp... " >&6; } 19799echo $ECHO_N "checking for (overly) strict mkstemp... $ECHO_C" >&6; }
11382if test "$cross_compiling" = yes; then : 19800if test "$cross_compiling" = yes; then
11383 19801
11384 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 19802 { echo "$as_me:$LINENO: result: yes" >&5
11385$as_echo "yes" >&6; } 19803echo "${ECHO_T}yes" >&6; }
11386 $as_echo "#define HAVE_STRICT_MKSTEMP 1" >>confdefs.h 19804 cat >>confdefs.h <<\_ACEOF
19805#define HAVE_STRICT_MKSTEMP 1
19806_ACEOF
11387 19807
11388 19808
11389 19809
11390else 19810else
11391 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
11392/* end confdefs.h. */ 19816/* end confdefs.h. */
11393 19817
11394#include <stdlib.h> 19818#include <stdlib.h>
@@ -11407,37 +19831,67 @@ main ()
11407 return 0; 19831 return 0;
11408} 19832}
11409_ACEOF 19833_ACEOF
11410if 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
11411 19854
11412 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 19855 { echo "$as_me:$LINENO: result: no" >&5
11413$as_echo "no" >&6; } 19856echo "${ECHO_T}no" >&6; }
11414 19857
11415else 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
11416 19862
11417 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 19863( exit $ac_status )
11418$as_echo "yes" >&6; }
11419 19864
11420$as_echo "#define HAVE_STRICT_MKSTEMP 1" >>confdefs.h 19865 { echo "$as_me:$LINENO: result: yes" >&5
19866echo "${ECHO_T}yes" >&6; }
19867
19868cat >>confdefs.h <<\_ACEOF
19869#define HAVE_STRICT_MKSTEMP 1
19870_ACEOF
11421 19871
11422 19872
11423fi 19873fi
11424rm -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
11425 conftest.$ac_objext conftest.beam conftest.$ac_ext
11426fi 19875fi
11427 19876
19877
11428fi 19878fi
11429 19879
11430if test ! -z "$check_for_openpty_ctty_bug"; then 19880if test ! -z "$check_for_openpty_ctty_bug"; then
11431 { $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
11432$as_echo_n "checking if openpty correctly handles controlling tty... " >&6; } 19882echo $ECHO_N "checking if openpty correctly handles controlling tty... $ECHO_C" >&6; }
11433 if test "$cross_compiling" = yes; then : 19883 if test "$cross_compiling" = yes; then
11434 19884
11435 { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compiling, assuming yes" >&5 19885 { echo "$as_me:$LINENO: result: cross-compiling, assuming yes" >&5
11436$as_echo "cross-compiling, assuming yes" >&6; } 19886echo "${ECHO_T}cross-compiling, assuming yes" >&6; }
11437 19887
11438 19888
11439else 19889else
11440 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
11441/* end confdefs.h. */ 19895/* end confdefs.h. */
11442 19896
11443#include <stdio.h> 19897#include <stdio.h>
@@ -11476,37 +19930,67 @@ main ()
11476 return 0; 19930 return 0;
11477} 19931}
11478_ACEOF 19932_ACEOF
11479if 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
11480 19953
11481 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 19954 { echo "$as_me:$LINENO: result: yes" >&5
11482$as_echo "yes" >&6; } 19955echo "${ECHO_T}yes" >&6; }
11483 19956
11484else 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
11485 19961
11486 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 19962( exit $ac_status )
11487$as_echo "no" >&6; } 19963
11488 $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
11489 19969
11490 19970
11491fi 19971fi
11492rm -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
11493 conftest.$ac_objext conftest.beam conftest.$ac_ext
11494fi 19973fi
11495 19974
19975
11496fi 19976fi
11497 19977
11498if test "x$ac_cv_func_getaddrinfo" = "xyes" && \ 19978if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
11499 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then 19979 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
11500 { $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
11501$as_echo_n "checking if getaddrinfo seems to work... " >&6; } 19981echo $ECHO_N "checking if getaddrinfo seems to work... $ECHO_C" >&6; }
11502 if test "$cross_compiling" = yes; then : 19982 if test "$cross_compiling" = yes; then
11503 19983
11504 { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compiling, assuming yes" >&5 19984 { echo "$as_me:$LINENO: result: cross-compiling, assuming yes" >&5
11505$as_echo "cross-compiling, assuming yes" >&6; } 19985echo "${ECHO_T}cross-compiling, assuming yes" >&6; }
11506 19986
11507 19987
11508else 19988else
11509 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
11510/* end confdefs.h. */ 19994/* end confdefs.h. */
11511 19995
11512#include <stdio.h> 19996#include <stdio.h>
@@ -11567,37 +20051,67 @@ main ()
11567 return 0; 20051 return 0;
11568} 20052}
11569_ACEOF 20053_ACEOF
11570if 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
11571 20074
11572 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 20075 { echo "$as_me:$LINENO: result: yes" >&5
11573$as_echo "yes" >&6; } 20076echo "${ECHO_T}yes" >&6; }
11574 20077
11575else 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
20082
20083( exit $ac_status )
11576 20084
11577 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 20085 { echo "$as_me:$LINENO: result: no" >&5
11578$as_echo "no" >&6; } 20086echo "${ECHO_T}no" >&6; }
11579 $as_echo "#define BROKEN_GETADDRINFO 1" >>confdefs.h 20087 cat >>confdefs.h <<\_ACEOF
20088#define BROKEN_GETADDRINFO 1
20089_ACEOF
11580 20090
11581 20091
11582fi 20092fi
11583rm -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
11584 conftest.$ac_objext conftest.beam conftest.$ac_ext
11585fi 20094fi
11586 20095
20096
11587fi 20097fi
11588 20098
11589if test "x$ac_cv_func_getaddrinfo" = "xyes" && \ 20099if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
11590 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then 20100 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
11591 { $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
11592$as_echo_n "checking if getaddrinfo seems to work... " >&6; } 20102echo $ECHO_N "checking if getaddrinfo seems to work... $ECHO_C" >&6; }
11593 if test "$cross_compiling" = yes; then : 20103 if test "$cross_compiling" = yes; then
11594 20104
11595 { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compiling, assuming no" >&5 20105 { echo "$as_me:$LINENO: result: cross-compiling, assuming no" >&5
11596$as_echo "cross-compiling, assuming no" >&6; } 20106echo "${ECHO_T}cross-compiling, assuming no" >&6; }
11597 20107
11598 20108
11599else 20109else
11600 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
11601/* end confdefs.h. */ 20115/* end confdefs.h. */
11602 20116
11603#include <stdio.h> 20117#include <stdio.h>
@@ -11646,32 +20160,138 @@ main ()
11646 return 0; 20160 return 0;
11647} 20161}
11648_ACEOF 20162_ACEOF
11649if 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
11650 20183
11651 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 20184 { echo "$as_me:$LINENO: result: yes" >&5
11652$as_echo "yes" >&6; } 20185echo "${ECHO_T}yes" >&6; }
11653 20186
11654$as_echo "#define AIX_GETNAMEINFO_HACK 1" >>confdefs.h 20187cat >>confdefs.h <<\_ACEOF
20188#define AIX_GETNAMEINFO_HACK 1
20189_ACEOF
11655 20190
11656 20191
11657else 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
11658 20196
11659 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 20197( exit $ac_status )
11660$as_echo "no" >&6; } 20198
11661 $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
20204
20205
20206fi
20207rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
20208fi
11662 20209
11663 20210
11664fi 20211fi
11665rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 20212
11666 conftest.$ac_objext conftest.beam conftest.$ac_ext 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
11667fi 20263fi
11668 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
11669fi 20285fi
11670 20286
11671if test "x$check_for_conflicting_getspnam" = "x1"; then 20287if test "x$check_for_conflicting_getspnam" = "x1"; then
11672 { $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
11673$as_echo_n "checking for conflicting getspnam in shadow.h... " >&6; } 20289echo $ECHO_N "checking for conflicting getspnam in shadow.h... $ECHO_C" >&6; }
11674 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
11675/* end confdefs.h. */ 20295/* end confdefs.h. */
11676 #include <shadow.h> 20296 #include <shadow.h>
11677int 20297int
@@ -11682,31 +20302,57 @@ main ()
11682 return 0; 20302 return 0;
11683} 20303}
11684_ACEOF 20304_ACEOF
11685if 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
11686 20322
11687 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 20323 { echo "$as_me:$LINENO: result: no" >&5
11688$as_echo "no" >&6; } 20324echo "${ECHO_T}no" >&6; }
11689 20325
11690else 20326else
20327 echo "$as_me: failed program was:" >&5
20328sed 's/^/| /' conftest.$ac_ext >&5
11691 20329
11692 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
11693$as_echo "yes" >&6; }
11694 20330
11695$as_echo "#define GETSPNAM_CONFLICTING_DEFS 1" >>confdefs.h 20331 { echo "$as_me:$LINENO: result: yes" >&5
20332echo "${ECHO_T}yes" >&6; }
20333
20334cat >>confdefs.h <<\_ACEOF
20335#define GETSPNAM_CONFLICTING_DEFS 1
20336_ACEOF
11696 20337
11697 20338
11698 20339
11699fi 20340fi
20341
11700rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 20342rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
11701fi 20343fi
11702 20344
11703{ $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
11704$as_echo_n "checking whether getpgrp requires zero arguments... " >&6; } 20346echo $ECHO_N "checking whether getpgrp requires zero arguments... $ECHO_C" >&6; }
11705if ${ac_cv_func_getpgrp_void+:} false; then : 20347if test "${ac_cv_func_getpgrp_void+set}" = set; then
11706 $as_echo_n "(cached) " >&6 20348 echo $ECHO_N "(cached) $ECHO_C" >&6
11707else 20349else
11708 # Use it with a single arg. 20350 # Use it with a single arg.
11709cat 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
11710/* end confdefs.h. */ 20356/* end confdefs.h. */
11711$ac_includes_default 20357$ac_includes_default
11712int 20358int
@@ -11717,19 +20363,41 @@ getpgrp (0);
11717 return 0; 20363 return 0;
11718} 20364}
11719_ACEOF 20365_ACEOF
11720if 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
11721 ac_cv_func_getpgrp_void=no 20383 ac_cv_func_getpgrp_void=no
11722else 20384else
11723 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
11724fi 20389fi
20390
11725rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 20391rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
11726 20392
11727fi 20393fi
11728{ $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
11729$as_echo "$ac_cv_func_getpgrp_void" >&6; } 20395echo "${ECHO_T}$ac_cv_func_getpgrp_void" >&6; }
11730if test $ac_cv_func_getpgrp_void = yes; then 20396if test $ac_cv_func_getpgrp_void = yes; then
11731 20397
11732$as_echo "#define GETPGRP_VOID 1" >>confdefs.h 20398cat >>confdefs.h <<\_ACEOF
20399#define GETPGRP_VOID 1
20400_ACEOF
11733 20401
11734fi 20402fi
11735 20403
@@ -11739,8 +20407,13 @@ saved_CPPFLAGS="$CPPFLAGS"
11739saved_LDFLAGS="$LDFLAGS" 20407saved_LDFLAGS="$LDFLAGS"
11740 20408
11741# Check whether --with-ssl-dir was given. 20409# Check whether --with-ssl-dir was given.
11742if test "${with_ssl_dir+set}" = set; then : 20410if test "${with_ssl_dir+set}" = set; then
11743 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
11744 if test "x$withval" != "xno" ; then 20417 if test "x$withval" != "xno" ; then
11745 case "$withval" in 20418 case "$withval" in
11746 # Relative paths 20419 # Relative paths
@@ -11775,8 +20448,44 @@ if test "${with_ssl_dir+set}" = set; then :
11775 20448
11776fi 20449fi
11777 20450
11778LIBS="-lcrypto $LIBS" 20451
11779cat 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
11780/* end confdefs.h. */ 20489/* end confdefs.h. */
11781 20490
11782/* Override any GCC internal prototype to avoid an error. 20491/* Override any GCC internal prototype to avoid an error.
@@ -11794,27 +20503,184 @@ return RAND_add ();
11794 return 0; 20503 return 0;
11795} 20504}
11796_ACEOF 20505_ACEOF
11797if 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
11798 20524
11799$as_echo "#define HAVE_OPENSSL 1" >>confdefs.h 20525cat >>confdefs.h <<\_ACEOF
20526#define HAVE_OPENSSL 1
20527_ACEOF
11800 20528
11801else 20529else
20530 echo "$as_me: failed program was:" >&5
20531sed 's/^/| /' conftest.$ac_ext >&5
11802 20532
11803 if test -n "${need_dash_r}"; then
11804 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
11805 else
11806 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
11807 fi
11808 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
11809 ac_fn_c_check_header_mongrel "$LINENO" "openssl/opensslv.h" "ac_cv_header_openssl_opensslv_h" "$ac_includes_default"
11810if test "x$ac_cv_header_openssl_opensslv_h" = xyes; then :
11811 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; }
20548else
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
20584fi
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; }
20589
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 :
11812else 20672else
11813 as_fn_error $? "*** OpenSSL headers missing - please install first or check config.log ***" "$LINENO" 5 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; }; }
11814fi 20676fi
11815 20677
11816 20678
11817 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 20679 cat >conftest.$ac_ext <<_ACEOF
20680/* confdefs.h. */
20681_ACEOF
20682cat confdefs.h >>conftest.$ac_ext
20683cat >>conftest.$ac_ext <<_ACEOF
11818/* end confdefs.h. */ 20684/* end confdefs.h. */
11819 20685
11820/* Override any GCC internal prototype to avoid an error. 20686/* Override any GCC internal prototype to avoid an error.
@@ -11832,227 +20698,331 @@ return RAND_add ();
11832 return 0; 20698 return 0;
11833} 20699}
11834_ACEOF 20700_ACEOF
11835if ac_fn_c_try_link "$LINENO"; then : 20701rm -f conftest.$ac_objext conftest$ac_exeext
11836 $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
11837 20722
11838else 20723else
20724 echo "$as_me: failed program was:" >&5
20725sed 's/^/| /' conftest.$ac_ext >&5
11839 20726
11840 as_fn_error $? "*** Can't find recent OpenSSL libcrypto (see config.log for details) ***" "$LINENO" 5 20727
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; }; }
11841 20731
11842 20732
11843fi 20733fi
11844rm -f core conftest.err conftest.$ac_objext \ 20734
11845 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
11846 20737
11847 20738
11848fi 20739fi
11849rm -f core conftest.err conftest.$ac_objext \
11850 conftest$ac_exeext conftest.$ac_ext
11851 20740
11852# Determine OpenSSL header version 20741rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
11853{ $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL header version" >&5 20742 conftest$ac_exeext conftest.$ac_ext
11854$as_echo_n "checking OpenSSL header version... " >&6; } 20743
11855if test "$cross_compiling" = yes; then : 20744 # Determine OpenSSL header version
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
11856 20748
11857 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: not checking" >&5 20749 { echo "$as_me:$LINENO: WARNING: cross compiling: not checking" >&5
11858$as_echo "$as_me: WARNING: cross compiling: not checking" >&2;} 20750echo "$as_me: WARNING: cross compiling: not checking" >&2;}
11859 20751
11860 20752
11861else 20753else
11862 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
11863/* end confdefs.h. */ 20759/* end confdefs.h. */
11864 20760
11865#include <stdio.h> 20761 #include <stdio.h>
11866#include <string.h> 20762 #include <string.h>
11867#include <openssl/opensslv.h> 20763 #include <openssl/opensslv.h>
11868#define DATA "conftest.sslincver" 20764 #define DATA "conftest.sslincver"
11869 20765
11870int 20766int
11871main () 20767main ()
11872{ 20768{
11873 20769
11874 FILE *fd; 20770 FILE *fd;
11875 int rc; 20771 int rc;
11876 20772
11877 fd = fopen(DATA,"w"); 20773 fd = fopen(DATA,"w");
11878 if(fd == NULL) 20774 if(fd == NULL)
11879 exit(1); 20775 exit(1);
11880 20776
11881 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)
11882 exit(1); 20778 exit(1);
11883 20779
11884 exit(0); 20780 exit(0);
11885 20781
11886 ; 20782 ;
11887 return 0; 20783 return 0;
11888} 20784}
11889_ACEOF 20785_ACEOF
11890if 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
11891 20806
11892 ssl_header_ver=`cat conftest.sslincver` 20807 ssl_header_ver=`cat conftest.sslincver`
11893 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ssl_header_ver" >&5 20808 { echo "$as_me:$LINENO: result: $ssl_header_ver" >&5
11894$as_echo "$ssl_header_ver" >&6; } 20809echo "${ECHO_T}$ssl_header_ver" >&6; }
11895 20810
11896else 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 )
11897 20817
11898 { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 20818 { echo "$as_me:$LINENO: result: not found" >&5
11899$as_echo "not found" >&6; } 20819echo "${ECHO_T}not found" >&6; }
11900 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; }; }
11901 20823
11902fi 20824fi
11903rm -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
11904 conftest.$ac_objext conftest.beam conftest.$ac_ext
11905fi 20826fi
11906 20827
11907 20828
11908# Determine OpenSSL library version
11909{ $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL library version" >&5
11910$as_echo_n "checking OpenSSL library version... " >&6; }
11911if test "$cross_compiling" = yes; then :
11912 20829
11913 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: not checking" >&5 20830 # Determine OpenSSL library version
11914$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;}
11915 20837
11916 20838
11917else 20839else
11918 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
11919/* end confdefs.h. */ 20845/* end confdefs.h. */
11920 20846
11921#include <stdio.h> 20847 #include <stdio.h>
11922#include <string.h> 20848 #include <string.h>
11923#include <openssl/opensslv.h> 20849 #include <openssl/opensslv.h>
11924#include <openssl/crypto.h> 20850 #include <openssl/crypto.h>
11925#define DATA "conftest.ssllibver" 20851 #define DATA "conftest.ssllibver"
11926 20852
11927int 20853int
11928main () 20854main ()
11929{ 20855{
11930 20856
11931 FILE *fd; 20857 FILE *fd;
11932 int rc; 20858 int rc;
11933 20859
11934 fd = fopen(DATA,"w"); 20860 fd = fopen(DATA,"w");
11935 if(fd == NULL) 20861 if(fd == NULL)
11936 exit(1); 20862 exit(1);
11937 20863
11938 if ((rc = fprintf(fd ,"%08x (%s)\n", SSLeay(), 20864 if ((rc = fprintf(fd ,"%08x (%s)\n", SSLeay(),
11939 SSLeay_version(SSLEAY_VERSION))) <0) 20865 SSLeay_version(SSLEAY_VERSION))) <0)
11940 exit(1); 20866 exit(1);
11941 20867
11942 exit(0); 20868 exit(0);
11943 20869
11944 ; 20870 ;
11945 return 0; 20871 return 0;
11946} 20872}
11947_ACEOF 20873_ACEOF
11948if ac_fn_c_try_run "$LINENO"; then : 20874rm -f conftest$ac_exeext
11949 20875if { (ac_try="$ac_link"
11950 ssl_library_ver=`cat conftest.ssllibver` 20876case "(($ac_try" in
11951 # Check version is supported. 20877 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
11952 case "$ssl_library_ver" in 20878 *) ac_try_echo=$ac_try;;
11953 0090[0-7]*|009080[0-5]*) 20879esac
11954 as_fn_error $? "OpenSSL >= 0.9.8f required" "$LINENO" 5 20880eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
11955 ;; 20881 (eval "$ac_link") 2>&5
11956 *) ;; 20882 ac_status=$?
11957 esac 20883 echo "$as_me:$LINENO: \$? = $ac_status" >&5
11958 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ssl_library_ver" >&5 20884 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
11959$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; }
11960 20907
11961else 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
20912
20913( exit $ac_status )
11962 20914
11963 { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 20915 { echo "$as_me:$LINENO: result: not found" >&5
11964$as_echo "not found" >&6; } 20916echo "${ECHO_T}not found" >&6; }
11965 as_fn_error $? "OpenSSL library not found." "$LINENO" 5 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; }; }
11966 20920
11967fi 20921fi
11968rm -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
11969 conftest.$ac_objext conftest.beam conftest.$ac_ext
11970fi 20923fi
11971 20924
11972 20925
11973# XXX make --without-openssl work
11974 20926
11975cat >>confdefs.h <<_ACEOF 20927 # Sanity check OpenSSL headers
11976#define WITH_OPENSSL 1 20928 { echo "$as_me:$LINENO: checking whether OpenSSL's headers match the library" >&5
11977_ACEOF 20929echo $ECHO_N "checking whether OpenSSL's headers match the library... $ECHO_C" >&6; }
20930 if test "$cross_compiling" = yes; then
11978 20931
11979 20932 { echo "$as_me:$LINENO: WARNING: cross compiling: not checking" >&5
11980cat >>confdefs.h <<_ACEOF 20933echo "$as_me: WARNING: cross compiling: not checking" >&2;}
11981#define WITH_SSH1 1
11982_ACEOF
11983
11984
11985
11986# Check whether --with-openssl-header-check was given.
11987if test "${with_openssl_header_check+set}" = set; then :
11988 withval=$with_openssl_header_check; if test "x$withval" = "xno" ; then
11989 openssl_check_nonfatal=1
11990 fi
11991
11992
11993fi
11994
11995
11996# Sanity check OpenSSL headers
11997{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether OpenSSL's headers match the library" >&5
11998$as_echo_n "checking whether OpenSSL's headers match the library... " >&6; }
11999if test "$cross_compiling" = yes; then :
12000
12001 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: not checking" >&5
12002$as_echo "$as_me: WARNING: cross compiling: not checking" >&2;}
12003 20934
12004 20935
12005else 20936else
12006 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
12007/* end confdefs.h. */ 20942/* end confdefs.h. */
12008 20943
12009#include <string.h> 20944 #include <string.h>
12010#include <openssl/opensslv.h> 20945 #include <openssl/opensslv.h>
12011 20946
12012int 20947int
12013main () 20948main ()
12014{ 20949{
12015 20950
12016 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); 20951 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
12017 20952
12018 ; 20953 ;
12019 return 0; 20954 return 0;
12020} 20955}
12021_ACEOF 20956_ACEOF
12022if 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
12023 20977
12024 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 20978 { echo "$as_me:$LINENO: result: yes" >&5
12025$as_echo "yes" >&6; } 20979echo "${ECHO_T}yes" >&6; }
12026 20980
12027else 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
12028 20985
12029 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 20986( exit $ac_status )
12030$as_echo "no" >&6; } 20987
12031 if test "x$openssl_check_nonfatal" = "x"; then 20988 { echo "$as_me:$LINENO: result: no" >&5
12032 as_fn_error $? "Your OpenSSL headers do not match your 20989echo "${ECHO_T}no" >&6; }
12033library. Check config.log for details. 20990 if test "x$openssl_check_nonfatal" = "x"; then
12034If 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
12035by running \"./configure --without-openssl-header-check\". 20992 library. Check config.log for details.
12036Also see contrib/findssl.sh for help identifying header/library mismatches. 20993 If you are sure your installation is consistent, you can disable the check
12037" "$LINENO" 5 20994 by running \"./configure --without-openssl-header-check\".
12038 else 20995 Also see contrib/findssl.sh for help identifying header/library mismatches.
12039 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Your OpenSSL headers do not match your 20996 " >&5
12040library. Check config.log for details. 20997echo "$as_me: error: Your OpenSSL headers do not match your
12041Also see contrib/findssl.sh for help identifying header/library mismatches." >&5 20998 library. Check config.log for details.
12042$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
12043library. Check config.log for details. 21000 by running \"./configure --without-openssl-header-check\".
12044Also see contrib/findssl.sh for help identifying header/library mismatches." >&2;} 21001 Also see contrib/findssl.sh for help identifying header/library mismatches.
12045 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
12046 21012
12047fi 21013fi
12048rm -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
12049 conftest.$ac_objext conftest.beam conftest.$ac_ext
12050fi 21015fi
12051 21016
12052 21017
12053{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if programs using OpenSSL functions will link" >&5 21018
12054$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
12055cat 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
12056/* end confdefs.h. */ 21026/* end confdefs.h. */
12057 #include <openssl/evp.h> 21027 #include <openssl/evp.h>
12058int 21028int
@@ -12063,20 +21033,44 @@ main ()
12063 return 0; 21033 return 0;
12064} 21034}
12065_ACEOF 21035_ACEOF
12066if 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
12067 21054
12068 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 21055 { echo "$as_me:$LINENO: result: yes" >&5
12069$as_echo "yes" >&6; } 21056echo "${ECHO_T}yes" >&6; }
12070 21057
12071else 21058else
21059 echo "$as_me: failed program was:" >&5
21060sed 's/^/| /' conftest.$ac_ext >&5
12072 21061
12073 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 21062
12074$as_echo "no" >&6; } 21063 { echo "$as_me:$LINENO: result: no" >&5
12075 saved_LIBS="$LIBS" 21064echo "${ECHO_T}no" >&6; }
12076 LIBS="$LIBS -ldl" 21065 saved_LIBS="$LIBS"
12077 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if programs using OpenSSL need -ldl" >&5 21066 LIBS="$LIBS -ldl"
12078$as_echo_n "checking if programs using OpenSSL need -ldl... " >&6; } 21067 { echo "$as_me:$LINENO: checking if programs using OpenSSL need -ldl" >&5
12079 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
12080/* end confdefs.h. */ 21074/* end confdefs.h. */
12081 #include <openssl/evp.h> 21075 #include <openssl/evp.h>
12082int 21076int
@@ -12087,218 +21081,438 @@ main ()
12087 return 0; 21081 return 0;
12088} 21082}
12089_ACEOF 21083_ACEOF
12090if 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
12091 21102
12092 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 21103 { echo "$as_me:$LINENO: result: yes" >&5
12093$as_echo "yes" >&6; } 21104echo "${ECHO_T}yes" >&6; }
12094 21105
12095else 21106else
21107 echo "$as_me: failed program was:" >&5
21108sed 's/^/| /' conftest.$ac_ext >&5
21109
12096 21110
12097 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 21111 { echo "$as_me:$LINENO: result: no" >&5
12098$as_echo "no" >&6; } 21112echo "${ECHO_T}no" >&6; }
12099 LIBS="$saved_LIBS" 21113 LIBS="$saved_LIBS"
12100 21114
12101 21115
12102fi 21116fi
12103rm -f core conftest.err conftest.$ac_objext \ 21117
12104 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
12105 21120
12106 21121
12107fi 21122fi
12108rm -f core conftest.err conftest.$ac_objext \ 21123
12109 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
12110 21136
12111for ac_func in \ 21137for ac_func in \
12112 BN_is_prime_ex \ 21138 BN_is_prime_ex \
12113 DSA_generate_parameters_ex \ 21139 DSA_generate_parameters_ex \
12114 EVP_DigestInit_ex \ 21140 EVP_DigestInit_ex \
12115 EVP_DigestFinal_ex \ 21141 EVP_DigestFinal_ex \
12116 EVP_MD_CTX_init \ 21142 EVP_MD_CTX_init \
12117 EVP_MD_CTX_cleanup \ 21143 EVP_MD_CTX_cleanup \
12118 EVP_MD_CTX_copy_ex \ 21144 EVP_MD_CTX_copy_ex \
12119 HMAC_CTX_init \ 21145 HMAC_CTX_init \
12120 RSA_generate_key_ex \ 21146 RSA_generate_key_ex \
12121 RSA_get_default_method \ 21147 RSA_get_default_method \
12122 21148
12123do : 21149do
12124 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`
12125ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 21151{ echo "$as_me:$LINENO: checking for $ac_func" >&5
12126if 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
12127 cat >>confdefs.h <<_ACEOF 21234 cat >>confdefs.h <<_ACEOF
12128#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 21235#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
12129_ACEOF 21236_ACEOF
12130 21237
12131fi 21238fi
12132done 21239done
12133 21240
12134 21241
12135 21242 if test "x$openssl_engine" = "xyes" ; then
12136# Check whether --with-ssl-engine was given. 21243 { echo "$as_me:$LINENO: checking for OpenSSL ENGINE support" >&5
12137if test "${with_ssl_engine+set}" = set; then : 21244echo $ECHO_N "checking for OpenSSL ENGINE support... $ECHO_C" >&6; }
12138 withval=$with_ssl_engine; if test "x$withval" != "xno" ; then 21245 cat >conftest.$ac_ext <<_ACEOF
12139 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL ENGINE support" >&5 21246/* confdefs.h. */
12140$as_echo_n "checking for OpenSSL ENGINE support... " >&6; } 21247_ACEOF
12141 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 21248cat confdefs.h >>conftest.$ac_ext
21249cat >>conftest.$ac_ext <<_ACEOF
12142/* end confdefs.h. */ 21250/* end confdefs.h. */
12143 21251
12144#include <openssl/engine.h> 21252 #include <openssl/engine.h>
12145 21253
12146int 21254int
12147main () 21255main ()
12148{ 21256{
12149 21257
12150 ENGINE_load_builtin_engines(); 21258 ENGINE_load_builtin_engines();
12151 ENGINE_register_all_complete(); 21259 ENGINE_register_all_complete();
12152 21260
12153 ; 21261 ;
12154 return 0; 21262 return 0;
12155} 21263}
12156_ACEOF 21264_ACEOF
12157if ac_fn_c_try_compile "$LINENO"; then : 21265rm -f conftest.$ac_objext
12158 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 21266if { (ac_try="$ac_compile"
12159$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; }
12160 21284
12161$as_echo "#define USE_OPENSSL_ENGINE 1" >>confdefs.h 21285cat >>confdefs.h <<\_ACEOF
21286#define USE_OPENSSL_ENGINE 1
21287_ACEOF
12162 21288
12163 21289
12164else 21290else
12165 as_fn_error $? "OpenSSL ENGINE support not found" "$LINENO" 5 21291 echo "$as_me: failed program was:" >&5
21292sed 's/^/| /' conftest.$ac_ext >&5
12166 21293
12167fi 21294 { { echo "$as_me:$LINENO: error: OpenSSL ENGINE support not found" >&5
12168rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 21295echo "$as_me: error: OpenSSL ENGINE support not found" >&2;}
12169 fi 21296 { (exit 1); exit 1; }; }
12170 21297
12171fi 21298fi
12172 21299
21300rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
21301 fi
12173 21302
12174# Check for OpenSSL without EVP_aes_{192,256}_cbc 21303 # Check for OpenSSL without EVP_aes_{192,256}_cbc
12175{ $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
12176$as_echo_n "checking whether OpenSSL has crippled AES support... " >&6; } 21305echo $ECHO_N "checking whether OpenSSL has crippled AES support... $ECHO_C" >&6; }
12177cat 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
12178/* end confdefs.h. */ 21311/* end confdefs.h. */
12179 21312
12180#include <string.h> 21313 #include <string.h>
12181#include <openssl/evp.h> 21314 #include <openssl/evp.h>
12182 21315
12183int 21316int
12184main () 21317main ()
12185{ 21318{
12186 21319
12187 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL); 21320 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
12188 21321
12189 ; 21322 ;
12190 return 0; 21323 return 0;
12191} 21324}
12192_ACEOF 21325_ACEOF
12193if 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
12194 21344
12195 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 21345 { echo "$as_me:$LINENO: result: no" >&5
12196$as_echo "no" >&6; } 21346echo "${ECHO_T}no" >&6; }
12197 21347
12198else 21348else
21349 echo "$as_me: failed program was:" >&5
21350sed 's/^/| /' conftest.$ac_ext >&5
12199 21351
12200 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
12201$as_echo "yes" >&6; }
12202 21352
12203$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
12204 21359
12205 21360
12206 21361
12207fi 21362fi
12208rm -f core conftest.err conftest.$ac_objext \
12209 conftest$ac_exeext conftest.$ac_ext
12210 21363
12211# Check for OpenSSL with EVP_aes_*ctr 21364rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12212{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether OpenSSL has AES CTR via EVP" >&5 21365 conftest$ac_exeext conftest.$ac_ext
12213$as_echo_n "checking whether OpenSSL has AES CTR via EVP... " >&6; } 21366
12214cat 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
12215/* end confdefs.h. */ 21375/* end confdefs.h. */
12216 21376
12217#include <string.h> 21377 #include <string.h>
12218#include <openssl/evp.h> 21378 #include <openssl/evp.h>
12219 21379
12220int 21380int
12221main () 21381main ()
12222{ 21382{
12223 21383
12224 exit(EVP_aes_128_ctr() == NULL || 21384 exit(EVP_aes_128_ctr() == NULL ||
12225 EVP_aes_192_cbc() == NULL || 21385 EVP_aes_192_cbc() == NULL ||
12226 EVP_aes_256_cbc() == NULL); 21386 EVP_aes_256_cbc() == NULL);
12227 21387
12228 ; 21388 ;
12229 return 0; 21389 return 0;
12230} 21390}
12231_ACEOF 21391_ACEOF
12232if 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
12233 21410
12234 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 21411 { echo "$as_me:$LINENO: result: yes" >&5
12235$as_echo "yes" >&6; } 21412echo "${ECHO_T}yes" >&6; }
12236 21413
12237$as_echo "#define OPENSSL_HAVE_EVPCTR 1" >>confdefs.h 21414cat >>confdefs.h <<\_ACEOF
21415#define OPENSSL_HAVE_EVPCTR 1
21416_ACEOF
12238 21417
12239 21418
12240else 21419else
21420 echo "$as_me: failed program was:" >&5
21421sed 's/^/| /' conftest.$ac_ext >&5
21422
12241 21423
12242 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 21424 { echo "$as_me:$LINENO: result: no" >&5
12243$as_echo "no" >&6; } 21425echo "${ECHO_T}no" >&6; }
12244 21426
12245 21427
12246fi 21428fi
12247rm -f core conftest.err conftest.$ac_objext \
12248 conftest$ac_exeext conftest.$ac_ext
12249 21429
12250# Check for OpenSSL with EVP_aes_*gcm 21430rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12251{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether OpenSSL has AES GCM via EVP" >&5 21431 conftest$ac_exeext conftest.$ac_ext
12252$as_echo_n "checking whether OpenSSL has AES GCM via EVP... " >&6; } 21432
12253cat 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
12254/* end confdefs.h. */ 21441/* end confdefs.h. */
12255 21442
12256#include <string.h> 21443 #include <string.h>
12257#include <openssl/evp.h> 21444 #include <openssl/evp.h>
12258 21445
12259int 21446int
12260main () 21447main ()
12261{ 21448{
12262 21449
12263 exit(EVP_aes_128_gcm() == NULL || 21450 exit(EVP_aes_128_gcm() == NULL ||
12264 EVP_aes_256_gcm() == NULL || 21451 EVP_aes_256_gcm() == NULL ||
12265 EVP_CTRL_GCM_SET_IV_FIXED == 0 || 21452 EVP_CTRL_GCM_SET_IV_FIXED == 0 ||
12266 EVP_CTRL_GCM_IV_GEN == 0 || 21453 EVP_CTRL_GCM_IV_GEN == 0 ||
12267 EVP_CTRL_GCM_SET_TAG == 0 || 21454 EVP_CTRL_GCM_SET_TAG == 0 ||
12268 EVP_CTRL_GCM_GET_TAG == 0 || 21455 EVP_CTRL_GCM_GET_TAG == 0 ||
12269 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0); 21456 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0);
12270 21457
12271 ; 21458 ;
12272 return 0; 21459 return 0;
12273} 21460}
12274_ACEOF 21461_ACEOF
12275if 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
12276 21480
12277 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 21481 { echo "$as_me:$LINENO: result: yes" >&5
12278$as_echo "yes" >&6; } 21482echo "${ECHO_T}yes" >&6; }
12279 21483
12280$as_echo "#define OPENSSL_HAVE_EVPGCM 1" >>confdefs.h 21484cat >>confdefs.h <<\_ACEOF
21485#define OPENSSL_HAVE_EVPGCM 1
21486_ACEOF
12281 21487
12282 21488
12283else 21489else
21490 echo "$as_me: failed program was:" >&5
21491sed 's/^/| /' conftest.$ac_ext >&5
21492
12284 21493
12285 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 21494 { echo "$as_me:$LINENO: result: no" >&5
12286$as_echo "no" >&6; } 21495echo "${ECHO_T}no" >&6; }
12287 unsupported_algorithms="$unsupported_cipers \ 21496 unsupported_algorithms="$unsupported_cipers \
12288 aes128-gcm@openssh.com aes256-gcm@openssh.com" 21497 aes128-gcm@openssh.com aes256-gcm@openssh.com"
12289 21498
12290 21499
12291fi 21500fi
12292rm -f core conftest.err conftest.$ac_objext \
12293 conftest$ac_exeext conftest.$ac_ext
12294 21501
12295{ $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 \
12296$as_echo_n "checking for library containing EVP_CIPHER_CTX_ctrl... " >&6; } 21503 conftest$ac_exeext conftest.$ac_ext
12297if ${ac_cv_search_EVP_CIPHER_CTX_ctrl+:} false; then : 21504
12298 $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
12299else 21509else
12300 ac_func_search_save_LIBS=$LIBS 21510 ac_func_search_save_LIBS=$LIBS
12301cat 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
12302/* end confdefs.h. */ 21516/* end confdefs.h. */
12303 21517
12304/* Override any GCC internal prototype to avoid an error. 21518/* Override any GCC internal prototype to avoid an error.
@@ -12323,82 +21537,139 @@ for ac_lib in '' crypto; do
12323 ac_res=-l$ac_lib 21537 ac_res=-l$ac_lib
12324 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 21538 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
12325 fi 21539 fi
12326 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
12327 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
12328fi 21564fi
12329rm -f core conftest.err conftest.$ac_objext \ 21565
12330 conftest$ac_exeext 21566rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12331 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
12332 break 21569 break
12333fi 21570fi
12334done 21571done
12335if ${ac_cv_search_EVP_CIPHER_CTX_ctrl+:} false; then : 21572if test "${ac_cv_search_EVP_CIPHER_CTX_ctrl+set}" = set; then
12336 21573 :
12337else 21574else
12338 ac_cv_search_EVP_CIPHER_CTX_ctrl=no 21575 ac_cv_search_EVP_CIPHER_CTX_ctrl=no
12339fi 21576fi
12340rm conftest.$ac_ext 21577rm conftest.$ac_ext
12341LIBS=$ac_func_search_save_LIBS 21578LIBS=$ac_func_search_save_LIBS
12342fi 21579fi
12343{ $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
12344$as_echo "$ac_cv_search_EVP_CIPHER_CTX_ctrl" >&6; } 21581echo "${ECHO_T}$ac_cv_search_EVP_CIPHER_CTX_ctrl" >&6; }
12345ac_res=$ac_cv_search_EVP_CIPHER_CTX_ctrl 21582ac_res=$ac_cv_search_EVP_CIPHER_CTX_ctrl
12346if test "$ac_res" != no; then : 21583if test "$ac_res" != no; then
12347 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 21584 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
12348 21585
12349$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
12350 21589
12351fi 21590fi
12352 21591
12353 21592
12354{ $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
12355$as_echo_n "checking if EVP_DigestUpdate returns an int... " >&6; } 21594echo $ECHO_N "checking if EVP_DigestUpdate returns an int... $ECHO_C" >&6; }
12356cat 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
12357/* end confdefs.h. */ 21600/* end confdefs.h. */
12358 21601
12359#include <string.h> 21602 #include <string.h>
12360#include <openssl/evp.h> 21603 #include <openssl/evp.h>
12361 21604
12362int 21605int
12363main () 21606main ()
12364{ 21607{
12365 21608
12366 if(EVP_DigestUpdate(NULL, NULL,0)) 21609 if(EVP_DigestUpdate(NULL, NULL,0))
12367 exit(0); 21610 exit(0);
12368 21611
12369 ; 21612 ;
12370 return 0; 21613 return 0;
12371} 21614}
12372_ACEOF 21615_ACEOF
12373if 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
12374 21634
12375 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 21635 { echo "$as_me:$LINENO: result: yes" >&5
12376$as_echo "yes" >&6; } 21636echo "${ECHO_T}yes" >&6; }
12377 21637
12378else 21638else
21639 echo "$as_me: failed program was:" >&5
21640sed 's/^/| /' conftest.$ac_ext >&5
21641
12379 21642
12380 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 21643 { echo "$as_me:$LINENO: result: no" >&5
12381$as_echo "no" >&6; } 21644echo "${ECHO_T}no" >&6; }
12382 21645
12383$as_echo "#define OPENSSL_EVP_DIGESTUPDATE_VOID 1" >>confdefs.h 21646cat >>confdefs.h <<\_ACEOF
21647#define OPENSSL_EVP_DIGESTUPDATE_VOID 1
21648_ACEOF
12384 21649
12385 21650
12386 21651
12387fi 21652fi
12388rm -f core conftest.err conftest.$ac_objext \
12389 conftest$ac_exeext conftest.$ac_ext
12390 21653
12391# Some systems want crypt() from libcrypt, *not* the version in OpenSSL, 21654rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12392# because the system crypt() is more featureful. 21655 conftest$ac_exeext conftest.$ac_ext
12393if test "x$check_for_libcrypt_before" = "x1"; then 21656
12394 { $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,
12395$as_echo_n "checking for crypt in -lcrypt... " >&6; } 21658 # because the system crypt() is more featureful.
12396if ${ac_cv_lib_crypt_crypt+:} false; then : 21659 if test "x$check_for_libcrypt_before" = "x1"; then
12397 $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
12398else 21665else
12399 ac_check_lib_save_LIBS=$LIBS 21666 ac_check_lib_save_LIBS=$LIBS
12400LIBS="-lcrypt $LIBS" 21667LIBS="-lcrypt $LIBS"
12401cat 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
12402/* end confdefs.h. */ 21673/* end confdefs.h. */
12403 21674
12404/* Override any GCC internal prototype to avoid an error. 21675/* Override any GCC internal prototype to avoid an error.
@@ -12416,18 +21687,39 @@ return crypt ();
12416 return 0; 21687 return 0;
12417} 21688}
12418_ACEOF 21689_ACEOF
12419if 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
12420 ac_cv_lib_crypt_crypt=yes 21708 ac_cv_lib_crypt_crypt=yes
12421else 21709else
12422 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
12423fi 21714fi
12424rm -f core conftest.err conftest.$ac_objext \ 21715
12425 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
12426LIBS=$ac_check_lib_save_LIBS 21718LIBS=$ac_check_lib_save_LIBS
12427fi 21719fi
12428{ $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
12429$as_echo "$ac_cv_lib_crypt_crypt" >&6; } 21721echo "${ECHO_T}$ac_cv_lib_crypt_crypt" >&6; }
12430if test "x$ac_cv_lib_crypt_crypt" = xyes; then : 21722if test $ac_cv_lib_crypt_crypt = yes; then
12431 cat >>confdefs.h <<_ACEOF 21723 cat >>confdefs.h <<_ACEOF
12432#define HAVE_LIBCRYPT 1 21724#define HAVE_LIBCRYPT 1
12433_ACEOF 21725_ACEOF
@@ -12436,19 +21728,23 @@ _ACEOF
12436 21728
12437fi 21729fi
12438 21730
12439fi 21731 fi
12440 21732
12441# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the 21733 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
12442# version in OpenSSL. 21734 # version in OpenSSL.
12443if test "x$check_for_libcrypt_later" = "x1"; then 21735 if test "x$check_for_libcrypt_later" = "x1"; then
12444 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5 21736 { echo "$as_me:$LINENO: checking for crypt in -lcrypt" >&5
12445$as_echo_n "checking for crypt in -lcrypt... " >&6; } 21737echo $ECHO_N "checking for crypt in -lcrypt... $ECHO_C" >&6; }
12446if ${ac_cv_lib_crypt_crypt+:} false; then : 21738if test "${ac_cv_lib_crypt_crypt+set}" = set; then
12447 $as_echo_n "(cached) " >&6 21739 echo $ECHO_N "(cached) $ECHO_C" >&6
12448else 21740else
12449 ac_check_lib_save_LIBS=$LIBS 21741 ac_check_lib_save_LIBS=$LIBS
12450LIBS="-lcrypt $LIBS" 21742LIBS="-lcrypt $LIBS"
12451cat 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
12452/* end confdefs.h. */ 21748/* end confdefs.h. */
12453 21749
12454/* Override any GCC internal prototype to avoid an error. 21750/* Override any GCC internal prototype to avoid an error.
@@ -12466,270 +21762,816 @@ return crypt ();
12466 return 0; 21762 return 0;
12467} 21763}
12468_ACEOF 21764_ACEOF
12469if 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
12470 ac_cv_lib_crypt_crypt=yes 21783 ac_cv_lib_crypt_crypt=yes
12471else 21784else
12472 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
12473fi 21789fi
12474rm -f core conftest.err conftest.$ac_objext \ 21790
12475 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
12476LIBS=$ac_check_lib_save_LIBS 21793LIBS=$ac_check_lib_save_LIBS
12477fi 21794fi
12478{ $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
12479$as_echo "$ac_cv_lib_crypt_crypt" >&6; } 21796echo "${ECHO_T}$ac_cv_lib_crypt_crypt" >&6; }
12480if test "x$ac_cv_lib_crypt_crypt" = xyes; then : 21797if test $ac_cv_lib_crypt_crypt = yes; then
12481 LIBS="$LIBS -lcrypt" 21798 LIBS="$LIBS -lcrypt"
12482fi 21799fi
12483 21800
12484fi 21801 fi
21802
21803
12485for ac_func in crypt DES_crypt 21804for ac_func in crypt DES_crypt
12486do : 21805do
12487 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`
12488ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 21807{ echo "$as_me:$LINENO: checking for $ac_func" >&5
12489if 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
12490 cat >>confdefs.h <<_ACEOF 21890 cat >>confdefs.h <<_ACEOF
12491#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 21891#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
12492_ACEOF 21892_ACEOF
12493 21893
12494fi 21894fi
12495done 21895done
12496 21896
12497 21897
12498# Search for SHA256 support in libc and/or OpenSSL 21898 # Search for SHA256 support in libc and/or OpenSSL
21899
21900
12499for ac_func in SHA256_Update EVP_sha256 21901for ac_func in SHA256_Update EVP_sha256
12500do : 21902do
12501 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`
12502ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 21904{ echo "$as_me:$LINENO: checking for $ac_func" >&5
12503if 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
12504 cat >>confdefs.h <<_ACEOF 21987 cat >>confdefs.h <<_ACEOF
12505#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 21988#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
12506_ACEOF 21989_ACEOF
12507 21990
12508else 21991else
12509 unsupported_algorithms="$unsupported_algorithms \ 21992 unsupported_algorithms="$unsupported_algorithms \
12510 hmac-sha2-256 hmac-sha2-512 \ 21993 hmac-sha2-256 hmac-sha2-512 \
12511 diffie-hellman-group-exchange-sha256 \ 21994 diffie-hellman-group-exchange-sha256 \
12512 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"
12513 21996
12514 21997
12515fi 21998fi
12516done 21999done
12517 22000
12518# Search for RIPE-MD support in OpenSSL 22001 # Search for RIPE-MD support in OpenSSL
22002
12519for ac_func in EVP_ripemd160 22003for ac_func in EVP_ripemd160
12520do : 22004do
12521 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`
12522if 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
12523 cat >>confdefs.h <<_ACEOF 22089 cat >>confdefs.h <<_ACEOF
12524#define HAVE_EVP_RIPEMD160 1 22090#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
12525_ACEOF 22091_ACEOF
12526 22092
12527else 22093else
12528 unsupported_algorithms="$unsupported_algorithms \ 22094 unsupported_algorithms="$unsupported_algorithms \
12529 hmac-ripemd160 22095 hmac-ripemd160
12530 hmac-ripemd160@openssh.com 22096 hmac-ripemd160@openssh.com
12531 hmac-ripemd160-etm@openssh.com" 22097 hmac-ripemd160-etm@openssh.com"
12532 22098
12533 22099
12534fi 22100fi
12535done 22101done
12536 22102
12537 22103
12538# Check complete ECC support in OpenSSL 22104 # Check complete ECC support in OpenSSL
12539{ $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
12540$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; }
12541cat 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
12542/* end confdefs.h. */ 22112/* end confdefs.h. */
12543 22113
12544#include <openssl/ec.h> 22114 #include <openssl/ec.h>
12545#include <openssl/ecdh.h> 22115 #include <openssl/ecdh.h>
12546#include <openssl/ecdsa.h> 22116 #include <openssl/ecdsa.h>
12547#include <openssl/evp.h> 22117 #include <openssl/evp.h>
12548#include <openssl/objects.h> 22118 #include <openssl/objects.h>
12549#include <openssl/opensslv.h> 22119 #include <openssl/opensslv.h>
12550#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */ 22120 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
12551# error "OpenSSL < 0.9.8g has unreliable ECC code" 22121 # error "OpenSSL < 0.9.8g has unreliable ECC code"
12552#endif 22122 #endif
12553 22123
12554int 22124int
12555main () 22125main ()
12556{ 22126{
12557 22127
12558 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);
12559 const EVP_MD *m = EVP_sha256(); /* We need this too */ 22129 const EVP_MD *m = EVP_sha256(); /* We need this too */
12560 22130
12561 ; 22131 ;
12562 return 0; 22132 return 0;
12563} 22133}
12564_ACEOF 22134_ACEOF
12565if ac_fn_c_try_link "$LINENO"; then : 22135rm -f conftest.$ac_objext conftest$ac_exeext
12566 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 22136if { (ac_try="$ac_link"
12567$as_echo "yes" >&6; } 22137case "(($ac_try" in
12568 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
12569else 22156else
12570 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 22157 echo "$as_me: failed program was:" >&5
12571$as_echo "no" >&6; } 22158sed 's/^/| /' conftest.$ac_ext >&5
22159
22160 { echo "$as_me:$LINENO: result: no" >&5
22161echo "${ECHO_T}no" >&6; }
12572 22162
12573fi 22163fi
12574rm -f core conftest.err conftest.$ac_objext \
12575 conftest$ac_exeext conftest.$ac_ext
12576 22164
12577{ $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 \
12578$as_echo_n "checking whether OpenSSL has NID_secp384r1... " >&6; } 22166 conftest$ac_exeext conftest.$ac_ext
12579cat 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
12580/* end confdefs.h. */ 22175/* end confdefs.h. */
12581 22176
12582#include <openssl/ec.h> 22177 #include <openssl/ec.h>
12583#include <openssl/ecdh.h> 22178 #include <openssl/ecdh.h>
12584#include <openssl/ecdsa.h> 22179 #include <openssl/ecdsa.h>
12585#include <openssl/evp.h> 22180 #include <openssl/evp.h>
12586#include <openssl/objects.h> 22181 #include <openssl/objects.h>
12587#include <openssl/opensslv.h> 22182 #include <openssl/opensslv.h>
12588#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */ 22183 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
12589# error "OpenSSL < 0.9.8g has unreliable ECC code" 22184 # error "OpenSSL < 0.9.8g has unreliable ECC code"
12590#endif 22185 #endif
12591 22186
12592int 22187int
12593main () 22188main ()
12594{ 22189{
12595 22190
12596 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1); 22191 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1);
12597 const EVP_MD *m = EVP_sha384(); /* We need this too */ 22192 const EVP_MD *m = EVP_sha384(); /* We need this too */
12598 22193
12599 ; 22194 ;
12600 return 0; 22195 return 0;
12601} 22196}
12602_ACEOF 22197_ACEOF
12603if ac_fn_c_try_link "$LINENO"; then : 22198rm -f conftest.$ac_objext conftest$ac_exeext
12604 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 22199if { (ac_try="$ac_link"
12605$as_echo "yes" >&6; } 22200case "(($ac_try" in
12606 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
12607else 22219else
12608 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 22220 echo "$as_me: failed program was:" >&5
12609$as_echo "no" >&6; } 22221sed 's/^/| /' conftest.$ac_ext >&5
22222
22223 { echo "$as_me:$LINENO: result: no" >&5
22224echo "${ECHO_T}no" >&6; }
12610 22225
12611fi 22226fi
12612rm -f core conftest.err conftest.$ac_objext \
12613 conftest$ac_exeext conftest.$ac_ext
12614 22227
12615{ $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 \
12616$as_echo_n "checking whether OpenSSL has NID_secp521r1... " >&6; } 22229 conftest$ac_exeext conftest.$ac_ext
12617cat 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
12618/* end confdefs.h. */ 22238/* end confdefs.h. */
12619 22239
12620#include <openssl/ec.h> 22240 #include <openssl/ec.h>
12621#include <openssl/ecdh.h> 22241 #include <openssl/ecdh.h>
12622#include <openssl/ecdsa.h> 22242 #include <openssl/ecdsa.h>
12623#include <openssl/evp.h> 22243 #include <openssl/evp.h>
12624#include <openssl/objects.h> 22244 #include <openssl/objects.h>
12625#include <openssl/opensslv.h> 22245 #include <openssl/opensslv.h>
12626#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */ 22246 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
12627# error "OpenSSL < 0.9.8g has unreliable ECC code" 22247 # error "OpenSSL < 0.9.8g has unreliable ECC code"
12628#endif 22248 #endif
12629 22249
12630int 22250int
12631main () 22251main ()
12632{ 22252{
12633 22253
12634 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1); 22254 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
12635 const EVP_MD *m = EVP_sha512(); /* We need this too */ 22255 const EVP_MD *m = EVP_sha512(); /* We need this too */
12636 22256
12637 ; 22257 ;
12638 return 0; 22258 return 0;
12639} 22259}
12640_ACEOF 22260_ACEOF
12641if ac_fn_c_try_link "$LINENO"; then : 22261rm -f conftest.$ac_objext conftest$ac_exeext
12642 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 22262if { (ac_try="$ac_link"
12643$as_echo "yes" >&6; } 22263case "(($ac_try" in
12644 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OpenSSL's NID_secp521r1 is functional" >&5 22264 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12645$as_echo_n "checking if OpenSSL's NID_secp521r1 is functional... " >&6; } 22265 *) ac_try_echo=$ac_try;;
12646 if test "$cross_compiling" = yes; then : 22266esac
12647 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: assuming yes" >&5 22267eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12648$as_echo "$as_me: WARNING: cross-compiling: assuming yes" >&2;} 22268 (eval "$ac_link") 2>conftest.er1
12649 enable_nistp521=1 22269 ac_status=$?
12650 22270 grep -v '^ *+' conftest.er1 >conftest.err
12651else 22271 rm -f conftest.er1
12652 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
12653/* end confdefs.h. */ 22294/* end confdefs.h. */
12654 22295
12655#include <openssl/ec.h> 22296 #include <openssl/ec.h>
12656#include <openssl/ecdh.h> 22297 #include <openssl/ecdh.h>
12657#include <openssl/ecdsa.h> 22298 #include <openssl/ecdsa.h>
12658#include <openssl/evp.h> 22299 #include <openssl/evp.h>
12659#include <openssl/objects.h> 22300 #include <openssl/objects.h>
12660#include <openssl/opensslv.h> 22301 #include <openssl/opensslv.h>
12661 22302
12662int 22303int
12663main () 22304main ()
12664{ 22305{
12665 22306
12666 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1); 22307 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
12667 const EVP_MD *m = EVP_sha512(); /* We need this too */ 22308 const EVP_MD *m = EVP_sha512(); /* We need this too */
12668 exit(e == NULL || m == NULL); 22309 exit(e == NULL || m == NULL);
12669 22310
12670 ; 22311 ;
12671 return 0; 22312 return 0;
12672} 22313}
12673_ACEOF 22314_ACEOF
12674if ac_fn_c_try_run "$LINENO"; then : 22315rm -f conftest$ac_exeext
12675 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 22316if { (ac_try="$ac_link"
12676$as_echo "yes" >&6; } 22317case "(($ac_try" in
12677 enable_nistp521=1 22318 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12678else 22319 *) ac_try_echo=$ac_try;;
12679 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 22320esac
12680$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; }
12681fi 22346fi
12682rm -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
12683 conftest.$ac_objext conftest.beam conftest.$ac_ext
12684fi 22348fi
12685 22349
22350
12686else 22351else
12687 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 22352 echo "$as_me: failed program was:" >&5
12688$as_echo "no" >&6; } 22353sed 's/^/| /' conftest.$ac_ext >&5
22354
22355 { echo "$as_me:$LINENO: result: no" >&5
22356echo "${ECHO_T}no" >&6; }
12689 22357
12690fi 22358fi
12691rm -f core conftest.err conftest.$ac_objext \
12692 conftest$ac_exeext conftest.$ac_ext
12693 22359
12694COMMENT_OUT_ECC="#no ecc#" 22360rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12695TEST_SSH_ECC=no 22361 conftest$ac_exeext conftest.$ac_ext
12696 22362
12697if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \ 22363 COMMENT_OUT_ECC="#no ecc#"
12698 test x$enable_nistp521 = x1; then 22364 TEST_SSH_ECC=no
12699 22365
12700$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
12701 22368
12702fi 22369cat >>confdefs.h <<\_ACEOF
12703if test x$enable_nistp256 = x1; then 22370#define OPENSSL_HAS_ECC 1
22371_ACEOF
22372
22373 fi
22374 if test x$enable_nistp256 = x1; then
12704 22375
12705$as_echo "#define OPENSSL_HAS_NISTP256 1" >>confdefs.h 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
12706 22403
12707 TEST_SSH_ECC=yes 22404 TEST_SSH_ECC=yes
12708 COMMENT_OUT_ECC="" 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
22410
22411
22412
22413else
22414 { echo "$as_me:$LINENO: checking for crypt in -lcrypt" >&5
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
12709else 22418else
12710 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp256 \ 22419 ac_check_lib_save_LIBS=$LIBS
12711 ecdh-sha2-nistp256 ecdsa-sha2-nistp256-cert-v01@openssh.com" 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"
12712fi 22477fi
12713if test x$enable_nistp384 = x1; then
12714 22478
12715$as_echo "#define OPENSSL_HAS_NISTP384 1" >>confdefs.h
12716 22479
12717 TEST_SSH_ECC=yes 22480for ac_func in crypt
12718 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
12719else 22487else
12720 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp384 \ 22488 cat >conftest.$ac_ext <<_ACEOF
12721 ecdh-sha2-nistp384 ecdsa-sha2-nistp384-cert-v01@openssh.com" 22489/* confdefs.h. */
12722fi 22490_ACEOF
12723if 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
12724 22497
12725$as_echo "#define OPENSSL_HAS_NISTP521 1" >>confdefs.h 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. */
12726 22502
12727 TEST_SSH_ECC=yes 22503#ifdef __STDC__
12728 COMMENT_OUT_ECC="" 22504# include <limits.h>
22505#else
22506# include <assert.h>
22507#endif
22508
22509#undef $ac_func
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"
12729else 22552else
12730 unsupported_algorithms="$unsupported_algorithms ecdh-sha2-nistp521 \ 22553 echo "$as_me: failed program was:" >&5
12731 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
12732fi 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
22573fi
22574
12733 22575
12734 22576
12735 22577
@@ -12740,12 +22582,93 @@ for ac_func in \
12740 arc4random_stir \ 22582 arc4random_stir \
12741 arc4random_uniform \ 22583 arc4random_uniform \
12742 22584
12743do : 22585do
12744 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`
12745ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 22587{ echo "$as_me:$LINENO: checking for $ac_func" >&5
12746if 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
12747 cat >>confdefs.h <<_ACEOF 22670 cat >>confdefs.h <<_ACEOF
12748#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 22671#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
12749_ACEOF 22672_ACEOF
12750 22673
12751fi 22674fi
@@ -12753,14 +22676,18 @@ done
12753 22676
12754 22677
12755saved_LIBS="$LIBS" 22678saved_LIBS="$LIBS"
12756{ $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
12757$as_echo_n "checking for ia_openinfo in -liaf... " >&6; } 22680echo $ECHO_N "checking for ia_openinfo in -liaf... $ECHO_C" >&6; }
12758if ${ac_cv_lib_iaf_ia_openinfo+:} false; then : 22681if test "${ac_cv_lib_iaf_ia_openinfo+set}" = set; then
12759 $as_echo_n "(cached) " >&6 22682 echo $ECHO_N "(cached) $ECHO_C" >&6
12760else 22683else
12761 ac_check_lib_save_LIBS=$LIBS 22684 ac_check_lib_save_LIBS=$LIBS
12762LIBS="-liaf $LIBS" 22685LIBS="-liaf $LIBS"
12763cat 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
12764/* end confdefs.h. */ 22691/* end confdefs.h. */
12765 22692
12766/* Override any GCC internal prototype to avoid an error. 22693/* Override any GCC internal prototype to avoid an error.
@@ -12778,30 +22705,136 @@ return ia_openinfo ();
12778 return 0; 22705 return 0;
12779} 22706}
12780_ACEOF 22707_ACEOF
12781if 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
12782 ac_cv_lib_iaf_ia_openinfo=yes 22726 ac_cv_lib_iaf_ia_openinfo=yes
12783else 22727else
12784 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
12785fi 22732fi
12786rm -f core conftest.err conftest.$ac_objext \ 22733
12787 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
12788LIBS=$ac_check_lib_save_LIBS 22736LIBS=$ac_check_lib_save_LIBS
12789fi 22737fi
12790{ $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
12791$as_echo "$ac_cv_lib_iaf_ia_openinfo" >&6; } 22739echo "${ECHO_T}$ac_cv_lib_iaf_ia_openinfo" >&6; }
12792if test "x$ac_cv_lib_iaf_ia_openinfo" = xyes; then : 22740if test $ac_cv_lib_iaf_ia_openinfo = yes; then
12793 22741
12794 LIBS="$LIBS -liaf" 22742 LIBS="$LIBS -liaf"
12795 for ac_func in set_id 22743
12796do : 22744for ac_func in set_id
12797 ac_fn_c_check_func "$LINENO" "set_id" "ac_cv_func_set_id" 22745do
12798if 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
12799 cat >>confdefs.h <<_ACEOF 22830 cat >>confdefs.h <<_ACEOF
12800#define HAVE_SET_ID 1 22831#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
12801_ACEOF 22832_ACEOF
12802 SSHDLIBS="$SSHDLIBS -liaf" 22833 SSHDLIBS="$SSHDLIBS -liaf"
12803 22834
12804$as_echo "#define HAVE_LIBIAF 1" >>confdefs.h 22835cat >>confdefs.h <<\_ACEOF
22836#define HAVE_LIBIAF 1
22837_ACEOF
12805 22838
12806 22839
12807fi 22840fi
@@ -12815,55 +22848,85 @@ LIBS="$saved_LIBS"
12815### Configure cryptographic random number support 22848### Configure cryptographic random number support
12816 22849
12817# Check wheter OpenSSL seeds itself 22850# Check wheter OpenSSL seeds itself
12818{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether OpenSSL's PRNG is internally seeded" >&5 22851if test "x$openssl" = "xyes" ; then
12819$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
12820if 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
12821 22855
12822 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: assuming yes" >&5 22856 { echo "$as_me:$LINENO: WARNING: cross compiling: assuming yes" >&5
12823$as_echo "$as_me: WARNING: cross compiling: assuming yes" >&2;} 22857echo "$as_me: WARNING: cross compiling: assuming yes" >&2;}
12824 # This is safe, since we will fatal() at runtime if 22858 # This is safe, since we will fatal() at runtime if
12825 # OpenSSL is not seeded correctly. 22859 # OpenSSL is not seeded correctly.
12826 OPENSSL_SEEDS_ITSELF=yes 22860 OPENSSL_SEEDS_ITSELF=yes
12827 22861
12828 22862
12829else 22863else
12830 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
12831/* end confdefs.h. */ 22869/* end confdefs.h. */
12832 22870
12833#include <string.h> 22871 #include <string.h>
12834#include <openssl/rand.h> 22872 #include <openssl/rand.h>
12835 22873
12836int 22874int
12837main () 22875main ()
12838{ 22876{
12839 22877
12840 exit(RAND_status() == 1 ? 0 : 1); 22878 exit(RAND_status() == 1 ? 0 : 1);
12841 22879
12842 ; 22880 ;
12843 return 0; 22881 return 0;
12844} 22882}
12845_ACEOF 22883_ACEOF
12846if 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
12847 22904
12848 OPENSSL_SEEDS_ITSELF=yes 22905 OPENSSL_SEEDS_ITSELF=yes
12849 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 22906 { echo "$as_me:$LINENO: result: yes" >&5
12850$as_echo "yes" >&6; } 22907echo "${ECHO_T}yes" >&6; }
12851 22908
12852else 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
22913
22914( exit $ac_status )
12853 22915
12854 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 22916 { echo "$as_me:$LINENO: result: no" >&5
12855$as_echo "no" >&6; } 22917echo "${ECHO_T}no" >&6; }
12856 22918
12857fi 22919fi
12858rm -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
12859 conftest.$ac_objext conftest.beam conftest.$ac_ext
12860fi 22921fi
12861 22922
12862 22923
22924fi
22925
12863# PRNGD TCP socket 22926# PRNGD TCP socket
12864 22927
12865# Check whether --with-prngd-port was given. 22928# Check whether --with-prngd-port was given.
12866if test "${with_prngd_port+set}" = set; then : 22929if test "${with_prngd_port+set}" = set; then
12867 withval=$with_prngd_port; 22930 withval=$with_prngd_port;
12868 case "$withval" in 22931 case "$withval" in
12869 no) 22932 no)
@@ -12872,7 +22935,9 @@ if test "${with_prngd_port+set}" = set; then :
12872 [0-9]*) 22935 [0-9]*)
12873 ;; 22936 ;;
12874 *) 22937 *)
12875 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; }; }
12876 ;; 22941 ;;
12877 esac 22942 esac
12878 if test ! -z "$withval" ; then 22943 if test ! -z "$withval" ; then
@@ -12891,7 +22956,7 @@ fi
12891# PRNGD Unix domain socket 22956# PRNGD Unix domain socket
12892 22957
12893# Check whether --with-prngd-socket was given. 22958# Check whether --with-prngd-socket was given.
12894if test "${with_prngd_socket+set}" = set; then : 22959if test "${with_prngd_socket+set}" = set; then
12895 withval=$with_prngd_socket; 22960 withval=$with_prngd_socket;
12896 case "$withval" in 22961 case "$withval" in
12897 yes) 22962 yes)
@@ -12903,17 +22968,21 @@ if test "${with_prngd_socket+set}" = set; then :
12903 /*) 22968 /*)
12904 ;; 22969 ;;
12905 *) 22970 *)
12906 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; }; }
12907 ;; 22974 ;;
12908 esac 22975 esac
12909 22976
12910 if test ! -z "$withval" ; then 22977 if test ! -z "$withval" ; then
12911 if test ! -z "$PRNGD_PORT" ; then 22978 if test ! -z "$PRNGD_PORT" ; then
12912 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; }; }
12913 fi 22982 fi
12914 if test ! -r "$withval" ; then 22983 if test ! -r "$withval" ; then
12915 { $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
12916$as_echo "$as_me: WARNING: Entropy socket is not readable" >&2;} 22985echo "$as_me: WARNING: Entropy socket is not readable" >&2;}
12917 fi 22986 fi
12918 PRNGD_SOCKET="$withval" 22987 PRNGD_SOCKET="$withval"
12919 22988
@@ -12927,8 +22996,8 @@ else
12927 22996
12928 # 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
12929 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then 22998 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
12930 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PRNGD/EGD socket" >&5 22999 { echo "$as_me:$LINENO: checking for PRNGD/EGD socket" >&5
12931$as_echo_n "checking for PRNGD/EGD socket... " >&6; } 23000echo $ECHO_N "checking for PRNGD/EGD socket... $ECHO_C" >&6; }
12932 # Insert other locations here 23001 # Insert other locations here
12933 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
12934 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
@@ -12941,11 +23010,11 @@ _ACEOF
12941 fi 23010 fi
12942 done 23011 done
12943 if test ! -z "$PRNGD_SOCKET" ; then 23012 if test ! -z "$PRNGD_SOCKET" ; then
12944 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PRNGD_SOCKET" >&5 23013 { echo "$as_me:$LINENO: result: $PRNGD_SOCKET" >&5
12945$as_echo "$PRNGD_SOCKET" >&6; } 23014echo "${ECHO_T}$PRNGD_SOCKET" >&6; }
12946 else 23015 else
12947 { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 23016 { echo "$as_me:$LINENO: result: not found" >&5
12948$as_echo "not found" >&6; } 23017echo "${ECHO_T}not found" >&6; }
12949 fi 23018 fi
12950 fi 23019 fi
12951 23020
@@ -12960,34 +23029,48 @@ elif test ! -z "$PRNGD_SOCKET" ; then
12960 RAND_MSG="PRNGd socket $PRNGD_SOCKET" 23029 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
12961elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then 23030elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
12962 23031
12963$as_echo "#define OPENSSL_PRNG_ONLY 1" >>confdefs.h 23032cat >>confdefs.h <<\_ACEOF
23033#define OPENSSL_PRNG_ONLY 1
23034_ACEOF
12964 23035
12965 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;}
12966else 23040else
12967 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; }; }
12968fi 23044fi
12969 23045
12970# Check for PAM libs 23046# Check for PAM libs
12971PAM_MSG="no" 23047PAM_MSG="no"
12972 23048
12973# Check whether --with-pam was given. 23049# Check whether --with-pam was given.
12974if test "${with_pam+set}" = set; then : 23050if test "${with_pam+set}" = set; then
12975 withval=$with_pam; 23051 withval=$with_pam;
12976 if test "x$withval" != "xno" ; then 23052 if test "x$withval" != "xno" ; then
12977 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \ 23053 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
12978 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then 23054 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
12979 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; }; }
12980 fi 23058 fi
12981 23059
12982 saved_LIBS="$LIBS" 23060 saved_LIBS="$LIBS"
12983 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 23061
12984$as_echo_n "checking for dlopen in -ldl... " >&6; } 23062{ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
12985if ${ac_cv_lib_dl_dlopen+:} false; then : 23063echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
12986 $as_echo_n "(cached) " >&6 23064if test "${ac_cv_lib_dl_dlopen+set}" = set; then
23065 echo $ECHO_N "(cached) $ECHO_C" >&6
12987else 23066else
12988 ac_check_lib_save_LIBS=$LIBS 23067 ac_check_lib_save_LIBS=$LIBS
12989LIBS="-ldl $LIBS" 23068LIBS="-ldl $LIBS"
12990cat 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
12991/* end confdefs.h. */ 23074/* end confdefs.h. */
12992 23075
12993/* Override any GCC internal prototype to avoid an error. 23076/* Override any GCC internal prototype to avoid an error.
@@ -13005,18 +23088,39 @@ return dlopen ();
13005 return 0; 23088 return 0;
13006} 23089}
13007_ACEOF 23090_ACEOF
13008if 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
13009 ac_cv_lib_dl_dlopen=yes 23109 ac_cv_lib_dl_dlopen=yes
13010else 23110else
13011 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
13012fi 23115fi
13013rm -f core conftest.err conftest.$ac_objext \ 23116
13014 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
13015LIBS=$ac_check_lib_save_LIBS 23119LIBS=$ac_check_lib_save_LIBS
13016fi 23120fi
13017{ $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
13018$as_echo "$ac_cv_lib_dl_dlopen" >&6; } 23122echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
13019if test "x$ac_cv_lib_dl_dlopen" = xyes; then : 23123if test $ac_cv_lib_dl_dlopen = yes; then
13020 cat >>confdefs.h <<_ACEOF 23124 cat >>confdefs.h <<_ACEOF
13021#define HAVE_LIBDL 1 23125#define HAVE_LIBDL 1
13022_ACEOF 23126_ACEOF
@@ -13025,14 +23129,19 @@ _ACEOF
13025 23129
13026fi 23130fi
13027 23131
13028 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pam_set_item in -lpam" >&5 23132
13029$as_echo_n "checking for pam_set_item in -lpam... " >&6; } 23133{ echo "$as_me:$LINENO: checking for pam_set_item in -lpam" >&5
13030if ${ac_cv_lib_pam_pam_set_item+:} false; then : 23134echo $ECHO_N "checking for pam_set_item in -lpam... $ECHO_C" >&6; }
13031 $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
13032else 23137else
13033 ac_check_lib_save_LIBS=$LIBS 23138 ac_check_lib_save_LIBS=$LIBS
13034LIBS="-lpam $LIBS" 23139LIBS="-lpam $LIBS"
13035cat 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
13036/* end confdefs.h. */ 23145/* end confdefs.h. */
13037 23146
13038/* Override any GCC internal prototype to avoid an error. 23147/* Override any GCC internal prototype to avoid an error.
@@ -13050,18 +23159,39 @@ return pam_set_item ();
13050 return 0; 23159 return 0;
13051} 23160}
13052_ACEOF 23161_ACEOF
13053if 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
13054 ac_cv_lib_pam_pam_set_item=yes 23180 ac_cv_lib_pam_pam_set_item=yes
13055else 23181else
13056 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
13057fi 23186fi
13058rm -f core conftest.err conftest.$ac_objext \ 23187
13059 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
13060LIBS=$ac_check_lib_save_LIBS 23190LIBS=$ac_check_lib_save_LIBS
13061fi 23191fi
13062{ $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
13063$as_echo "$ac_cv_lib_pam_pam_set_item" >&6; } 23193echo "${ECHO_T}$ac_cv_lib_pam_pam_set_item" >&6; }
13064if test "x$ac_cv_lib_pam_pam_set_item" = xyes; then : 23194if test $ac_cv_lib_pam_pam_set_item = yes; then
13065 cat >>confdefs.h <<_ACEOF 23195 cat >>confdefs.h <<_ACEOF
13066#define HAVE_LIBPAM 1 23196#define HAVE_LIBPAM 1
13067_ACEOF 23197_ACEOF
@@ -13069,26 +23199,194 @@ _ACEOF
13069 LIBS="-lpam $LIBS" 23199 LIBS="-lpam $LIBS"
13070 23200
13071else 23201else
13072 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; }; }
13073fi 23205fi
13074 23206
13075 for ac_func in pam_getenvlist 23207
13076do : 23208for ac_func in pam_getenvlist
13077 ac_fn_c_check_func "$LINENO" "pam_getenvlist" "ac_cv_func_pam_getenvlist" 23209do
13078if 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
13079 cat >>confdefs.h <<_ACEOF 23294 cat >>confdefs.h <<_ACEOF
13080#define HAVE_PAM_GETENVLIST 1 23295#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
13081_ACEOF 23296_ACEOF
13082 23297
13083fi 23298fi
13084done 23299done
13085 23300
13086 for ac_func in pam_putenv 23301
13087do : 23302for ac_func in pam_putenv
13088 ac_fn_c_check_func "$LINENO" "pam_putenv" "ac_cv_func_pam_putenv" 23303do
13089if 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
13090 cat >>confdefs.h <<_ACEOF 23388 cat >>confdefs.h <<_ACEOF
13091#define HAVE_PAM_PUTENV 1 23389#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
13092_ACEOF 23390_ACEOF
13093 23391
13094fi 23392fi
@@ -13100,7 +23398,9 @@ done
13100 23398
13101 SSHDLIBS="$SSHDLIBS -lpam" 23399 SSHDLIBS="$SSHDLIBS -lpam"
13102 23400
13103$as_echo "#define USE_PAM 1" >>confdefs.h 23401cat >>confdefs.h <<\_ACEOF
23402#define USE_PAM 1
23403_ACEOF
13104 23404
13105 23405
13106 if test $ac_cv_lib_dl_dlopen = yes; then 23406 if test $ac_cv_lib_dl_dlopen = yes; then
@@ -13122,9 +23422,13 @@ fi
13122# Check for older PAM 23422# Check for older PAM
13123if test "x$PAM_MSG" = "xyes" ; then 23423if test "x$PAM_MSG" = "xyes" ; then
13124 # Check PAM strerror arguments (old PAM) 23424 # Check PAM strerror arguments (old PAM)
13125 { $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
13126$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; }
13127 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
13128/* end confdefs.h. */ 23432/* end confdefs.h. */
13129 23433
13130#include <stdlib.h> 23434#include <stdlib.h>
@@ -13144,20 +23448,42 @@ main ()
13144 return 0; 23448 return 0;
13145} 23449}
13146_ACEOF 23450_ACEOF
13147if ac_fn_c_try_compile "$LINENO"; then : 23451rm -f conftest.$ac_objext
13148 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 23452if { (ac_try="$ac_compile"
13149$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; }
13150else 23470else
23471 echo "$as_me: failed program was:" >&5
23472sed 's/^/| /' conftest.$ac_ext >&5
13151 23473
13152 23474
13153$as_echo "#define HAVE_OLD_PAM 1" >>confdefs.h
13154 23475
13155 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 23476cat >>confdefs.h <<\_ACEOF
13156$as_echo "yes" >&6; } 23477#define HAVE_OLD_PAM 1
23478_ACEOF
23479
23480 { echo "$as_me:$LINENO: result: yes" >&5
23481echo "${ECHO_T}yes" >&6; }
13157 PAM_MSG="yes (old library)" 23482 PAM_MSG="yes (old library)"
13158 23483
13159 23484
13160fi 23485fi
23486
13161rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 23487rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13162fi 23488fi
13163 23489
@@ -13171,7 +23497,7 @@ case "$host" in
13171esac 23497esac
13172 23498
13173# Check whether --with-privsep-user was given. 23499# Check whether --with-privsep-user was given.
13174if test "${with_privsep_user+set}" = set; then : 23500if test "${with_privsep_user+set}" = set; then
13175 withval=$with_privsep_user; 23501 withval=$with_privsep_user;
13176 if test -n "$withval" && test "x$withval" != "xno" && \ 23502 if test -n "$withval" && test "x$withval" != "xno" && \
13177 test "x${withval}" != "xyes"; then 23503 test "x${withval}" != "xyes"; then
@@ -13197,20 +23523,75 @@ fi
13197 23523
13198 23524
13199if test "x$have_linux_no_new_privs" = "x1" ; then 23525if test "x$have_linux_no_new_privs" = "x1" ; then
13200ac_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
13201 #include <sys/types.h> 23538 #include <sys/types.h>
13202 #include <linux/seccomp.h> 23539 #include <linux/seccomp.h>
13203 23540
13204" 23541
13205if 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
13206 have_seccomp_filter=1 23583 have_seccomp_filter=1
13207fi 23584fi
13208 23585
13209fi 23586fi
13210if test "x$have_seccomp_filter" = "x1" ; then 23587if test "x$have_seccomp_filter" = "x1" ; then
13211{ $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
13212$as_echo_n "checking kernel for seccomp_filter support... " >&6; } 23589echo $ECHO_N "checking kernel for seccomp_filter support... $ECHO_C" >&6; }
13213cat 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
13214/* end confdefs.h. */ 23595/* end confdefs.h. */
13215 23596
13216 #include <errno.h> 23597 #include <errno.h>
@@ -13231,27 +23612,48 @@ main ()
13231 return 0; 23612 return 0;
13232} 23613}
13233_ACEOF 23614_ACEOF
13234if ac_fn_c_try_link "$LINENO"; then : 23615rm -f conftest.$ac_objext conftest$ac_exeext
13235 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 23616if { (ac_try="$ac_link"
13236$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; }
13237else 23635else
23636 echo "$as_me: failed program was:" >&5
23637sed 's/^/| /' conftest.$ac_ext >&5
23638
13238 23639
13239 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 23640 { echo "$as_me:$LINENO: result: no" >&5
13240$as_echo "no" >&6; } 23641echo "${ECHO_T}no" >&6; }
13241 # Disable seccomp filter as a target 23642 # Disable seccomp filter as a target
13242 have_seccomp_filter=0 23643 have_seccomp_filter=0
13243 23644
13244 23645
13245fi 23646fi
13246rm -f core conftest.err conftest.$ac_objext \ 23647
13247 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
13248fi 23650fi
13249 23651
13250# Decide which sandbox style to use 23652# Decide which sandbox style to use
13251sandbox_arg="" 23653sandbox_arg=""
13252 23654
13253# Check whether --with-sandbox was given. 23655# Check whether --with-sandbox was given.
13254if test "${with_sandbox+set}" = set; then : 23656if test "${with_sandbox+set}" = set; then
13255 withval=$with_sandbox; 23657 withval=$with_sandbox;
13256 if test "x$withval" = "xyes" ; then 23658 if test "x$withval" = "xyes" ; then
13257 sandbox_arg="" 23659 sandbox_arg=""
@@ -13266,14 +23668,18 @@ fi
13266# 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
13267# 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
13268# 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.
13269{ $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
13270$as_echo_n "checking if select works with descriptor rlimit... " >&6; } 23672echo $ECHO_N "checking if select works with descriptor rlimit... $ECHO_C" >&6; }
13271if test "$cross_compiling" = yes; then : 23673if test "$cross_compiling" = yes; then
13272 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: assuming yes" >&5 23674 { echo "$as_me:$LINENO: WARNING: cross compiling: assuming yes" >&5
13273$as_echo "$as_me: WARNING: cross compiling: assuming yes" >&2;} 23675echo "$as_me: WARNING: cross compiling: assuming yes" >&2;}
13274 23676
13275else 23677else
13276 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
13277/* end confdefs.h. */ 23683/* end confdefs.h. */
13278 23684
13279#include <sys/types.h> 23685#include <sys/types.h>
@@ -13312,28 +23718,56 @@ main ()
13312 return 0; 23718 return 0;
13313} 23719}
13314_ACEOF 23720_ACEOF
13315if ac_fn_c_try_run "$LINENO"; then : 23721rm -f conftest$ac_exeext
13316 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 23722if { (ac_try="$ac_link"
13317$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; }
13318 select_works_with_rlimit=yes 23743 select_works_with_rlimit=yes
13319else 23744else
13320 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 23745 echo "$as_me: program exited with status $ac_status" >&5
13321$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; }
13322 select_works_with_rlimit=no 23752 select_works_with_rlimit=no
13323fi 23753fi
13324rm -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
13325 conftest.$ac_objext conftest.beam conftest.$ac_ext
13326fi 23755fi
13327 23756
13328 23757
13329{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if setrlimit(RLIMIT_NOFILE,{0,0}) works" >&5 23758
13330$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
13331if test "$cross_compiling" = yes; then : 23760echo $ECHO_N "checking if setrlimit(RLIMIT_NOFILE,{0,0}) works... $ECHO_C" >&6; }
13332 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: assuming yes" >&5 23761if test "$cross_compiling" = yes; then
13333$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;}
13334 23764
13335else 23765else
13336 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
13337/* end confdefs.h. */ 23771/* end confdefs.h. */
13338 23772
13339#include <sys/types.h> 23773#include <sys/types.h>
@@ -13360,28 +23794,56 @@ main ()
13360 return 0; 23794 return 0;
13361} 23795}
13362_ACEOF 23796_ACEOF
13363if ac_fn_c_try_run "$LINENO"; then : 23797rm -f conftest$ac_exeext
13364 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 23798if { (ac_try="$ac_link"
13365$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; }
13366 rlimit_nofile_zero_works=yes 23819 rlimit_nofile_zero_works=yes
13367else 23820else
13368 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 23821 echo "$as_me: program exited with status $ac_status" >&5
13369$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; }
13370 rlimit_nofile_zero_works=no 23828 rlimit_nofile_zero_works=no
13371fi 23829fi
13372rm -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
13373 conftest.$ac_objext conftest.beam conftest.$ac_ext
13374fi 23831fi
13375 23832
13376 23833
13377{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if setrlimit RLIMIT_FSIZE works" >&5 23834
13378$as_echo_n "checking if setrlimit RLIMIT_FSIZE works... " >&6; } 23835{ echo "$as_me:$LINENO: checking if setrlimit RLIMIT_FSIZE works" >&5
13379if test "$cross_compiling" = yes; then : 23836echo $ECHO_N "checking if setrlimit RLIMIT_FSIZE works... $ECHO_C" >&6; }
13380 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: assuming yes" >&5 23837if test "$cross_compiling" = yes; then
13381$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;}
13382 23840
13383else 23841else
13384 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
13385/* end confdefs.h. */ 23847/* end confdefs.h. */
13386 23848
13387#include <sys/types.h> 23849#include <sys/types.h>
@@ -13401,38 +23863,72 @@ main ()
13401 return 0; 23863 return 0;
13402} 23864}
13403_ACEOF 23865_ACEOF
13404if ac_fn_c_try_run "$LINENO"; then : 23866rm -f conftest$ac_exeext
13405 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 23867if { (ac_try="$ac_link"
13406$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; }
13407else 23888else
13408 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 23889 echo "$as_me: program exited with status $ac_status" >&5
13409$as_echo "no" >&6; } 23890echo "$as_me: failed program was:" >&5
23891sed 's/^/| /' conftest.$ac_ext >&5
13410 23892
13411$as_echo "#define SANDBOX_SKIP_RLIMIT_FSIZE 1" >>confdefs.h 23893( exit $ac_status )
23894{ echo "$as_me:$LINENO: result: no" >&5
23895echo "${ECHO_T}no" >&6; }
23896
23897cat >>confdefs.h <<\_ACEOF
23898#define SANDBOX_SKIP_RLIMIT_FSIZE 1
23899_ACEOF
13412 23900
13413fi 23901fi
13414rm -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
13415 conftest.$ac_objext conftest.beam conftest.$ac_ext
13416fi 23903fi
13417 23904
13418 23905
23906
13419if test "x$sandbox_arg" = "xsystrace" || \ 23907if test "x$sandbox_arg" = "xsystrace" || \
13420 ( 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
13421 test "x$have_systr_policy_kill" != "x1" && \ 23909 test "x$have_systr_policy_kill" != "x1" && \
13422 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; }; }
13423 SANDBOX_STYLE="systrace" 23913 SANDBOX_STYLE="systrace"
13424 23914
13425$as_echo "#define SANDBOX_SYSTRACE 1" >>confdefs.h 23915cat >>confdefs.h <<\_ACEOF
23916#define SANDBOX_SYSTRACE 1
23917_ACEOF
13426 23918
13427elif test "x$sandbox_arg" = "xdarwin" || \ 23919elif test "x$sandbox_arg" = "xdarwin" || \
13428 ( 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" && \
13429 test "x$ac_cv_header_sandbox_h" = "xyes") ; then 23921 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
13430 test "x$ac_cv_func_sandbox_init" != "xyes" -o \ 23922 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
13431 "x$ac_cv_header_sandbox_h" != "xyes" && \ 23923 "x$ac_cv_header_sandbox_h" != "xyes" && \
13432 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; }; }
13433 SANDBOX_STYLE="darwin" 23927 SANDBOX_STYLE="darwin"
13434 23928
13435$as_echo "#define SANDBOX_DARWIN 1" >>confdefs.h 23929cat >>confdefs.h <<\_ACEOF
23930#define SANDBOX_DARWIN 1
23931_ACEOF
13436 23932
13437elif test "x$sandbox_arg" = "xseccomp_filter" || \ 23933elif test "x$sandbox_arg" = "xseccomp_filter" || \
13438 ( test -z "$sandbox_arg" && \ 23934 ( test -z "$sandbox_arg" && \
@@ -13444,49 +23940,75 @@ elif test "x$sandbox_arg" = "xseccomp_filter" || \
13444 test "x$have_linux_no_new_privs" = "x1" && \ 23940 test "x$have_linux_no_new_privs" = "x1" && \
13445 test "x$ac_cv_func_prctl" = "xyes" ) ; then 23941 test "x$ac_cv_func_prctl" = "xyes" ) ; then
13446 test "x$seccomp_audit_arch" = "x" && \ 23942 test "x$seccomp_audit_arch" = "x" && \
13447 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; }; }
13448 test "x$have_linux_no_new_privs" != "x1" && \ 23946 test "x$have_linux_no_new_privs" != "x1" && \
13449 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; }; }
13450 test "x$have_seccomp_filter" != "x1" && \ 23950 test "x$have_seccomp_filter" != "x1" && \
13451 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; }; }
13452 test "x$ac_cv_func_prctl" != "xyes" && \ 23954 test "x$ac_cv_func_prctl" != "xyes" && \
13453 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; }; }
13454 SANDBOX_STYLE="seccomp_filter" 23958 SANDBOX_STYLE="seccomp_filter"
13455 23959
13456$as_echo "#define SANDBOX_SECCOMP_FILTER 1" >>confdefs.h 23960cat >>confdefs.h <<\_ACEOF
23961#define SANDBOX_SECCOMP_FILTER 1
23962_ACEOF
13457 23963
13458elif test "x$sandbox_arg" = "xcapsicum" || \ 23964elif test "x$sandbox_arg" = "xcapsicum" || \
13459 ( test -z "$sandbox_arg" && \ 23965 ( test -z "$sandbox_arg" && \
13460 test "x$ac_cv_header_sys_capability_h" = "xyes" && \ 23966 test "x$ac_cv_header_sys_capability_h" = "xyes" && \
13461 test "x$ac_cv_func_cap_rights_limit" = "xyes") ; then 23967 test "x$ac_cv_func_cap_rights_limit" = "xyes") ; then
13462 test "x$ac_cv_header_sys_capability_h" != "xyes" && \ 23968 test "x$ac_cv_header_sys_capability_h" != "xyes" && \
13463 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; }; }
13464 test "x$ac_cv_func_cap_rights_limit" != "xyes" && \ 23972 test "x$ac_cv_func_cap_rights_limit" != "xyes" && \
13465 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; }; }
13466 SANDBOX_STYLE="capsicum" 23976 SANDBOX_STYLE="capsicum"
13467 23977
13468$as_echo "#define SANDBOX_CAPSICUM 1" >>confdefs.h 23978cat >>confdefs.h <<\_ACEOF
23979#define SANDBOX_CAPSICUM 1
23980_ACEOF
13469 23981
13470elif test "x$sandbox_arg" = "xrlimit" || \ 23982elif test "x$sandbox_arg" = "xrlimit" || \
13471 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \ 23983 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \
13472 test "x$select_works_with_rlimit" = "xyes" && \ 23984 test "x$select_works_with_rlimit" = "xyes" && \
13473 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then 23985 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then
13474 test "x$ac_cv_func_setrlimit" != "xyes" && \ 23986 test "x$ac_cv_func_setrlimit" != "xyes" && \
13475 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; }; }
13476 test "x$select_works_with_rlimit" != "xyes" && \ 23990 test "x$select_works_with_rlimit" != "xyes" && \
13477 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; }; }
13478 SANDBOX_STYLE="rlimit" 23994 SANDBOX_STYLE="rlimit"
13479 23995
13480$as_echo "#define SANDBOX_RLIMIT 1" >>confdefs.h 23996cat >>confdefs.h <<\_ACEOF
23997#define SANDBOX_RLIMIT 1
23998_ACEOF
13481 23999
13482elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \ 24000elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
13483 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then 24001 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
13484 SANDBOX_STYLE="none" 24002 SANDBOX_STYLE="none"
13485 24003
13486$as_echo "#define SANDBOX_NULL 1" >>confdefs.h 24004cat >>confdefs.h <<\_ACEOF
24005#define SANDBOX_NULL 1
24006_ACEOF
13487 24007
13488else 24008else
13489 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; }; }
13490fi 24012fi
13491 24013
13492# Cheap hack to ensure NEWS-OS libraries are arranged right. 24014# Cheap hack to ensure NEWS-OS libraries are arranged right.
@@ -13495,8 +24017,60 @@ if test ! -z "$SONY" ; then
13495fi 24017fi
13496 24018
13497# Check for long long datatypes 24019# Check for long long datatypes
13498ac_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
13499if 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
13500 24074
13501cat >>confdefs.h <<_ACEOF 24075cat >>confdefs.h <<_ACEOF
13502#define HAVE_LONG_LONG 1 24076#define HAVE_LONG_LONG 1
@@ -13504,8 +24078,60 @@ _ACEOF
13504 24078
13505 24079
13506fi 24080fi
13507ac_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
13508if 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
13509 24135
13510cat >>confdefs.h <<_ACEOF 24136cat >>confdefs.h <<_ACEOF
13511#define HAVE_UNSIGNED_LONG_LONG 1 24137#define HAVE_UNSIGNED_LONG_LONG 1
@@ -13513,8 +24139,60 @@ _ACEOF
13513 24139
13514 24140
13515fi 24141fi
13516ac_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
13517if 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
13518 24196
13519cat >>confdefs.h <<_ACEOF 24197cat >>confdefs.h <<_ACEOF
13520#define HAVE_LONG_DOUBLE 1 24198#define HAVE_LONG_DOUBLE 1
@@ -13525,31 +24203,403 @@ fi
13525 24203
13526 24204
13527# 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
13528# 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
13529# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects 24261# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
13530# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. 24262# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
13531# This bug is HP SR number 8606223364. 24263# This bug is HP SR number 8606223364.
13532{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short int" >&5 24264{ echo "$as_me:$LINENO: checking size of short int" >&5
13533$as_echo_n "checking size of short int... " >&6; } 24265echo $ECHO_N "checking size of short int... $ECHO_C" >&6; }
13534if ${ac_cv_sizeof_short_int+:} false; then : 24266if test "${ac_cv_sizeof_short_int+set}" = set; then
13535 $as_echo_n "(cached) " >&6 24267 echo $ECHO_N "(cached) $ECHO_C" >&6
13536else 24268else
13537 if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short int))" "ac_cv_sizeof_short_int" "$ac_includes_default"; then : 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
13538 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
13539else 24435else
13540 if test "$ac_cv_type_short_int" = yes; then 24436 echo "$as_me: failed program was:" >&5
13541 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 24437sed 's/^/| /' conftest.$ac_ext >&5
13542$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 24438
13543as_fn_error 77 "cannot compute sizeof (short int) 24439 ac_hi=`expr '(' $ac_mid ')' - 1`
13544See \`config.log' for more details" "$LINENO" 5; } 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
24449else
24450 echo "$as_me: failed program was:" >&5
24451sed 's/^/| /' conftest.$ac_ext >&5
24452
24453 ac_lo= ac_hi=
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; }; }
13545 else 24593 else
13546 ac_cv_sizeof_short_int=0 24594 ac_cv_sizeof_short_int=0
13547 fi 24595 fi
13548fi 24596fi
13549 24597rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
24598fi
24599rm -f conftest.val
13550fi 24600fi
13551{ $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
13552$as_echo "$ac_cv_sizeof_short_int" >&6; } 24602echo "${ECHO_T}$ac_cv_sizeof_short_int" >&6; }
13553 24603
13554 24604
13555 24605
@@ -13558,31 +24608,403 @@ cat >>confdefs.h <<_ACEOF
13558_ACEOF 24608_ACEOF
13559 24609
13560 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
13561# 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
13562# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects 24666# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
13563# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. 24667# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
13564# This bug is HP SR number 8606223364. 24668# This bug is HP SR number 8606223364.
13565{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 24669{ echo "$as_me:$LINENO: checking size of int" >&5
13566$as_echo_n "checking size of int... " >&6; } 24670echo $ECHO_N "checking size of int... $ECHO_C" >&6; }
13567if ${ac_cv_sizeof_int+:} false; then : 24671if test "${ac_cv_sizeof_int+set}" = set; then
13568 $as_echo_n "(cached) " >&6 24672 echo $ECHO_N "(cached) $ECHO_C" >&6
24673else
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
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
13569else 24840else
13570 if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : 24841 echo "$as_me: failed program was:" >&5
24842sed 's/^/| /' conftest.$ac_ext >&5
13571 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
13572else 24854else
13573 if test "$ac_cv_type_int" = yes; then 24855 echo "$as_me: failed program was:" >&5
13574 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 24856sed 's/^/| /' conftest.$ac_ext >&5
13575$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 24857
13576as_fn_error 77 "cannot compute sizeof (int) 24858 ac_lo= ac_hi=
13577See \`config.log' for more details" "$LINENO" 5; } 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`
24986else
24987 echo "$as_me: program exited with status $ac_status" >&5
24988echo "$as_me: failed program was:" >&5
24989sed 's/^/| /' conftest.$ac_ext >&5
24990
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; }; }
13578 else 24998 else
13579 ac_cv_sizeof_int=0 24999 ac_cv_sizeof_int=0
13580 fi 25000 fi
13581fi 25001fi
13582 25002rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
13583fi 25003fi
13584{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 25004rm -f conftest.val
13585$as_echo "$ac_cv_sizeof_int" >&6; } 25005fi
25006{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
25007echo "${ECHO_T}$ac_cv_sizeof_int" >&6; }
13586 25008
13587 25009
13588 25010
@@ -13591,31 +25013,403 @@ cat >>confdefs.h <<_ACEOF
13591_ACEOF 25013_ACEOF
13592 25014
13593 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
13594# 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
13595# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects 25071# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
13596# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. 25072# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
13597# This bug is HP SR number 8606223364. 25073# This bug is HP SR number 8606223364.
13598{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long int" >&5 25074{ echo "$as_me:$LINENO: checking size of long int" >&5
13599$as_echo_n "checking size of long int... " >&6; } 25075echo $ECHO_N "checking size of long int... $ECHO_C" >&6; }
13600if ${ac_cv_sizeof_long_int+:} false; then : 25076if test "${ac_cv_sizeof_long_int+set}" = set; then
13601 $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
13602else 25154else
13603 if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long int))" "ac_cv_sizeof_long_int" "$ac_includes_default"; then : 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
13604 25165
25166rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
25167 done
13605else 25168else
13606 if test "$ac_cv_type_long_int" = yes; then 25169 echo "$as_me: failed program was:" >&5
13607 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 25170sed 's/^/| /' conftest.$ac_ext >&5
13608$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 25171
13609as_fn_error 77 "cannot compute sizeof (long int) 25172 cat >conftest.$ac_ext <<_ACEOF
13610See \`config.log' for more details" "$LINENO" 5; } 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
25259else
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;
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`
25391else
25392 echo "$as_me: program exited with status $ac_status" >&5
25393echo "$as_me: failed program was:" >&5
25394sed 's/^/| /' conftest.$ac_ext >&5
25395
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; }; }
13611 else 25403 else
13612 ac_cv_sizeof_long_int=0 25404 ac_cv_sizeof_long_int=0
13613 fi 25405 fi
13614fi 25406fi
13615 25407rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
25408fi
25409rm -f conftest.val
13616fi 25410fi
13617{ $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
13618$as_echo "$ac_cv_sizeof_long_int" >&6; } 25412echo "${ECHO_T}$ac_cv_sizeof_long_int" >&6; }
13619 25413
13620 25414
13621 25415
@@ -13624,31 +25418,403 @@ cat >>confdefs.h <<_ACEOF
13624_ACEOF 25418_ACEOF
13625 25419
13626 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
13627# 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
13628# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects 25476# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
13629# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. 25477# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
13630# This bug is HP SR number 8606223364. 25478# This bug is HP SR number 8606223364.
13631{ $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
13632$as_echo_n "checking size of long long int... " >&6; } 25480echo $ECHO_N "checking size of long long int... $ECHO_C" >&6; }
13633if ${ac_cv_sizeof_long_long_int+:} false; then : 25481if test "${ac_cv_sizeof_long_long_int+set}" = set; then
13634 $as_echo_n "(cached) " >&6 25482 echo $ECHO_N "(cached) $ECHO_C" >&6
13635else 25483else
13636 if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long int))" "ac_cv_sizeof_long_long_int" "$ac_includes_default"; then : 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
25559else
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
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
25650else
25651 echo "$as_me: failed program was:" >&5
25652sed 's/^/| /' conftest.$ac_ext >&5
25653
25654 ac_hi=`expr '(' $ac_mid ')' - 1`
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;
13637 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`
13638else 25796else
13639 if test "$ac_cv_type_long_long_int" = yes; then 25797 echo "$as_me: program exited with status $ac_status" >&5
13640 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 25798echo "$as_me: failed program was:" >&5
13641$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 25799sed 's/^/| /' conftest.$ac_ext >&5
13642as_fn_error 77 "cannot compute sizeof (long long int) 25800
13643See \`config.log' for more details" "$LINENO" 5; } 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; }; }
13644 else 25808 else
13645 ac_cv_sizeof_long_long_int=0 25809 ac_cv_sizeof_long_long_int=0
13646 fi 25810 fi
13647fi 25811fi
13648 25812rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
13649fi 25813fi
13650{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long_int" >&5 25814rm -f conftest.val
13651$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; }
13652 25818
13653 25819
13654 25820
@@ -13665,16 +25831,20 @@ fi
13665 25831
13666# 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.
13667if test -z "$have_llong_max"; then 25833if test -z "$have_llong_max"; then
13668 { $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
13669$as_echo_n "checking for max value of long long... " >&6; } 25835echo $ECHO_N "checking for max value of long long... $ECHO_C" >&6; }
13670 if test "$cross_compiling" = yes; then : 25836 if test "$cross_compiling" = yes; then
13671 25837
13672 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: not checking" >&5 25838 { echo "$as_me:$LINENO: WARNING: cross compiling: not checking" >&5
13673$as_echo "$as_me: WARNING: cross compiling: not checking" >&2;} 25839echo "$as_me: WARNING: cross compiling: not checking" >&2;}
13674 25840
13675 25841
13676else 25842else
13677 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
13678/* end confdefs.h. */ 25848/* end confdefs.h. */
13679 25849
13680#include <stdio.h> 25850#include <stdio.h>
@@ -13755,22 +25925,41 @@ main ()
13755 return 0; 25925 return 0;
13756} 25926}
13757_ACEOF 25927_ACEOF
13758if 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
13759 25948
13760 llong_min=`$AWK '{print $1}' conftest.llminmax` 25949 llong_min=`$AWK '{print $1}' conftest.llminmax`
13761 llong_max=`$AWK '{print $2}' conftest.llminmax` 25950 llong_max=`$AWK '{print $2}' conftest.llminmax`
13762 25951
13763 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $llong_max" >&5 25952 { echo "$as_me:$LINENO: result: $llong_max" >&5
13764$as_echo "$llong_max" >&6; } 25953echo "${ECHO_T}$llong_max" >&6; }
13765 25954
13766cat >>confdefs.h <<_ACEOF 25955cat >>confdefs.h <<_ACEOF
13767#define LLONG_MAX ${llong_max}LL 25956#define LLONG_MAX ${llong_max}LL
13768_ACEOF 25957_ACEOF
13769 25958
13770 { $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
13771$as_echo_n "checking for min value of long long... " >&6; } 25960echo $ECHO_N "checking for min value of long long... $ECHO_C" >&6; }
13772 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $llong_min" >&5 25961 { echo "$as_me:$LINENO: result: $llong_min" >&5
13773$as_echo "$llong_min" >&6; } 25962echo "${ECHO_T}$llong_min" >&6; }
13774 25963
13775cat >>confdefs.h <<_ACEOF 25964cat >>confdefs.h <<_ACEOF
13776#define LLONG_MIN ${llong_min}LL 25965#define LLONG_MIN ${llong_min}LL
@@ -13778,26 +25967,35 @@ _ACEOF
13778 25967
13779 25968
13780else 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
13781 25973
13782 { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 25974( exit $ac_status )
13783$as_echo "not found" >&6; } 25975
25976 { echo "$as_me:$LINENO: result: not found" >&5
25977echo "${ECHO_T}not found" >&6; }
13784 25978
13785fi 25979fi
13786rm -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
13787 conftest.$ac_objext conftest.beam conftest.$ac_ext
13788fi 25981fi
13789 25982
25983
13790fi 25984fi
13791 25985
13792 25986
13793# More checks for data types 25987# More checks for data types
13794{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for u_int type" >&5 25988{ echo "$as_me:$LINENO: checking for u_int type" >&5
13795$as_echo_n "checking for u_int type... " >&6; } 25989echo $ECHO_N "checking for u_int type... $ECHO_C" >&6; }
13796if ${ac_cv_have_u_int+:} false; then : 25990if test "${ac_cv_have_u_int+set}" = set; then
13797 $as_echo_n "(cached) " >&6 25991 echo $ECHO_N "(cached) $ECHO_C" >&6
13798else 25992else
13799 25993
13800 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
13801/* end confdefs.h. */ 25999/* end confdefs.h. */
13802 #include <sys/types.h> 26000 #include <sys/types.h>
13803int 26001int
@@ -13808,31 +26006,57 @@ main ()
13808 return 0; 26006 return 0;
13809} 26007}
13810_ACEOF 26008_ACEOF
13811if 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
13812 ac_cv_have_u_int="yes" 26026 ac_cv_have_u_int="yes"
13813else 26027else
13814 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"
13815 26032
13816fi 26033fi
26034
13817rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26035rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13818 26036
13819fi 26037fi
13820{ $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
13821$as_echo "$ac_cv_have_u_int" >&6; } 26039echo "${ECHO_T}$ac_cv_have_u_int" >&6; }
13822if test "x$ac_cv_have_u_int" = "xyes" ; then 26040if test "x$ac_cv_have_u_int" = "xyes" ; then
13823 26041
13824$as_echo "#define HAVE_U_INT 1" >>confdefs.h 26042cat >>confdefs.h <<\_ACEOF
26043#define HAVE_U_INT 1
26044_ACEOF
13825 26045
13826 have_u_int=1 26046 have_u_int=1
13827fi 26047fi
13828 26048
13829{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for intXX_t types" >&5 26049{ echo "$as_me:$LINENO: checking for intXX_t types" >&5
13830$as_echo_n "checking for intXX_t types... " >&6; } 26050echo $ECHO_N "checking for intXX_t types... $ECHO_C" >&6; }
13831if ${ac_cv_have_intxx_t+:} false; then : 26051if test "${ac_cv_have_intxx_t+set}" = set; then
13832 $as_echo_n "(cached) " >&6 26052 echo $ECHO_N "(cached) $ECHO_C" >&6
13833else 26053else
13834 26054
13835 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
13836/* end confdefs.h. */ 26060/* end confdefs.h. */
13837 #include <sys/types.h> 26061 #include <sys/types.h>
13838int 26062int
@@ -13843,20 +26067,42 @@ main ()
13843 return 0; 26067 return 0;
13844} 26068}
13845_ACEOF 26069_ACEOF
13846if 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
13847 ac_cv_have_intxx_t="yes" 26087 ac_cv_have_intxx_t="yes"
13848else 26088else
13849 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"
13850 26093
13851fi 26094fi
26095
13852rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26096rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13853 26097
13854fi 26098fi
13855{ $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
13856$as_echo "$ac_cv_have_intxx_t" >&6; } 26100echo "${ECHO_T}$ac_cv_have_intxx_t" >&6; }
13857if test "x$ac_cv_have_intxx_t" = "xyes" ; then 26101if test "x$ac_cv_have_intxx_t" = "xyes" ; then
13858 26102
13859$as_echo "#define HAVE_INTXX_T 1" >>confdefs.h 26103cat >>confdefs.h <<\_ACEOF
26104#define HAVE_INTXX_T 1
26105_ACEOF
13860 26106
13861 have_intxx_t=1 26107 have_intxx_t=1
13862fi 26108fi
@@ -13864,9 +26110,13 @@ fi
13864if (test -z "$have_intxx_t" && \ 26110if (test -z "$have_intxx_t" && \
13865 test "x$ac_cv_header_stdint_h" = "xyes") 26111 test "x$ac_cv_header_stdint_h" = "xyes")
13866then 26112then
13867 { $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
13868$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; }
13869 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
13870/* end confdefs.h. */ 26120/* end confdefs.h. */
13871 #include <stdint.h> 26121 #include <stdint.h>
13872int 26122int
@@ -13877,28 +26127,54 @@ main ()
13877 return 0; 26127 return 0;
13878} 26128}
13879_ACEOF 26129_ACEOF
13880if 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
13881 26147
13882 $as_echo "#define HAVE_INTXX_T 1" >>confdefs.h 26148 cat >>confdefs.h <<\_ACEOF
26149#define HAVE_INTXX_T 1
26150_ACEOF
13883 26151
13884 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 26152 { echo "$as_me:$LINENO: result: yes" >&5
13885$as_echo "yes" >&6; } 26153echo "${ECHO_T}yes" >&6; }
13886 26154
13887else 26155else
13888 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 26156 echo "$as_me: failed program was:" >&5
13889$as_echo "no" >&6; } 26157sed 's/^/| /' conftest.$ac_ext >&5
26158
26159 { echo "$as_me:$LINENO: result: no" >&5
26160echo "${ECHO_T}no" >&6; }
13890 26161
13891fi 26162fi
26163
13892rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26164rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13893fi 26165fi
13894 26166
13895{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for int64_t type" >&5 26167{ echo "$as_me:$LINENO: checking for int64_t type" >&5
13896$as_echo_n "checking for int64_t type... " >&6; } 26168echo $ECHO_N "checking for int64_t type... $ECHO_C" >&6; }
13897if ${ac_cv_have_int64_t+:} false; then : 26169if test "${ac_cv_have_int64_t+set}" = set; then
13898 $as_echo_n "(cached) " >&6 26170 echo $ECHO_N "(cached) $ECHO_C" >&6
13899else 26171else
13900 26172
13901 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
13902/* end confdefs.h. */ 26178/* end confdefs.h. */
13903 26179
13904#include <sys/types.h> 26180#include <sys/types.h>
@@ -13920,30 +26196,56 @@ int64_t a; a = 1;
13920 return 0; 26196 return 0;
13921} 26197}
13922_ACEOF 26198_ACEOF
13923if 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
13924 ac_cv_have_int64_t="yes" 26216 ac_cv_have_int64_t="yes"
13925else 26217else
13926 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"
13927 26222
13928fi 26223fi
26224
13929rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26225rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13930 26226
13931fi 26227fi
13932{ $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
13933$as_echo "$ac_cv_have_int64_t" >&6; } 26229echo "${ECHO_T}$ac_cv_have_int64_t" >&6; }
13934if test "x$ac_cv_have_int64_t" = "xyes" ; then 26230if test "x$ac_cv_have_int64_t" = "xyes" ; then
13935 26231
13936$as_echo "#define HAVE_INT64_T 1" >>confdefs.h 26232cat >>confdefs.h <<\_ACEOF
26233#define HAVE_INT64_T 1
26234_ACEOF
13937 26235
13938fi 26236fi
13939 26237
13940{ $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
13941$as_echo_n "checking for u_intXX_t types... " >&6; } 26239echo $ECHO_N "checking for u_intXX_t types... $ECHO_C" >&6; }
13942if ${ac_cv_have_u_intxx_t+:} false; then : 26240if test "${ac_cv_have_u_intxx_t+set}" = set; then
13943 $as_echo_n "(cached) " >&6 26241 echo $ECHO_N "(cached) $ECHO_C" >&6
13944else 26242else
13945 26243
13946 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
13947/* end confdefs.h. */ 26249/* end confdefs.h. */
13948 #include <sys/types.h> 26250 #include <sys/types.h>
13949int 26251int
@@ -13954,28 +26256,54 @@ main ()
13954 return 0; 26256 return 0;
13955} 26257}
13956_ACEOF 26258_ACEOF
13957if 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
13958 ac_cv_have_u_intxx_t="yes" 26276 ac_cv_have_u_intxx_t="yes"
13959else 26277else
13960 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"
13961 26282
13962fi 26283fi
26284
13963rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26285rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
13964 26286
13965fi 26287fi
13966{ $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
13967$as_echo "$ac_cv_have_u_intxx_t" >&6; } 26289echo "${ECHO_T}$ac_cv_have_u_intxx_t" >&6; }
13968if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then 26290if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
13969 26291
13970$as_echo "#define HAVE_U_INTXX_T 1" >>confdefs.h 26292cat >>confdefs.h <<\_ACEOF
26293#define HAVE_U_INTXX_T 1
26294_ACEOF
13971 26295
13972 have_u_intxx_t=1 26296 have_u_intxx_t=1
13973fi 26297fi
13974 26298
13975if test -z "$have_u_intxx_t" ; then 26299if test -z "$have_u_intxx_t" ; then
13976 { $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
13977$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; }
13978 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
13979/* end confdefs.h. */ 26307/* end confdefs.h. */
13980 #include <sys/socket.h> 26308 #include <sys/socket.h>
13981int 26309int
@@ -13986,28 +26314,54 @@ main ()
13986 return 0; 26314 return 0;
13987} 26315}
13988_ACEOF 26316_ACEOF
13989if 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
13990 26334
13991 $as_echo "#define HAVE_U_INTXX_T 1" >>confdefs.h 26335 cat >>confdefs.h <<\_ACEOF
26336#define HAVE_U_INTXX_T 1
26337_ACEOF
13992 26338
13993 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 26339 { echo "$as_me:$LINENO: result: yes" >&5
13994$as_echo "yes" >&6; } 26340echo "${ECHO_T}yes" >&6; }
13995 26341
13996else 26342else
13997 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 26343 echo "$as_me: failed program was:" >&5
13998$as_echo "no" >&6; } 26344sed 's/^/| /' conftest.$ac_ext >&5
26345
26346 { echo "$as_me:$LINENO: result: no" >&5
26347echo "${ECHO_T}no" >&6; }
13999 26348
14000fi 26349fi
26350
14001rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26351rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14002fi 26352fi
14003 26353
14004{ $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
14005$as_echo_n "checking for u_int64_t types... " >&6; } 26355echo $ECHO_N "checking for u_int64_t types... $ECHO_C" >&6; }
14006if ${ac_cv_have_u_int64_t+:} false; then : 26356if test "${ac_cv_have_u_int64_t+set}" = set; then
14007 $as_echo_n "(cached) " >&6 26357 echo $ECHO_N "(cached) $ECHO_C" >&6
14008else 26358else
14009 26359
14010 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
14011/* end confdefs.h. */ 26365/* end confdefs.h. */
14012 #include <sys/types.h> 26366 #include <sys/types.h>
14013int 26367int
@@ -14018,20 +26372,42 @@ main ()
14018 return 0; 26372 return 0;
14019} 26373}
14020_ACEOF 26374_ACEOF
14021if 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
14022 ac_cv_have_u_int64_t="yes" 26392 ac_cv_have_u_int64_t="yes"
14023else 26393else
14024 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"
14025 26398
14026fi 26399fi
26400
14027rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26401rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14028 26402
14029fi 26403fi
14030{ $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
14031$as_echo "$ac_cv_have_u_int64_t" >&6; } 26405echo "${ECHO_T}$ac_cv_have_u_int64_t" >&6; }
14032if test "x$ac_cv_have_u_int64_t" = "xyes" ; then 26406if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
14033 26407
14034$as_echo "#define HAVE_U_INT64_T 1" >>confdefs.h 26408cat >>confdefs.h <<\_ACEOF
26409#define HAVE_U_INT64_T 1
26410_ACEOF
14035 26411
14036 have_u_int64_t=1 26412 have_u_int64_t=1
14037fi 26413fi
@@ -14039,9 +26415,13 @@ fi
14039if (test -z "$have_u_int64_t" && \ 26415if (test -z "$have_u_int64_t" && \
14040 test "x$ac_cv_header_sys_bitypes_h" = "xyes") 26416 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
14041then 26417then
14042 { $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
14043$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; }
14044 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
14045/* end confdefs.h. */ 26425/* end confdefs.h. */
14046 #include <sys/bitypes.h> 26426 #include <sys/bitypes.h>
14047int 26427int
@@ -14052,29 +26432,55 @@ main ()
14052 return 0; 26432 return 0;
14053} 26433}
14054_ACEOF 26434_ACEOF
14055if 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
14056 26452
14057 $as_echo "#define HAVE_U_INT64_T 1" >>confdefs.h 26453 cat >>confdefs.h <<\_ACEOF
26454#define HAVE_U_INT64_T 1
26455_ACEOF
14058 26456
14059 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 26457 { echo "$as_me:$LINENO: result: yes" >&5
14060$as_echo "yes" >&6; } 26458echo "${ECHO_T}yes" >&6; }
14061 26459
14062else 26460else
14063 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 26461 echo "$as_me: failed program was:" >&5
14064$as_echo "no" >&6; } 26462sed 's/^/| /' conftest.$ac_ext >&5
26463
26464 { echo "$as_me:$LINENO: result: no" >&5
26465echo "${ECHO_T}no" >&6; }
14065 26466
14066fi 26467fi
26468
14067rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26469rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14068fi 26470fi
14069 26471
14070if test -z "$have_u_intxx_t" ; then 26472if test -z "$have_u_intxx_t" ; then
14071 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uintXX_t types" >&5 26473 { echo "$as_me:$LINENO: checking for uintXX_t types" >&5
14072$as_echo_n "checking for uintXX_t types... " >&6; } 26474echo $ECHO_N "checking for uintXX_t types... $ECHO_C" >&6; }
14073if ${ac_cv_have_uintxx_t+:} false; then : 26475if test "${ac_cv_have_uintxx_t+set}" = set; then
14074 $as_echo_n "(cached) " >&6 26476 echo $ECHO_N "(cached) $ECHO_C" >&6
14075else 26477else
14076 26478
14077 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
14078/* end confdefs.h. */ 26484/* end confdefs.h. */
14079 26485
14080#include <sys/types.h> 26486#include <sys/types.h>
@@ -14092,20 +26498,42 @@ main ()
14092 return 0; 26498 return 0;
14093} 26499}
14094_ACEOF 26500_ACEOF
14095if 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
14096 ac_cv_have_uintxx_t="yes" 26518 ac_cv_have_uintxx_t="yes"
14097else 26519else
14098 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"
14099 26524
14100fi 26525fi
26526
14101rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26527rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14102 26528
14103fi 26529fi
14104{ $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
14105$as_echo "$ac_cv_have_uintxx_t" >&6; } 26531echo "${ECHO_T}$ac_cv_have_uintxx_t" >&6; }
14106 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then 26532 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
14107 26533
14108$as_echo "#define HAVE_UINTXX_T 1" >>confdefs.h 26534cat >>confdefs.h <<\_ACEOF
26535#define HAVE_UINTXX_T 1
26536_ACEOF
14109 26537
14110 fi 26538 fi
14111fi 26539fi
@@ -14113,9 +26541,13 @@ fi
14113if (test -z "$have_uintxx_t" && \ 26541if (test -z "$have_uintxx_t" && \
14114 test "x$ac_cv_header_stdint_h" = "xyes") 26542 test "x$ac_cv_header_stdint_h" = "xyes")
14115then 26543then
14116 { $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
14117$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; }
14118 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
14119/* end confdefs.h. */ 26551/* end confdefs.h. */
14120 #include <stdint.h> 26552 #include <stdint.h>
14121int 26553int
@@ -14126,27 +26558,53 @@ main ()
14126 return 0; 26558 return 0;
14127} 26559}
14128_ACEOF 26560_ACEOF
14129if 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
14130 26578
14131 $as_echo "#define HAVE_UINTXX_T 1" >>confdefs.h 26579 cat >>confdefs.h <<\_ACEOF
26580#define HAVE_UINTXX_T 1
26581_ACEOF
14132 26582
14133 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 26583 { echo "$as_me:$LINENO: result: yes" >&5
14134$as_echo "yes" >&6; } 26584echo "${ECHO_T}yes" >&6; }
14135 26585
14136else 26586else
14137 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 26587 echo "$as_me: failed program was:" >&5
14138$as_echo "no" >&6; } 26588sed 's/^/| /' conftest.$ac_ext >&5
26589
26590 { echo "$as_me:$LINENO: result: no" >&5
26591echo "${ECHO_T}no" >&6; }
14139 26592
14140fi 26593fi
26594
14141rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26595rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14142fi 26596fi
14143 26597
14144if (test -z "$have_uintxx_t" && \ 26598if (test -z "$have_uintxx_t" && \
14145 test "x$ac_cv_header_inttypes_h" = "xyes") 26599 test "x$ac_cv_header_inttypes_h" = "xyes")
14146then 26600then
14147 { $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
14148$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; }
14149 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
14150/* end confdefs.h. */ 26608/* end confdefs.h. */
14151 #include <inttypes.h> 26609 #include <inttypes.h>
14152int 26610int
@@ -14157,27 +26615,53 @@ main ()
14157 return 0; 26615 return 0;
14158} 26616}
14159_ACEOF 26617_ACEOF
14160if 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
14161 26635
14162 $as_echo "#define HAVE_UINTXX_T 1" >>confdefs.h 26636 cat >>confdefs.h <<\_ACEOF
26637#define HAVE_UINTXX_T 1
26638_ACEOF
14163 26639
14164 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 26640 { echo "$as_me:$LINENO: result: yes" >&5
14165$as_echo "yes" >&6; } 26641echo "${ECHO_T}yes" >&6; }
14166 26642
14167else 26643else
14168 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 26644 echo "$as_me: failed program was:" >&5
14169$as_echo "no" >&6; } 26645sed 's/^/| /' conftest.$ac_ext >&5
26646
26647 { echo "$as_me:$LINENO: result: no" >&5
26648echo "${ECHO_T}no" >&6; }
14170 26649
14171fi 26650fi
26651
14172rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26652rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14173fi 26653fi
14174 26654
14175if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \ 26655if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
14176 test "x$ac_cv_header_sys_bitypes_h" = "xyes") 26656 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
14177then 26657then
14178 { $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
14179$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; }
14180 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
14181/* end confdefs.h. */ 26665/* end confdefs.h. */
14182 26666
14183#include <sys/bitypes.h> 26667#include <sys/bitypes.h>
@@ -14194,31 +26678,59 @@ main ()
14194 return 0; 26678 return 0;
14195} 26679}
14196_ACEOF 26680_ACEOF
14197if 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
14198 26698
14199 $as_echo "#define HAVE_U_INTXX_T 1" >>confdefs.h 26699 cat >>confdefs.h <<\_ACEOF
26700#define HAVE_U_INTXX_T 1
26701_ACEOF
14200 26702
14201 $as_echo "#define HAVE_INTXX_T 1" >>confdefs.h 26703 cat >>confdefs.h <<\_ACEOF
26704#define HAVE_INTXX_T 1
26705_ACEOF
14202 26706
14203 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 26707 { echo "$as_me:$LINENO: result: yes" >&5
14204$as_echo "yes" >&6; } 26708echo "${ECHO_T}yes" >&6; }
14205 26709
14206else 26710else
14207 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 26711 echo "$as_me: failed program was:" >&5
14208$as_echo "no" >&6; } 26712sed 's/^/| /' conftest.$ac_ext >&5
26713
26714 { echo "$as_me:$LINENO: result: no" >&5
26715echo "${ECHO_T}no" >&6; }
14209 26716
14210fi 26717fi
26718
14211rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26719rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14212fi 26720fi
14213 26721
14214 26722
14215{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for u_char" >&5 26723{ echo "$as_me:$LINENO: checking for u_char" >&5
14216$as_echo_n "checking for u_char... " >&6; } 26724echo $ECHO_N "checking for u_char... $ECHO_C" >&6; }
14217if ${ac_cv_have_u_char+:} false; then : 26725if test "${ac_cv_have_u_char+set}" = set; then
14218 $as_echo_n "(cached) " >&6 26726 echo $ECHO_N "(cached) $ECHO_C" >&6
14219else 26727else
14220 26728
14221 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
14222/* end confdefs.h. */ 26734/* end confdefs.h. */
14223 #include <sys/types.h> 26735 #include <sys/types.h>
14224int 26736int
@@ -14229,29 +26741,103 @@ main ()
14229 return 0; 26741 return 0;
14230} 26742}
14231_ACEOF 26743_ACEOF
14232if 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
14233 ac_cv_have_u_char="yes" 26761 ac_cv_have_u_char="yes"
14234else 26762else
14235 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"
14236 26767
14237fi 26768fi
26769
14238rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 26770rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14239 26771
14240fi 26772fi
14241{ $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
14242$as_echo "$ac_cv_have_u_char" >&6; } 26774echo "${ECHO_T}$ac_cv_have_u_char" >&6; }
14243if test "x$ac_cv_have_u_char" = "xyes" ; then 26775if test "x$ac_cv_have_u_char" = "xyes" ; then
14244 26776
14245$as_echo "#define HAVE_U_CHAR 1" >>confdefs.h 26777cat >>confdefs.h <<\_ACEOF
26778#define HAVE_U_CHAR 1
26779_ACEOF
14246 26780
14247fi 26781fi
14248 26782
14249ac_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
14250#include <sys/types.h> 26795#include <sys/types.h>
14251#include <stdint.h> 26796#include <stdint.h>
14252 26797
14253" 26798
14254if 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
14255 26841
14256cat >>confdefs.h <<_ACEOF 26842cat >>confdefs.h <<_ACEOF
14257#define HAVE_INTMAX_T 1 26843#define HAVE_INTMAX_T 1
@@ -14259,12 +26845,64 @@ _ACEOF
14259 26845
14260 26846
14261fi 26847fi
14262ac_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
14263#include <sys/types.h> 26860#include <sys/types.h>
14264#include <stdint.h> 26861#include <stdint.h>
14265 26862
14266" 26863
14267if 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
14268 26906
14269cat >>confdefs.h <<_ACEOF 26907cat >>confdefs.h <<_ACEOF
14270#define HAVE_UINTMAX_T 1 26908#define HAVE_UINTMAX_T 1
@@ -14275,17 +26913,69 @@ fi
14275 26913
14276 26914
14277 26915
14278 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>
14279#include <sys/socket.h> 26928#include <sys/socket.h>
14280"
14281if test "x$ac_cv_type_socklen_t" = xyes; then :
14282 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
14283else 26960else
26961 echo "$as_me: failed program was:" >&5
26962sed 's/^/| /' conftest.$ac_ext >&5
26963
26964 ac_cv_type_socklen_t=no
26965fi
14284 26966
14285 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t equivalent" >&5 26967rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14286$as_echo_n "checking for socklen_t equivalent... " >&6; } 26968fi
14287 if ${curl_cv_socklen_t_equiv+:} false; then : 26969{ echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
14288 $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
14289else 26979else
14290 26980
14291 # Systems have either "struct sockaddr *" or 26981 # Systems have either "struct sockaddr *" or
@@ -14293,7 +26983,11 @@ else
14293 curl_cv_socklen_t_equiv= 26983 curl_cv_socklen_t_equiv=
14294 for arg2 in "struct sockaddr" void; do 26984 for arg2 in "struct sockaddr" void; do
14295 for t in int size_t unsigned long "unsigned long"; do 26985 for t in int size_t unsigned long "unsigned long"; do
14296 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
14297/* end confdefs.h. */ 26991/* end confdefs.h. */
14298 26992
14299 #include <sys/types.h> 26993 #include <sys/types.h>
@@ -14312,24 +27006,48 @@ main ()
14312 return 0; 27006 return 0;
14313} 27007}
14314_ACEOF 27008_ACEOF
14315if 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
14316 27026
14317 curl_cv_socklen_t_equiv="$t" 27027 curl_cv_socklen_t_equiv="$t"
14318 break 27028 break
14319 27029
27030else
27031 echo "$as_me: failed program was:" >&5
27032sed 's/^/| /' conftest.$ac_ext >&5
27033
27034
14320fi 27035fi
27036
14321rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27037rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14322 done 27038 done
14323 done 27039 done
14324 27040
14325 if test "x$curl_cv_socklen_t_equiv" = x; then 27041 if test "x$curl_cv_socklen_t_equiv" = x; then
14326 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; }; }
14327 fi 27045 fi
14328 27046
14329fi 27047fi
14330 27048
14331 { $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
14332$as_echo "$curl_cv_socklen_t_equiv" >&6; } 27050echo "${ECHO_T}$curl_cv_socklen_t_equiv" >&6; }
14333 27051
14334cat >>confdefs.h <<_ACEOF 27052cat >>confdefs.h <<_ACEOF
14335#define socklen_t $curl_cv_socklen_t_equiv 27053#define socklen_t $curl_cv_socklen_t_equiv
@@ -14339,9 +27057,61 @@ fi
14339 27057
14340 27058
14341 27059
14342ac_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
14343" 27061echo $ECHO_N "checking for sig_atomic_t... $ECHO_C" >&6; }
14344if 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
14345 27115
14346cat >>confdefs.h <<_ACEOF 27116cat >>confdefs.h <<_ACEOF
14347#define HAVE_SIG_ATOMIC_T 1 27117#define HAVE_SIG_ATOMIC_T 1
@@ -14350,7 +27120,18 @@ _ACEOF
14350 27120
14351fi 27121fi
14352 27122
14353ac_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
14354#include <sys/types.h> 27135#include <sys/types.h>
14355#ifdef HAVE_SYS_BITYPES_H 27136#ifdef HAVE_SYS_BITYPES_H
14356#include <sys/bitypes.h> 27137#include <sys/bitypes.h>
@@ -14362,8 +27143,49 @@ ac_fn_c_check_type "$LINENO" "fsblkcnt_t" "ac_cv_type_fsblkcnt_t" "
14362#include <sys/statvfs.h> 27143#include <sys/statvfs.h>
14363#endif 27144#endif
14364 27145
14365" 27146
14366if 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
14367 27189
14368cat >>confdefs.h <<_ACEOF 27190cat >>confdefs.h <<_ACEOF
14369#define HAVE_FSBLKCNT_T 1 27191#define HAVE_FSBLKCNT_T 1
@@ -14371,7 +27193,18 @@ _ACEOF
14371 27193
14372 27194
14373fi 27195fi
14374ac_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
14375#include <sys/types.h> 27208#include <sys/types.h>
14376#ifdef HAVE_SYS_BITYPES_H 27209#ifdef HAVE_SYS_BITYPES_H
14377#include <sys/bitypes.h> 27210#include <sys/bitypes.h>
@@ -14383,8 +27216,49 @@ ac_fn_c_check_type "$LINENO" "fsfilcnt_t" "ac_cv_type_fsfilcnt_t" "
14383#include <sys/statvfs.h> 27216#include <sys/statvfs.h>
14384#endif 27217#endif
14385 27218
14386" 27219
14387if 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
14388 27262
14389cat >>confdefs.h <<_ACEOF 27263cat >>confdefs.h <<_ACEOF
14390#define HAVE_FSFILCNT_T 1 27264#define HAVE_FSFILCNT_T 1
@@ -14394,10 +27268,62 @@ _ACEOF
14394fi 27268fi
14395 27269
14396 27270
14397ac_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>
14398#include <netinet/in.h> 27283#include <netinet/in.h>
14399" 27284
14400if 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
14401 27327
14402cat >>confdefs.h <<_ACEOF 27328cat >>confdefs.h <<_ACEOF
14403#define HAVE_IN_ADDR_T 1 27329#define HAVE_IN_ADDR_T 1
@@ -14405,10 +27331,62 @@ _ACEOF
14405 27331
14406 27332
14407fi 27333fi
14408ac_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>
14409#include <netinet/in.h> 27346#include <netinet/in.h>
14410" 27347
14411if 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
14412 27390
14413cat >>confdefs.h <<_ACEOF 27391cat >>confdefs.h <<_ACEOF
14414#define HAVE_IN_PORT_T 1 27392#define HAVE_IN_PORT_T 1
@@ -14418,13 +27396,17 @@ _ACEOF
14418fi 27396fi
14419 27397
14420 27398
14421{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for size_t" >&5 27399{ echo "$as_me:$LINENO: checking for size_t" >&5
14422$as_echo_n "checking for size_t... " >&6; } 27400echo $ECHO_N "checking for size_t... $ECHO_C" >&6; }
14423if ${ac_cv_have_size_t+:} false; then : 27401if test "${ac_cv_have_size_t+set}" = set; then
14424 $as_echo_n "(cached) " >&6 27402 echo $ECHO_N "(cached) $ECHO_C" >&6
14425else 27403else
14426 27404
14427 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
14428/* end confdefs.h. */ 27410/* end confdefs.h. */
14429 #include <sys/types.h> 27411 #include <sys/types.h>
14430int 27412int
@@ -14435,30 +27417,56 @@ main ()
14435 return 0; 27417 return 0;
14436} 27418}
14437_ACEOF 27419_ACEOF
14438if 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
14439 ac_cv_have_size_t="yes" 27437 ac_cv_have_size_t="yes"
14440else 27438else
14441 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"
14442 27443
14443fi 27444fi
27445
14444rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27446rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14445 27447
14446fi 27448fi
14447{ $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
14448$as_echo "$ac_cv_have_size_t" >&6; } 27450echo "${ECHO_T}$ac_cv_have_size_t" >&6; }
14449if test "x$ac_cv_have_size_t" = "xyes" ; then 27451if test "x$ac_cv_have_size_t" = "xyes" ; then
14450 27452
14451$as_echo "#define HAVE_SIZE_T 1" >>confdefs.h 27453cat >>confdefs.h <<\_ACEOF
27454#define HAVE_SIZE_T 1
27455_ACEOF
14452 27456
14453fi 27457fi
14454 27458
14455{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ssize_t" >&5 27459{ echo "$as_me:$LINENO: checking for ssize_t" >&5
14456$as_echo_n "checking for ssize_t... " >&6; } 27460echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6; }
14457if ${ac_cv_have_ssize_t+:} false; then : 27461if test "${ac_cv_have_ssize_t+set}" = set; then
14458 $as_echo_n "(cached) " >&6 27462 echo $ECHO_N "(cached) $ECHO_C" >&6
14459else 27463else
14460 27464
14461 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
14462/* end confdefs.h. */ 27470/* end confdefs.h. */
14463 #include <sys/types.h> 27471 #include <sys/types.h>
14464int 27472int
@@ -14469,30 +27477,56 @@ main ()
14469 return 0; 27477 return 0;
14470} 27478}
14471_ACEOF 27479_ACEOF
14472if 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
14473 ac_cv_have_ssize_t="yes" 27497 ac_cv_have_ssize_t="yes"
14474else 27498else
14475 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"
14476 27503
14477fi 27504fi
27505
14478rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27506rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14479 27507
14480fi 27508fi
14481{ $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
14482$as_echo "$ac_cv_have_ssize_t" >&6; } 27510echo "${ECHO_T}$ac_cv_have_ssize_t" >&6; }
14483if test "x$ac_cv_have_ssize_t" = "xyes" ; then 27511if test "x$ac_cv_have_ssize_t" = "xyes" ; then
14484 27512
14485$as_echo "#define HAVE_SSIZE_T 1" >>confdefs.h 27513cat >>confdefs.h <<\_ACEOF
27514#define HAVE_SSIZE_T 1
27515_ACEOF
14486 27516
14487fi 27517fi
14488 27518
14489{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_t" >&5 27519{ echo "$as_me:$LINENO: checking for clock_t" >&5
14490$as_echo_n "checking for clock_t... " >&6; } 27520echo $ECHO_N "checking for clock_t... $ECHO_C" >&6; }
14491if ${ac_cv_have_clock_t+:} false; then : 27521if test "${ac_cv_have_clock_t+set}" = set; then
14492 $as_echo_n "(cached) " >&6 27522 echo $ECHO_N "(cached) $ECHO_C" >&6
14493else 27523else
14494 27524
14495 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
14496/* end confdefs.h. */ 27530/* end confdefs.h. */
14497 #include <time.h> 27531 #include <time.h>
14498int 27532int
@@ -14503,30 +27537,56 @@ main ()
14503 return 0; 27537 return 0;
14504} 27538}
14505_ACEOF 27539_ACEOF
14506if 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
14507 ac_cv_have_clock_t="yes" 27557 ac_cv_have_clock_t="yes"
14508else 27558else
14509 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"
14510 27563
14511fi 27564fi
27565
14512rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27566rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14513 27567
14514fi 27568fi
14515{ $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
14516$as_echo "$ac_cv_have_clock_t" >&6; } 27570echo "${ECHO_T}$ac_cv_have_clock_t" >&6; }
14517if test "x$ac_cv_have_clock_t" = "xyes" ; then 27571if test "x$ac_cv_have_clock_t" = "xyes" ; then
14518 27572
14519$as_echo "#define HAVE_CLOCK_T 1" >>confdefs.h 27573cat >>confdefs.h <<\_ACEOF
27574#define HAVE_CLOCK_T 1
27575_ACEOF
14520 27576
14521fi 27577fi
14522 27578
14523{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sa_family_t" >&5 27579{ echo "$as_me:$LINENO: checking for sa_family_t" >&5
14524$as_echo_n "checking for sa_family_t... " >&6; } 27580echo $ECHO_N "checking for sa_family_t... $ECHO_C" >&6; }
14525if ${ac_cv_have_sa_family_t+:} false; then : 27581if test "${ac_cv_have_sa_family_t+set}" = set; then
14526 $as_echo_n "(cached) " >&6 27582 echo $ECHO_N "(cached) $ECHO_C" >&6
14527else 27583else
14528 27584
14529 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
14530/* end confdefs.h. */ 27590/* end confdefs.h. */
14531 27591
14532#include <sys/types.h> 27592#include <sys/types.h>
@@ -14540,10 +27600,33 @@ main ()
14540 return 0; 27600 return 0;
14541} 27601}
14542_ACEOF 27602_ACEOF
14543if 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
14544 ac_cv_have_sa_family_t="yes" 27620 ac_cv_have_sa_family_t="yes"
14545else 27621else
14546 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
14547/* end confdefs.h. */ 27630/* end confdefs.h. */
14548 27631
14549#include <sys/types.h> 27632#include <sys/types.h>
@@ -14558,33 +27641,60 @@ main ()
14558 return 0; 27641 return 0;
14559} 27642}
14560_ACEOF 27643_ACEOF
14561if 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
14562 ac_cv_have_sa_family_t="yes" 27661 ac_cv_have_sa_family_t="yes"
14563else 27662else
14564 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"
14565 27667
14566fi 27668fi
27669
14567rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27670rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14568 27671
14569fi 27672fi
27673
14570rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27674rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14571 27675
14572fi 27676fi
14573{ $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
14574$as_echo "$ac_cv_have_sa_family_t" >&6; } 27678echo "${ECHO_T}$ac_cv_have_sa_family_t" >&6; }
14575if test "x$ac_cv_have_sa_family_t" = "xyes" ; then 27679if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
14576 27680
14577$as_echo "#define HAVE_SA_FAMILY_T 1" >>confdefs.h 27681cat >>confdefs.h <<\_ACEOF
27682#define HAVE_SA_FAMILY_T 1
27683_ACEOF
14578 27684
14579fi 27685fi
14580 27686
14581{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pid_t" >&5 27687{ echo "$as_me:$LINENO: checking for pid_t" >&5
14582$as_echo_n "checking for pid_t... " >&6; } 27688echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; }
14583if ${ac_cv_have_pid_t+:} false; then : 27689if test "${ac_cv_have_pid_t+set}" = set; then
14584 $as_echo_n "(cached) " >&6 27690 echo $ECHO_N "(cached) $ECHO_C" >&6
14585else 27691else
14586 27692
14587 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
14588/* end confdefs.h. */ 27698/* end confdefs.h. */
14589 #include <sys/types.h> 27699 #include <sys/types.h>
14590int 27700int
@@ -14595,30 +27705,56 @@ main ()
14595 return 0; 27705 return 0;
14596} 27706}
14597_ACEOF 27707_ACEOF
14598if 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
14599 ac_cv_have_pid_t="yes" 27725 ac_cv_have_pid_t="yes"
14600else 27726else
14601 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"
14602 27731
14603fi 27732fi
27733
14604rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27734rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14605 27735
14606fi 27736fi
14607{ $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
14608$as_echo "$ac_cv_have_pid_t" >&6; } 27738echo "${ECHO_T}$ac_cv_have_pid_t" >&6; }
14609if test "x$ac_cv_have_pid_t" = "xyes" ; then 27739if test "x$ac_cv_have_pid_t" = "xyes" ; then
14610 27740
14611$as_echo "#define HAVE_PID_T 1" >>confdefs.h 27741cat >>confdefs.h <<\_ACEOF
27742#define HAVE_PID_T 1
27743_ACEOF
14612 27744
14613fi 27745fi
14614 27746
14615{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for mode_t" >&5 27747{ echo "$as_me:$LINENO: checking for mode_t" >&5
14616$as_echo_n "checking for mode_t... " >&6; } 27748echo $ECHO_N "checking for mode_t... $ECHO_C" >&6; }
14617if ${ac_cv_have_mode_t+:} false; then : 27749if test "${ac_cv_have_mode_t+set}" = set; then
14618 $as_echo_n "(cached) " >&6 27750 echo $ECHO_N "(cached) $ECHO_C" >&6
14619else 27751else
14620 27752
14621 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
14622/* end confdefs.h. */ 27758/* end confdefs.h. */
14623 #include <sys/types.h> 27759 #include <sys/types.h>
14624int 27760int
@@ -14629,31 +27765,57 @@ main ()
14629 return 0; 27765 return 0;
14630} 27766}
14631_ACEOF 27767_ACEOF
14632if 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
14633 ac_cv_have_mode_t="yes" 27785 ac_cv_have_mode_t="yes"
14634else 27786else
14635 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"
14636 27791
14637fi 27792fi
27793
14638rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27794rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14639 27795
14640fi 27796fi
14641{ $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
14642$as_echo "$ac_cv_have_mode_t" >&6; } 27798echo "${ECHO_T}$ac_cv_have_mode_t" >&6; }
14643if test "x$ac_cv_have_mode_t" = "xyes" ; then 27799if test "x$ac_cv_have_mode_t" = "xyes" ; then
14644 27800
14645$as_echo "#define HAVE_MODE_T 1" >>confdefs.h 27801cat >>confdefs.h <<\_ACEOF
27802#define HAVE_MODE_T 1
27803_ACEOF
14646 27804
14647fi 27805fi
14648 27806
14649 27807
14650{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct sockaddr_storage" >&5 27808{ echo "$as_me:$LINENO: checking for struct sockaddr_storage" >&5
14651$as_echo_n "checking for struct sockaddr_storage... " >&6; } 27809echo $ECHO_N "checking for struct sockaddr_storage... $ECHO_C" >&6; }
14652if ${ac_cv_have_struct_sockaddr_storage+:} false; then : 27810if test "${ac_cv_have_struct_sockaddr_storage+set}" = set; then
14653 $as_echo_n "(cached) " >&6 27811 echo $ECHO_N "(cached) $ECHO_C" >&6
14654else 27812else
14655 27813
14656 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
14657/* end confdefs.h. */ 27819/* end confdefs.h. */
14658 27820
14659#include <sys/types.h> 27821#include <sys/types.h>
@@ -14667,30 +27829,56 @@ main ()
14667 return 0; 27829 return 0;
14668} 27830}
14669_ACEOF 27831_ACEOF
14670if 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
14671 ac_cv_have_struct_sockaddr_storage="yes" 27849 ac_cv_have_struct_sockaddr_storage="yes"
14672else 27850else
14673 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"
14674 27855
14675fi 27856fi
27857
14676rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27858rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14677 27859
14678fi 27860fi
14679{ $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
14680$as_echo "$ac_cv_have_struct_sockaddr_storage" >&6; } 27862echo "${ECHO_T}$ac_cv_have_struct_sockaddr_storage" >&6; }
14681if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then 27863if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
14682 27864
14683$as_echo "#define HAVE_STRUCT_SOCKADDR_STORAGE 1" >>confdefs.h 27865cat >>confdefs.h <<\_ACEOF
27866#define HAVE_STRUCT_SOCKADDR_STORAGE 1
27867_ACEOF
14684 27868
14685fi 27869fi
14686 27870
14687{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct sockaddr_in6" >&5 27871{ echo "$as_me:$LINENO: checking for struct sockaddr_in6" >&5
14688$as_echo_n "checking for struct sockaddr_in6... " >&6; } 27872echo $ECHO_N "checking for struct sockaddr_in6... $ECHO_C" >&6; }
14689if ${ac_cv_have_struct_sockaddr_in6+:} false; then : 27873if test "${ac_cv_have_struct_sockaddr_in6+set}" = set; then
14690 $as_echo_n "(cached) " >&6 27874 echo $ECHO_N "(cached) $ECHO_C" >&6
14691else 27875else
14692 27876
14693 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
14694/* end confdefs.h. */ 27882/* end confdefs.h. */
14695 27883
14696#include <sys/types.h> 27884#include <sys/types.h>
@@ -14704,30 +27892,56 @@ main ()
14704 return 0; 27892 return 0;
14705} 27893}
14706_ACEOF 27894_ACEOF
14707if 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
14708 ac_cv_have_struct_sockaddr_in6="yes" 27912 ac_cv_have_struct_sockaddr_in6="yes"
14709else 27913else
14710 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"
14711 27918
14712fi 27919fi
27920
14713rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27921rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14714 27922
14715fi 27923fi
14716{ $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
14717$as_echo "$ac_cv_have_struct_sockaddr_in6" >&6; } 27925echo "${ECHO_T}$ac_cv_have_struct_sockaddr_in6" >&6; }
14718if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then 27926if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
14719 27927
14720$as_echo "#define HAVE_STRUCT_SOCKADDR_IN6 1" >>confdefs.h 27928cat >>confdefs.h <<\_ACEOF
27929#define HAVE_STRUCT_SOCKADDR_IN6 1
27930_ACEOF
14721 27931
14722fi 27932fi
14723 27933
14724{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct in6_addr" >&5 27934{ echo "$as_me:$LINENO: checking for struct in6_addr" >&5
14725$as_echo_n "checking for struct in6_addr... " >&6; } 27935echo $ECHO_N "checking for struct in6_addr... $ECHO_C" >&6; }
14726if ${ac_cv_have_struct_in6_addr+:} false; then : 27936if test "${ac_cv_have_struct_in6_addr+set}" = set; then
14727 $as_echo_n "(cached) " >&6 27937 echo $ECHO_N "(cached) $ECHO_C" >&6
14728else 27938else
14729 27939
14730 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
14731/* end confdefs.h. */ 27945/* end confdefs.h. */
14732 27946
14733#include <sys/types.h> 27947#include <sys/types.h>
@@ -14741,30 +27955,150 @@ main ()
14741 return 0; 27955 return 0;
14742} 27956}
14743_ACEOF 27957_ACEOF
14744if 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
14745 ac_cv_have_struct_in6_addr="yes" 27975 ac_cv_have_struct_in6_addr="yes"
14746else 27976else
14747 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"
14748 27981
14749fi 27982fi
27983
14750rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 27984rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14751 27985
14752fi 27986fi
14753{ $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
14754$as_echo "$ac_cv_have_struct_in6_addr" >&6; } 27988echo "${ECHO_T}$ac_cv_have_struct_in6_addr" >&6; }
14755if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then 27989if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
14756 27990
14757$as_echo "#define HAVE_STRUCT_IN6_ADDR 1" >>confdefs.h 27991cat >>confdefs.h <<\_ACEOF
27992#define HAVE_STRUCT_IN6_ADDR 1
27993_ACEOF
27994
14758 27995
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
28008#ifdef HAVE_SYS_TYPES_H
28009#include <sys/types.h>
28010#endif
28011#include <netinet/in.h>
28012
28013
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. */
14759 28052
14760 ac_fn_c_check_member "$LINENO" "struct sockaddr_in6" "sin6_scope_id" "ac_cv_member_struct_sockaddr_in6_sin6_scope_id" "
14761#ifdef HAVE_SYS_TYPES_H 28053#ifdef HAVE_SYS_TYPES_H
14762#include <sys/types.h> 28054#include <sys/types.h>
14763#endif 28055#endif
14764#include <netinet/in.h> 28056#include <netinet/in.h>
14765 28057
14766" 28058
14767if test "x$ac_cv_member_struct_sockaddr_in6_sin6_scope_id" = xyes; then : 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
14768 28102
14769cat >>confdefs.h <<_ACEOF 28103cat >>confdefs.h <<_ACEOF
14770#define HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1 28104#define HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1
@@ -14775,13 +28109,17 @@ fi
14775 28109
14776fi 28110fi
14777 28111
14778{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct addrinfo" >&5 28112{ echo "$as_me:$LINENO: checking for struct addrinfo" >&5
14779$as_echo_n "checking for struct addrinfo... " >&6; } 28113echo $ECHO_N "checking for struct addrinfo... $ECHO_C" >&6; }
14780if ${ac_cv_have_struct_addrinfo+:} false; then : 28114if test "${ac_cv_have_struct_addrinfo+set}" = set; then
14781 $as_echo_n "(cached) " >&6 28115 echo $ECHO_N "(cached) $ECHO_C" >&6
14782else 28116else
14783 28117
14784 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
14785/* end confdefs.h. */ 28123/* end confdefs.h. */
14786 28124
14787#include <sys/types.h> 28125#include <sys/types.h>
@@ -14796,30 +28134,56 @@ main ()
14796 return 0; 28134 return 0;
14797} 28135}
14798_ACEOF 28136_ACEOF
14799if 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
14800 ac_cv_have_struct_addrinfo="yes" 28154 ac_cv_have_struct_addrinfo="yes"
14801else 28155else
14802 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"
14803 28160
14804fi 28161fi
28162
14805rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 28163rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14806 28164
14807fi 28165fi
14808{ $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
14809$as_echo "$ac_cv_have_struct_addrinfo" >&6; } 28167echo "${ECHO_T}$ac_cv_have_struct_addrinfo" >&6; }
14810if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then 28168if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
14811 28169
14812$as_echo "#define HAVE_STRUCT_ADDRINFO 1" >>confdefs.h 28170cat >>confdefs.h <<\_ACEOF
28171#define HAVE_STRUCT_ADDRINFO 1
28172_ACEOF
14813 28173
14814fi 28174fi
14815 28175
14816{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timeval" >&5 28176{ echo "$as_me:$LINENO: checking for struct timeval" >&5
14817$as_echo_n "checking for struct timeval... " >&6; } 28177echo $ECHO_N "checking for struct timeval... $ECHO_C" >&6; }
14818if ${ac_cv_have_struct_timeval+:} false; then : 28178if test "${ac_cv_have_struct_timeval+set}" = set; then
14819 $as_echo_n "(cached) " >&6 28179 echo $ECHO_N "(cached) $ECHO_C" >&6
14820else 28180else
14821 28181
14822 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
14823/* end confdefs.h. */ 28187/* end confdefs.h. */
14824 #include <sys/time.h> 28188 #include <sys/time.h>
14825int 28189int
@@ -14830,26 +28194,100 @@ main ()
14830 return 0; 28194 return 0;
14831} 28195}
14832_ACEOF 28196_ACEOF
14833if 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
14834 ac_cv_have_struct_timeval="yes" 28214 ac_cv_have_struct_timeval="yes"
14835else 28215else
14836 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"
14837 28220
14838fi 28221fi
28222
14839rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 28223rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14840 28224
14841fi 28225fi
14842{ $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
14843$as_echo "$ac_cv_have_struct_timeval" >&6; } 28227echo "${ECHO_T}$ac_cv_have_struct_timeval" >&6; }
14844if test "x$ac_cv_have_struct_timeval" = "xyes" ; then 28228if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
14845 28229
14846$as_echo "#define HAVE_STRUCT_TIMEVAL 1" >>confdefs.h 28230cat >>confdefs.h <<\_ACEOF
28231#define HAVE_STRUCT_TIMEVAL 1
28232_ACEOF
14847 28233
14848 have_struct_timeval=1 28234 have_struct_timeval=1
14849fi 28235fi
14850 28236
14851ac_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
14852if 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
14853 28291
14854cat >>confdefs.h <<_ACEOF 28292cat >>confdefs.h <<_ACEOF
14855#define HAVE_STRUCT_TIMESPEC 1 28293#define HAVE_STRUCT_TIMESPEC 1
@@ -14868,12 +28306,16 @@ if test "x$ac_cv_have_int64_t" = "xno" && \
14868 echo "" 28306 echo ""
14869 exit 1; 28307 exit 1;
14870else 28308else
14871 if test "$cross_compiling" = yes; then : 28309 if test "$cross_compiling" = yes; then
14872 { $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
14873$as_echo "$as_me: WARNING: cross compiling: Assuming working snprintf()" >&2;} 28311echo "$as_me: WARNING: cross compiling: Assuming working snprintf()" >&2;}
14874 28312
14875else 28313else
14876 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
14877/* end confdefs.h. */ 28319/* end confdefs.h. */
14878 28320
14879#include <stdio.h> 28321#include <stdio.h>
@@ -14900,35 +28342,65 @@ main() { exit(0); }
14900#endif 28342#endif
14901 28343
14902_ACEOF 28344_ACEOF
14903if 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
14904 true 28365 true
14905else 28366else
14906 $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
14907 28375
14908fi 28376fi
14909rm -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
14910 conftest.$ac_objext conftest.beam conftest.$ac_ext
14911fi 28378fi
14912 28379
28380
14913fi 28381fi
14914 28382
14915 28383
14916# look for field 'ut_host' in header 'utmp.h' 28384# look for field 'ut_host' in header 'utmp.h'
14917 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 28385 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
14918 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_host 28386 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_host
14919 { $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
14920$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; }
14921 if eval \${$ossh_varname+:} false; then : 28389 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
14922 $as_echo_n "(cached) " >&6 28390 echo $ECHO_N "(cached) $ECHO_C" >&6
14923else 28391else
14924 28392
14925 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
14926/* end confdefs.h. */ 28398/* end confdefs.h. */
14927#include <utmp.h> 28399#include <utmp.h>
14928 28400
14929_ACEOF 28401_ACEOF
14930if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28402if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
14931 $EGREP "ut_host" >/dev/null 2>&1; then : 28403 $EGREP "ut_host" >/dev/null 2>&1; then
14932 eval "$ossh_varname=yes" 28404 eval "$ossh_varname=yes"
14933else 28405else
14934 eval "$ossh_varname=no" 28406 eval "$ossh_varname=no"
@@ -14939,35 +28411,41 @@ fi
14939 28411
14940 ossh_result=`eval 'echo $'"$ossh_varname"` 28412 ossh_result=`eval 'echo $'"$ossh_varname"`
14941 if test -n "`echo $ossh_varname`"; then 28413 if test -n "`echo $ossh_varname`"; then
14942 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28414 { echo "$as_me:$LINENO: result: $ossh_result" >&5
14943$as_echo "$ossh_result" >&6; } 28415echo "${ECHO_T}$ossh_result" >&6; }
14944 if test "x$ossh_result" = "xyes"; then 28416 if test "x$ossh_result" = "xyes"; then
14945 28417
14946$as_echo "#define HAVE_HOST_IN_UTMP 1" >>confdefs.h 28418cat >>confdefs.h <<\_ACEOF
28419#define HAVE_HOST_IN_UTMP 1
28420_ACEOF
14947 28421
14948 fi 28422 fi
14949 else 28423 else
14950 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28424 { echo "$as_me:$LINENO: result: no" >&5
14951$as_echo "no" >&6; } 28425echo "${ECHO_T}no" >&6; }
14952 fi 28426 fi
14953 28427
14954 28428
14955# look for field 'ut_host' in header 'utmpx.h' 28429# look for field 'ut_host' in header 'utmpx.h'
14956 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'` 28430 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
14957 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_host 28431 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_host
14958 { $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
14959$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; }
14960 if eval \${$ossh_varname+:} false; then : 28434 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
14961 $as_echo_n "(cached) " >&6 28435 echo $ECHO_N "(cached) $ECHO_C" >&6
14962else 28436else
14963 28437
14964 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
14965/* end confdefs.h. */ 28443/* end confdefs.h. */
14966#include <utmpx.h> 28444#include <utmpx.h>
14967 28445
14968_ACEOF 28446_ACEOF
14969if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28447if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
14970 $EGREP "ut_host" >/dev/null 2>&1; then : 28448 $EGREP "ut_host" >/dev/null 2>&1; then
14971 eval "$ossh_varname=yes" 28449 eval "$ossh_varname=yes"
14972else 28450else
14973 eval "$ossh_varname=no" 28451 eval "$ossh_varname=no"
@@ -14978,35 +28456,41 @@ fi
14978 28456
14979 ossh_result=`eval 'echo $'"$ossh_varname"` 28457 ossh_result=`eval 'echo $'"$ossh_varname"`
14980 if test -n "`echo $ossh_varname`"; then 28458 if test -n "`echo $ossh_varname`"; then
14981 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28459 { echo "$as_me:$LINENO: result: $ossh_result" >&5
14982$as_echo "$ossh_result" >&6; } 28460echo "${ECHO_T}$ossh_result" >&6; }
14983 if test "x$ossh_result" = "xyes"; then 28461 if test "x$ossh_result" = "xyes"; then
14984 28462
14985$as_echo "#define HAVE_HOST_IN_UTMPX 1" >>confdefs.h 28463cat >>confdefs.h <<\_ACEOF
28464#define HAVE_HOST_IN_UTMPX 1
28465_ACEOF
14986 28466
14987 fi 28467 fi
14988 else 28468 else
14989 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28469 { echo "$as_me:$LINENO: result: no" >&5
14990$as_echo "no" >&6; } 28470echo "${ECHO_T}no" >&6; }
14991 fi 28471 fi
14992 28472
14993 28473
14994# look for field 'syslen' in header 'utmpx.h' 28474# look for field 'syslen' in header 'utmpx.h'
14995 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'` 28475 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
14996 ossh_varname="ossh_cv_$ossh_safe""_has_"syslen 28476 ossh_varname="ossh_cv_$ossh_safe""_has_"syslen
14997 { $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
14998$as_echo_n "checking for syslen field in utmpx.h... " >&6; } 28478echo $ECHO_N "checking for syslen field in utmpx.h... $ECHO_C" >&6; }
14999 if eval \${$ossh_varname+:} false; then : 28479 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15000 $as_echo_n "(cached) " >&6 28480 echo $ECHO_N "(cached) $ECHO_C" >&6
15001else 28481else
15002 28482
15003 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
15004/* end confdefs.h. */ 28488/* end confdefs.h. */
15005#include <utmpx.h> 28489#include <utmpx.h>
15006 28490
15007_ACEOF 28491_ACEOF
15008if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28492if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15009 $EGREP "syslen" >/dev/null 2>&1; then : 28493 $EGREP "syslen" >/dev/null 2>&1; then
15010 eval "$ossh_varname=yes" 28494 eval "$ossh_varname=yes"
15011else 28495else
15012 eval "$ossh_varname=no" 28496 eval "$ossh_varname=no"
@@ -15017,35 +28501,41 @@ fi
15017 28501
15018 ossh_result=`eval 'echo $'"$ossh_varname"` 28502 ossh_result=`eval 'echo $'"$ossh_varname"`
15019 if test -n "`echo $ossh_varname`"; then 28503 if test -n "`echo $ossh_varname`"; then
15020 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28504 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15021$as_echo "$ossh_result" >&6; } 28505echo "${ECHO_T}$ossh_result" >&6; }
15022 if test "x$ossh_result" = "xyes"; then 28506 if test "x$ossh_result" = "xyes"; then
15023 28507
15024$as_echo "#define HAVE_SYSLEN_IN_UTMPX 1" >>confdefs.h 28508cat >>confdefs.h <<\_ACEOF
28509#define HAVE_SYSLEN_IN_UTMPX 1
28510_ACEOF
15025 28511
15026 fi 28512 fi
15027 else 28513 else
15028 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28514 { echo "$as_me:$LINENO: result: no" >&5
15029$as_echo "no" >&6; } 28515echo "${ECHO_T}no" >&6; }
15030 fi 28516 fi
15031 28517
15032 28518
15033# look for field 'ut_pid' in header 'utmp.h' 28519# look for field 'ut_pid' in header 'utmp.h'
15034 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 28520 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
15035 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_pid 28521 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_pid
15036 { $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
15037$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; }
15038 if eval \${$ossh_varname+:} false; then : 28524 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15039 $as_echo_n "(cached) " >&6 28525 echo $ECHO_N "(cached) $ECHO_C" >&6
15040else 28526else
15041 28527
15042 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
15043/* end confdefs.h. */ 28533/* end confdefs.h. */
15044#include <utmp.h> 28534#include <utmp.h>
15045 28535
15046_ACEOF 28536_ACEOF
15047if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28537if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15048 $EGREP "ut_pid" >/dev/null 2>&1; then : 28538 $EGREP "ut_pid" >/dev/null 2>&1; then
15049 eval "$ossh_varname=yes" 28539 eval "$ossh_varname=yes"
15050else 28540else
15051 eval "$ossh_varname=no" 28541 eval "$ossh_varname=no"
@@ -15056,35 +28546,41 @@ fi
15056 28546
15057 ossh_result=`eval 'echo $'"$ossh_varname"` 28547 ossh_result=`eval 'echo $'"$ossh_varname"`
15058 if test -n "`echo $ossh_varname`"; then 28548 if test -n "`echo $ossh_varname`"; then
15059 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28549 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15060$as_echo "$ossh_result" >&6; } 28550echo "${ECHO_T}$ossh_result" >&6; }
15061 if test "x$ossh_result" = "xyes"; then 28551 if test "x$ossh_result" = "xyes"; then
15062 28552
15063$as_echo "#define HAVE_PID_IN_UTMP 1" >>confdefs.h 28553cat >>confdefs.h <<\_ACEOF
28554#define HAVE_PID_IN_UTMP 1
28555_ACEOF
15064 28556
15065 fi 28557 fi
15066 else 28558 else
15067 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28559 { echo "$as_me:$LINENO: result: no" >&5
15068$as_echo "no" >&6; } 28560echo "${ECHO_T}no" >&6; }
15069 fi 28561 fi
15070 28562
15071 28563
15072# look for field 'ut_type' in header 'utmp.h' 28564# look for field 'ut_type' in header 'utmp.h'
15073 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 28565 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
15074 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_type 28566 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_type
15075 { $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
15076$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; }
15077 if eval \${$ossh_varname+:} false; then : 28569 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15078 $as_echo_n "(cached) " >&6 28570 echo $ECHO_N "(cached) $ECHO_C" >&6
15079else 28571else
15080 28572
15081 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
15082/* end confdefs.h. */ 28578/* end confdefs.h. */
15083#include <utmp.h> 28579#include <utmp.h>
15084 28580
15085_ACEOF 28581_ACEOF
15086if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28582if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15087 $EGREP "ut_type" >/dev/null 2>&1; then : 28583 $EGREP "ut_type" >/dev/null 2>&1; then
15088 eval "$ossh_varname=yes" 28584 eval "$ossh_varname=yes"
15089else 28585else
15090 eval "$ossh_varname=no" 28586 eval "$ossh_varname=no"
@@ -15095,35 +28591,41 @@ fi
15095 28591
15096 ossh_result=`eval 'echo $'"$ossh_varname"` 28592 ossh_result=`eval 'echo $'"$ossh_varname"`
15097 if test -n "`echo $ossh_varname`"; then 28593 if test -n "`echo $ossh_varname`"; then
15098 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28594 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15099$as_echo "$ossh_result" >&6; } 28595echo "${ECHO_T}$ossh_result" >&6; }
15100 if test "x$ossh_result" = "xyes"; then 28596 if test "x$ossh_result" = "xyes"; then
15101 28597
15102$as_echo "#define HAVE_TYPE_IN_UTMP 1" >>confdefs.h 28598cat >>confdefs.h <<\_ACEOF
28599#define HAVE_TYPE_IN_UTMP 1
28600_ACEOF
15103 28601
15104 fi 28602 fi
15105 else 28603 else
15106 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28604 { echo "$as_me:$LINENO: result: no" >&5
15107$as_echo "no" >&6; } 28605echo "${ECHO_T}no" >&6; }
15108 fi 28606 fi
15109 28607
15110 28608
15111# look for field 'ut_type' in header 'utmpx.h' 28609# look for field 'ut_type' in header 'utmpx.h'
15112 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'` 28610 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
15113 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_type 28611 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_type
15114 { $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
15115$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; }
15116 if eval \${$ossh_varname+:} false; then : 28614 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15117 $as_echo_n "(cached) " >&6 28615 echo $ECHO_N "(cached) $ECHO_C" >&6
15118else 28616else
15119 28617
15120 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
15121/* end confdefs.h. */ 28623/* end confdefs.h. */
15122#include <utmpx.h> 28624#include <utmpx.h>
15123 28625
15124_ACEOF 28626_ACEOF
15125if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28627if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15126 $EGREP "ut_type" >/dev/null 2>&1; then : 28628 $EGREP "ut_type" >/dev/null 2>&1; then
15127 eval "$ossh_varname=yes" 28629 eval "$ossh_varname=yes"
15128else 28630else
15129 eval "$ossh_varname=no" 28631 eval "$ossh_varname=no"
@@ -15134,35 +28636,41 @@ fi
15134 28636
15135 ossh_result=`eval 'echo $'"$ossh_varname"` 28637 ossh_result=`eval 'echo $'"$ossh_varname"`
15136 if test -n "`echo $ossh_varname`"; then 28638 if test -n "`echo $ossh_varname`"; then
15137 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28639 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15138$as_echo "$ossh_result" >&6; } 28640echo "${ECHO_T}$ossh_result" >&6; }
15139 if test "x$ossh_result" = "xyes"; then 28641 if test "x$ossh_result" = "xyes"; then
15140 28642
15141$as_echo "#define HAVE_TYPE_IN_UTMPX 1" >>confdefs.h 28643cat >>confdefs.h <<\_ACEOF
28644#define HAVE_TYPE_IN_UTMPX 1
28645_ACEOF
15142 28646
15143 fi 28647 fi
15144 else 28648 else
15145 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28649 { echo "$as_me:$LINENO: result: no" >&5
15146$as_echo "no" >&6; } 28650echo "${ECHO_T}no" >&6; }
15147 fi 28651 fi
15148 28652
15149 28653
15150# look for field 'ut_tv' in header 'utmp.h' 28654# look for field 'ut_tv' in header 'utmp.h'
15151 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 28655 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
15152 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_tv 28656 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_tv
15153 { $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
15154$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; }
15155 if eval \${$ossh_varname+:} false; then : 28659 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15156 $as_echo_n "(cached) " >&6 28660 echo $ECHO_N "(cached) $ECHO_C" >&6
15157else 28661else
15158 28662
15159 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
15160/* end confdefs.h. */ 28668/* end confdefs.h. */
15161#include <utmp.h> 28669#include <utmp.h>
15162 28670
15163_ACEOF 28671_ACEOF
15164if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28672if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15165 $EGREP "ut_tv" >/dev/null 2>&1; then : 28673 $EGREP "ut_tv" >/dev/null 2>&1; then
15166 eval "$ossh_varname=yes" 28674 eval "$ossh_varname=yes"
15167else 28675else
15168 eval "$ossh_varname=no" 28676 eval "$ossh_varname=no"
@@ -15173,35 +28681,41 @@ fi
15173 28681
15174 ossh_result=`eval 'echo $'"$ossh_varname"` 28682 ossh_result=`eval 'echo $'"$ossh_varname"`
15175 if test -n "`echo $ossh_varname`"; then 28683 if test -n "`echo $ossh_varname`"; then
15176 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28684 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15177$as_echo "$ossh_result" >&6; } 28685echo "${ECHO_T}$ossh_result" >&6; }
15178 if test "x$ossh_result" = "xyes"; then 28686 if test "x$ossh_result" = "xyes"; then
15179 28687
15180$as_echo "#define HAVE_TV_IN_UTMP 1" >>confdefs.h 28688cat >>confdefs.h <<\_ACEOF
28689#define HAVE_TV_IN_UTMP 1
28690_ACEOF
15181 28691
15182 fi 28692 fi
15183 else 28693 else
15184 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28694 { echo "$as_me:$LINENO: result: no" >&5
15185$as_echo "no" >&6; } 28695echo "${ECHO_T}no" >&6; }
15186 fi 28696 fi
15187 28697
15188 28698
15189# look for field 'ut_id' in header 'utmp.h' 28699# look for field 'ut_id' in header 'utmp.h'
15190 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 28700 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
15191 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_id 28701 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_id
15192 { $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
15193$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; }
15194 if eval \${$ossh_varname+:} false; then : 28704 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15195 $as_echo_n "(cached) " >&6 28705 echo $ECHO_N "(cached) $ECHO_C" >&6
15196else 28706else
15197 28707
15198 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
15199/* end confdefs.h. */ 28713/* end confdefs.h. */
15200#include <utmp.h> 28714#include <utmp.h>
15201 28715
15202_ACEOF 28716_ACEOF
15203if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28717if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15204 $EGREP "ut_id" >/dev/null 2>&1; then : 28718 $EGREP "ut_id" >/dev/null 2>&1; then
15205 eval "$ossh_varname=yes" 28719 eval "$ossh_varname=yes"
15206else 28720else
15207 eval "$ossh_varname=no" 28721 eval "$ossh_varname=no"
@@ -15212,35 +28726,41 @@ fi
15212 28726
15213 ossh_result=`eval 'echo $'"$ossh_varname"` 28727 ossh_result=`eval 'echo $'"$ossh_varname"`
15214 if test -n "`echo $ossh_varname`"; then 28728 if test -n "`echo $ossh_varname`"; then
15215 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28729 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15216$as_echo "$ossh_result" >&6; } 28730echo "${ECHO_T}$ossh_result" >&6; }
15217 if test "x$ossh_result" = "xyes"; then 28731 if test "x$ossh_result" = "xyes"; then
15218 28732
15219$as_echo "#define HAVE_ID_IN_UTMP 1" >>confdefs.h 28733cat >>confdefs.h <<\_ACEOF
28734#define HAVE_ID_IN_UTMP 1
28735_ACEOF
15220 28736
15221 fi 28737 fi
15222 else 28738 else
15223 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28739 { echo "$as_me:$LINENO: result: no" >&5
15224$as_echo "no" >&6; } 28740echo "${ECHO_T}no" >&6; }
15225 fi 28741 fi
15226 28742
15227 28743
15228# look for field 'ut_id' in header 'utmpx.h' 28744# look for field 'ut_id' in header 'utmpx.h'
15229 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'` 28745 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
15230 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_id 28746 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_id
15231 { $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
15232$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; }
15233 if eval \${$ossh_varname+:} false; then : 28749 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15234 $as_echo_n "(cached) " >&6 28750 echo $ECHO_N "(cached) $ECHO_C" >&6
15235else 28751else
15236 28752
15237 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
15238/* end confdefs.h. */ 28758/* end confdefs.h. */
15239#include <utmpx.h> 28759#include <utmpx.h>
15240 28760
15241_ACEOF 28761_ACEOF
15242if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28762if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15243 $EGREP "ut_id" >/dev/null 2>&1; then : 28763 $EGREP "ut_id" >/dev/null 2>&1; then
15244 eval "$ossh_varname=yes" 28764 eval "$ossh_varname=yes"
15245else 28765else
15246 eval "$ossh_varname=no" 28766 eval "$ossh_varname=no"
@@ -15251,35 +28771,41 @@ fi
15251 28771
15252 ossh_result=`eval 'echo $'"$ossh_varname"` 28772 ossh_result=`eval 'echo $'"$ossh_varname"`
15253 if test -n "`echo $ossh_varname`"; then 28773 if test -n "`echo $ossh_varname`"; then
15254 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28774 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15255$as_echo "$ossh_result" >&6; } 28775echo "${ECHO_T}$ossh_result" >&6; }
15256 if test "x$ossh_result" = "xyes"; then 28776 if test "x$ossh_result" = "xyes"; then
15257 28777
15258$as_echo "#define HAVE_ID_IN_UTMPX 1" >>confdefs.h 28778cat >>confdefs.h <<\_ACEOF
28779#define HAVE_ID_IN_UTMPX 1
28780_ACEOF
15259 28781
15260 fi 28782 fi
15261 else 28783 else
15262 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28784 { echo "$as_me:$LINENO: result: no" >&5
15263$as_echo "no" >&6; } 28785echo "${ECHO_T}no" >&6; }
15264 fi 28786 fi
15265 28787
15266 28788
15267# look for field 'ut_addr' in header 'utmp.h' 28789# look for field 'ut_addr' in header 'utmp.h'
15268 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 28790 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
15269 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr 28791 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr
15270 { $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
15271$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; }
15272 if eval \${$ossh_varname+:} false; then : 28794 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15273 $as_echo_n "(cached) " >&6 28795 echo $ECHO_N "(cached) $ECHO_C" >&6
15274else 28796else
15275 28797
15276 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
15277/* end confdefs.h. */ 28803/* end confdefs.h. */
15278#include <utmp.h> 28804#include <utmp.h>
15279 28805
15280_ACEOF 28806_ACEOF
15281if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28807if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15282 $EGREP "ut_addr" >/dev/null 2>&1; then : 28808 $EGREP "ut_addr" >/dev/null 2>&1; then
15283 eval "$ossh_varname=yes" 28809 eval "$ossh_varname=yes"
15284else 28810else
15285 eval "$ossh_varname=no" 28811 eval "$ossh_varname=no"
@@ -15290,35 +28816,41 @@ fi
15290 28816
15291 ossh_result=`eval 'echo $'"$ossh_varname"` 28817 ossh_result=`eval 'echo $'"$ossh_varname"`
15292 if test -n "`echo $ossh_varname`"; then 28818 if test -n "`echo $ossh_varname`"; then
15293 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28819 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15294$as_echo "$ossh_result" >&6; } 28820echo "${ECHO_T}$ossh_result" >&6; }
15295 if test "x$ossh_result" = "xyes"; then 28821 if test "x$ossh_result" = "xyes"; then
15296 28822
15297$as_echo "#define HAVE_ADDR_IN_UTMP 1" >>confdefs.h 28823cat >>confdefs.h <<\_ACEOF
28824#define HAVE_ADDR_IN_UTMP 1
28825_ACEOF
15298 28826
15299 fi 28827 fi
15300 else 28828 else
15301 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28829 { echo "$as_me:$LINENO: result: no" >&5
15302$as_echo "no" >&6; } 28830echo "${ECHO_T}no" >&6; }
15303 fi 28831 fi
15304 28832
15305 28833
15306# look for field 'ut_addr' in header 'utmpx.h' 28834# look for field 'ut_addr' in header 'utmpx.h'
15307 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'` 28835 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
15308 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr 28836 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr
15309 { $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
15310$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; }
15311 if eval \${$ossh_varname+:} false; then : 28839 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15312 $as_echo_n "(cached) " >&6 28840 echo $ECHO_N "(cached) $ECHO_C" >&6
15313else 28841else
15314 28842
15315 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
15316/* end confdefs.h. */ 28848/* end confdefs.h. */
15317#include <utmpx.h> 28849#include <utmpx.h>
15318 28850
15319_ACEOF 28851_ACEOF
15320if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28852if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15321 $EGREP "ut_addr" >/dev/null 2>&1; then : 28853 $EGREP "ut_addr" >/dev/null 2>&1; then
15322 eval "$ossh_varname=yes" 28854 eval "$ossh_varname=yes"
15323else 28855else
15324 eval "$ossh_varname=no" 28856 eval "$ossh_varname=no"
@@ -15329,35 +28861,41 @@ fi
15329 28861
15330 ossh_result=`eval 'echo $'"$ossh_varname"` 28862 ossh_result=`eval 'echo $'"$ossh_varname"`
15331 if test -n "`echo $ossh_varname`"; then 28863 if test -n "`echo $ossh_varname`"; then
15332 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28864 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15333$as_echo "$ossh_result" >&6; } 28865echo "${ECHO_T}$ossh_result" >&6; }
15334 if test "x$ossh_result" = "xyes"; then 28866 if test "x$ossh_result" = "xyes"; then
15335 28867
15336$as_echo "#define HAVE_ADDR_IN_UTMPX 1" >>confdefs.h 28868cat >>confdefs.h <<\_ACEOF
28869#define HAVE_ADDR_IN_UTMPX 1
28870_ACEOF
15337 28871
15338 fi 28872 fi
15339 else 28873 else
15340 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28874 { echo "$as_me:$LINENO: result: no" >&5
15341$as_echo "no" >&6; } 28875echo "${ECHO_T}no" >&6; }
15342 fi 28876 fi
15343 28877
15344 28878
15345# look for field 'ut_addr_v6' in header 'utmp.h' 28879# look for field 'ut_addr_v6' in header 'utmp.h'
15346 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 28880 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
15347 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr_v6 28881 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr_v6
15348 { $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
15349$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; }
15350 if eval \${$ossh_varname+:} false; then : 28884 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15351 $as_echo_n "(cached) " >&6 28885 echo $ECHO_N "(cached) $ECHO_C" >&6
15352else 28886else
15353 28887
15354 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
15355/* end confdefs.h. */ 28893/* end confdefs.h. */
15356#include <utmp.h> 28894#include <utmp.h>
15357 28895
15358_ACEOF 28896_ACEOF
15359if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28897if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15360 $EGREP "ut_addr_v6" >/dev/null 2>&1; then : 28898 $EGREP "ut_addr_v6" >/dev/null 2>&1; then
15361 eval "$ossh_varname=yes" 28899 eval "$ossh_varname=yes"
15362else 28900else
15363 eval "$ossh_varname=no" 28901 eval "$ossh_varname=no"
@@ -15368,35 +28906,41 @@ fi
15368 28906
15369 ossh_result=`eval 'echo $'"$ossh_varname"` 28907 ossh_result=`eval 'echo $'"$ossh_varname"`
15370 if test -n "`echo $ossh_varname`"; then 28908 if test -n "`echo $ossh_varname`"; then
15371 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28909 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15372$as_echo "$ossh_result" >&6; } 28910echo "${ECHO_T}$ossh_result" >&6; }
15373 if test "x$ossh_result" = "xyes"; then 28911 if test "x$ossh_result" = "xyes"; then
15374 28912
15375$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
15376 28916
15377 fi 28917 fi
15378 else 28918 else
15379 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28919 { echo "$as_me:$LINENO: result: no" >&5
15380$as_echo "no" >&6; } 28920echo "${ECHO_T}no" >&6; }
15381 fi 28921 fi
15382 28922
15383 28923
15384# look for field 'ut_addr_v6' in header 'utmpx.h' 28924# look for field 'ut_addr_v6' in header 'utmpx.h'
15385 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'` 28925 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
15386 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr_v6 28926 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr_v6
15387 { $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
15388$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; }
15389 if eval \${$ossh_varname+:} false; then : 28929 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15390 $as_echo_n "(cached) " >&6 28930 echo $ECHO_N "(cached) $ECHO_C" >&6
15391else 28931else
15392 28932
15393 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
15394/* end confdefs.h. */ 28938/* end confdefs.h. */
15395#include <utmpx.h> 28939#include <utmpx.h>
15396 28940
15397_ACEOF 28941_ACEOF
15398if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28942if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15399 $EGREP "ut_addr_v6" >/dev/null 2>&1; then : 28943 $EGREP "ut_addr_v6" >/dev/null 2>&1; then
15400 eval "$ossh_varname=yes" 28944 eval "$ossh_varname=yes"
15401else 28945else
15402 eval "$ossh_varname=no" 28946 eval "$ossh_varname=no"
@@ -15407,35 +28951,41 @@ fi
15407 28951
15408 ossh_result=`eval 'echo $'"$ossh_varname"` 28952 ossh_result=`eval 'echo $'"$ossh_varname"`
15409 if test -n "`echo $ossh_varname`"; then 28953 if test -n "`echo $ossh_varname`"; then
15410 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28954 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15411$as_echo "$ossh_result" >&6; } 28955echo "${ECHO_T}$ossh_result" >&6; }
15412 if test "x$ossh_result" = "xyes"; then 28956 if test "x$ossh_result" = "xyes"; then
15413 28957
15414$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
15415 28961
15416 fi 28962 fi
15417 else 28963 else
15418 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 28964 { echo "$as_me:$LINENO: result: no" >&5
15419$as_echo "no" >&6; } 28965echo "${ECHO_T}no" >&6; }
15420 fi 28966 fi
15421 28967
15422 28968
15423# look for field 'ut_exit' in header 'utmp.h' 28969# look for field 'ut_exit' in header 'utmp.h'
15424 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 28970 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
15425 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_exit 28971 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_exit
15426 { $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
15427$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; }
15428 if eval \${$ossh_varname+:} false; then : 28974 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15429 $as_echo_n "(cached) " >&6 28975 echo $ECHO_N "(cached) $ECHO_C" >&6
15430else 28976else
15431 28977
15432 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
15433/* end confdefs.h. */ 28983/* end confdefs.h. */
15434#include <utmp.h> 28984#include <utmp.h>
15435 28985
15436_ACEOF 28986_ACEOF
15437if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 28987if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15438 $EGREP "ut_exit" >/dev/null 2>&1; then : 28988 $EGREP "ut_exit" >/dev/null 2>&1; then
15439 eval "$ossh_varname=yes" 28989 eval "$ossh_varname=yes"
15440else 28990else
15441 eval "$ossh_varname=no" 28991 eval "$ossh_varname=no"
@@ -15446,35 +28996,41 @@ fi
15446 28996
15447 ossh_result=`eval 'echo $'"$ossh_varname"` 28997 ossh_result=`eval 'echo $'"$ossh_varname"`
15448 if test -n "`echo $ossh_varname`"; then 28998 if test -n "`echo $ossh_varname`"; then
15449 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 28999 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15450$as_echo "$ossh_result" >&6; } 29000echo "${ECHO_T}$ossh_result" >&6; }
15451 if test "x$ossh_result" = "xyes"; then 29001 if test "x$ossh_result" = "xyes"; then
15452 29002
15453$as_echo "#define HAVE_EXIT_IN_UTMP 1" >>confdefs.h 29003cat >>confdefs.h <<\_ACEOF
29004#define HAVE_EXIT_IN_UTMP 1
29005_ACEOF
15454 29006
15455 fi 29007 fi
15456 else 29008 else
15457 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 29009 { echo "$as_me:$LINENO: result: no" >&5
15458$as_echo "no" >&6; } 29010echo "${ECHO_T}no" >&6; }
15459 fi 29011 fi
15460 29012
15461 29013
15462# look for field 'ut_time' in header 'utmp.h' 29014# look for field 'ut_time' in header 'utmp.h'
15463 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'` 29015 ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
15464 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_time 29016 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_time
15465 { $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
15466$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; }
15467 if eval \${$ossh_varname+:} false; then : 29019 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15468 $as_echo_n "(cached) " >&6 29020 echo $ECHO_N "(cached) $ECHO_C" >&6
15469else 29021else
15470 29022
15471 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
15472/* end confdefs.h. */ 29028/* end confdefs.h. */
15473#include <utmp.h> 29029#include <utmp.h>
15474 29030
15475_ACEOF 29031_ACEOF
15476if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 29032if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15477 $EGREP "ut_time" >/dev/null 2>&1; then : 29033 $EGREP "ut_time" >/dev/null 2>&1; then
15478 eval "$ossh_varname=yes" 29034 eval "$ossh_varname=yes"
15479else 29035else
15480 eval "$ossh_varname=no" 29036 eval "$ossh_varname=no"
@@ -15485,35 +29041,41 @@ fi
15485 29041
15486 ossh_result=`eval 'echo $'"$ossh_varname"` 29042 ossh_result=`eval 'echo $'"$ossh_varname"`
15487 if test -n "`echo $ossh_varname`"; then 29043 if test -n "`echo $ossh_varname`"; then
15488 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 29044 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15489$as_echo "$ossh_result" >&6; } 29045echo "${ECHO_T}$ossh_result" >&6; }
15490 if test "x$ossh_result" = "xyes"; then 29046 if test "x$ossh_result" = "xyes"; then
15491 29047
15492$as_echo "#define HAVE_TIME_IN_UTMP 1" >>confdefs.h 29048cat >>confdefs.h <<\_ACEOF
29049#define HAVE_TIME_IN_UTMP 1
29050_ACEOF
15493 29051
15494 fi 29052 fi
15495 else 29053 else
15496 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 29054 { echo "$as_me:$LINENO: result: no" >&5
15497$as_echo "no" >&6; } 29055echo "${ECHO_T}no" >&6; }
15498 fi 29056 fi
15499 29057
15500 29058
15501# look for field 'ut_time' in header 'utmpx.h' 29059# look for field 'ut_time' in header 'utmpx.h'
15502 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'` 29060 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
15503 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_time 29061 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_time
15504 { $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
15505$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; }
15506 if eval \${$ossh_varname+:} false; then : 29064 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15507 $as_echo_n "(cached) " >&6 29065 echo $ECHO_N "(cached) $ECHO_C" >&6
15508else 29066else
15509 29067
15510 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
15511/* end confdefs.h. */ 29073/* end confdefs.h. */
15512#include <utmpx.h> 29074#include <utmpx.h>
15513 29075
15514_ACEOF 29076_ACEOF
15515if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 29077if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15516 $EGREP "ut_time" >/dev/null 2>&1; then : 29078 $EGREP "ut_time" >/dev/null 2>&1; then
15517 eval "$ossh_varname=yes" 29079 eval "$ossh_varname=yes"
15518else 29080else
15519 eval "$ossh_varname=no" 29081 eval "$ossh_varname=no"
@@ -15524,35 +29086,41 @@ fi
15524 29086
15525 ossh_result=`eval 'echo $'"$ossh_varname"` 29087 ossh_result=`eval 'echo $'"$ossh_varname"`
15526 if test -n "`echo $ossh_varname`"; then 29088 if test -n "`echo $ossh_varname`"; then
15527 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 29089 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15528$as_echo "$ossh_result" >&6; } 29090echo "${ECHO_T}$ossh_result" >&6; }
15529 if test "x$ossh_result" = "xyes"; then 29091 if test "x$ossh_result" = "xyes"; then
15530 29092
15531$as_echo "#define HAVE_TIME_IN_UTMPX 1" >>confdefs.h 29093cat >>confdefs.h <<\_ACEOF
29094#define HAVE_TIME_IN_UTMPX 1
29095_ACEOF
15532 29096
15533 fi 29097 fi
15534 else 29098 else
15535 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 29099 { echo "$as_me:$LINENO: result: no" >&5
15536$as_echo "no" >&6; } 29100echo "${ECHO_T}no" >&6; }
15537 fi 29101 fi
15538 29102
15539 29103
15540# look for field 'ut_tv' in header 'utmpx.h' 29104# look for field 'ut_tv' in header 'utmpx.h'
15541 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'` 29105 ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
15542 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_tv 29106 ossh_varname="ossh_cv_$ossh_safe""_has_"ut_tv
15543 { $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
15544$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; }
15545 if eval \${$ossh_varname+:} false; then : 29109 if { as_var=$ossh_varname; eval "test \"\${$as_var+set}\" = set"; }; then
15546 $as_echo_n "(cached) " >&6 29110 echo $ECHO_N "(cached) $ECHO_C" >&6
15547else 29111else
15548 29112
15549 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
15550/* end confdefs.h. */ 29118/* end confdefs.h. */
15551#include <utmpx.h> 29119#include <utmpx.h>
15552 29120
15553_ACEOF 29121_ACEOF
15554if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | 29122if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
15555 $EGREP "ut_tv" >/dev/null 2>&1; then : 29123 $EGREP "ut_tv" >/dev/null 2>&1; then
15556 eval "$ossh_varname=yes" 29124 eval "$ossh_varname=yes"
15557else 29125else
15558 eval "$ossh_varname=no" 29126 eval "$ossh_varname=no"
@@ -15563,21 +29131,115 @@ fi
15563 29131
15564 ossh_result=`eval 'echo $'"$ossh_varname"` 29132 ossh_result=`eval 'echo $'"$ossh_varname"`
15565 if test -n "`echo $ossh_varname`"; then 29133 if test -n "`echo $ossh_varname`"; then
15566 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ossh_result" >&5 29134 { echo "$as_me:$LINENO: result: $ossh_result" >&5
15567$as_echo "$ossh_result" >&6; } 29135echo "${ECHO_T}$ossh_result" >&6; }
15568 if test "x$ossh_result" = "xyes"; then 29136 if test "x$ossh_result" = "xyes"; then
15569 29137
15570$as_echo "#define HAVE_TV_IN_UTMPX 1" >>confdefs.h 29138cat >>confdefs.h <<\_ACEOF
29139#define HAVE_TV_IN_UTMPX 1
29140_ACEOF
15571 29141
15572 fi 29142 fi
15573 else 29143 else
15574 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 29144 { echo "$as_me:$LINENO: result: no" >&5
15575$as_echo "no" >&6; } 29145echo "${ECHO_T}no" >&6; }
15576 fi 29146 fi
15577 29147
15578 29148
15579ac_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
15580if 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
15581 29243
15582cat >>confdefs.h <<_ACEOF 29244cat >>confdefs.h <<_ACEOF
15583#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 29245#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
@@ -15586,12 +29248,108 @@ _ACEOF
15586 29248
15587fi 29249fi
15588 29250
15589ac_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
15590#include <sys/types.h> 29263#include <sys/types.h>
15591#include <pwd.h> 29264#include <pwd.h>
15592 29265
15593" 29266
15594if 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
15595 29353
15596cat >>confdefs.h <<_ACEOF 29354cat >>confdefs.h <<_ACEOF
15597#define HAVE_STRUCT_PASSWD_PW_GECOS 1 29355#define HAVE_STRUCT_PASSWD_PW_GECOS 1
@@ -15599,12 +29357,108 @@ _ACEOF
15599 29357
15600 29358
15601fi 29359fi
15602ac_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
15603#include <sys/types.h> 29372#include <sys/types.h>
15604#include <pwd.h> 29373#include <pwd.h>
15605 29374
15606" 29375
15607if test "x$ac_cv_member_struct_passwd_pw_class" = xyes; then : 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
29415#include <sys/types.h>
29416#include <pwd.h>
29417
29418
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
15608 29462
15609cat >>confdefs.h <<_ACEOF 29463cat >>confdefs.h <<_ACEOF
15610#define HAVE_STRUCT_PASSWD_PW_CLASS 1 29464#define HAVE_STRUCT_PASSWD_PW_CLASS 1
@@ -15612,12 +29466,108 @@ _ACEOF
15612 29466
15613 29467
15614fi 29468fi
15615ac_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
15616#include <sys/types.h> 29481#include <sys/types.h>
15617#include <pwd.h> 29482#include <pwd.h>
15618 29483
15619" 29484
15620if 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
15621 29571
15622cat >>confdefs.h <<_ACEOF 29572cat >>confdefs.h <<_ACEOF
15623#define HAVE_STRUCT_PASSWD_PW_CHANGE 1 29573#define HAVE_STRUCT_PASSWD_PW_CHANGE 1
@@ -15625,12 +29575,108 @@ _ACEOF
15625 29575
15626 29576
15627fi 29577fi
15628ac_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
15629#include <sys/types.h> 29590#include <sys/types.h>
15630#include <pwd.h> 29591#include <pwd.h>
15631 29592
15632" 29593
15633if 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
15634 29680
15635cat >>confdefs.h <<_ACEOF 29681cat >>confdefs.h <<_ACEOF
15636#define HAVE_STRUCT_PASSWD_PW_EXPIRE 1 29682#define HAVE_STRUCT_PASSWD_PW_EXPIRE 1
@@ -15640,7 +29686,18 @@ _ACEOF
15640fi 29686fi
15641 29687
15642 29688
15643ac_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
15644#include <stdio.h> 29701#include <stdio.h>
15645#if HAVE_SYS_TYPES_H 29702#if HAVE_SYS_TYPES_H
15646# include <sys/types.h> 29703# include <sys/types.h>
@@ -15649,23 +29706,119 @@ ac_fn_c_check_member "$LINENO" "struct __res_state" "retrans" "ac_cv_member_stru
15649#include <arpa/nameser.h> 29706#include <arpa/nameser.h>
15650#include <resolv.h> 29707#include <resolv.h>
15651 29708
15652"
15653if test "x$ac_cv_member_struct___res_state_retrans" = xyes; then :
15654 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
29786else
29787 echo "$as_me: failed program was:" >&5
29788sed 's/^/| /' conftest.$ac_ext >&5
29789
29790 ac_cv_member_struct___res_state_retrans=no
29791fi
29792
29793rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
29794fi
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 :
15655else 29802else
15656 29803
15657$as_echo "#define __res_state state" >>confdefs.h 29804cat >>confdefs.h <<\_ACEOF
29805#define __res_state state
29806_ACEOF
15658 29807
15659fi 29808fi
15660 29809
15661 29810
15662{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ss_family field in struct sockaddr_storage" >&5 29811{ echo "$as_me:$LINENO: checking for ss_family field in struct sockaddr_storage" >&5
15663$as_echo_n "checking for ss_family field in struct sockaddr_storage... " >&6; } 29812echo $ECHO_N "checking for ss_family field in struct sockaddr_storage... $ECHO_C" >&6; }
15664if ${ac_cv_have_ss_family_in_struct_ss+:} false; then : 29813if test "${ac_cv_have_ss_family_in_struct_ss+set}" = set; then
15665 $as_echo_n "(cached) " >&6 29814 echo $ECHO_N "(cached) $ECHO_C" >&6
15666else 29815else
15667 29816
15668 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
15669/* end confdefs.h. */ 29822/* end confdefs.h. */
15670 29823
15671#include <sys/types.h> 29824#include <sys/types.h>
@@ -15679,29 +29832,55 @@ main ()
15679 return 0; 29832 return 0;
15680} 29833}
15681_ACEOF 29834_ACEOF
15682if 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
15683 ac_cv_have_ss_family_in_struct_ss="yes" 29852 ac_cv_have_ss_family_in_struct_ss="yes"
15684else 29853else
15685 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"
15686fi 29858fi
29859
15687rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 29860rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15688 29861
15689fi 29862fi
15690{ $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
15691$as_echo "$ac_cv_have_ss_family_in_struct_ss" >&6; } 29864echo "${ECHO_T}$ac_cv_have_ss_family_in_struct_ss" >&6; }
15692if 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
15693 29866
15694$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
15695 29870
15696fi 29871fi
15697 29872
15698{ $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
15699$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; }
15700if ${ac_cv_have___ss_family_in_struct_ss+:} false; then : 29875if test "${ac_cv_have___ss_family_in_struct_ss+set}" = set; then
15701 $as_echo_n "(cached) " >&6 29876 echo $ECHO_N "(cached) $ECHO_C" >&6
15702else 29877else
15703 29878
15704 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
15705/* end confdefs.h. */ 29884/* end confdefs.h. */
15706 29885
15707#include <sys/types.h> 29886#include <sys/types.h>
@@ -15715,30 +29894,56 @@ main ()
15715 return 0; 29894 return 0;
15716} 29895}
15717_ACEOF 29896_ACEOF
15718if 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
15719 ac_cv_have___ss_family_in_struct_ss="yes" 29914 ac_cv_have___ss_family_in_struct_ss="yes"
15720else 29915else
15721 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"
15722 29920
15723fi 29921fi
29922
15724rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 29923rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15725 29924
15726fi 29925fi
15727{ $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
15728$as_echo "$ac_cv_have___ss_family_in_struct_ss" >&6; } 29927echo "${ECHO_T}$ac_cv_have___ss_family_in_struct_ss" >&6; }
15729if 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
15730 29929
15731$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
15732 29933
15733fi 29934fi
15734 29935
15735{ $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
15736$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; }
15737if ${ac_cv_have_accrights_in_msghdr+:} false; then : 29938if test "${ac_cv_have_accrights_in_msghdr+set}" = set; then
15738 $as_echo_n "(cached) " >&6 29939 echo $ECHO_N "(cached) $ECHO_C" >&6
15739else 29940else
15740 29941
15741 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
15742/* end confdefs.h. */ 29947/* end confdefs.h. */
15743 29948
15744#include <sys/types.h> 29949#include <sys/types.h>
@@ -15761,26 +29966,52 @@ exit(0);
15761 return 0; 29966 return 0;
15762} 29967}
15763_ACEOF 29968_ACEOF
15764if 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
15765 ac_cv_have_accrights_in_msghdr="yes" 29986 ac_cv_have_accrights_in_msghdr="yes"
15766else 29987else
15767 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"
15768 29992
15769fi 29993fi
29994
15770rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 29995rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15771 29996
15772fi 29997fi
15773{ $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
15774$as_echo "$ac_cv_have_accrights_in_msghdr" >&6; } 29999echo "${ECHO_T}$ac_cv_have_accrights_in_msghdr" >&6; }
15775if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then 30000if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
15776 30001
15777$as_echo "#define HAVE_ACCRIGHTS_IN_MSGHDR 1" >>confdefs.h 30002cat >>confdefs.h <<\_ACEOF
30003#define HAVE_ACCRIGHTS_IN_MSGHDR 1
30004_ACEOF
15778 30005
15779fi 30006fi
15780 30007
15781{ $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
15782$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; }
15783cat 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
15784/* end confdefs.h. */ 30015/* end confdefs.h. */
15785 30016
15786#include <sys/param.h> 30017#include <sys/param.h>
@@ -15803,16 +30034,39 @@ main ()
15803 return 0; 30034 return 0;
15804} 30035}
15805_ACEOF 30036_ACEOF
15806if ac_fn_c_try_compile "$LINENO"; then : 30037rm -f conftest.$ac_objext
15807 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 30038if { (ac_try="$ac_compile"
15808$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; }
15809else 30056else
15810 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 30057 echo "$as_me: failed program was:" >&5
15811$as_echo "no" >&6; } 30058sed 's/^/| /' conftest.$ac_ext >&5
30059
30060 { echo "$as_me:$LINENO: result: no" >&5
30061echo "${ECHO_T}no" >&6; }
15812 30062
15813 { $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
15814$as_echo_n "checking if fsid_t has member val... " >&6; } 30064echo $ECHO_N "checking if fsid_t has member val... $ECHO_C" >&6; }
15815 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
15816/* end confdefs.h. */ 30070/* end confdefs.h. */
15817 30071
15818#include <sys/types.h> 30072#include <sys/types.h>
@@ -15826,21 +30080,47 @@ main ()
15826 return 0; 30080 return 0;
15827} 30081}
15828_ACEOF 30082_ACEOF
15829if ac_fn_c_try_compile "$LINENO"; then : 30083rm -f conftest.$ac_objext
15830 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 30084if { (ac_try="$ac_compile"
15831$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; }
15832 30102
15833$as_echo "#define FSID_HAS_VAL 1" >>confdefs.h 30103cat >>confdefs.h <<\_ACEOF
30104#define FSID_HAS_VAL 1
30105_ACEOF
15834 30106
15835else 30107else
15836 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 30108 echo "$as_me: failed program was:" >&5
15837$as_echo "no" >&6; } 30109sed 's/^/| /' conftest.$ac_ext >&5
30110
30111 { echo "$as_me:$LINENO: result: no" >&5
30112echo "${ECHO_T}no" >&6; }
15838fi 30113fi
30114
15839rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 30115rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15840 30116
15841 { $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
15842$as_echo_n "checking if f_fsid has member __val... " >&6; } 30118echo $ECHO_N "checking if f_fsid has member __val... $ECHO_C" >&6; }
15843 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
15844/* end confdefs.h. */ 30124/* end confdefs.h. */
15845 30125
15846#include <sys/types.h> 30126#include <sys/types.h>
@@ -15854,28 +30134,55 @@ main ()
15854 return 0; 30134 return 0;
15855} 30135}
15856_ACEOF 30136_ACEOF
15857if ac_fn_c_try_compile "$LINENO"; then : 30137rm -f conftest.$ac_objext
15858 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 30138if { (ac_try="$ac_compile"
15859$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; }
15860 30156
15861$as_echo "#define FSID_HAS___VAL 1" >>confdefs.h 30157cat >>confdefs.h <<\_ACEOF
30158#define FSID_HAS___VAL 1
30159_ACEOF
15862 30160
15863else 30161else
15864 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 30162 echo "$as_me: failed program was:" >&5
15865$as_echo "no" >&6; } 30163sed 's/^/| /' conftest.$ac_ext >&5
30164
30165 { echo "$as_me:$LINENO: result: no" >&5
30166echo "${ECHO_T}no" >&6; }
15866fi 30167fi
30168
15867rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 30169rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15868 30170
15869fi 30171fi
30172
15870rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 30173rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15871 30174
15872{ $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
15873$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; }
15874if ${ac_cv_have_control_in_msghdr+:} false; then : 30177if test "${ac_cv_have_control_in_msghdr+set}" = set; then
15875 $as_echo_n "(cached) " >&6 30178 echo $ECHO_N "(cached) $ECHO_C" >&6
15876else 30179else
15877 30180
15878 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
15879/* end confdefs.h. */ 30186/* end confdefs.h. */
15880 30187
15881#include <sys/types.h> 30188#include <sys/types.h>
@@ -15898,30 +30205,56 @@ exit(0);
15898 return 0; 30205 return 0;
15899} 30206}
15900_ACEOF 30207_ACEOF
15901if 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
15902 ac_cv_have_control_in_msghdr="yes" 30225 ac_cv_have_control_in_msghdr="yes"
15903else 30226else
15904 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"
15905 30231
15906fi 30232fi
30233
15907rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 30234rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15908 30235
15909fi 30236fi
15910{ $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
15911$as_echo "$ac_cv_have_control_in_msghdr" >&6; } 30238echo "${ECHO_T}$ac_cv_have_control_in_msghdr" >&6; }
15912if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then 30239if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
15913 30240
15914$as_echo "#define HAVE_CONTROL_IN_MSGHDR 1" >>confdefs.h 30241cat >>confdefs.h <<\_ACEOF
30242#define HAVE_CONTROL_IN_MSGHDR 1
30243_ACEOF
15915 30244
15916fi 30245fi
15917 30246
15918{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if libc defines __progname" >&5 30247{ echo "$as_me:$LINENO: checking if libc defines __progname" >&5
15919$as_echo_n "checking if libc defines __progname... " >&6; } 30248echo $ECHO_N "checking if libc defines __progname... $ECHO_C" >&6; }
15920if ${ac_cv_libc_defines___progname+:} false; then : 30249if test "${ac_cv_libc_defines___progname+set}" = set; then
15921 $as_echo_n "(cached) " >&6 30250 echo $ECHO_N "(cached) $ECHO_C" >&6
15922else 30251else
15923 30252
15924 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
15925/* end confdefs.h. */ 30258/* end confdefs.h. */
15926 30259
15927int 30260int
@@ -15932,31 +30265,58 @@ main ()
15932 return 0; 30265 return 0;
15933} 30266}
15934_ACEOF 30267_ACEOF
15935if 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
15936 ac_cv_libc_defines___progname="yes" 30286 ac_cv_libc_defines___progname="yes"
15937else 30287else
15938 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"
15939 30292
15940fi 30293fi
15941rm -f core conftest.err conftest.$ac_objext \ 30294
15942 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
15943 30297
15944fi 30298fi
15945{ $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
15946$as_echo "$ac_cv_libc_defines___progname" >&6; } 30300echo "${ECHO_T}$ac_cv_libc_defines___progname" >&6; }
15947if test "x$ac_cv_libc_defines___progname" = "xyes" ; then 30301if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
15948 30302
15949$as_echo "#define HAVE___PROGNAME 1" >>confdefs.h 30303cat >>confdefs.h <<\_ACEOF
30304#define HAVE___PROGNAME 1
30305_ACEOF
15950 30306
15951fi 30307fi
15952 30308
15953{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC implements __FUNCTION__" >&5 30309{ echo "$as_me:$LINENO: checking whether $CC implements __FUNCTION__" >&5
15954$as_echo_n "checking whether $CC implements __FUNCTION__... " >&6; } 30310echo $ECHO_N "checking whether $CC implements __FUNCTION__... $ECHO_C" >&6; }
15955if ${ac_cv_cc_implements___FUNCTION__+:} false; then : 30311if test "${ac_cv_cc_implements___FUNCTION__+set}" = set; then
15956 $as_echo_n "(cached) " >&6 30312 echo $ECHO_N "(cached) $ECHO_C" >&6
15957else 30313else
15958 30314
15959 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
15960/* end confdefs.h. */ 30320/* end confdefs.h. */
15961 #include <stdio.h> 30321 #include <stdio.h>
15962int 30322int
@@ -15967,31 +30327,58 @@ main ()
15967 return 0; 30327 return 0;
15968} 30328}
15969_ACEOF 30329_ACEOF
15970if 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
15971 ac_cv_cc_implements___FUNCTION__="yes" 30348 ac_cv_cc_implements___FUNCTION__="yes"
15972else 30349else
15973 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"
15974 30354
15975fi 30355fi
15976rm -f core conftest.err conftest.$ac_objext \ 30356
15977 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
15978 30359
15979fi 30360fi
15980{ $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
15981$as_echo "$ac_cv_cc_implements___FUNCTION__" >&6; } 30362echo "${ECHO_T}$ac_cv_cc_implements___FUNCTION__" >&6; }
15982if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then 30363if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
15983 30364
15984$as_echo "#define HAVE___FUNCTION__ 1" >>confdefs.h 30365cat >>confdefs.h <<\_ACEOF
30366#define HAVE___FUNCTION__ 1
30367_ACEOF
15985 30368
15986fi 30369fi
15987 30370
15988{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC implements __func__" >&5 30371{ echo "$as_me:$LINENO: checking whether $CC implements __func__" >&5
15989$as_echo_n "checking whether $CC implements __func__... " >&6; } 30372echo $ECHO_N "checking whether $CC implements __func__... $ECHO_C" >&6; }
15990if ${ac_cv_cc_implements___func__+:} false; then : 30373if test "${ac_cv_cc_implements___func__+set}" = set; then
15991 $as_echo_n "(cached) " >&6 30374 echo $ECHO_N "(cached) $ECHO_C" >&6
15992else 30375else
15993 30376
15994 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
15995/* end confdefs.h. */ 30382/* end confdefs.h. */
15996 #include <stdio.h> 30383 #include <stdio.h>
15997int 30384int
@@ -16002,31 +30389,58 @@ main ()
16002 return 0; 30389 return 0;
16003} 30390}
16004_ACEOF 30391_ACEOF
16005if 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
16006 ac_cv_cc_implements___func__="yes" 30410 ac_cv_cc_implements___func__="yes"
16007else 30411else
16008 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"
16009 30416
16010fi 30417fi
16011rm -f core conftest.err conftest.$ac_objext \ 30418
16012 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
16013 30421
16014fi 30422fi
16015{ $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
16016$as_echo "$ac_cv_cc_implements___func__" >&6; } 30424echo "${ECHO_T}$ac_cv_cc_implements___func__" >&6; }
16017if test "x$ac_cv_cc_implements___func__" = "xyes" ; then 30425if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
16018 30426
16019$as_echo "#define HAVE___func__ 1" >>confdefs.h 30427cat >>confdefs.h <<\_ACEOF
30428#define HAVE___func__ 1
30429_ACEOF
16020 30430
16021fi 30431fi
16022 30432
16023{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether va_copy exists" >&5 30433{ echo "$as_me:$LINENO: checking whether va_copy exists" >&5
16024$as_echo_n "checking whether va_copy exists... " >&6; } 30434echo $ECHO_N "checking whether va_copy exists... $ECHO_C" >&6; }
16025if ${ac_cv_have_va_copy+:} false; then : 30435if test "${ac_cv_have_va_copy+set}" = set; then
16026 $as_echo_n "(cached) " >&6 30436 echo $ECHO_N "(cached) $ECHO_C" >&6
16027else 30437else
16028 30438
16029 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
16030/* end confdefs.h. */ 30444/* end confdefs.h. */
16031 30445
16032#include <stdarg.h> 30446#include <stdarg.h>
@@ -16040,31 +30454,58 @@ main ()
16040 return 0; 30454 return 0;
16041} 30455}
16042_ACEOF 30456_ACEOF
16043if 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
16044 ac_cv_have_va_copy="yes" 30475 ac_cv_have_va_copy="yes"
16045else 30476else
16046 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"
16047 30481
16048fi 30482fi
16049rm -f core conftest.err conftest.$ac_objext \ 30483
16050 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
16051 30486
16052fi 30487fi
16053{ $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
16054$as_echo "$ac_cv_have_va_copy" >&6; } 30489echo "${ECHO_T}$ac_cv_have_va_copy" >&6; }
16055if test "x$ac_cv_have_va_copy" = "xyes" ; then 30490if test "x$ac_cv_have_va_copy" = "xyes" ; then
16056 30491
16057$as_echo "#define HAVE_VA_COPY 1" >>confdefs.h 30492cat >>confdefs.h <<\_ACEOF
30493#define HAVE_VA_COPY 1
30494_ACEOF
16058 30495
16059fi 30496fi
16060 30497
16061{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __va_copy exists" >&5 30498{ echo "$as_me:$LINENO: checking whether __va_copy exists" >&5
16062$as_echo_n "checking whether __va_copy exists... " >&6; } 30499echo $ECHO_N "checking whether __va_copy exists... $ECHO_C" >&6; }
16063if ${ac_cv_have___va_copy+:} false; then : 30500if test "${ac_cv_have___va_copy+set}" = set; then
16064 $as_echo_n "(cached) " >&6 30501 echo $ECHO_N "(cached) $ECHO_C" >&6
16065else 30502else
16066 30503
16067 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
16068/* end confdefs.h. */ 30509/* end confdefs.h. */
16069 30510
16070#include <stdarg.h> 30511#include <stdarg.h>
@@ -16078,31 +30519,58 @@ main ()
16078 return 0; 30519 return 0;
16079} 30520}
16080_ACEOF 30521_ACEOF
16081if 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
16082 ac_cv_have___va_copy="yes" 30540 ac_cv_have___va_copy="yes"
16083else 30541else
16084 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"
16085 30546
16086fi 30547fi
16087rm -f core conftest.err conftest.$ac_objext \ 30548
16088 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
16089 30551
16090fi 30552fi
16091{ $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
16092$as_echo "$ac_cv_have___va_copy" >&6; } 30554echo "${ECHO_T}$ac_cv_have___va_copy" >&6; }
16093if test "x$ac_cv_have___va_copy" = "xyes" ; then 30555if test "x$ac_cv_have___va_copy" = "xyes" ; then
16094 30556
16095$as_echo "#define HAVE___VA_COPY 1" >>confdefs.h 30557cat >>confdefs.h <<\_ACEOF
30558#define HAVE___VA_COPY 1
30559_ACEOF
16096 30560
16097fi 30561fi
16098 30562
16099{ $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
16100$as_echo_n "checking whether getopt has optreset support... " >&6; } 30564echo $ECHO_N "checking whether getopt has optreset support... $ECHO_C" >&6; }
16101if ${ac_cv_have_getopt_optreset+:} false; then : 30565if test "${ac_cv_have_getopt_optreset+set}" = set; then
16102 $as_echo_n "(cached) " >&6 30566 echo $ECHO_N "(cached) $ECHO_C" >&6
16103else 30567else
16104 30568
16105 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
16106/* end confdefs.h. */ 30574/* end confdefs.h. */
16107 #include <getopt.h> 30575 #include <getopt.h>
16108int 30576int
@@ -16113,31 +30581,58 @@ main ()
16113 return 0; 30581 return 0;
16114} 30582}
16115_ACEOF 30583_ACEOF
16116if 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
16117 ac_cv_have_getopt_optreset="yes" 30602 ac_cv_have_getopt_optreset="yes"
16118else 30603else
16119 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"
16120 30608
16121fi 30609fi
16122rm -f core conftest.err conftest.$ac_objext \ 30610
16123 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
16124 30613
16125fi 30614fi
16126{ $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
16127$as_echo "$ac_cv_have_getopt_optreset" >&6; } 30616echo "${ECHO_T}$ac_cv_have_getopt_optreset" >&6; }
16128if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then 30617if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
16129 30618
16130$as_echo "#define HAVE_GETOPT_OPTRESET 1" >>confdefs.h 30619cat >>confdefs.h <<\_ACEOF
30620#define HAVE_GETOPT_OPTRESET 1
30621_ACEOF
16131 30622
16132fi 30623fi
16133 30624
16134{ $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
16135$as_echo_n "checking if libc defines sys_errlist... " >&6; } 30626echo $ECHO_N "checking if libc defines sys_errlist... $ECHO_C" >&6; }
16136if ${ac_cv_libc_defines_sys_errlist+:} false; then : 30627if test "${ac_cv_libc_defines_sys_errlist+set}" = set; then
16137 $as_echo_n "(cached) " >&6 30628 echo $ECHO_N "(cached) $ECHO_C" >&6
16138else 30629else
16139 30630
16140 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
16141/* end confdefs.h. */ 30636/* end confdefs.h. */
16142 30637
16143int 30638int
@@ -16148,32 +30643,59 @@ main ()
16148 return 0; 30643 return 0;
16149} 30644}
16150_ACEOF 30645_ACEOF
16151if 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
16152 ac_cv_libc_defines_sys_errlist="yes" 30664 ac_cv_libc_defines_sys_errlist="yes"
16153else 30665else
16154 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"
16155 30670
16156fi 30671fi
16157rm -f core conftest.err conftest.$ac_objext \ 30672
16158 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
16159 30675
16160fi 30676fi
16161{ $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
16162$as_echo "$ac_cv_libc_defines_sys_errlist" >&6; } 30678echo "${ECHO_T}$ac_cv_libc_defines_sys_errlist" >&6; }
16163if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then 30679if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
16164 30680
16165$as_echo "#define HAVE_SYS_ERRLIST 1" >>confdefs.h 30681cat >>confdefs.h <<\_ACEOF
30682#define HAVE_SYS_ERRLIST 1
30683_ACEOF
16166 30684
16167fi 30685fi
16168 30686
16169 30687
16170{ $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
16171$as_echo_n "checking if libc defines sys_nerr... " >&6; } 30689echo $ECHO_N "checking if libc defines sys_nerr... $ECHO_C" >&6; }
16172if ${ac_cv_libc_defines_sys_nerr+:} false; then : 30690if test "${ac_cv_libc_defines_sys_nerr+set}" = set; then
16173 $as_echo_n "(cached) " >&6 30691 echo $ECHO_N "(cached) $ECHO_C" >&6
16174else 30692else
16175 30693
16176 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
16177/* end confdefs.h. */ 30699/* end confdefs.h. */
16178 30700
16179int 30701int
@@ -16184,32 +30706,59 @@ main ()
16184 return 0; 30706 return 0;
16185} 30707}
16186_ACEOF 30708_ACEOF
16187if 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
16188 ac_cv_libc_defines_sys_nerr="yes" 30727 ac_cv_libc_defines_sys_nerr="yes"
16189else 30728else
16190 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"
16191 30733
16192fi 30734fi
16193rm -f core conftest.err conftest.$ac_objext \ 30735
16194 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
16195 30738
16196fi 30739fi
16197{ $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
16198$as_echo "$ac_cv_libc_defines_sys_nerr" >&6; } 30741echo "${ECHO_T}$ac_cv_libc_defines_sys_nerr" >&6; }
16199if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then 30742if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
16200 30743
16201$as_echo "#define HAVE_SYS_NERR 1" >>confdefs.h 30744cat >>confdefs.h <<\_ACEOF
30745#define HAVE_SYS_NERR 1
30746_ACEOF
16202 30747
16203fi 30748fi
16204 30749
16205# Check libraries needed by DNS fingerprint support 30750# Check libraries needed by DNS fingerprint support
16206{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing getrrsetbyname" >&5 30751{ echo "$as_me:$LINENO: checking for library containing getrrsetbyname" >&5
16207$as_echo_n "checking for library containing getrrsetbyname... " >&6; } 30752echo $ECHO_N "checking for library containing getrrsetbyname... $ECHO_C" >&6; }
16208if ${ac_cv_search_getrrsetbyname+:} false; then : 30753if test "${ac_cv_search_getrrsetbyname+set}" = set; then
16209 $as_echo_n "(cached) " >&6 30754 echo $ECHO_N "(cached) $ECHO_C" >&6
16210else 30755else
16211 ac_func_search_save_LIBS=$LIBS 30756 ac_func_search_save_LIBS=$LIBS
16212cat 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
16213/* end confdefs.h. */ 30762/* end confdefs.h. */
16214 30763
16215/* Override any GCC internal prototype to avoid an error. 30764/* Override any GCC internal prototype to avoid an error.
@@ -16234,41 +30783,70 @@ for ac_lib in '' resolv; do
16234 ac_res=-l$ac_lib 30783 ac_res=-l$ac_lib
16235 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 30784 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
16236 fi 30785 fi
16237 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
16238 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
16239fi 30810fi
16240rm -f core conftest.err conftest.$ac_objext \ 30811
16241 conftest$ac_exeext 30812rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
16242 if ${ac_cv_search_getrrsetbyname+:} false; then : 30813 conftest$ac_exeext
30814 if test "${ac_cv_search_getrrsetbyname+set}" = set; then
16243 break 30815 break
16244fi 30816fi
16245done 30817done
16246if ${ac_cv_search_getrrsetbyname+:} false; then : 30818if test "${ac_cv_search_getrrsetbyname+set}" = set; then
16247 30819 :
16248else 30820else
16249 ac_cv_search_getrrsetbyname=no 30821 ac_cv_search_getrrsetbyname=no
16250fi 30822fi
16251rm conftest.$ac_ext 30823rm conftest.$ac_ext
16252LIBS=$ac_func_search_save_LIBS 30824LIBS=$ac_func_search_save_LIBS
16253fi 30825fi
16254{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getrrsetbyname" >&5 30826{ echo "$as_me:$LINENO: result: $ac_cv_search_getrrsetbyname" >&5
16255$as_echo "$ac_cv_search_getrrsetbyname" >&6; } 30827echo "${ECHO_T}$ac_cv_search_getrrsetbyname" >&6; }
16256ac_res=$ac_cv_search_getrrsetbyname 30828ac_res=$ac_cv_search_getrrsetbyname
16257if test "$ac_res" != no; then : 30829if test "$ac_res" != no; then
16258 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 30830 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
16259 30831
16260$as_echo "#define HAVE_GETRRSETBYNAME 1" >>confdefs.h 30832cat >>confdefs.h <<\_ACEOF
30833#define HAVE_GETRRSETBYNAME 1
30834_ACEOF
16261 30835
16262else 30836else
16263 30837
16264 # Needed by our getrrsetbyname() 30838 # Needed by our getrrsetbyname()
16265 { $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
16266$as_echo_n "checking for library containing res_query... " >&6; } 30840echo $ECHO_N "checking for library containing res_query... $ECHO_C" >&6; }
16267if ${ac_cv_search_res_query+:} false; then : 30841if test "${ac_cv_search_res_query+set}" = set; then
16268 $as_echo_n "(cached) " >&6 30842 echo $ECHO_N "(cached) $ECHO_C" >&6
16269else 30843else
16270 ac_func_search_save_LIBS=$LIBS 30844 ac_func_search_save_LIBS=$LIBS
16271cat 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
16272/* end confdefs.h. */ 30850/* end confdefs.h. */
16273 30851
16274/* Override any GCC internal prototype to avoid an error. 30852/* Override any GCC internal prototype to avoid an error.
@@ -16293,38 +30871,65 @@ for ac_lib in '' resolv; do
16293 ac_res=-l$ac_lib 30871 ac_res=-l$ac_lib
16294 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 30872 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
16295 fi 30873 fi
16296 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
16297 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
16298fi 30898fi
16299rm -f core conftest.err conftest.$ac_objext \ 30899
16300 conftest$ac_exeext 30900rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
16301 if ${ac_cv_search_res_query+:} false; then : 30901 conftest$ac_exeext
30902 if test "${ac_cv_search_res_query+set}" = set; then
16302 break 30903 break
16303fi 30904fi
16304done 30905done
16305if ${ac_cv_search_res_query+:} false; then : 30906if test "${ac_cv_search_res_query+set}" = set; then
16306 30907 :
16307else 30908else
16308 ac_cv_search_res_query=no 30909 ac_cv_search_res_query=no
16309fi 30910fi
16310rm conftest.$ac_ext 30911rm conftest.$ac_ext
16311LIBS=$ac_func_search_save_LIBS 30912LIBS=$ac_func_search_save_LIBS
16312fi 30913fi
16313{ $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
16314$as_echo "$ac_cv_search_res_query" >&6; } 30915echo "${ECHO_T}$ac_cv_search_res_query" >&6; }
16315ac_res=$ac_cv_search_res_query 30916ac_res=$ac_cv_search_res_query
16316if test "$ac_res" != no; then : 30917if test "$ac_res" != no; then
16317 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 30918 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
16318 30919
16319fi 30920fi
16320 30921
16321 { $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
16322$as_echo_n "checking for library containing dn_expand... " >&6; } 30923echo $ECHO_N "checking for library containing dn_expand... $ECHO_C" >&6; }
16323if ${ac_cv_search_dn_expand+:} false; then : 30924if test "${ac_cv_search_dn_expand+set}" = set; then
16324 $as_echo_n "(cached) " >&6 30925 echo $ECHO_N "(cached) $ECHO_C" >&6
16325else 30926else
16326 ac_func_search_save_LIBS=$LIBS 30927 ac_func_search_save_LIBS=$LIBS
16327cat 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
16328/* end confdefs.h. */ 30933/* end confdefs.h. */
16329 30934
16330/* Override any GCC internal prototype to avoid an error. 30935/* Override any GCC internal prototype to avoid an error.
@@ -16349,34 +30954,61 @@ for ac_lib in '' resolv; do
16349 ac_res=-l$ac_lib 30954 ac_res=-l$ac_lib
16350 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 30955 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
16351 fi 30956 fi
16352 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
16353 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
16354fi 30981fi
16355rm -f core conftest.err conftest.$ac_objext \ 30982
16356 conftest$ac_exeext 30983rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
16357 if ${ac_cv_search_dn_expand+:} false; then : 30984 conftest$ac_exeext
30985 if test "${ac_cv_search_dn_expand+set}" = set; then
16358 break 30986 break
16359fi 30987fi
16360done 30988done
16361if ${ac_cv_search_dn_expand+:} false; then : 30989if test "${ac_cv_search_dn_expand+set}" = set; then
16362 30990 :
16363else 30991else
16364 ac_cv_search_dn_expand=no 30992 ac_cv_search_dn_expand=no
16365fi 30993fi
16366rm conftest.$ac_ext 30994rm conftest.$ac_ext
16367LIBS=$ac_func_search_save_LIBS 30995LIBS=$ac_func_search_save_LIBS
16368fi 30996fi
16369{ $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
16370$as_echo "$ac_cv_search_dn_expand" >&6; } 30998echo "${ECHO_T}$ac_cv_search_dn_expand" >&6; }
16371ac_res=$ac_cv_search_dn_expand 30999ac_res=$ac_cv_search_dn_expand
16372if test "$ac_res" != no; then : 31000if test "$ac_res" != no; then
16373 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 31001 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
16374 31002
16375fi 31003fi
16376 31004
16377 { $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
16378$as_echo_n "checking if res_query will link... " >&6; } 31006echo $ECHO_N "checking if res_query will link... $ECHO_C" >&6; }
16379 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
16380/* end confdefs.h. */ 31012/* end confdefs.h. */
16381 31013
16382#include <sys/types.h> 31014#include <sys/types.h>
@@ -16395,17 +31027,41 @@ main ()
16395 return 0; 31027 return 0;
16396} 31028}
16397_ACEOF 31029_ACEOF
16398if ac_fn_c_try_link "$LINENO"; then : 31030rm -f conftest.$ac_objext conftest$ac_exeext
16399 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 31031if { (ac_try="$ac_link"
16400$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; }
16401else 31050else
16402 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 31051 echo "$as_me: failed program was:" >&5
16403$as_echo "no" >&6; } 31052sed 's/^/| /' conftest.$ac_ext >&5
31053
31054 { echo "$as_me:$LINENO: result: no" >&5
31055echo "${ECHO_T}no" >&6; }
16404 saved_LIBS="$LIBS" 31056 saved_LIBS="$LIBS"
16405 LIBS="$LIBS -lresolv" 31057 LIBS="$LIBS -lresolv"
16406 { $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
16407$as_echo_n "checking for res_query in -lresolv... " >&6; } 31059echo $ECHO_N "checking for res_query in -lresolv... $ECHO_C" >&6; }
16408 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
16409/* end confdefs.h. */ 31065/* end confdefs.h. */
16410 31066
16411#include <sys/types.h> 31067#include <sys/types.h>
@@ -16424,62 +31080,375 @@ main ()
16424 return 0; 31080 return 0;
16425} 31081}
16426_ACEOF 31082_ACEOF
16427if ac_fn_c_try_link "$LINENO"; then : 31083rm -f conftest.$ac_objext conftest$ac_exeext
16428 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 31084if { (ac_try="$ac_link"
16429$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; }
31103else
31104 echo "$as_me: failed program was:" >&5
31105sed 's/^/| /' conftest.$ac_ext >&5
31106
31107 LIBS="$saved_LIBS"
31108 { echo "$as_me:$LINENO: result: no" >&5
31109echo "${ECHO_T}no" >&6; }
31110fi
31111
31112rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
31113 conftest$ac_exeext conftest.$ac_ext
31114
31115fi
31116
31117rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
31118 conftest$ac_exeext conftest.$ac_ext
31119
31120
31121for ac_func in _getshort _getlong
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"
16430else 31193else
16431 LIBS="$saved_LIBS" 31194 echo "$as_me: failed program was:" >&5
16432 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 31195sed 's/^/| /' conftest.$ac_ext >&5
16433$as_echo "no" >&6; } 31196
31197 eval "$as_ac_var=no"
16434fi 31198fi
16435rm -f core conftest.err conftest.$ac_objext \
16436 conftest$ac_exeext conftest.$ac_ext
16437 31199
31200rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
31201 conftest$ac_exeext conftest.$ac_ext
16438fi 31202fi
16439rm -f core conftest.err conftest.$ac_objext \ 31203ac_res=`eval echo '${'$as_ac_var'}'`
16440 conftest$ac_exeext conftest.$ac_ext 31204 { echo "$as_me:$LINENO: result: $ac_res" >&5
16441 for ac_func in _getshort _getlong 31205echo "${ECHO_T}$ac_res" >&6; }
16442do : 31206if test `eval echo '${'$as_ac_var'}'` = yes; then
16443 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
16444ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
16445if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
16446 cat >>confdefs.h <<_ACEOF 31207 cat >>confdefs.h <<_ACEOF
16447#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 31208#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
16448_ACEOF 31209_ACEOF
16449 31210
16450fi 31211fi
16451done 31212done
16452 31213
16453 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>
16454 #include <arpa/nameser.h> 31226 #include <arpa/nameser.h>
16455" 31227
16456if test "x$ac_cv_have_decl__getshort" = xyes; then : 31228int
16457 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
16458else 31257else
16459 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
31262fi
31263
31264rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
16460fi 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
16461 31269
16462cat >>confdefs.h <<_ACEOF 31270cat >>confdefs.h <<_ACEOF
16463#define HAVE_DECL__GETSHORT $ac_have_decl 31271#define HAVE_DECL__GETSHORT 1
31272_ACEOF
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. */
16464_ACEOF 31289_ACEOF
16465ac_fn_c_check_decl "$LINENO" "_getlong" "ac_cv_have_decl__getlong" "#include <sys/types.h> 31290cat confdefs.h >>conftest.$ac_ext
31291cat >>conftest.$ac_ext <<_ACEOF
31292/* end confdefs.h. */
31293#include <sys/types.h>
16466 #include <arpa/nameser.h> 31294 #include <arpa/nameser.h>
16467" 31295
16468if test "x$ac_cv_have_decl__getlong" = xyes; then : 31296int
16469 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
16470else 31325else
16471 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
16472fi 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
16473 31337
16474cat >>confdefs.h <<_ACEOF 31338cat >>confdefs.h <<_ACEOF
16475#define HAVE_DECL__GETLONG $ac_have_decl 31339#define HAVE_DECL__GETLONG 1
16476_ACEOF 31340_ACEOF
16477 31341
16478 ac_fn_c_check_member "$LINENO" "HEADER" "ad" "ac_cv_member_HEADER_ad" "#include <arpa/nameser.h>
16479"
16480if test "x$ac_cv_member_HEADER_ad" = xyes; then :
16481 31342
16482$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>
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
31438fi
31439
31440rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
31441fi
31442
31443rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
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
31448
31449cat >>confdefs.h <<\_ACEOF
31450#define HAVE_HEADER_AD 1
31451_ACEOF
16483 31452
16484fi 31453fi
16485 31454
@@ -16487,9 +31456,13 @@ fi
16487fi 31456fi
16488 31457
16489 31458
16490{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if struct __res_state _res is an extern" >&5 31459{ echo "$as_me:$LINENO: checking if struct __res_state _res is an extern" >&5
16491$as_echo_n "checking if struct __res_state _res is an extern... " >&6; } 31460echo $ECHO_N "checking if struct __res_state _res is an extern... $ECHO_C" >&6; }
16492cat confdefs.h - <<_ACEOF >conftest.$ac_ext 31461cat >conftest.$ac_ext <<_ACEOF
31462/* confdefs.h. */
31463_ACEOF
31464cat confdefs.h >>conftest.$ac_ext
31465cat >>conftest.$ac_ext <<_ACEOF
16493/* end confdefs.h. */ 31466/* end confdefs.h. */
16494 31467
16495#include <stdio.h> 31468#include <stdio.h>
@@ -16509,49 +31482,209 @@ main ()
16509 return 0; 31482 return 0;
16510} 31483}
16511_ACEOF 31484_ACEOF
16512if ac_fn_c_try_link "$LINENO"; then : 31485rm -f conftest.$ac_objext conftest$ac_exeext
16513 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 31486if { (ac_try="$ac_link"
16514$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; }
16515 31505
16516$as_echo "#define HAVE__RES_EXTERN 1" >>confdefs.h 31506cat >>confdefs.h <<\_ACEOF
31507#define HAVE__RES_EXTERN 1
31508_ACEOF
16517 31509
16518 31510
16519else 31511else
16520 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 31512 echo "$as_me: failed program was:" >&5
16521$as_echo "no" >&6; } 31513sed 's/^/| /' conftest.$ac_ext >&5
31514
31515 { echo "$as_me:$LINENO: result: no" >&5
31516echo "${ECHO_T}no" >&6; }
16522 31517
16523fi 31518fi
16524rm -f core conftest.err conftest.$ac_objext \ 31519
16525 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
16526 31522
16527# Check whether user wants SELinux support 31523# Check whether user wants SELinux support
16528SELINUX_MSG="no" 31524SELINUX_MSG="no"
16529LIBSELINUX="" 31525LIBSELINUX=""
16530 31526
16531# Check whether --with-selinux was given. 31527# Check whether --with-selinux was given.
16532if test "${with_selinux+set}" = set; then : 31528if test "${with_selinux+set}" = set; then
16533 withval=$with_selinux; if test "x$withval" != "xno" ; then 31529 withval=$with_selinux; if test "x$withval" != "xno" ; then
16534 save_LIBS="$LIBS" 31530 save_LIBS="$LIBS"
16535 31531
16536$as_echo "#define WITH_SELINUX 1" >>confdefs.h 31532cat >>confdefs.h <<\_ACEOF
31533#define WITH_SELINUX 1
31534_ACEOF
16537 31535
16538 SELINUX_MSG="yes" 31536 SELINUX_MSG="yes"
16539 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
16540if 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; }
16541 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
16542else 31615else
16543 as_fn_error $? "SELinux support requires selinux.h header" "$LINENO" 5 31616 echo "$as_me: failed program was:" >&5
31617sed 's/^/| /' conftest.$ac_ext >&5
31618
31619 ac_header_preproc=no
16544fi 31620fi
16545 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; }
16546 31625
16547 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setexeccon in -lselinux" >&5 31626# So? What about this header?
16548$as_echo_n "checking for setexeccon in -lselinux... " >&6; } 31627case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
16549if ${ac_cv_lib_selinux_setexeccon+:} false; then : 31628 yes:no: )
16550 $as_echo_n "(cached) " >&6 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
31660else
31661 ac_cv_header_selinux_selinux_h=$ac_header_preproc
31662fi
31663{ echo "$as_me:$LINENO: result: $ac_cv_header_selinux_selinux_h" >&5
31664echo "${ECHO_T}$ac_cv_header_selinux_selinux_h" >&6; }
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
31674
31675
31676 { echo "$as_me:$LINENO: checking for setexeccon in -lselinux" >&5
31677echo $ECHO_N "checking for setexeccon in -lselinux... $ECHO_C" >&6; }
31678if test "${ac_cv_lib_selinux_setexeccon+set}" = set; then
31679 echo $ECHO_N "(cached) $ECHO_C" >&6
16551else 31680else
16552 ac_check_lib_save_LIBS=$LIBS 31681 ac_check_lib_save_LIBS=$LIBS
16553LIBS="-lselinux $LIBS" 31682LIBS="-lselinux $LIBS"
16554cat 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
16555/* end confdefs.h. */ 31688/* end confdefs.h. */
16556 31689
16557/* Override any GCC internal prototype to avoid an error. 31690/* Override any GCC internal prototype to avoid an error.
@@ -16569,34 +31702,140 @@ return setexeccon ();
16569 return 0; 31702 return 0;
16570} 31703}
16571_ACEOF 31704_ACEOF
16572if 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
16573 ac_cv_lib_selinux_setexeccon=yes 31723 ac_cv_lib_selinux_setexeccon=yes
16574else 31724else
16575 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
16576fi 31729fi
16577rm -f core conftest.err conftest.$ac_objext \ 31730
16578 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
16579LIBS=$ac_check_lib_save_LIBS 31733LIBS=$ac_check_lib_save_LIBS
16580fi 31734fi
16581{ $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
16582$as_echo "$ac_cv_lib_selinux_setexeccon" >&6; } 31736echo "${ECHO_T}$ac_cv_lib_selinux_setexeccon" >&6; }
16583if test "x$ac_cv_lib_selinux_setexeccon" = xyes; then : 31737if test $ac_cv_lib_selinux_setexeccon = yes; then
16584 LIBSELINUX="-lselinux" 31738 LIBSELINUX="-lselinux"
16585 LIBS="$LIBS -lselinux" 31739 LIBS="$LIBS -lselinux"
16586 31740
16587else 31741else
16588 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; }; }
16589fi 31745fi
16590 31746
16591 SSHLIBS="$SSHLIBS $LIBSELINUX" 31747 SSHLIBS="$SSHLIBS $LIBSELINUX"
16592 SSHDLIBS="$SSHDLIBS $LIBSELINUX" 31748 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
16593 for ac_func in getseuserbyname get_default_context_with_level 31749
16594do : 31750
16595 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` 31751for ac_func in getseuserbyname get_default_context_with_level
16596ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 31752do
16597if 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
16598 cat >>confdefs.h <<_ACEOF 31837 cat >>confdefs.h <<_ACEOF
16599#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 31838#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
16600_ACEOF 31839_ACEOF
16601 31840
16602fi 31841fi
@@ -16614,7 +31853,7 @@ fi
16614KRB5_MSG="no" 31853KRB5_MSG="no"
16615 31854
16616# Check whether --with-kerberos5 was given. 31855# Check whether --with-kerberos5 was given.
16617if test "${with_kerberos5+set}" = set; then : 31856if test "${with_kerberos5+set}" = set; then
16618 withval=$with_kerberos5; if test "x$withval" != "xno" ; then 31857 withval=$with_kerberos5; if test "x$withval" != "xno" ; then
16619 if test "x$withval" = "xyes" ; then 31858 if test "x$withval" = "xyes" ; then
16620 KRB5ROOT="/usr/local" 31859 KRB5ROOT="/usr/local"
@@ -16623,16 +31862,18 @@ if test "${with_kerberos5+set}" = set; then :
16623 fi 31862 fi
16624 31863
16625 31864
16626$as_echo "#define KRB5 1" >>confdefs.h 31865cat >>confdefs.h <<\_ACEOF
31866#define KRB5 1
31867_ACEOF
16627 31868
16628 KRB5_MSG="yes" 31869 KRB5_MSG="yes"
16629 31870
16630 # 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.
16631set dummy krb5-config; ac_word=$2 31872set dummy krb5-config; ac_word=$2
16632{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 31873{ echo "$as_me:$LINENO: checking for $ac_word" >&5
16633$as_echo_n "checking for $ac_word... " >&6; } 31874echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
16634if ${ac_cv_path_KRB5CONF+:} false; then : 31875if test "${ac_cv_path_KRB5CONF+set}" = set; then
16635 $as_echo_n "(cached) " >&6 31876 echo $ECHO_N "(cached) $ECHO_C" >&6
16636else 31877else
16637 case $KRB5CONF in 31878 case $KRB5CONF in
16638 [\\/]* | ?:[\\/]*) 31879 [\\/]* | ?:[\\/]*)
@@ -16645,14 +31886,14 @@ for as_dir in $as_dummy
16645do 31886do
16646 IFS=$as_save_IFS 31887 IFS=$as_save_IFS
16647 test -z "$as_dir" && as_dir=. 31888 test -z "$as_dir" && as_dir=.
16648 for ac_exec_ext in '' $ac_executable_extensions; do 31889 for ac_exec_ext in '' $ac_executable_extensions; do
16649 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
16650 ac_cv_path_KRB5CONF="$as_dir/$ac_word$ac_exec_ext" 31891 ac_cv_path_KRB5CONF="$as_dir/$ac_word$ac_exec_ext"
16651 $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
16652 break 2 31893 break 2
16653 fi 31894 fi
16654done 31895done
16655 done 31896done
16656IFS=$as_save_IFS 31897IFS=$as_save_IFS
16657 31898
16658 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"
@@ -16661,11 +31902,11 @@ esac
16661fi 31902fi
16662KRB5CONF=$ac_cv_path_KRB5CONF 31903KRB5CONF=$ac_cv_path_KRB5CONF
16663if test -n "$KRB5CONF"; then 31904if test -n "$KRB5CONF"; then
16664 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $KRB5CONF" >&5 31905 { echo "$as_me:$LINENO: result: $KRB5CONF" >&5
16665$as_echo "$KRB5CONF" >&6; } 31906echo "${ECHO_T}$KRB5CONF" >&6; }
16666else 31907else
16667 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 31908 { echo "$as_me:$LINENO: result: no" >&5
16668$as_echo "no" >&6; } 31909echo "${ECHO_T}no" >&6; }
16669fi 31910fi
16670 31911
16671 31912
@@ -16674,24 +31915,30 @@ fi
16674 K5LIBS="`$KRB5CONF --libs`" 31915 K5LIBS="`$KRB5CONF --libs`"
16675 CPPFLAGS="$CPPFLAGS $K5CFLAGS" 31916 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
16676 31917
16677 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gssapi support" >&5 31918 { echo "$as_me:$LINENO: checking for gssapi support" >&5
16678$as_echo_n "checking for gssapi support... " >&6; } 31919echo $ECHO_N "checking for gssapi support... $ECHO_C" >&6; }
16679 if $KRB5CONF | grep gssapi >/dev/null ; then 31920 if $KRB5CONF | grep gssapi >/dev/null ; then
16680 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 31921 { echo "$as_me:$LINENO: result: yes" >&5
16681$as_echo "yes" >&6; } 31922echo "${ECHO_T}yes" >&6; }
16682 31923
16683$as_echo "#define GSSAPI 1" >>confdefs.h 31924cat >>confdefs.h <<\_ACEOF
31925#define GSSAPI 1
31926_ACEOF
16684 31927
16685 GSSCFLAGS="`$KRB5CONF --cflags gssapi`" 31928 GSSCFLAGS="`$KRB5CONF --cflags gssapi`"
16686 GSSLIBS="`$KRB5CONF --libs gssapi`" 31929 GSSLIBS="`$KRB5CONF --libs gssapi`"
16687 CPPFLAGS="$CPPFLAGS $GSSCFLAGS" 31930 CPPFLAGS="$CPPFLAGS $GSSCFLAGS"
16688 else 31931 else
16689 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 31932 { echo "$as_me:$LINENO: result: no" >&5
16690$as_echo "no" >&6; } 31933echo "${ECHO_T}no" >&6; }
16691 fi 31934 fi
16692 { $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
16693$as_echo_n "checking whether we are using Heimdal... " >&6; } 31936echo $ECHO_N "checking whether we are using Heimdal... $ECHO_C" >&6; }
16694 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
16695/* end confdefs.h. */ 31942/* end confdefs.h. */
16696 #include <krb5.h> 31943 #include <krb5.h>
16697 31944
@@ -16703,24 +31950,50 @@ main ()
16703 return 0; 31950 return 0;
16704} 31951}
16705_ACEOF 31952_ACEOF
16706if ac_fn_c_try_compile "$LINENO"; then : 31953rm -f conftest.$ac_objext
16707 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 31954if { (ac_try="$ac_compile"
16708$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; }
16709 31972
16710$as_echo "#define HEIMDAL 1" >>confdefs.h 31973cat >>confdefs.h <<\_ACEOF
31974#define HEIMDAL 1
31975_ACEOF
16711 31976
16712else 31977else
16713 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 31978 echo "$as_me: failed program was:" >&5
16714$as_echo "no" >&6; } 31979sed 's/^/| /' conftest.$ac_ext >&5
31980
31981 { echo "$as_me:$LINENO: result: no" >&5
31982echo "${ECHO_T}no" >&6; }
16715 31983
16716fi 31984fi
31985
16717rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 31986rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
16718 else 31987 else
16719 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include" 31988 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
16720 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib" 31989 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
16721 { $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
16722$as_echo_n "checking whether we are using Heimdal... " >&6; } 31991echo $ECHO_N "checking whether we are using Heimdal... $ECHO_C" >&6; }
16723 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
16724/* end confdefs.h. */ 31997/* end confdefs.h. */
16725 #include <krb5.h> 31998 #include <krb5.h>
16726 31999
@@ -16732,21 +32005,43 @@ main ()
16732 return 0; 32005 return 0;
16733} 32006}
16734_ACEOF 32007_ACEOF
16735if ac_fn_c_try_compile "$LINENO"; then : 32008rm -f conftest.$ac_objext
16736 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 32009if { (ac_try="$ac_compile"
16737$as_echo "yes" >&6; } 32010case "(($ac_try" in
16738 $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
16739 32030
16740 K5LIBS="-lkrb5" 32031 K5LIBS="-lkrb5"
16741 K5LIBS="$K5LIBS -lcom_err -lasn1" 32032 K5LIBS="$K5LIBS -lcom_err -lasn1"
16742 { $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
16743$as_echo_n "checking for net_write in -lroken... " >&6; } 32034echo $ECHO_N "checking for net_write in -lroken... $ECHO_C" >&6; }
16744if ${ac_cv_lib_roken_net_write+:} false; then : 32035if test "${ac_cv_lib_roken_net_write+set}" = set; then
16745 $as_echo_n "(cached) " >&6 32036 echo $ECHO_N "(cached) $ECHO_C" >&6
16746else 32037else
16747 ac_check_lib_save_LIBS=$LIBS 32038 ac_check_lib_save_LIBS=$LIBS
16748LIBS="-lroken $LIBS" 32039LIBS="-lroken $LIBS"
16749cat 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
16750/* end confdefs.h. */ 32045/* end confdefs.h. */
16751 32046
16752/* Override any GCC internal prototype to avoid an error. 32047/* Override any GCC internal prototype to avoid an error.
@@ -16764,29 +32059,54 @@ return net_write ();
16764 return 0; 32059 return 0;
16765} 32060}
16766_ACEOF 32061_ACEOF
16767if 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
16768 ac_cv_lib_roken_net_write=yes 32080 ac_cv_lib_roken_net_write=yes
16769else 32081else
16770 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
16771fi 32086fi
16772rm -f core conftest.err conftest.$ac_objext \ 32087
16773 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
16774LIBS=$ac_check_lib_save_LIBS 32090LIBS=$ac_check_lib_save_LIBS
16775fi 32091fi
16776{ $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
16777$as_echo "$ac_cv_lib_roken_net_write" >&6; } 32093echo "${ECHO_T}$ac_cv_lib_roken_net_write" >&6; }
16778if test "x$ac_cv_lib_roken_net_write" = xyes; then : 32094if test $ac_cv_lib_roken_net_write = yes; then
16779 K5LIBS="$K5LIBS -lroken" 32095 K5LIBS="$K5LIBS -lroken"
16780fi 32096fi
16781 32097
16782 { $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
16783$as_echo_n "checking for des_cbc_encrypt in -ldes... " >&6; } 32099echo $ECHO_N "checking for des_cbc_encrypt in -ldes... $ECHO_C" >&6; }
16784if ${ac_cv_lib_des_des_cbc_encrypt+:} false; then : 32100if test "${ac_cv_lib_des_des_cbc_encrypt+set}" = set; then
16785 $as_echo_n "(cached) " >&6 32101 echo $ECHO_N "(cached) $ECHO_C" >&6
16786else 32102else
16787 ac_check_lib_save_LIBS=$LIBS 32103 ac_check_lib_save_LIBS=$LIBS
16788LIBS="-ldes $LIBS" 32104LIBS="-ldes $LIBS"
16789cat 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
16790/* end confdefs.h. */ 32110/* end confdefs.h. */
16791 32111
16792/* Override any GCC internal prototype to avoid an error. 32112/* Override any GCC internal prototype to avoid an error.
@@ -16804,37 +32124,66 @@ return des_cbc_encrypt ();
16804 return 0; 32124 return 0;
16805} 32125}
16806_ACEOF 32126_ACEOF
16807if 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
16808 ac_cv_lib_des_des_cbc_encrypt=yes 32145 ac_cv_lib_des_des_cbc_encrypt=yes
16809else 32146else
16810 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
16811fi 32151fi
16812rm -f core conftest.err conftest.$ac_objext \ 32152
16813 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
16814LIBS=$ac_check_lib_save_LIBS 32155LIBS=$ac_check_lib_save_LIBS
16815fi 32156fi
16816{ $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
16817$as_echo "$ac_cv_lib_des_des_cbc_encrypt" >&6; } 32158echo "${ECHO_T}$ac_cv_lib_des_des_cbc_encrypt" >&6; }
16818if test "x$ac_cv_lib_des_des_cbc_encrypt" = xyes; then : 32159if test $ac_cv_lib_des_des_cbc_encrypt = yes; then
16819 K5LIBS="$K5LIBS -ldes" 32160 K5LIBS="$K5LIBS -ldes"
16820fi 32161fi
16821 32162
16822 32163
16823else 32164else
16824 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 32165 echo "$as_me: failed program was:" >&5
16825$as_echo "no" >&6; } 32166sed 's/^/| /' conftest.$ac_ext >&5
32167
32168 { echo "$as_me:$LINENO: result: no" >&5
32169echo "${ECHO_T}no" >&6; }
16826 K5LIBS="-lkrb5 -lk5crypto -lcom_err" 32170 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
16827 32171
16828 32172
16829fi 32173fi
32174
16830rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 32175rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
16831 { $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
16832$as_echo_n "checking for library containing dn_expand... " >&6; } 32177echo $ECHO_N "checking for library containing dn_expand... $ECHO_C" >&6; }
16833if ${ac_cv_search_dn_expand+:} false; then : 32178if test "${ac_cv_search_dn_expand+set}" = set; then
16834 $as_echo_n "(cached) " >&6 32179 echo $ECHO_N "(cached) $ECHO_C" >&6
16835else 32180else
16836 ac_func_search_save_LIBS=$LIBS 32181 ac_func_search_save_LIBS=$LIBS
16837cat 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
16838/* end confdefs.h. */ 32187/* end confdefs.h. */
16839 32188
16840/* Override any GCC internal prototype to avoid an error. 32189/* Override any GCC internal prototype to avoid an error.
@@ -16859,40 +32208,67 @@ for ac_lib in '' resolv; do
16859 ac_res=-l$ac_lib 32208 ac_res=-l$ac_lib
16860 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 32209 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
16861 fi 32210 fi
16862 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
16863 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
16864fi 32235fi
16865rm -f core conftest.err conftest.$ac_objext \ 32236
16866 conftest$ac_exeext 32237rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
16867 if ${ac_cv_search_dn_expand+:} false; then : 32238 conftest$ac_exeext
32239 if test "${ac_cv_search_dn_expand+set}" = set; then
16868 break 32240 break
16869fi 32241fi
16870done 32242done
16871if ${ac_cv_search_dn_expand+:} false; then : 32243if test "${ac_cv_search_dn_expand+set}" = set; then
16872 32244 :
16873else 32245else
16874 ac_cv_search_dn_expand=no 32246 ac_cv_search_dn_expand=no
16875fi 32247fi
16876rm conftest.$ac_ext 32248rm conftest.$ac_ext
16877LIBS=$ac_func_search_save_LIBS 32249LIBS=$ac_func_search_save_LIBS
16878fi 32250fi
16879{ $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
16880$as_echo "$ac_cv_search_dn_expand" >&6; } 32252echo "${ECHO_T}$ac_cv_search_dn_expand" >&6; }
16881ac_res=$ac_cv_search_dn_expand 32253ac_res=$ac_cv_search_dn_expand
16882if test "$ac_res" != no; then : 32254if test "$ac_res" != no; then
16883 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 32255 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
16884 32256
16885fi 32257fi
16886 32258
16887 32259
16888 { $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
16889$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; }
16890if ${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
16891 $as_echo_n "(cached) " >&6 32263 echo $ECHO_N "(cached) $ECHO_C" >&6
16892else 32264else
16893 ac_check_lib_save_LIBS=$LIBS 32265 ac_check_lib_save_LIBS=$LIBS
16894LIBS="-lgssapi_krb5 $LIBS" 32266LIBS="-lgssapi_krb5 $LIBS"
16895cat 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
16896/* end confdefs.h. */ 32272/* end confdefs.h. */
16897 32273
16898/* Override any GCC internal prototype to avoid an error. 32274/* Override any GCC internal prototype to avoid an error.
@@ -16910,30 +32286,57 @@ return gss_init_sec_context ();
16910 return 0; 32286 return 0;
16911} 32287}
16912_ACEOF 32288_ACEOF
16913if 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
16914 ac_cv_lib_gssapi_krb5_gss_init_sec_context=yes 32307 ac_cv_lib_gssapi_krb5_gss_init_sec_context=yes
16915else 32308else
16916 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
16917fi 32313fi
16918rm -f core conftest.err conftest.$ac_objext \ 32314
16919 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
16920LIBS=$ac_check_lib_save_LIBS 32317LIBS=$ac_check_lib_save_LIBS
16921fi 32318fi
16922{ $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
16923$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; }
16924if 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
16925 $as_echo "#define GSSAPI 1" >>confdefs.h 32322 cat >>confdefs.h <<\_ACEOF
32323#define GSSAPI 1
32324_ACEOF
16926 32325
16927 GSSLIBS="-lgssapi_krb5" 32326 GSSLIBS="-lgssapi_krb5"
16928else 32327else
16929 { $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
16930$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; }
16931if ${ac_cv_lib_gssapi_gss_init_sec_context+:} false; then : 32330if test "${ac_cv_lib_gssapi_gss_init_sec_context+set}" = set; then
16932 $as_echo_n "(cached) " >&6 32331 echo $ECHO_N "(cached) $ECHO_C" >&6
16933else 32332else
16934 ac_check_lib_save_LIBS=$LIBS 32333 ac_check_lib_save_LIBS=$LIBS
16935LIBS="-lgssapi $LIBS" 32334LIBS="-lgssapi $LIBS"
16936cat 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
16937/* end confdefs.h. */ 32340/* end confdefs.h. */
16938 32341
16939/* Override any GCC internal prototype to avoid an error. 32342/* Override any GCC internal prototype to avoid an error.
@@ -16951,30 +32354,57 @@ return gss_init_sec_context ();
16951 return 0; 32354 return 0;
16952} 32355}
16953_ACEOF 32356_ACEOF
16954if 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
16955 ac_cv_lib_gssapi_gss_init_sec_context=yes 32375 ac_cv_lib_gssapi_gss_init_sec_context=yes
16956else 32376else
16957 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
16958fi 32381fi
16959rm -f core conftest.err conftest.$ac_objext \ 32382
16960 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
16961LIBS=$ac_check_lib_save_LIBS 32385LIBS=$ac_check_lib_save_LIBS
16962fi 32386fi
16963{ $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
16964$as_echo "$ac_cv_lib_gssapi_gss_init_sec_context" >&6; } 32388echo "${ECHO_T}$ac_cv_lib_gssapi_gss_init_sec_context" >&6; }
16965if test "x$ac_cv_lib_gssapi_gss_init_sec_context" = xyes; then : 32389if test $ac_cv_lib_gssapi_gss_init_sec_context = yes; then
16966 $as_echo "#define GSSAPI 1" >>confdefs.h 32390 cat >>confdefs.h <<\_ACEOF
32391#define GSSAPI 1
32392_ACEOF
16967 32393
16968 GSSLIBS="-lgssapi" 32394 GSSLIBS="-lgssapi"
16969else 32395else
16970 { $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
16971$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; }
16972if ${ac_cv_lib_gss_gss_init_sec_context+:} false; then : 32398if test "${ac_cv_lib_gss_gss_init_sec_context+set}" = set; then
16973 $as_echo_n "(cached) " >&6 32399 echo $ECHO_N "(cached) $ECHO_C" >&6
16974else 32400else
16975 ac_check_lib_save_LIBS=$LIBS 32401 ac_check_lib_save_LIBS=$LIBS
16976LIBS="-lgss $LIBS" 32402LIBS="-lgss $LIBS"
16977cat 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
16978/* end confdefs.h. */ 32408/* end confdefs.h. */
16979 32409
16980/* Override any GCC internal prototype to avoid an error. 32410/* Override any GCC internal prototype to avoid an error.
@@ -16992,24 +32422,47 @@ return gss_init_sec_context ();
16992 return 0; 32422 return 0;
16993} 32423}
16994_ACEOF 32424_ACEOF
16995if 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
16996 ac_cv_lib_gss_gss_init_sec_context=yes 32443 ac_cv_lib_gss_gss_init_sec_context=yes
16997else 32444else
16998 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
16999fi 32449fi
17000rm -f core conftest.err conftest.$ac_objext \ 32450
17001 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
17002LIBS=$ac_check_lib_save_LIBS 32453LIBS=$ac_check_lib_save_LIBS
17003fi 32454fi
17004{ $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
17005$as_echo "$ac_cv_lib_gss_gss_init_sec_context" >&6; } 32456echo "${ECHO_T}$ac_cv_lib_gss_gss_init_sec_context" >&6; }
17006if test "x$ac_cv_lib_gss_gss_init_sec_context" = xyes; then : 32457if test $ac_cv_lib_gss_gss_init_sec_context = yes; then
17007 $as_echo "#define GSSAPI 1" >>confdefs.h 32458 cat >>confdefs.h <<\_ACEOF
32459#define GSSAPI 1
32460_ACEOF
17008 32461
17009 GSSLIBS="-lgss" 32462 GSSLIBS="-lgss"
17010else 32463else
17011 { $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
17012$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;}
17013fi 32466fi
17014 32467
17015 32468
@@ -17019,23 +32472,285 @@ fi
17019fi 32472fi
17020 32473
17021 32474
17022 ac_fn_c_check_header_mongrel "$LINENO" "gssapi.h" "ac_cv_header_gssapi_h" "$ac_includes_default" 32475 if test "${ac_cv_header_gssapi_h+set}" = set; then
17023if test "x$ac_cv_header_gssapi_h" = xyes; 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
32558fi
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; }
17024 32563
32564# So? What about this header?
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; }
32603
32604fi
32605if test $ac_cv_header_gssapi_h = yes; then
32606 :
17025else 32607else
17026 unset ac_cv_header_gssapi_h 32608 unset ac_cv_header_gssapi_h
17027 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi" 32609 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
17028 for ac_header in gssapi.h 32610
17029do : 32611for ac_header in gssapi.h
17030 ac_fn_c_check_header_mongrel "$LINENO" "gssapi.h" "ac_cv_header_gssapi_h" "$ac_includes_default" 32612do
17031if 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
17032 cat >>confdefs.h <<_ACEOF 32747 cat >>confdefs.h <<_ACEOF
17033#define HAVE_GSSAPI_H 1 32748#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
17034_ACEOF 32749_ACEOF
17035 32750
17036else 32751else
17037 { $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
17038$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;}
17039 32754
17040fi 32755fi
17041 32756
@@ -17049,9 +32764,138 @@ fi
17049 32764
17050 oldCPP="$CPPFLAGS" 32765 oldCPP="$CPPFLAGS"
17051 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi" 32766 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
17052 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
17053if 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
17054 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; }
32895
32896fi
32897if test $ac_cv_header_gssapi_krb5_h = yes; then
32898 :
17055else 32899else
17056 CPPFLAGS="$oldCPP" 32900 CPPFLAGS="$oldCPP"
17057fi 32901fi
@@ -17066,39 +32910,438 @@ fi
17066 blibpath="$blibpath:${KRB5ROOT}/lib" 32910 blibpath="$blibpath:${KRB5ROOT}/lib"
17067 fi 32911 fi
17068 32912
17069 for ac_header in gssapi.h gssapi/gssapi.h 32913
17070do : 32914
17071 as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` 32915for ac_header in gssapi.h gssapi/gssapi.h
17072ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" 32916do
17073if 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
17074 cat >>confdefs.h <<_ACEOF 33051 cat >>confdefs.h <<_ACEOF
17075#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 33052#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
17076_ACEOF 33053_ACEOF
17077 33054
17078fi 33055fi
17079 33056
17080done 33057done
17081 33058
17082 for ac_header in gssapi_krb5.h gssapi/gssapi_krb5.h 33059
17083do : 33060
17084 as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` 33061for ac_header in gssapi_krb5.h gssapi/gssapi_krb5.h
17085ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" 33062do
17086if 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
17087 cat >>confdefs.h <<_ACEOF 33197 cat >>confdefs.h <<_ACEOF
17088#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 33198#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
17089_ACEOF 33199_ACEOF
17090 33200
17091fi 33201fi
17092 33202
17093done 33203done
17094 33204
17095 for ac_header in gssapi_generic.h gssapi/gssapi_generic.h 33205
17096do : 33206
17097 as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` 33207for ac_header in gssapi_generic.h gssapi/gssapi_generic.h
17098ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" 33208do
17099if 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
17100 cat >>confdefs.h <<_ACEOF 33343 cat >>confdefs.h <<_ACEOF
17101#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 33344#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
17102_ACEOF 33345_ACEOF
17103 33346
17104fi 33347fi
@@ -17106,13 +33349,17 @@ fi
17106done 33349done
17107 33350
17108 33351
17109 { $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
17110$as_echo_n "checking for library containing k_hasafs... " >&6; } 33353echo $ECHO_N "checking for library containing k_hasafs... $ECHO_C" >&6; }
17111if ${ac_cv_search_k_hasafs+:} false; then : 33354if test "${ac_cv_search_k_hasafs+set}" = set; then
17112 $as_echo_n "(cached) " >&6 33355 echo $ECHO_N "(cached) $ECHO_C" >&6
17113else 33356else
17114 ac_func_search_save_LIBS=$LIBS 33357 ac_func_search_save_LIBS=$LIBS
17115cat 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
17116/* end confdefs.h. */ 33363/* end confdefs.h. */
17117 33364
17118/* Override any GCC internal prototype to avoid an error. 33365/* Override any GCC internal prototype to avoid an error.
@@ -17137,35 +33384,71 @@ for ac_lib in '' kafs; do
17137 ac_res=-l$ac_lib 33384 ac_res=-l$ac_lib
17138 LIBS="-l$ac_lib $ac_func_search_save_LIBS" 33385 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
17139 fi 33386 fi
17140 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
17141 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
17142fi 33411fi
17143rm -f core conftest.err conftest.$ac_objext \ 33412
17144 conftest$ac_exeext 33413rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
17145 if ${ac_cv_search_k_hasafs+:} false; then : 33414 conftest$ac_exeext
33415 if test "${ac_cv_search_k_hasafs+set}" = set; then
17146 break 33416 break
17147fi 33417fi
17148done 33418done
17149if ${ac_cv_search_k_hasafs+:} false; then : 33419if test "${ac_cv_search_k_hasafs+set}" = set; then
17150 33420 :
17151else 33421else
17152 ac_cv_search_k_hasafs=no 33422 ac_cv_search_k_hasafs=no
17153fi 33423fi
17154rm conftest.$ac_ext 33424rm conftest.$ac_ext
17155LIBS=$ac_func_search_save_LIBS 33425LIBS=$ac_func_search_save_LIBS
17156fi 33426fi
17157{ $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
17158$as_echo "$ac_cv_search_k_hasafs" >&6; } 33428echo "${ECHO_T}$ac_cv_search_k_hasafs" >&6; }
17159ac_res=$ac_cv_search_k_hasafs 33429ac_res=$ac_cv_search_k_hasafs
17160if test "$ac_res" != no; then : 33430if test "$ac_res" != no; then
17161 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 33431 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
17162 33432
17163$as_echo "#define USE_AFS 1" >>confdefs.h 33433cat >>confdefs.h <<\_ACEOF
33434#define USE_AFS 1
33435_ACEOF
17164 33436
17165fi 33437fi
17166 33438
17167 33439
17168 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
17169#ifdef HAVE_GSSAPI_H 33452#ifdef HAVE_GSSAPI_H
17170# include <gssapi.h> 33453# include <gssapi.h>
17171#elif defined(HAVE_GSSAPI_GSSAPI_H) 33454#elif defined(HAVE_GSSAPI_GSSAPI_H)
@@ -17178,176 +33461,177 @@ fi
17178# include <gssapi/gssapi_generic.h> 33461# include <gssapi/gssapi_generic.h>
17179#endif 33462#endif
17180 33463
17181" 33464
17182if test "x$ac_cv_have_decl_GSS_C_NT_HOSTBASED_SERVICE" = xyes; then : 33465int
17183 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
17184else 33494else
17185 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
17186fi 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
17187 33506
17188cat >>confdefs.h <<_ACEOF 33507cat >>confdefs.h <<_ACEOF
17189#define HAVE_DECL_GSS_C_NT_HOSTBASED_SERVICE $ac_have_decl 33508#define HAVE_DECL_GSS_C_NT_HOSTBASED_SERVICE 1
17190_ACEOF 33509_ACEOF
17191 33510
17192 saved_LIBS="$LIBS" 33511
17193 LIBS="$LIBS $K5LIBS" 33512else
17194 for ac_func in krb5_cc_new_unique krb5_get_error_message krb5_free_error_message
17195do :
17196 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
17197ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
17198if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
17199 cat >>confdefs.h <<_ACEOF 33513 cat >>confdefs.h <<_ACEOF
17200#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 33514#define HAVE_DECL_GSS_C_NT_HOSTBASED_SERVICE 0
17201_ACEOF 33515_ACEOF
17202 33516
33517
17203fi 33518fi
17204done
17205 33519
17206 LIBS="$saved_LIBS"
17207 33520
17208 fi 33521 saved_LIBS="$LIBS"
33522 LIBS="$LIBS $K5LIBS"
17209 33523
17210 33524
17211fi
17212 33525
33526for ac_func in krb5_cc_new_unique krb5_get_error_message krb5_free_error_message
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
17213 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. */
17214 33548
33549#ifdef __STDC__
33550# include <limits.h>
33551#else
33552# include <assert.h>
33553#endif
17215 33554
17216# Check whether user wants ConsoleKit support 33555#undef $ac_func
17217CONSOLEKIT_MSG="no"
17218LIBCK_CONNECTOR=""
17219 33556
17220# Check whether --with-consolekit was given. 33557/* Override any GCC internal prototype to avoid an error.
17221if test "${with_consolekit+set}" = set; then : 33558 Use char because int might match the return type of a GCC
17222 withval=$with_consolekit; if test "x$withval" != "xno" ; then 33559 builtin and then its argument prototype would still apply. */
17223 if test -n "$ac_tool_prefix"; then 33560#ifdef __cplusplus
17224 # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. 33561extern "C"
17225set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 33562#endif
17226{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 33563char $ac_func ();
17227$as_echo_n "checking for $ac_word... " >&6; } 33564/* The GNU C library defines this for functions which it implements
17228if ${ac_cv_path_PKGCONFIG+:} false; then : 33565 to always fail with ENOSYS. Some functions are actually named
17229 $as_echo_n "(cached) " >&6 33566 something starting with __ and the normal name is an alias. */
17230else 33567#if defined __stub_$ac_func || defined __stub___$ac_func
17231 case $PKGCONFIG in 33568choke me
17232 [\\/]* | ?:[\\/]*) 33569#endif
17233 ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path.
17234 ;;
17235 *)
17236 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
17237for as_dir in $PATH
17238do
17239 IFS=$as_save_IFS
17240 test -z "$as_dir" && as_dir=.
17241 for ac_exec_ext in '' $ac_executable_extensions; do
17242 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
17243 ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
17244 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
17245 break 2
17246 fi
17247done
17248 done
17249IFS=$as_save_IFS
17250 33570
17251 ;; 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;;
17252esac 33584esac
17253fi 33585eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
17254PKGCONFIG=$ac_cv_path_PKGCONFIG 33586 (eval "$ac_link") 2>conftest.er1
17255if test -n "$PKGCONFIG"; then 33587 ac_status=$?
17256 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 33588 grep -v '^ *+' conftest.er1 >conftest.err
17257$as_echo "$PKGCONFIG" >&6; } 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"
17258else 33598else
17259 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 33599 echo "$as_me: failed program was:" >&5
17260$as_echo "no" >&6; } 33600sed 's/^/| /' conftest.$ac_ext >&5
17261fi
17262
17263 33601
33602 eval "$as_ac_var=no"
17264fi 33603fi
17265if test -z "$ac_cv_path_PKGCONFIG"; then
17266 ac_pt_PKGCONFIG=$PKGCONFIG
17267 # Extract the first word of "pkg-config", so it can be a program name with args.
17268set dummy pkg-config; ac_word=$2
17269{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
17270$as_echo_n "checking for $ac_word... " >&6; }
17271if ${ac_cv_path_ac_pt_PKGCONFIG+:} false; then :
17272 $as_echo_n "(cached) " >&6
17273else
17274 case $ac_pt_PKGCONFIG in
17275 [\\/]* | ?:[\\/]*)
17276 ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path.
17277 ;;
17278 *)
17279 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
17280for as_dir in $PATH
17281do
17282 IFS=$as_save_IFS
17283 test -z "$as_dir" && as_dir=.
17284 for ac_exec_ext in '' $ac_executable_extensions; do
17285 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
17286 ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
17287 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
17288 break 2
17289 fi
17290done
17291 done
17292IFS=$as_save_IFS
17293 33604
17294 ;; 33605rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
17295esac 33606 conftest$ac_exeext conftest.$ac_ext
17296fi
17297ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG
17298if test -n "$ac_pt_PKGCONFIG"; then
17299 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5
17300$as_echo "$ac_pt_PKGCONFIG" >&6; }
17301else
17302 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
17303$as_echo "no" >&6; }
17304fi 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
33612 cat >>confdefs.h <<_ACEOF
33613#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
33614_ACEOF
17305 33615
17306 if test "x$ac_pt_PKGCONFIG" = x; then
17307 PKGCONFIG="no"
17308 else
17309 case $cross_compiling:$ac_tool_warned in
17310yes:)
17311{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
17312$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
17313ac_tool_warned=yes ;;
17314esac
17315 PKGCONFIG=$ac_pt_PKGCONFIG
17316 fi
17317else
17318 PKGCONFIG="$ac_cv_path_PKGCONFIG"
17319fi 33616fi
33617done
17320 33618
17321 if test "$PKGCONFIG" != "no"; then 33619 LIBS="$saved_LIBS"
17322 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ck-connector" >&5
17323$as_echo_n "checking for ck-connector... " >&6; }
17324 if $PKGCONFIG --exists ck-connector; then
17325 CKCON_CFLAGS=`$PKGCONFIG --cflags ck-connector`
17326 CKCON_LIBS=`$PKGCONFIG --libs ck-connector`
17327 CPPFLAGS="$CPPFLAGS $CKCON_CFLAGS"
17328 SSHDLIBS="$SSHDLIBS $CKCON_LIBS"
17329 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
17330$as_echo "yes" >&6; }
17331
17332$as_echo "#define USE_CONSOLEKIT 1" >>confdefs.h
17333 33620
17334 CONSOLEKIT_MSG="yes"
17335 else
17336 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
17337$as_echo "no" >&6; }
17338 fi
17339 fi
17340 fi 33621 fi
17341 33622
33623
17342fi 33624fi
17343 33625
17344 33626
33627
33628
17345# Looking for programs, paths and files 33629# Looking for programs, paths and files
17346 33630
17347PRIVSEP_PATH=/var/empty 33631PRIVSEP_PATH=/var/empty
17348 33632
17349# Check whether --with-privsep-path was given. 33633# Check whether --with-privsep-path was given.
17350if test "${with_privsep_path+set}" = set; then : 33634if test "${with_privsep_path+set}" = set; then
17351 withval=$with_privsep_path; 33635 withval=$with_privsep_path;
17352 if test -n "$withval" && test "x$withval" != "xno" && \ 33636 if test -n "$withval" && test "x$withval" != "xno" && \
17353 test "x${withval}" != "xyes"; then 33637 test "x${withval}" != "xyes"; then
@@ -17361,7 +33645,7 @@ fi
17361 33645
17362 33646
17363# Check whether --with-xauth was given. 33647# Check whether --with-xauth was given.
17364if test "${with_xauth+set}" = set; then : 33648if test "${with_xauth+set}" = set; then
17365 withval=$with_xauth; 33649 withval=$with_xauth;
17366 if test -n "$withval" && test "x$withval" != "xno" && \ 33650 if test -n "$withval" && test "x$withval" != "xno" && \
17367 test "x${withval}" != "xyes"; then 33651 test "x${withval}" != "xyes"; then
@@ -17377,10 +33661,10 @@ else
17377 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin" 33661 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
17378 # 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.
17379set dummy xauth; ac_word=$2 33663set dummy xauth; ac_word=$2
17380{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 33664{ echo "$as_me:$LINENO: checking for $ac_word" >&5
17381$as_echo_n "checking for $ac_word... " >&6; } 33665echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
17382if ${ac_cv_path_xauth_path+:} false; then : 33666if test "${ac_cv_path_xauth_path+set}" = set; then
17383 $as_echo_n "(cached) " >&6 33667 echo $ECHO_N "(cached) $ECHO_C" >&6
17384else 33668else
17385 case $xauth_path in 33669 case $xauth_path in
17386 [\\/]* | ?:[\\/]*) 33670 [\\/]* | ?:[\\/]*)
@@ -17392,14 +33676,14 @@ for as_dir in $TestPath
17392do 33676do
17393 IFS=$as_save_IFS 33677 IFS=$as_save_IFS
17394 test -z "$as_dir" && as_dir=. 33678 test -z "$as_dir" && as_dir=.
17395 for ac_exec_ext in '' $ac_executable_extensions; do 33679 for ac_exec_ext in '' $ac_executable_extensions; do
17396 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
17397 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"
17398 $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
17399 break 2 33683 break 2
17400 fi 33684 fi
17401done 33685done
17402 done 33686done
17403IFS=$as_save_IFS 33687IFS=$as_save_IFS
17404 33688
17405 ;; 33689 ;;
@@ -17407,11 +33691,11 @@ esac
17407fi 33691fi
17408xauth_path=$ac_cv_path_xauth_path 33692xauth_path=$ac_cv_path_xauth_path
17409if test -n "$xauth_path"; then 33693if test -n "$xauth_path"; then
17410 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xauth_path" >&5 33694 { echo "$as_me:$LINENO: result: $xauth_path" >&5
17411$as_echo "$xauth_path" >&6; } 33695echo "${ECHO_T}$xauth_path" >&6; }
17412else 33696else
17413 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 33697 { echo "$as_me:$LINENO: result: no" >&5
17414$as_echo "no" >&6; } 33698echo "${ECHO_T}no" >&6; }
17415fi 33699fi
17416 33700
17417 33701
@@ -17425,7 +33709,7 @@ fi
17425 33709
17426STRIP_OPT=-s 33710STRIP_OPT=-s
17427# Check whether --enable-strip was given. 33711# Check whether --enable-strip was given.
17428if test "${enable_strip+set}" = set; then : 33712if test "${enable_strip+set}" = set; then
17429 enableval=$enable_strip; 33713 enableval=$enable_strip;
17430 if test "x$enableval" = "xno" ; then 33714 if test "x$enableval" = "xno" ; then
17431 STRIP_OPT= 33715 STRIP_OPT=
@@ -17452,7 +33736,7 @@ fi
17452# Check for mail directory 33736# Check for mail directory
17453 33737
17454# Check whether --with-maildir was given. 33738# Check whether --with-maildir was given.
17455if test "${with_maildir+set}" = set; then : 33739if test "${with_maildir+set}" = set; then
17456 withval=$with_maildir; 33740 withval=$with_maildir;
17457 if test "X$withval" != X && test "x$withval" != xno && \ 33741 if test "X$withval" != X && test "x$withval" != xno && \
17458 test "x${withval}" != xyes; then 33742 test "x${withval}" != xyes; then
@@ -17471,16 +33755,20 @@ else
17471_ACEOF 33755_ACEOF
17472 33756
17473 else 33757 else
17474 { $as_echo "$as_me:${as_lineno-$LINENO}: checking Discovering system mail directory" >&5 33758 { echo "$as_me:$LINENO: checking Discovering system mail directory" >&5
17475$as_echo_n "checking Discovering system mail directory... " >&6; } 33759echo $ECHO_N "checking Discovering system mail directory... $ECHO_C" >&6; }
17476 if test "$cross_compiling" = yes; then : 33760 if test "$cross_compiling" = yes; then
17477 33761
17478 { $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
17479$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;}
17480 33764
17481 33765
17482else 33766else
17483 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
17484/* end confdefs.h. */ 33772/* end confdefs.h. */
17485 33773
17486#include <stdio.h> 33774#include <stdio.h>
@@ -17523,13 +33811,32 @@ main ()
17523 return 0; 33811 return 0;
17524} 33812}
17525_ACEOF 33813_ACEOF
17526if 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
17527 33834
17528 maildir_what=`awk -F: '{print $1}' conftest.maildir` 33835 maildir_what=`awk -F: '{print $1}' conftest.maildir`
17529 maildir=`awk -F: '{print $2}' conftest.maildir \ 33836 maildir=`awk -F: '{print $2}' conftest.maildir \
17530 | sed 's|/$||'` 33837 | sed 's|/$||'`
17531 { $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
17532$as_echo "Using: $maildir from $maildir_what" >&6; } 33839echo "${ECHO_T}Using: $maildir from $maildir_what" >&6; }
17533 if test "x$maildir_what" != "x_PATH_MAILDIR"; then 33840 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
17534 cat >>confdefs.h <<_ACEOF 33841 cat >>confdefs.h <<_ACEOF
17535#define MAIL_DIRECTORY "$maildir" 33842#define MAIL_DIRECTORY "$maildir"
@@ -17538,25 +33845,30 @@ _ACEOF
17538 fi 33845 fi
17539 33846
17540else 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 )
17541 33853
17542 if test "X$ac_status" = "X2";then 33854 if test "X$ac_status" = "X2";then
17543# 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
17544 { $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
17545$as_echo "Using: default value of /var/spool/mail" >&6; } 33857echo "${ECHO_T}Using: default value of /var/spool/mail" >&6; }
17546 cat >>confdefs.h <<_ACEOF 33858 cat >>confdefs.h <<_ACEOF
17547#define MAIL_DIRECTORY "/var/spool/mail" 33859#define MAIL_DIRECTORY "/var/spool/mail"
17548_ACEOF 33860_ACEOF
17549 33861
17550 else 33862 else
17551 { $as_echo "$as_me:${as_lineno-$LINENO}: result: *** not found ***" >&5 33863 { echo "$as_me:$LINENO: result: *** not found ***" >&5
17552$as_echo "*** not found ***" >&6; } 33864echo "${ECHO_T}*** not found ***" >&6; }
17553 fi 33865 fi
17554 33866
17555fi 33867fi
17556rm -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
17557 conftest.$ac_objext conftest.beam conftest.$ac_ext
17558fi 33869fi
17559 33870
33871
17560 fi 33872 fi
17561 33873
17562 33874
@@ -17564,30 +33876,30 @@ fi
17564 # maildir 33876 # maildir
17565 33877
17566if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then 33878if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
17567 { $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
17568$as_echo "$as_me: WARNING: cross compiling: Disabling /dev/ptmx test" >&2;} 33880echo "$as_me: WARNING: cross compiling: Disabling /dev/ptmx test" >&2;}
17569 disable_ptmx_check=yes 33881 disable_ptmx_check=yes
17570fi 33882fi
17571if test -z "$no_dev_ptmx" ; then 33883if test -z "$no_dev_ptmx" ; then
17572 if test "x$disable_ptmx_check" != "xyes" ; then 33884 if test "x$disable_ptmx_check" != "xyes" ; then
17573 as_ac_File=`$as_echo "ac_cv_file_"/dev/ptmx"" | $as_tr_sh` 33885 { echo "$as_me:$LINENO: checking for \"/dev/ptmx\"" >&5
17574{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for \"/dev/ptmx\"" >&5 33886echo $ECHO_N "checking for \"/dev/ptmx\"... $ECHO_C" >&6; }
17575$as_echo_n "checking for \"/dev/ptmx\"... " >&6; } 33887if test "${ac_cv_file___dev_ptmx_+set}" = set; then
17576if eval \${$as_ac_File+:} false; then : 33888 echo $ECHO_N "(cached) $ECHO_C" >&6
17577 $as_echo_n "(cached) " >&6
17578else 33889else
17579 test "$cross_compiling" = yes && 33890 test "$cross_compiling" = yes &&
17580 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; }; }
17581if test -r ""/dev/ptmx""; then 33894if test -r ""/dev/ptmx""; then
17582 eval "$as_ac_File=yes" 33895 ac_cv_file___dev_ptmx_=yes
17583else 33896else
17584 eval "$as_ac_File=no" 33897 ac_cv_file___dev_ptmx_=no
17585fi 33898fi
17586fi 33899fi
17587eval ac_res=\$$as_ac_File 33900{ echo "$as_me:$LINENO: result: $ac_cv_file___dev_ptmx_" >&5
17588 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 33901echo "${ECHO_T}$ac_cv_file___dev_ptmx_" >&6; }
17589$as_echo "$ac_res" >&6; } 33902if test $ac_cv_file___dev_ptmx_ = yes; then
17590if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
17591 33903
17592 33904
17593cat >>confdefs.h <<_ACEOF 33905cat >>confdefs.h <<_ACEOF
@@ -17603,24 +33915,24 @@ fi
17603fi 33915fi
17604 33916
17605if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then 33917if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
17606 as_ac_File=`$as_echo "ac_cv_file_"/dev/ptc"" | $as_tr_sh` 33918 { echo "$as_me:$LINENO: checking for \"/dev/ptc\"" >&5
17607{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for \"/dev/ptc\"" >&5 33919echo $ECHO_N "checking for \"/dev/ptc\"... $ECHO_C" >&6; }
17608$as_echo_n "checking for \"/dev/ptc\"... " >&6; } 33920if test "${ac_cv_file___dev_ptc_+set}" = set; then
17609if eval \${$as_ac_File+:} false; then : 33921 echo $ECHO_N "(cached) $ECHO_C" >&6
17610 $as_echo_n "(cached) " >&6
17611else 33922else
17612 test "$cross_compiling" = yes && 33923 test "$cross_compiling" = yes &&
17613 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; }; }
17614if test -r ""/dev/ptc""; then 33927if test -r ""/dev/ptc""; then
17615 eval "$as_ac_File=yes" 33928 ac_cv_file___dev_ptc_=yes
17616else 33929else
17617 eval "$as_ac_File=no" 33930 ac_cv_file___dev_ptc_=no
17618fi 33931fi
17619fi 33932fi
17620eval ac_res=\$$as_ac_File 33933{ echo "$as_me:$LINENO: result: $ac_cv_file___dev_ptc_" >&5
17621 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 33934echo "${ECHO_T}$ac_cv_file___dev_ptc_" >&6; }
17622$as_echo "$ac_res" >&6; } 33935if test $ac_cv_file___dev_ptc_ = yes; then
17623if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
17624 33936
17625 33937
17626cat >>confdefs.h <<_ACEOF 33938cat >>confdefs.h <<_ACEOF
@@ -17633,21 +33945,23 @@ _ACEOF
17633fi 33945fi
17634 33946
17635else 33947else
17636 { $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
17637$as_echo "$as_me: WARNING: cross compiling: Disabling /dev/ptc test" >&2;} 33949echo "$as_me: WARNING: cross compiling: Disabling /dev/ptc test" >&2;}
17638fi 33950fi
17639 33951
17640# 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
17641 33953
17642# Check whether --with-mantype was given. 33954# Check whether --with-mantype was given.
17643if test "${with_mantype+set}" = set; then : 33955if test "${with_mantype+set}" = set; then
17644 withval=$with_mantype; 33956 withval=$with_mantype;
17645 case "$withval" in 33957 case "$withval" in
17646 man|cat|doc) 33958 man|cat|doc)
17647 MANTYPE=$withval 33959 MANTYPE=$withval
17648 ;; 33960 ;;
17649 *) 33961 *)
17650 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; }; }
17651 ;; 33965 ;;
17652 esac 33966 esac
17653 33967
@@ -17660,10 +33974,10 @@ if test -z "$MANTYPE"; then
17660do 33974do
17661 # 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.
17662set dummy $ac_prog; ac_word=$2 33976set dummy $ac_prog; ac_word=$2
17663{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 33977{ echo "$as_me:$LINENO: checking for $ac_word" >&5
17664$as_echo_n "checking for $ac_word... " >&6; } 33978echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
17665if ${ac_cv_path_NROFF+:} false; then : 33979if test "${ac_cv_path_NROFF+set}" = set; then
17666 $as_echo_n "(cached) " >&6 33980 echo $ECHO_N "(cached) $ECHO_C" >&6
17667else 33981else
17668 case $NROFF in 33982 case $NROFF in
17669 [\\/]* | ?:[\\/]*) 33983 [\\/]* | ?:[\\/]*)
@@ -17675,14 +33989,14 @@ for as_dir in $TestPath
17675do 33989do
17676 IFS=$as_save_IFS 33990 IFS=$as_save_IFS
17677 test -z "$as_dir" && as_dir=. 33991 test -z "$as_dir" && as_dir=.
17678 for ac_exec_ext in '' $ac_executable_extensions; do 33992 for ac_exec_ext in '' $ac_executable_extensions; do
17679 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
17680 ac_cv_path_NROFF="$as_dir/$ac_word$ac_exec_ext" 33994 ac_cv_path_NROFF="$as_dir/$ac_word$ac_exec_ext"
17681 $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
17682 break 2 33996 break 2
17683 fi 33997 fi
17684done 33998done
17685 done 33999done
17686IFS=$as_save_IFS 34000IFS=$as_save_IFS
17687 34001
17688 ;; 34002 ;;
@@ -17690,11 +34004,11 @@ esac
17690fi 34004fi
17691NROFF=$ac_cv_path_NROFF 34005NROFF=$ac_cv_path_NROFF
17692if test -n "$NROFF"; then 34006if test -n "$NROFF"; then
17693 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NROFF" >&5 34007 { echo "$as_me:$LINENO: result: $NROFF" >&5
17694$as_echo "$NROFF" >&6; } 34008echo "${ECHO_T}$NROFF" >&6; }
17695else 34009else
17696 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 34010 { echo "$as_me:$LINENO: result: no" >&5
17697$as_echo "no" >&6; } 34011echo "${ECHO_T}no" >&6; }
17698fi 34012fi
17699 34013
17700 34014
@@ -17722,11 +34036,13 @@ fi
17722MD5_MSG="no" 34036MD5_MSG="no"
17723 34037
17724# Check whether --with-md5-passwords was given. 34038# Check whether --with-md5-passwords was given.
17725if test "${with_md5_passwords+set}" = set; then : 34039if test "${with_md5_passwords+set}" = set; then
17726 withval=$with_md5_passwords; 34040 withval=$with_md5_passwords;
17727 if test "x$withval" != "xno" ; then 34041 if test "x$withval" != "xno" ; then
17728 34042
17729$as_echo "#define HAVE_MD5_PASSWORDS 1" >>confdefs.h 34043cat >>confdefs.h <<\_ACEOF
34044#define HAVE_MD5_PASSWORDS 1
34045_ACEOF
17730 34046
17731 MD5_MSG="yes" 34047 MD5_MSG="yes"
17732 fi 34048 fi
@@ -17738,10 +34054,12 @@ fi
17738# Whether to disable shadow password support 34054# Whether to disable shadow password support
17739 34055
17740# Check whether --with-shadow was given. 34056# Check whether --with-shadow was given.
17741if test "${with_shadow+set}" = set; then : 34057if test "${with_shadow+set}" = set; then
17742 withval=$with_shadow; 34058 withval=$with_shadow;
17743 if test "x$withval" = "xno" ; then 34059 if test "x$withval" = "xno" ; then
17744 $as_echo "#define DISABLE_SHADOW 1" >>confdefs.h 34060 cat >>confdefs.h <<\_ACEOF
34061#define DISABLE_SHADOW 1
34062_ACEOF
17745 34063
17746 disable_shadow=yes 34064 disable_shadow=yes
17747 fi 34065 fi
@@ -17751,9 +34069,13 @@ fi
17751 34069
17752 34070
17753if test -z "$disable_shadow" ; then 34071if test -z "$disable_shadow" ; then
17754 { $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
17755$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; }
17756 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
17757/* end confdefs.h. */ 34079/* end confdefs.h. */
17758 34080
17759#include <sys/types.h> 34081#include <sys/types.h>
@@ -17768,20 +34090,45 @@ main ()
17768 return 0; 34090 return 0;
17769} 34091}
17770_ACEOF 34092_ACEOF
17771if 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
17772 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
17773fi 34117fi
34118
17774rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 34119rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
17775 34120
17776 if test "x$sp_expire_available" = "xyes" ; then 34121 if test "x$sp_expire_available" = "xyes" ; then
17777 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 34122 { echo "$as_me:$LINENO: result: yes" >&5
17778$as_echo "yes" >&6; } 34123echo "${ECHO_T}yes" >&6; }
17779 34124
17780$as_echo "#define HAS_SHADOW_EXPIRE 1" >>confdefs.h 34125cat >>confdefs.h <<\_ACEOF
34126#define HAS_SHADOW_EXPIRE 1
34127_ACEOF
17781 34128
17782 else 34129 else
17783 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 34130 { echo "$as_me:$LINENO: result: no" >&5
17784$as_echo "no" >&6; } 34131echo "${ECHO_T}no" >&6; }
17785 fi 34132 fi
17786fi 34133fi
17787 34134
@@ -17789,16 +34136,20 @@ fi
17789if test ! -z "$IPADDR_IN_DISPLAY" ; then 34136if test ! -z "$IPADDR_IN_DISPLAY" ; then
17790 DISPLAY_HACK_MSG="yes" 34137 DISPLAY_HACK_MSG="yes"
17791 34138
17792$as_echo "#define IPADDR_IN_DISPLAY 1" >>confdefs.h 34139cat >>confdefs.h <<\_ACEOF
34140#define IPADDR_IN_DISPLAY 1
34141_ACEOF
17793 34142
17794else 34143else
17795 DISPLAY_HACK_MSG="no" 34144 DISPLAY_HACK_MSG="no"
17796 34145
17797# Check whether --with-ipaddr-display was given. 34146# Check whether --with-ipaddr-display was given.
17798if test "${with_ipaddr_display+set}" = set; then : 34147if test "${with_ipaddr_display+set}" = set; then
17799 withval=$with_ipaddr_display; 34148 withval=$with_ipaddr_display;
17800 if test "x$withval" != "xno" ; then 34149 if test "x$withval" != "xno" ; then
17801 $as_echo "#define IPADDR_IN_DISPLAY 1" >>confdefs.h 34150 cat >>confdefs.h <<\_ACEOF
34151#define IPADDR_IN_DISPLAY 1
34152_ACEOF
17802 34153
17803 DISPLAY_HACK_MSG="yes" 34154 DISPLAY_HACK_MSG="yes"
17804 fi 34155 fi
@@ -17810,10 +34161,10 @@ fi
17810 34161
17811# check for /etc/default/login and use it if present. 34162# check for /etc/default/login and use it if present.
17812# Check whether --enable-etc-default-login was given. 34163# Check whether --enable-etc-default-login was given.
17813if test "${enable_etc_default_login+set}" = set; then : 34164if test "${enable_etc_default_login+set}" = set; then
17814 enableval=$enable_etc_default_login; if test "x$enableval" = "xno"; then 34165 enableval=$enable_etc_default_login; if test "x$enableval" = "xno"; then
17815 { $as_echo "$as_me:${as_lineno-$LINENO}: /etc/default/login handling disabled" >&5 34166 { echo "$as_me:$LINENO: /etc/default/login handling disabled" >&5
17816$as_echo "$as_me: /etc/default/login handling disabled" >&6;} 34167echo "$as_me: /etc/default/login handling disabled" >&6;}
17817 etc_default_login=no 34168 etc_default_login=no
17818 else 34169 else
17819 etc_default_login=yes 34170 etc_default_login=yes
@@ -17821,8 +34172,8 @@ $as_echo "$as_me: /etc/default/login handling disabled" >&6;}
17821else 34172else
17822 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; 34173 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
17823 then 34174 then
17824 { $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
17825$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;}
17826 etc_default_login=no 34177 etc_default_login=no
17827 else 34178 else
17828 etc_default_login=yes 34179 etc_default_login=yes
@@ -17832,30 +34183,32 @@ fi
17832 34183
17833 34184
17834if test "x$etc_default_login" != "xno"; then 34185if test "x$etc_default_login" != "xno"; then
17835 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
17836{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for \"/etc/default/login\"" >&5 34187echo $ECHO_N "checking for \"/etc/default/login\"... $ECHO_C" >&6; }
17837$as_echo_n "checking for \"/etc/default/login\"... " >&6; } 34188if test "${ac_cv_file___etc_default_login_+set}" = set; then
17838if eval \${$as_ac_File+:} false; then : 34189 echo $ECHO_N "(cached) $ECHO_C" >&6
17839 $as_echo_n "(cached) " >&6
17840else 34190else
17841 test "$cross_compiling" = yes && 34191 test "$cross_compiling" = yes &&
17842 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; }; }
17843if test -r ""/etc/default/login""; then 34195if test -r ""/etc/default/login""; then
17844 eval "$as_ac_File=yes" 34196 ac_cv_file___etc_default_login_=yes
17845else 34197else
17846 eval "$as_ac_File=no" 34198 ac_cv_file___etc_default_login_=no
17847fi 34199fi
17848fi 34200fi
17849eval ac_res=\$$as_ac_File 34201{ echo "$as_me:$LINENO: result: $ac_cv_file___etc_default_login_" >&5
17850 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 34202echo "${ECHO_T}$ac_cv_file___etc_default_login_" >&6; }
17851$as_echo "$ac_res" >&6; } 34203if test $ac_cv_file___etc_default_login_ = yes; then
17852if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
17853 external_path_file=/etc/default/login 34204 external_path_file=/etc/default/login
17854fi 34205fi
17855 34206
17856 if test "x$external_path_file" = "x/etc/default/login"; then 34207 if test "x$external_path_file" = "x/etc/default/login"; then
17857 34208
17858$as_echo "#define HAVE_ETC_DEFAULT_LOGIN 1" >>confdefs.h 34209cat >>confdefs.h <<\_ACEOF
34210#define HAVE_ETC_DEFAULT_LOGIN 1
34211_ACEOF
17859 34212
17860 fi 34213 fi
17861fi 34214fi
@@ -17869,21 +34222,21 @@ fi
17869SERVER_PATH_MSG="(default)" 34222SERVER_PATH_MSG="(default)"
17870 34223
17871# Check whether --with-default-path was given. 34224# Check whether --with-default-path was given.
17872if test "${with_default_path+set}" = set; then : 34225if test "${with_default_path+set}" = set; then
17873 withval=$with_default_path; 34226 withval=$with_default_path;
17874 if test "x$external_path_file" = "x/etc/login.conf" ; then 34227 if test "x$external_path_file" = "x/etc/login.conf" ; then
17875 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 34228 { echo "$as_me:$LINENO: WARNING:
17876--with-default-path=PATH has no effect on this system. 34229--with-default-path=PATH has no effect on this system.
17877Edit /etc/login.conf instead." >&5 34230Edit /etc/login.conf instead." >&5
17878$as_echo "$as_me: WARNING: 34231echo "$as_me: WARNING:
17879--with-default-path=PATH has no effect on this system. 34232--with-default-path=PATH has no effect on this system.
17880Edit /etc/login.conf instead." >&2;} 34233Edit /etc/login.conf instead." >&2;}
17881 elif test "x$withval" != "xno" ; then 34234 elif test "x$withval" != "xno" ; then
17882 if test ! -z "$external_path_file" ; then 34235 if test ! -z "$external_path_file" ; then
17883 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 34236 { echo "$as_me:$LINENO: WARNING:
17884--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
17885$external_path_file ." >&5 34238$external_path_file ." >&5
17886$as_echo "$as_me: WARNING: 34239echo "$as_me: WARNING:
17887--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
17888$external_path_file ." >&2;} 34241$external_path_file ." >&2;}
17889 fi 34242 fi
@@ -17893,22 +34246,26 @@ $external_path_file ." >&2;}
17893 34246
17894else 34247else
17895 if test "x$external_path_file" = "x/etc/login.conf" ; then 34248 if test "x$external_path_file" = "x/etc/login.conf" ; then
17896 { $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
17897$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;}
17898 else 34251 else
17899 if test ! -z "$external_path_file" ; then 34252 if test ! -z "$external_path_file" ; then
17900 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 34253 { echo "$as_me:$LINENO: WARNING:
17901If 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,
17902otherwise scp will not work." >&5 34255otherwise scp will not work." >&5
17903$as_echo "$as_me: WARNING: 34256echo "$as_me: WARNING:
17904If 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,
17905otherwise scp will not work." >&2;} 34258otherwise scp will not work." >&2;}
17906 fi 34259 fi
17907 if test "$cross_compiling" = yes; then : 34260 if test "$cross_compiling" = yes; then
17908 user_path="/usr/bin:/bin:/usr/sbin:/sbin" 34261 user_path="/usr/bin:/bin:/usr/sbin:/sbin"
17909 34262
17910else 34263else
17911 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
17912/* end confdefs.h. */ 34269/* end confdefs.h. */
17913 34270
17914/* find out what STDPATH is */ 34271/* find out what STDPATH is */
@@ -17948,15 +34305,39 @@ main ()
17948 return 0; 34305 return 0;
17949} 34306}
17950_ACEOF 34307_ACEOF
17951if 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
17952 user_path=`cat conftest.stdpath` 34328 user_path=`cat conftest.stdpath`
17953else 34329else
17954 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"
17955fi 34336fi
17956rm -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
17957 conftest.$ac_objext conftest.beam conftest.$ac_ext
17958fi 34338fi
17959 34339
34340
17960# make sure $bindir is in USER_PATH so scp will work 34341# make sure $bindir is in USER_PATH so scp will work
17961 t_bindir="${bindir}" 34342 t_bindir="${bindir}"
17962 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do 34343 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do
@@ -17973,8 +34354,8 @@ fi
17973 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1 34354 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
17974 if test $? -ne 0 ; then 34355 if test $? -ne 0 ; then
17975 user_path=$user_path:$t_bindir 34356 user_path=$user_path:$t_bindir
17976 { $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
17977$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; }
17978 fi 34359 fi
17979 fi 34360 fi
17980 fi 34361 fi
@@ -17993,7 +34374,7 @@ fi
17993# Set superuser path separately to user path 34374# Set superuser path separately to user path
17994 34375
17995# Check whether --with-superuser-path was given. 34376# Check whether --with-superuser-path was given.
17996if test "${with_superuser_path+set}" = set; then : 34377if test "${with_superuser_path+set}" = set; then
17997 withval=$with_superuser_path; 34378 withval=$with_superuser_path;
17998 if test -n "$withval" && test "x$withval" != "xno" && \ 34379 if test -n "$withval" && test "x$withval" != "xno" && \
17999 test "x${withval}" != "xyes"; then 34380 test "x${withval}" != "xyes"; then
@@ -18010,36 +34391,40 @@ fi
18010 34391
18011 34392
18012 34393
18013{ $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
18014$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; }
18015IPV4_IN6_HACK_MSG="no" 34396IPV4_IN6_HACK_MSG="no"
18016 34397
18017# Check whether --with-4in6 was given. 34398# Check whether --with-4in6 was given.
18018if test "${with_4in6+set}" = set; then : 34399if test "${with_4in6+set}" = set; then
18019 withval=$with_4in6; 34400 withval=$with_4in6;
18020 if test "x$withval" != "xno" ; then 34401 if test "x$withval" != "xno" ; then
18021 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 34402 { echo "$as_me:$LINENO: result: yes" >&5
18022$as_echo "yes" >&6; } 34403echo "${ECHO_T}yes" >&6; }
18023 34404
18024$as_echo "#define IPV4_IN_IPV6 1" >>confdefs.h 34405cat >>confdefs.h <<\_ACEOF
34406#define IPV4_IN_IPV6 1
34407_ACEOF
18025 34408
18026 IPV4_IN6_HACK_MSG="yes" 34409 IPV4_IN6_HACK_MSG="yes"
18027 else 34410 else
18028 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 34411 { echo "$as_me:$LINENO: result: no" >&5
18029$as_echo "no" >&6; } 34412echo "${ECHO_T}no" >&6; }
18030 fi 34413 fi
18031 34414
18032else 34415else
18033 34416
18034 if test "x$inet6_default_4in6" = "xyes"; then 34417 if test "x$inet6_default_4in6" = "xyes"; then
18035 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 34418 { echo "$as_me:$LINENO: result: yes (default)" >&5
18036$as_echo "yes (default)" >&6; } 34419echo "${ECHO_T}yes (default)" >&6; }
18037 $as_echo "#define IPV4_IN_IPV6 1" >>confdefs.h 34420 cat >>confdefs.h <<\_ACEOF
34421#define IPV4_IN_IPV6 1
34422_ACEOF
18038 34423
18039 IPV4_IN6_HACK_MSG="yes" 34424 IPV4_IN6_HACK_MSG="yes"
18040 else 34425 else
18041 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (default)" >&5 34426 { echo "$as_me:$LINENO: result: no (default)" >&5
18042$as_echo "no (default)" >&6; } 34427echo "${ECHO_T}no (default)" >&6; }
18043 fi 34428 fi
18044 34429
18045 34430
@@ -18050,11 +34435,13 @@ fi
18050BSD_AUTH_MSG=no 34435BSD_AUTH_MSG=no
18051 34436
18052# Check whether --with-bsd-auth was given. 34437# Check whether --with-bsd-auth was given.
18053if test "${with_bsd_auth+set}" = set; then : 34438if test "${with_bsd_auth+set}" = set; then
18054 withval=$with_bsd_auth; 34439 withval=$with_bsd_auth;
18055 if test "x$withval" != "xno" ; then 34440 if test "x$withval" != "xno" ; then
18056 34441
18057$as_echo "#define BSD_AUTH 1" >>confdefs.h 34442cat >>confdefs.h <<\_ACEOF
34443#define BSD_AUTH 1
34444_ACEOF
18058 34445
18059 BSD_AUTH_MSG=yes 34446 BSD_AUTH_MSG=yes
18060 fi 34447 fi
@@ -18075,14 +34462,14 @@ fi
18075 34462
18076 34463
18077# Check whether --with-pid-dir was given. 34464# Check whether --with-pid-dir was given.
18078if test "${with_pid_dir+set}" = set; then : 34465if test "${with_pid_dir+set}" = set; then
18079 withval=$with_pid_dir; 34466 withval=$with_pid_dir;
18080 if test -n "$withval" && test "x$withval" != "xno" && \ 34467 if test -n "$withval" && test "x$withval" != "xno" && \
18081 test "x${withval}" != "xyes"; then 34468 test "x${withval}" != "xyes"; then
18082 piddir=$withval 34469 piddir=$withval
18083 if test ! -d $piddir ; then 34470 if test ! -d $piddir ; then
18084 { $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
18085$as_echo "$as_me: WARNING: ** no $piddir directory on this system **" >&2;} 34472echo "$as_me: WARNING: ** no $piddir directory on this system **" >&2;}
18086 fi 34473 fi
18087 fi 34474 fi
18088 34475
@@ -18098,10 +34485,12 @@ _ACEOF
18098 34485
18099 34486
18100# Check whether --enable-lastlog was given. 34487# Check whether --enable-lastlog was given.
18101if test "${enable_lastlog+set}" = set; then : 34488if test "${enable_lastlog+set}" = set; then
18102 enableval=$enable_lastlog; 34489 enableval=$enable_lastlog;
18103 if test "x$enableval" = "xno" ; then 34490 if test "x$enableval" = "xno" ; then
18104 $as_echo "#define DISABLE_LASTLOG 1" >>confdefs.h 34491 cat >>confdefs.h <<\_ACEOF
34492#define DISABLE_LASTLOG 1
34493_ACEOF
18105 34494
18106 fi 34495 fi
18107 34496
@@ -18109,10 +34498,12 @@ if test "${enable_lastlog+set}" = set; then :
18109fi 34498fi
18110 34499
18111# Check whether --enable-utmp was given. 34500# Check whether --enable-utmp was given.
18112if test "${enable_utmp+set}" = set; then : 34501if test "${enable_utmp+set}" = set; then
18113 enableval=$enable_utmp; 34502 enableval=$enable_utmp;
18114 if test "x$enableval" = "xno" ; then 34503 if test "x$enableval" = "xno" ; then
18115 $as_echo "#define DISABLE_UTMP 1" >>confdefs.h 34504 cat >>confdefs.h <<\_ACEOF
34505#define DISABLE_UTMP 1
34506_ACEOF
18116 34507
18117 fi 34508 fi
18118 34509
@@ -18120,11 +34511,13 @@ if test "${enable_utmp+set}" = set; then :
18120fi 34511fi
18121 34512
18122# Check whether --enable-utmpx was given. 34513# Check whether --enable-utmpx was given.
18123if test "${enable_utmpx+set}" = set; then : 34514if test "${enable_utmpx+set}" = set; then
18124 enableval=$enable_utmpx; 34515 enableval=$enable_utmpx;
18125 if test "x$enableval" = "xno" ; then 34516 if test "x$enableval" = "xno" ; then
18126 34517
18127$as_echo "#define DISABLE_UTMPX 1" >>confdefs.h 34518cat >>confdefs.h <<\_ACEOF
34519#define DISABLE_UTMPX 1
34520_ACEOF
18128 34521
18129 fi 34522 fi
18130 34523
@@ -18132,10 +34525,12 @@ $as_echo "#define DISABLE_UTMPX 1" >>confdefs.h
18132fi 34525fi
18133 34526
18134# Check whether --enable-wtmp was given. 34527# Check whether --enable-wtmp was given.
18135if test "${enable_wtmp+set}" = set; then : 34528if test "${enable_wtmp+set}" = set; then
18136 enableval=$enable_wtmp; 34529 enableval=$enable_wtmp;
18137 if test "x$enableval" = "xno" ; then 34530 if test "x$enableval" = "xno" ; then
18138 $as_echo "#define DISABLE_WTMP 1" >>confdefs.h 34531 cat >>confdefs.h <<\_ACEOF
34532#define DISABLE_WTMP 1
34533_ACEOF
18139 34534
18140 fi 34535 fi
18141 34536
@@ -18143,11 +34538,13 @@ if test "${enable_wtmp+set}" = set; then :
18143fi 34538fi
18144 34539
18145# Check whether --enable-wtmpx was given. 34540# Check whether --enable-wtmpx was given.
18146if test "${enable_wtmpx+set}" = set; then : 34541if test "${enable_wtmpx+set}" = set; then
18147 enableval=$enable_wtmpx; 34542 enableval=$enable_wtmpx;
18148 if test "x$enableval" = "xno" ; then 34543 if test "x$enableval" = "xno" ; then
18149 34544
18150$as_echo "#define DISABLE_WTMPX 1" >>confdefs.h 34545cat >>confdefs.h <<\_ACEOF
34546#define DISABLE_WTMPX 1
34547_ACEOF
18151 34548
18152 fi 34549 fi
18153 34550
@@ -18155,10 +34552,12 @@ $as_echo "#define DISABLE_WTMPX 1" >>confdefs.h
18155fi 34552fi
18156 34553
18157# Check whether --enable-libutil was given. 34554# Check whether --enable-libutil was given.
18158if test "${enable_libutil+set}" = set; then : 34555if test "${enable_libutil+set}" = set; then
18159 enableval=$enable_libutil; 34556 enableval=$enable_libutil;
18160 if test "x$enableval" = "xno" ; then 34557 if test "x$enableval" = "xno" ; then
18161 $as_echo "#define DISABLE_LOGIN 1" >>confdefs.h 34558 cat >>confdefs.h <<\_ACEOF
34559#define DISABLE_LOGIN 1
34560_ACEOF
18162 34561
18163 fi 34562 fi
18164 34563
@@ -18166,11 +34565,13 @@ if test "${enable_libutil+set}" = set; then :
18166fi 34565fi
18167 34566
18168# Check whether --enable-pututline was given. 34567# Check whether --enable-pututline was given.
18169if test "${enable_pututline+set}" = set; then : 34568if test "${enable_pututline+set}" = set; then
18170 enableval=$enable_pututline; 34569 enableval=$enable_pututline;
18171 if test "x$enableval" = "xno" ; then 34570 if test "x$enableval" = "xno" ; then
18172 34571
18173$as_echo "#define DISABLE_PUTUTLINE 1" >>confdefs.h 34572cat >>confdefs.h <<\_ACEOF
34573#define DISABLE_PUTUTLINE 1
34574_ACEOF
18174 34575
18175 fi 34576 fi
18176 34577
@@ -18178,11 +34579,13 @@ $as_echo "#define DISABLE_PUTUTLINE 1" >>confdefs.h
18178fi 34579fi
18179 34580
18180# Check whether --enable-pututxline was given. 34581# Check whether --enable-pututxline was given.
18181if test "${enable_pututxline+set}" = set; then : 34582if test "${enable_pututxline+set}" = set; then
18182 enableval=$enable_pututxline; 34583 enableval=$enable_pututxline;
18183 if test "x$enableval" = "xno" ; then 34584 if test "x$enableval" = "xno" ; then
18184 34585
18185$as_echo "#define DISABLE_PUTUTXLINE 1" >>confdefs.h 34586cat >>confdefs.h <<\_ACEOF
34587#define DISABLE_PUTUTXLINE 1
34588_ACEOF
18186 34589
18187 fi 34590 fi
18188 34591
@@ -18191,10 +34594,12 @@ fi
18191 34594
18192 34595
18193# Check whether --with-lastlog was given. 34596# Check whether --with-lastlog was given.
18194if test "${with_lastlog+set}" = set; then : 34597if test "${with_lastlog+set}" = set; then
18195 withval=$with_lastlog; 34598 withval=$with_lastlog;
18196 if test "x$withval" = "xno" ; then 34599 if test "x$withval" = "xno" ; then
18197 $as_echo "#define DISABLE_LASTLOG 1" >>confdefs.h 34600 cat >>confdefs.h <<\_ACEOF
34601#define DISABLE_LASTLOG 1
34602_ACEOF
18198 34603
18199 elif test -n "$withval" && test "x${withval}" != "xyes"; then 34604 elif test -n "$withval" && test "x${withval}" != "xyes"; then
18200 conf_lastlog_location=$withval 34605 conf_lastlog_location=$withval
@@ -18205,9 +34610,13 @@ fi
18205 34610
18206 34611
18207 34612
18208{ $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
18209$as_echo_n "checking if your system defines LASTLOG_FILE... " >&6; } 34614echo $ECHO_N "checking if your system defines LASTLOG_FILE... $ECHO_C" >&6; }
18210cat 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
18211/* end confdefs.h. */ 34620/* end confdefs.h. */
18212 34621
18213#include <sys/types.h> 34622#include <sys/types.h>
@@ -18230,16 +34639,39 @@ main ()
18230 return 0; 34639 return 0;
18231} 34640}
18232_ACEOF 34641_ACEOF
18233if ac_fn_c_try_compile "$LINENO"; then : 34642rm -f conftest.$ac_objext
18234 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 34643if { (ac_try="$ac_compile"
18235$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; }
18236else 34661else
34662 echo "$as_me: failed program was:" >&5
34663sed 's/^/| /' conftest.$ac_ext >&5
34664
18237 34665
18238 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 34666 { echo "$as_me:$LINENO: result: no" >&5
18239$as_echo "no" >&6; } 34667echo "${ECHO_T}no" >&6; }
18240 { $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
18241$as_echo_n "checking if your system defines _PATH_LASTLOG... " >&6; } 34669echo $ECHO_N "checking if your system defines _PATH_LASTLOG... $ECHO_C" >&6; }
18242 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
18243/* end confdefs.h. */ 34675/* end confdefs.h. */
18244 34676
18245#include <sys/types.h> 34677#include <sys/types.h>
@@ -18259,19 +34691,40 @@ main ()
18259 return 0; 34691 return 0;
18260} 34692}
18261_ACEOF 34693_ACEOF
18262if ac_fn_c_try_compile "$LINENO"; then : 34694rm -f conftest.$ac_objext
18263 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 34695if { (ac_try="$ac_compile"
18264$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; }
18265else 34713else
34714 echo "$as_me: failed program was:" >&5
34715sed 's/^/| /' conftest.$ac_ext >&5
18266 34716
18267 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 34717
18268$as_echo "no" >&6; } 34718 { echo "$as_me:$LINENO: result: no" >&5
34719echo "${ECHO_T}no" >&6; }
18269 system_lastlog_path=no 34720 system_lastlog_path=no
18270 34721
18271fi 34722fi
34723
18272rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 34724rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
18273 34725
18274fi 34726fi
34727
18275rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 34728rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
18276 34729
18277if test -z "$conf_lastlog_location"; then 34730if test -z "$conf_lastlog_location"; then
@@ -18282,8 +34735,8 @@ if test -z "$conf_lastlog_location"; then
18282 fi 34735 fi
18283 done 34736 done
18284 if test -z "$conf_lastlog_location"; then 34737 if test -z "$conf_lastlog_location"; then
18285 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ** Cannot find lastlog **" >&5 34738 { echo "$as_me:$LINENO: WARNING: ** Cannot find lastlog **" >&5
18286$as_echo "$as_me: WARNING: ** Cannot find lastlog **" >&2;} 34739echo "$as_me: WARNING: ** Cannot find lastlog **" >&2;}
18287 fi 34740 fi
18288 fi 34741 fi
18289fi 34742fi
@@ -18296,9 +34749,13 @@ _ACEOF
18296 34749
18297fi 34750fi
18298 34751
18299{ $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
18300$as_echo_n "checking if your system defines UTMP_FILE... " >&6; } 34753echo $ECHO_N "checking if your system defines UTMP_FILE... $ECHO_C" >&6; }
18301cat 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
18302/* end confdefs.h. */ 34759/* end confdefs.h. */
18303 34760
18304#include <sys/types.h> 34761#include <sys/types.h>
@@ -18315,15 +34772,35 @@ main ()
18315 return 0; 34772 return 0;
18316} 34773}
18317_ACEOF 34774_ACEOF
18318if ac_fn_c_try_compile "$LINENO"; then : 34775rm -f conftest.$ac_objext
18319 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 34776if { (ac_try="$ac_compile"
18320$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; }
18321else 34794else
18322 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 34795 echo "$as_me: failed program was:" >&5
18323$as_echo "no" >&6; } 34796sed 's/^/| /' conftest.$ac_ext >&5
34797
34798 { echo "$as_me:$LINENO: result: no" >&5
34799echo "${ECHO_T}no" >&6; }
18324 system_utmp_path=no 34800 system_utmp_path=no
18325 34801
18326fi 34802fi
34803
18327rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 34804rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
18328if test -z "$conf_utmp_location"; then 34805if test -z "$conf_utmp_location"; then
18329 if test x"$system_utmp_path" = x"no" ; then 34806 if test x"$system_utmp_path" = x"no" ; then
@@ -18333,7 +34810,9 @@ if test -z "$conf_utmp_location"; then
18333 fi 34810 fi
18334 done 34811 done
18335 if test -z "$conf_utmp_location"; then 34812 if test -z "$conf_utmp_location"; then
18336 $as_echo "#define DISABLE_UTMP 1" >>confdefs.h 34813 cat >>confdefs.h <<\_ACEOF
34814#define DISABLE_UTMP 1
34815_ACEOF
18337 34816
18338 fi 34817 fi
18339 fi 34818 fi
@@ -18346,9 +34825,13 @@ _ACEOF
18346 34825
18347fi 34826fi
18348 34827
18349{ $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
18350$as_echo_n "checking if your system defines WTMP_FILE... " >&6; } 34829echo $ECHO_N "checking if your system defines WTMP_FILE... $ECHO_C" >&6; }
18351cat 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
18352/* end confdefs.h. */ 34835/* end confdefs.h. */
18353 34836
18354#include <sys/types.h> 34837#include <sys/types.h>
@@ -18365,15 +34848,35 @@ main ()
18365 return 0; 34848 return 0;
18366} 34849}
18367_ACEOF 34850_ACEOF
18368if ac_fn_c_try_compile "$LINENO"; then : 34851rm -f conftest.$ac_objext
18369 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 34852if { (ac_try="$ac_compile"
18370$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; }
18371else 34870else
18372 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 34871 echo "$as_me: failed program was:" >&5
18373$as_echo "no" >&6; } 34872sed 's/^/| /' conftest.$ac_ext >&5
34873
34874 { echo "$as_me:$LINENO: result: no" >&5
34875echo "${ECHO_T}no" >&6; }
18374 system_wtmp_path=no 34876 system_wtmp_path=no
18375 34877
18376fi 34878fi
34879
18377rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 34880rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
18378if test -z "$conf_wtmp_location"; then 34881if test -z "$conf_wtmp_location"; then
18379 if test x"$system_wtmp_path" = x"no" ; then 34882 if test x"$system_wtmp_path" = x"no" ; then
@@ -18383,7 +34886,9 @@ if test -z "$conf_wtmp_location"; then
18383 fi 34886 fi
18384 done 34887 done
18385 if test -z "$conf_wtmp_location"; then 34888 if test -z "$conf_wtmp_location"; then
18386 $as_echo "#define DISABLE_WTMP 1" >>confdefs.h 34889 cat >>confdefs.h <<\_ACEOF
34890#define DISABLE_WTMP 1
34891_ACEOF
18387 34892
18388 fi 34893 fi
18389 fi 34894 fi
@@ -18396,9 +34901,13 @@ _ACEOF
18396 34901
18397fi 34902fi
18398 34903
18399{ $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
18400$as_echo_n "checking if your system defines WTMPX_FILE... " >&6; } 34905echo $ECHO_N "checking if your system defines WTMPX_FILE... $ECHO_C" >&6; }
18401cat 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
18402/* end confdefs.h. */ 34911/* end confdefs.h. */
18403 34912
18404#include <sys/types.h> 34913#include <sys/types.h>
@@ -18418,19 +34927,41 @@ main ()
18418 return 0; 34927 return 0;
18419} 34928}
18420_ACEOF 34929_ACEOF
18421if ac_fn_c_try_compile "$LINENO"; then : 34930rm -f conftest.$ac_objext
18422 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 34931if { (ac_try="$ac_compile"
18423$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; }
18424else 34949else
18425 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 34950 echo "$as_me: failed program was:" >&5
18426$as_echo "no" >&6; } 34951sed 's/^/| /' conftest.$ac_ext >&5
34952
34953 { echo "$as_me:$LINENO: result: no" >&5
34954echo "${ECHO_T}no" >&6; }
18427 system_wtmpx_path=no 34955 system_wtmpx_path=no
18428 34956
18429fi 34957fi
34958
18430rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 34959rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
18431if test -z "$conf_wtmpx_location"; then 34960if test -z "$conf_wtmpx_location"; then
18432 if test x"$system_wtmpx_path" = x"no" ; then 34961 if test x"$system_wtmpx_path" = x"no" ; then
18433 $as_echo "#define DISABLE_WTMPX 1" >>confdefs.h 34962 cat >>confdefs.h <<\_ACEOF
34963#define DISABLE_WTMPX 1
34964_ACEOF
18434 34965
18435 fi 34966 fi
18436else 34967else
@@ -18444,11 +34975,22 @@ fi
18444 34975
18445if test ! -z "$blibpath" ; then 34976if test ! -z "$blibpath" ; then
18446 LDFLAGS="$LDFLAGS $blibflags$blibpath" 34977 LDFLAGS="$LDFLAGS $blibflags$blibpath"
18447 { $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
18448$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;}
18449fi 34980fi
18450 34981
18451ac_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
18452#ifdef HAVE_SYS_TYPES_H 34994#ifdef HAVE_SYS_TYPES_H
18453#include <sys/types.h> 34995#include <sys/types.h>
18454#endif 34996#endif
@@ -18462,20 +35004,128 @@ ac_fn_c_check_member "$LINENO" "struct lastlog" "ll_line" "ac_cv_member_struct_l
18462#include <lastlog.h> 35004#include <lastlog.h>
18463#endif 35005#endif
18464 35006
18465"
18466if test "x$ac_cv_member_struct_lastlog_ll_line" = xyes; then :
18467 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
35047#ifdef HAVE_SYS_TYPES_H
35048#include <sys/types.h>
35049#endif
35050#ifdef HAVE_UTMP_H
35051#include <utmp.h>
35052#endif
35053#ifdef HAVE_UTMPX_H
35054#include <utmpx.h>
35055#endif
35056#ifdef HAVE_LASTLOG_H
35057#include <lastlog.h>
35058#endif
35059
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 :
18468else 35105else
18469 35106
18470 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then 35107 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
18471 $as_echo "#define DISABLE_LASTLOG 1" >>confdefs.h 35108 cat >>confdefs.h <<\_ACEOF
35109#define DISABLE_LASTLOG 1
35110_ACEOF
18472 35111
18473 fi 35112 fi
18474 35113
18475fi 35114fi
18476 35115
18477 35116
18478ac_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
18479#ifdef HAVE_SYS_TYPES_H 35129#ifdef HAVE_SYS_TYPES_H
18480#include <sys/types.h> 35130#include <sys/types.h>
18481#endif 35131#endif
@@ -18489,14 +35139,113 @@ ac_fn_c_check_member "$LINENO" "struct utmp" "ut_line" "ac_cv_member_struct_utmp
18489#include <lastlog.h> 35139#include <lastlog.h>
18490#endif 35140#endif
18491 35141
18492"
18493if test "x$ac_cv_member_struct_utmp_ut_line" = xyes; then :
18494 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
18495else 35171else
35172 echo "$as_me: failed program was:" >&5
35173sed 's/^/| /' conftest.$ac_ext >&5
18496 35174
18497 $as_echo "#define DISABLE_UTMP 1" >>confdefs.h 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. */
18498 35181
18499 $as_echo "#define DISABLE_WTMP 1" >>confdefs.h 35182#ifdef HAVE_SYS_TYPES_H
35183#include <sys/types.h>
35184#endif
35185#ifdef HAVE_UTMP_H
35186#include <utmp.h>
35187#endif
35188#ifdef HAVE_UTMPX_H
35189#include <utmpx.h>
35190#endif
35191#ifdef HAVE_LASTLOG_H
35192#include <lastlog.h>
35193#endif
35194
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 :
35240else
35241
35242 cat >>confdefs.h <<\_ACEOF
35243#define DISABLE_UTMP 1
35244_ACEOF
35245
35246 cat >>confdefs.h <<\_ACEOF
35247#define DISABLE_WTMP 1
35248_ACEOF
18500 35249
18501 35250
18502fi 35251fi
@@ -18509,8 +35258,59 @@ if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
18509else 35258else
18510 TEST_SSH_IPV6=yes 35259 TEST_SSH_IPV6=yes
18511fi 35260fi
18512ac_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
18513if 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
18514 TEST_SSH_IPV6=no 35314 TEST_SSH_IPV6=no
18515fi 35315fi
18516 35316
@@ -18551,13 +35351,12 @@ _ACEOF
18551 case $ac_val in #( 35351 case $ac_val in #(
18552 *${as_nl}*) 35352 *${as_nl}*)
18553 case $ac_var in #( 35353 case $ac_var in #(
18554 *_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
18555$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;} ;;
18556 esac 35356 esac
18557 case $ac_var in #( 35357 case $ac_var in #(
18558 _ | IFS | as_nl) ;; #( 35358 _ | IFS | as_nl) ;; #(
18559 BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( 35359 *) $as_unset $ac_var ;;
18560 *) { eval $ac_var=; unset $ac_var;} ;;
18561 esac ;; 35360 esac ;;
18562 esac 35361 esac
18563 done 35362 done
@@ -18565,8 +35364,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
18565 (set) 2>&1 | 35364 (set) 2>&1 |
18566 case $as_nl`(ac_space=' '; set) 2>&1` in #( 35365 case $as_nl`(ac_space=' '; set) 2>&1` in #(
18567 *${as_nl}ac_space=\ *) 35366 *${as_nl}ac_space=\ *)
18568 # `set' does not quote correctly, so add quotes: double-quote 35367 # `set' does not quote correctly, so add quotes (double-quote
18569 # substitution turns \\\\ into \\, and sed turns \\ into \. 35368 # substitution turns \\\\ into \\, and sed turns \\ into \).
18570 sed -n \ 35369 sed -n \
18571 "s/'/'\\\\''/g; 35370 "s/'/'\\\\''/g;
18572 s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" 35371 s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
@@ -18588,24 +35387,13 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
18588 :end' >>confcache 35387 :end' >>confcache
18589if diff "$cache_file" confcache >/dev/null 2>&1; then :; else 35388if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
18590 if test -w "$cache_file"; then 35389 if test -w "$cache_file"; then
18591 if test "x$cache_file" != "x/dev/null"; then 35390 test "x$cache_file" != "x/dev/null" &&
18592 { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 35391 { echo "$as_me:$LINENO: updating cache $cache_file" >&5
18593$as_echo "$as_me: updating cache $cache_file" >&6;} 35392echo "$as_me: updating cache $cache_file" >&6;}
18594 if test ! -f "$cache_file" || test -h "$cache_file"; then 35393 cat confcache >$cache_file
18595 cat confcache >"$cache_file"
18596 else
18597 case $cache_file in #(
18598 */* | ?:*)
18599 mv -f confcache "$cache_file"$$ &&
18600 mv -f "$cache_file"$$ "$cache_file" ;; #(
18601 *)
18602 mv -f confcache "$cache_file" ;;
18603 esac
18604 fi
18605 fi
18606 else 35394 else
18607 { $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
18608$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} 35396echo "$as_me: not updating unwritable cache $cache_file" >&6;}
18609 fi 35397 fi
18610fi 35398fi
18611rm -f confcache 35399rm -f confcache
@@ -18618,15 +35406,14 @@ DEFS=-DHAVE_CONFIG_H
18618 35406
18619ac_libobjs= 35407ac_libobjs=
18620ac_ltlibobjs= 35408ac_ltlibobjs=
18621U=
18622for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue 35409for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
18623 # 1. Remove the extension, and $U if already installed. 35410 # 1. Remove the extension, and $U if already installed.
18624 ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' 35411 ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
18625 ac_i=`$as_echo "$ac_i" | sed "$ac_script"` 35412 ac_i=`echo "$ac_i" | sed "$ac_script"`
18626 # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR 35413 # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
18627 # will be set to the directory where LIBOBJS objects are built. 35414 # will be set to the directory where LIBOBJS objects are built.
18628 as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" 35415 ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
18629 as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' 35416 ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
18630done 35417done
18631LIBOBJS=$ac_libobjs 35418LIBOBJS=$ac_libobjs
18632 35419
@@ -18634,15 +35421,12 @@ LTLIBOBJS=$ac_ltlibobjs
18634 35421
18635 35422
18636 35423
18637 35424: ${CONFIG_STATUS=./config.status}
18638: "${CONFIG_STATUS=./config.status}"
18639ac_write_fail=0
18640ac_clean_files_save=$ac_clean_files 35425ac_clean_files_save=$ac_clean_files
18641ac_clean_files="$ac_clean_files $CONFIG_STATUS" 35426ac_clean_files="$ac_clean_files $CONFIG_STATUS"
18642{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 35427{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
18643$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} 35428echo "$as_me: creating $CONFIG_STATUS" >&6;}
18644as_write_fail=0 35429cat >$CONFIG_STATUS <<_ACEOF
18645cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
18646#! $SHELL 35430#! $SHELL
18647# Generated by $as_me. 35431# Generated by $as_me.
18648# Run this file to recreate the current configuration. 35432# Run this file to recreate the current configuration.
@@ -18652,79 +35436,59 @@ cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
18652debug=false 35436debug=false
18653ac_cs_recheck=false 35437ac_cs_recheck=false
18654ac_cs_silent=false 35438ac_cs_silent=false
18655
18656SHELL=\${CONFIG_SHELL-$SHELL} 35439SHELL=\${CONFIG_SHELL-$SHELL}
18657export SHELL 35440_ACEOF
18658_ASEOF 35441
18659cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 35442cat >>$CONFIG_STATUS <<\_ACEOF
18660## -------------------- ## 35443## --------------------- ##
18661## M4sh Initialization. ## 35444## M4sh Initialization. ##
18662## -------------------- ## 35445## --------------------- ##
18663 35446
18664# Be more Bourne compatible 35447# Be more Bourne compatible
18665DUALCASE=1; export DUALCASE # for MKS sh 35448DUALCASE=1; export DUALCASE # for MKS sh
18666if 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
18667 emulate sh 35450 emulate sh
18668 NULLCMD=: 35451 NULLCMD=:
18669 # 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
18670 # is contrary to our usage. Disable this feature. 35453 # is contrary to our usage. Disable this feature.
18671 alias -g '${1+"$@"}'='"$@"' 35454 alias -g '${1+"$@"}'='"$@"'
18672 setopt NO_GLOB_SUBST 35455 setopt NO_GLOB_SUBST
18673else 35456else
18674 case `(set -o) 2>/dev/null` in #( 35457 case `(set -o) 2>/dev/null` in
18675 *posix*) : 35458 *posix*) set -o posix ;;
18676 set -o posix ;; #(
18677 *) :
18678 ;;
18679esac 35459esac
35460
18680fi 35461fi
18681 35462
18682 35463
18683as_nl=' 35464
18684' 35465
18685export as_nl 35466# PATH needs CR
18686# Printing a long string crashes Solaris 7 /usr/bin/printf. 35467# Avoid depending upon Character Ranges.
18687as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' 35468as_cr_letters='abcdefghijklmnopqrstuvwxyz'
18688as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo 35469as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
18689as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo 35470as_cr_Letters=$as_cr_letters$as_cr_LETTERS
18690# Prefer a ksh shell builtin over an external printf program on Solaris, 35471as_cr_digits='0123456789'
18691# but without wasting forks for bash or zsh. 35472as_cr_alnum=$as_cr_Letters$as_cr_digits
18692if test -z "$BASH_VERSION$ZSH_VERSION" \ 35473
18693 && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then 35474# The user is always right.
18694 as_echo='print -r --' 35475if test "${PATH_SEPARATOR+set}" != set; then
18695 as_echo_n='print -rn --' 35476 echo "#! /bin/sh" >conf$$.sh
18696elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then 35477 echo "exit 0" >>conf$$.sh
18697 as_echo='printf %s\n' 35478 chmod +x conf$$.sh
18698 as_echo_n='printf %s' 35479 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
18699else 35480 PATH_SEPARATOR=';'
18700 if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
18701 as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
18702 as_echo_n='/usr/ucb/echo -n'
18703 else 35481 else
18704 as_echo_body='eval expr "X$1" : "X\\(.*\\)"' 35482 PATH_SEPARATOR=:
18705 as_echo_n_body='eval
18706 arg=$1;
18707 case $arg in #(
18708 *"$as_nl"*)
18709 expr "X$arg" : "X\\(.*\\)$as_nl";
18710 arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
18711 esac;
18712 expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
18713 '
18714 export as_echo_n_body
18715 as_echo_n='sh -c $as_echo_n_body as_echo'
18716 fi 35483 fi
18717 export as_echo_body 35484 rm -f conf$$.sh
18718 as_echo='sh -c $as_echo_body as_echo'
18719fi 35485fi
18720 35486
18721# The user is always right. 35487# Support unset when possible.
18722if test "${PATH_SEPARATOR+set}" != set; then 35488if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
18723 PATH_SEPARATOR=: 35489 as_unset=unset
18724 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { 35490else
18725 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || 35491 as_unset=false
18726 PATH_SEPARATOR=';'
18727 }
18728fi 35492fi
18729 35493
18730 35494
@@ -18733,19 +35497,20 @@ fi
18733# there to prevent editors from complaining about space-tab. 35497# there to prevent editors from complaining about space-tab.
18734# (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
18735# splitting by setting IFS to empty value.) 35499# splitting by setting IFS to empty value.)
35500as_nl='
35501'
18736IFS=" "" $as_nl" 35502IFS=" "" $as_nl"
18737 35503
18738# 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.
18739as_myself= 35505case $0 in
18740case $0 in #((
18741 *[\\/]* ) as_myself=$0 ;; 35506 *[\\/]* ) as_myself=$0 ;;
18742 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 35507 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
18743for as_dir in $PATH 35508for as_dir in $PATH
18744do 35509do
18745 IFS=$as_save_IFS 35510 IFS=$as_save_IFS
18746 test -z "$as_dir" && as_dir=. 35511 test -z "$as_dir" && as_dir=.
18747 test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break 35512 test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
18748 done 35513done
18749IFS=$as_save_IFS 35514IFS=$as_save_IFS
18750 35515
18751 ;; 35516 ;;
@@ -18756,111 +35521,32 @@ if test "x$as_myself" = x; then
18756 as_myself=$0 35521 as_myself=$0
18757fi 35522fi
18758if test ! -f "$as_myself"; then 35523if test ! -f "$as_myself"; then
18759 $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
18760 exit 1 35525 { (exit 1); exit 1; }
18761fi 35526fi
18762 35527
18763# Unset variables that we do not need and which cause bugs (e.g. in 35528# Work around bugs in pre-3.0 UWIN ksh.
18764# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" 35529for as_var in ENV MAIL MAILPATH
18765# suppresses any "Segmentation fault" message there. '((' could 35530do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
18766# trigger a bug in pdksh 5.2.14.
18767for as_var in BASH_ENV ENV MAIL MAILPATH
18768do eval test x\${$as_var+set} = xset \
18769 && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
18770done 35531done
18771PS1='$ ' 35532PS1='$ '
18772PS2='> ' 35533PS2='> '
18773PS4='+ ' 35534PS4='+ '
18774 35535
18775# NLS nuisances. 35536# NLS nuisances.
18776LC_ALL=C 35537for as_var in \
18777export LC_ALL 35538 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
18778LANGUAGE=C 35539 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
18779export LANGUAGE 35540 LC_TELEPHONE LC_TIME
18780 35541do
18781# CDPATH. 35542 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
18782(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 35543 eval $as_var=C; export $as_var
18783 35544 else
18784 35545 ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
18785# as_fn_error STATUS ERROR [LINENO LOG_FD]
18786# ----------------------------------------
18787# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
18788# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
18789# script with STATUS, using 1 if that was 0.
18790as_fn_error ()
18791{
18792 as_status=$1; test $as_status -eq 0 && as_status=1
18793 if test "$4"; then
18794 as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
18795 $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
18796 fi 35546 fi
18797 $as_echo "$as_me: error: $2" >&2 35547done
18798 as_fn_exit $as_status
18799} # as_fn_error
18800
18801
18802# as_fn_set_status STATUS
18803# -----------------------
18804# Set $? to STATUS, without forking.
18805as_fn_set_status ()
18806{
18807 return $1
18808} # as_fn_set_status
18809
18810# as_fn_exit STATUS
18811# -----------------
18812# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
18813as_fn_exit ()
18814{
18815 set +e
18816 as_fn_set_status $1
18817 exit $1
18818} # as_fn_exit
18819
18820# as_fn_unset VAR
18821# ---------------
18822# Portably unset VAR.
18823as_fn_unset ()
18824{
18825 { eval $1=; unset $1;}
18826}
18827as_unset=as_fn_unset
18828# as_fn_append VAR VALUE
18829# ----------------------
18830# Append the text in VALUE to the end of the definition contained in VAR. Take
18831# advantage of any shell optimizations that allow amortized linear growth over
18832# repeated appends, instead of the typical quadratic growth present in naive
18833# implementations.
18834if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
18835 eval 'as_fn_append ()
18836 {
18837 eval $1+=\$2
18838 }'
18839else
18840 as_fn_append ()
18841 {
18842 eval $1=\$$1\$2
18843 }
18844fi # as_fn_append
18845
18846# as_fn_arith ARG...
18847# ------------------
18848# Perform arithmetic evaluation on the ARGs, and store the result in the
18849# global $as_val. Take advantage of shells that can avoid forks. The arguments
18850# must be portable across $(()) and expr.
18851if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
18852 eval 'as_fn_arith ()
18853 {
18854 as_val=$(( $* ))
18855 }'
18856else
18857 as_fn_arith ()
18858 {
18859 as_val=`expr "$@" || test $? -eq 1`
18860 }
18861fi # as_fn_arith
18862
18863 35548
35549# Required to use basename.
18864if expr a : '\(a\)' >/dev/null 2>&1 && 35550if expr a : '\(a\)' >/dev/null 2>&1 &&
18865 test "X`expr 00001 : '.*\(...\)'`" = X001; then 35551 test "X`expr 00001 : '.*\(...\)'`" = X001; then
18866 as_expr=expr 35552 as_expr=expr
@@ -18874,17 +35560,13 @@ else
18874 as_basename=false 35560 as_basename=false
18875fi 35561fi
18876 35562
18877if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
18878 as_dirname=dirname
18879else
18880 as_dirname=false
18881fi
18882 35563
35564# Name of the executable.
18883as_me=`$as_basename -- "$0" || 35565as_me=`$as_basename -- "$0" ||
18884$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ 35566$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
18885 X"$0" : 'X\(//\)$' \| \ 35567 X"$0" : 'X\(//\)$' \| \
18886 X"$0" : 'X\(/\)' \| . 2>/dev/null || 35568 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
18887$as_echo X/"$0" | 35569echo X/"$0" |
18888 sed '/^.*\/\([^/][^/]*\)\/*$/{ 35570 sed '/^.*\/\([^/][^/]*\)\/*$/{
18889 s//\1/ 35571 s//\1/
18890 q 35572 q
@@ -18899,103 +35581,104 @@ $as_echo X/"$0" |
18899 } 35581 }
18900 s/.*/./; q'` 35582 s/.*/./; q'`
18901 35583
18902# Avoid depending upon Character Ranges. 35584# CDPATH.
18903as_cr_letters='abcdefghijklmnopqrstuvwxyz' 35585$as_unset CDPATH
18904as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' 35586
18905as_cr_Letters=$as_cr_letters$as_cr_LETTERS 35587
18906as_cr_digits='0123456789' 35588
18907as_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
18908 35637
18909ECHO_C= ECHO_N= ECHO_T= 35638ECHO_C= ECHO_N= ECHO_T=
18910case `echo -n x` in #((((( 35639case `echo -n x` in
18911-n*) 35640-n*)
18912 case `echo 'xy\c'` in 35641 case `echo 'x\c'` in
18913 *c*) ECHO_T=' ';; # ECHO_T is single tab character. 35642 *c*) ECHO_T=' ';; # ECHO_T is single tab character.
18914 xy) ECHO_C='\c';; 35643 *) ECHO_C='\c';;
18915 *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
18916 ECHO_T=' ';;
18917 esac;; 35644 esac;;
18918*) 35645*)
18919 ECHO_N='-n';; 35646 ECHO_N='-n';;
18920esac 35647esac
18921 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
18922rm -f conf$$ conf$$.exe conf$$.file 35656rm -f conf$$ conf$$.exe conf$$.file
18923if test -d conf$$.dir; then 35657if test -d conf$$.dir; then
18924 rm -f conf$$.dir/conf$$.file 35658 rm -f conf$$.dir/conf$$.file
18925else 35659else
18926 rm -f conf$$.dir 35660 rm -f conf$$.dir
18927 mkdir conf$$.dir 2>/dev/null 35661 mkdir conf$$.dir
18928fi 35662fi
18929if (echo >conf$$.file) 2>/dev/null; then 35663echo >conf$$.file
18930 if ln -s conf$$.file conf$$ 2>/dev/null; then 35664if ln -s conf$$.file conf$$ 2>/dev/null; then
18931 as_ln_s='ln -s' 35665 as_ln_s='ln -s'
18932 # ... but there are two gotchas: 35666 # ... but there are two gotchas:
18933 # 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.
18934 # 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.
18935 # In both cases, we have to default to `cp -p'. 35669 # In both cases, we have to default to `cp -p'.
18936 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 ||
18937 as_ln_s='cp -p'
18938 elif ln conf$$.file conf$$ 2>/dev/null; then
18939 as_ln_s=ln
18940 else
18941 as_ln_s='cp -p' 35671 as_ln_s='cp -p'
18942 fi 35672elif ln conf$$.file conf$$ 2>/dev/null; then
35673 as_ln_s=ln
18943else 35674else
18944 as_ln_s='cp -p' 35675 as_ln_s='cp -p'
18945fi 35676fi
18946rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file 35677rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
18947rmdir conf$$.dir 2>/dev/null 35678rmdir conf$$.dir 2>/dev/null
18948 35679
18949
18950# as_fn_mkdir_p
18951# -------------
18952# Create "$as_dir" as a directory, including parents if necessary.
18953as_fn_mkdir_p ()
18954{
18955
18956 case $as_dir in #(
18957 -*) as_dir=./$as_dir;;
18958 esac
18959 test -d "$as_dir" || eval $as_mkdir_p || {
18960 as_dirs=
18961 while :; do
18962 case $as_dir in #(
18963 *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
18964 *) as_qdir=$as_dir;;
18965 esac
18966 as_dirs="'$as_qdir' $as_dirs"
18967 as_dir=`$as_dirname -- "$as_dir" ||
18968$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
18969 X"$as_dir" : 'X\(//\)[^/]' \| \
18970 X"$as_dir" : 'X\(//\)$' \| \
18971 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
18972$as_echo X"$as_dir" |
18973 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
18974 s//\1/
18975 q
18976 }
18977 /^X\(\/\/\)[^/].*/{
18978 s//\1/
18979 q
18980 }
18981 /^X\(\/\/\)$/{
18982 s//\1/
18983 q
18984 }
18985 /^X\(\/\).*/{
18986 s//\1/
18987 q
18988 }
18989 s/.*/./; q'`
18990 test -d "$as_dir" && break
18991 done
18992 test -z "$as_dirs" || eval "mkdir $as_dirs"
18993 } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
18994
18995
18996} # as_fn_mkdir_p
18997if mkdir -p . 2>/dev/null; then 35680if mkdir -p . 2>/dev/null; then
18998 as_mkdir_p='mkdir -p "$as_dir"' 35681 as_mkdir_p=:
18999else 35682else
19000 test -d ./-p && rmdir ./-p 35683 test -d ./-p && rmdir ./-p
19001 as_mkdir_p=false 35684 as_mkdir_p=false
@@ -19012,12 +35695,12 @@ else
19012 as_test_x=' 35695 as_test_x='
19013 eval sh -c '\'' 35696 eval sh -c '\''
19014 if test -d "$1"; then 35697 if test -d "$1"; then
19015 test -d "$1/."; 35698 test -d "$1/.";
19016 else 35699 else
19017 case $1 in #( 35700 case $1 in
19018 -*)set "./$1";; 35701 -*)set "./$1";;
19019 esac; 35702 esac;
19020 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
19021 ???[sx]*):;;*)false;;esac;fi 35704 ???[sx]*):;;*)false;;esac;fi
19022 '\'' sh 35705 '\'' sh
19023 ' 35706 '
@@ -19032,19 +35715,13 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
19032 35715
19033 35716
19034exec 6>&1 35717exec 6>&1
19035## ----------------------------------- ##
19036## Main body of $CONFIG_STATUS script. ##
19037## ----------------------------------- ##
19038_ASEOF
19039test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
19040 35718
19041cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 35719# Save the log message, to keep $[0] and so on meaningful, and to
19042# Save the log message, to keep $0 and so on meaningful, and to
19043# report actual input values of CONFIG_FILES etc. instead of their 35720# report actual input values of CONFIG_FILES etc. instead of their
19044# values after options handling. 35721# values after options handling.
19045ac_log=" 35722ac_log="
19046This file was extended by OpenSSH $as_me Portable, which was 35723This file was extended by OpenSSH $as_me Portable, which was
19047generated by GNU Autoconf 2.68. Invocation command line was 35724generated by GNU Autoconf 2.61. Invocation command line was
19048 35725
19049 CONFIG_FILES = $CONFIG_FILES 35726 CONFIG_FILES = $CONFIG_FILES
19050 CONFIG_HEADERS = $CONFIG_HEADERS 35727 CONFIG_HEADERS = $CONFIG_HEADERS
@@ -19057,41 +35734,29 @@ on `(hostname || uname -n) 2>/dev/null | sed 1q`
19057 35734
19058_ACEOF 35735_ACEOF
19059 35736
19060case $ac_config_files in *" 35737cat >>$CONFIG_STATUS <<_ACEOF
19061"*) set x $ac_config_files; shift; ac_config_files=$*;;
19062esac
19063
19064case $ac_config_headers in *"
19065"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
19066esac
19067
19068
19069cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
19070# Files that config.status was made for. 35738# Files that config.status was made for.
19071config_files="$ac_config_files" 35739config_files="$ac_config_files"
19072config_headers="$ac_config_headers" 35740config_headers="$ac_config_headers"
19073 35741
19074_ACEOF 35742_ACEOF
19075 35743
19076cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 35744cat >>$CONFIG_STATUS <<\_ACEOF
19077ac_cs_usage="\ 35745ac_cs_usage="\
19078\`$as_me' instantiates files and other configuration actions 35746\`$as_me' instantiates files from templates according to the
19079from templates according to the current configuration. Unless the files 35747current configuration.
19080and actions are specified as TAGs, all are instantiated by default.
19081 35748
19082Usage: $0 [OPTION]... [TAG]... 35749Usage: $0 [OPTIONS] [FILE]...
19083 35750
19084 -h, --help print this help, then exit 35751 -h, --help print this help, then exit
19085 -V, --version print version number and configuration settings, then exit 35752 -V, --version print version number and configuration settings, then exit
19086 --config print configuration, then exit 35753 -q, --quiet do not print progress messages
19087 -q, --quiet, --silent
19088 do not print progress messages
19089 -d, --debug don't remove temporary files 35754 -d, --debug don't remove temporary files
19090 --recheck update $as_me by reconfiguring in the same conditions 35755 --recheck update $as_me by reconfiguring in the same conditions
19091 --file=FILE[:TEMPLATE] 35756 --file=FILE[:TEMPLATE]
19092 instantiate the configuration file FILE 35757 instantiate the configuration file FILE
19093 --header=FILE[:TEMPLATE] 35758 --header=FILE[:TEMPLATE]
19094 instantiate the configuration header FILE 35759 instantiate the configuration header FILE
19095 35760
19096Configuration files: 35761Configuration files:
19097$config_files 35762$config_files
@@ -19099,43 +35764,36 @@ $config_files
19099Configuration headers: 35764Configuration headers:
19100$config_headers 35765$config_headers
19101 35766
19102Report bugs to <openssh-unix-dev@mindrot.org>." 35767Report bugs to <bug-autoconf@gnu.org>."
19103 35768
19104_ACEOF 35769_ACEOF
19105cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 35770cat >>$CONFIG_STATUS <<_ACEOF
19106ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
19107ac_cs_version="\\ 35771ac_cs_version="\\
19108OpenSSH config.status Portable 35772OpenSSH config.status Portable
19109configured by $0, generated by GNU Autoconf 2.68, 35773configured by $0, generated by GNU Autoconf 2.61,
19110 with options \\"\$ac_cs_config\\" 35774 with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
19111 35775
19112Copyright (C) 2010 Free Software Foundation, Inc. 35776Copyright (C) 2006 Free Software Foundation, Inc.
19113This config.status script is free software; the Free Software Foundation 35777This config.status script is free software; the Free Software Foundation
19114gives unlimited permission to copy, distribute and modify it." 35778gives unlimited permission to copy, distribute and modify it."
19115 35779
19116ac_pwd='$ac_pwd' 35780ac_pwd='$ac_pwd'
19117srcdir='$srcdir' 35781srcdir='$srcdir'
19118INSTALL='$INSTALL' 35782INSTALL='$INSTALL'
19119AWK='$AWK'
19120test -n "\$AWK" || AWK=awk
19121_ACEOF 35783_ACEOF
19122 35784
19123cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 35785cat >>$CONFIG_STATUS <<\_ACEOF
19124# 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.
19125ac_need_defaults=: 35788ac_need_defaults=:
19126while test $# != 0 35789while test $# != 0
19127do 35790do
19128 case $1 in 35791 case $1 in
19129 --*=?*) 35792 --*=*)
19130 ac_option=`expr "X$1" : 'X\([^=]*\)='` 35793 ac_option=`expr "X$1" : 'X\([^=]*\)='`
19131 ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` 35794 ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
19132 ac_shift=: 35795 ac_shift=:
19133 ;; 35796 ;;
19134 --*=)
19135 ac_option=`expr "X$1" : 'X\([^=]*\)='`
19136 ac_optarg=
19137 ac_shift=:
19138 ;;
19139 *) 35797 *)
19140 ac_option=$1 35798 ac_option=$1
19141 ac_optarg=$2 35799 ac_optarg=$2
@@ -19148,41 +35806,34 @@ do
19148 -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) 35806 -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
19149 ac_cs_recheck=: ;; 35807 ac_cs_recheck=: ;;
19150 --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) 35808 --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
19151 $as_echo "$ac_cs_version"; exit ;; 35809 echo "$ac_cs_version"; exit ;;
19152 --config | --confi | --conf | --con | --co | --c )
19153 $as_echo "$ac_cs_config"; exit ;;
19154 --debug | --debu | --deb | --de | --d | -d ) 35810 --debug | --debu | --deb | --de | --d | -d )
19155 debug=: ;; 35811 debug=: ;;
19156 --file | --fil | --fi | --f ) 35812 --file | --fil | --fi | --f )
19157 $ac_shift 35813 $ac_shift
19158 case $ac_optarg in 35814 CONFIG_FILES="$CONFIG_FILES $ac_optarg"
19159 *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
19160 '') as_fn_error $? "missing file argument" ;;
19161 esac
19162 as_fn_append CONFIG_FILES " '$ac_optarg'"
19163 ac_need_defaults=false;; 35815 ac_need_defaults=false;;
19164 --header | --heade | --head | --hea ) 35816 --header | --heade | --head | --hea )
19165 $ac_shift 35817 $ac_shift
19166 case $ac_optarg in 35818 CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
19167 *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
19168 esac
19169 as_fn_append CONFIG_HEADERS " '$ac_optarg'"
19170 ac_need_defaults=false;; 35819 ac_need_defaults=false;;
19171 --he | --h) 35820 --he | --h)
19172 # Conflict between --help and --header 35821 # Conflict between --help and --header
19173 as_fn_error $? "ambiguous option: \`$1' 35822 { echo "$as_me: error: ambiguous option: $1
19174Try \`$0 --help' for more information.";; 35823Try \`$0 --help' for more information." >&2
35824 { (exit 1); exit 1; }; };;
19175 --help | --hel | -h ) 35825 --help | --hel | -h )
19176 $as_echo "$ac_cs_usage"; exit ;; 35826 echo "$ac_cs_usage"; exit ;;
19177 -q | -quiet | --quiet | --quie | --qui | --qu | --q \ 35827 -q | -quiet | --quiet | --quie | --qui | --qu | --q \
19178 | -silent | --silent | --silen | --sile | --sil | --si | --s) 35828 | -silent | --silent | --silen | --sile | --sil | --si | --s)
19179 ac_cs_silent=: ;; 35829 ac_cs_silent=: ;;
19180 35830
19181 # This is an error. 35831 # This is an error.
19182 -*) as_fn_error $? "unrecognized option: \`$1' 35832 -*) { echo "$as_me: error: unrecognized option: $1
19183Try \`$0 --help' for more information." ;; 35833Try \`$0 --help' for more information." >&2
35834 { (exit 1); exit 1; }; } ;;
19184 35835
19185 *) as_fn_append ac_config_targets " $1" 35836 *) ac_config_targets="$ac_config_targets $1"
19186 ac_need_defaults=false ;; 35837 ac_need_defaults=false ;;
19187 35838
19188 esac 35839 esac
@@ -19197,32 +35848,30 @@ if $ac_cs_silent; then
19197fi 35848fi
19198 35849
19199_ACEOF 35850_ACEOF
19200cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 35851cat >>$CONFIG_STATUS <<_ACEOF
19201if \$ac_cs_recheck; then 35852if \$ac_cs_recheck; then
19202 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
19203 shift 35854 CONFIG_SHELL=$SHELL
19204 \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
19205 CONFIG_SHELL='$SHELL'
19206 export CONFIG_SHELL 35855 export CONFIG_SHELL
19207 exec "\$@" 35856 exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
19208fi 35857fi
19209 35858
19210_ACEOF 35859_ACEOF
19211cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 35860cat >>$CONFIG_STATUS <<\_ACEOF
19212exec 5>>config.log 35861exec 5>>config.log
19213{ 35862{
19214 echo 35863 echo
19215 sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX 35864 sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
19216## Running $as_me. ## 35865## Running $as_me. ##
19217_ASBOX 35866_ASBOX
19218 $as_echo "$ac_log" 35867 echo "$ac_log"
19219} >&5 35868} >&5
19220 35869
19221_ACEOF 35870_ACEOF
19222cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 35871cat >>$CONFIG_STATUS <<_ACEOF
19223_ACEOF 35872_ACEOF
19224 35873
19225cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 35874cat >>$CONFIG_STATUS <<\_ACEOF
19226 35875
19227# Handling of arguments. 35876# Handling of arguments.
19228for ac_config_target in $ac_config_targets 35877for ac_config_target in $ac_config_targets
@@ -19237,7 +35886,9 @@ do
19237 "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" ;;
19238 "survey.sh") CONFIG_FILES="$CONFIG_FILES survey.sh" ;; 35887 "survey.sh") CONFIG_FILES="$CONFIG_FILES survey.sh" ;;
19239 35888
19240 *) 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; }; };;
19241 esac 35892 esac
19242done 35893done
19243 35894
@@ -19259,302 +35910,255 @@ fi
19259# 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'.
19260$debug || 35911$debug ||
19261{ 35912{
19262 tmp= ac_tmp= 35913 tmp=
19263 trap 'exit_status=$? 35914 trap 'exit_status=$?
19264 : "${ac_tmp:=$tmp}" 35915 { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
19265 { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
19266' 0 35916' 0
19267 trap 'as_fn_exit 1' 1 2 13 15 35917 trap '{ (exit 1); exit 1; }' 1 2 13 15
19268} 35918}
19269# Create a (secure) tmp directory for tmp files. 35919# Create a (secure) tmp directory for tmp files.
19270 35920
19271{ 35921{
19272 tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && 35922 tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
19273 test -d "$tmp" 35923 test -n "$tmp" && test -d "$tmp"
19274} || 35924} ||
19275{ 35925{
19276 tmp=./conf$$-$RANDOM 35926 tmp=./conf$$-$RANDOM
19277 (umask 077 && mkdir "$tmp") 35927 (umask 077 && mkdir "$tmp")
19278} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 35928} ||
19279ac_tmp=$tmp 35929{
19280 35930 echo "$me: cannot create a temporary directory in ." >&2
19281# Set up the scripts for CONFIG_FILES section. 35931 { (exit 1); exit 1; }
19282# No need to generate them if there are no CONFIG_FILES. 35932}
19283# This happens for instance with `./config.status config.h'.
19284if test -n "$CONFIG_FILES"; then
19285 35933
35934#
35935# Set up the sed scripts for CONFIG_FILES section.
35936#
19286 35937
19287ac_cr=`echo X | tr X '\015'` 35938# No need to generate the scripts if there are no CONFIG_FILES.
19288# On cygwin, bash can eat \r inside `` if the user requested igncr. 35939# This happens for instance when ./config.status config.h
19289# But we know of no other shell where ac_cr would be empty at this 35940if test -n "$CONFIG_FILES"; then
19290# point, so we can use a bashism as a fallback.
19291if test "x$ac_cr" = x; then
19292 eval ac_cr=\$\'\\r\'
19293fi
19294ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
19295if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
19296 ac_cs_awk_cr='\\r'
19297else
19298 ac_cs_awk_cr=$ac_cr
19299fi
19300 35941
19301echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
19302_ACEOF 35942_ACEOF
19303 35943
19304 35944
19305{ 35945
19306 echo "cat >conf$$subs.awk <<_ACEOF" &&
19307 echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
19308 echo "_ACEOF"
19309} >conf$$subs.sh ||
19310 as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
19311ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
19312ac_delim='%!_!# ' 35946ac_delim='%!_!# '
19313for ac_last_try in false false false false false :; do 35947for ac_last_try in false false false false false :; do
19314 . ./conf$$subs.sh || 35948 cat >conf$$subs.sed <<_ACEOF
19315 as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 35949SHELL!$SHELL$ac_delim
19316 35950PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
19317 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` 35951PACKAGE_NAME!$PACKAGE_NAME$ac_delim
19318 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
19319 break 36049 break
19320 elif $ac_last_try; then 36050 elif $ac_last_try; then
19321 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; }; }
19322 else 36054 else
19323 ac_delim="$ac_delim!$ac_delim _$ac_delim!! " 36055 ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
19324 fi 36056 fi
19325done 36057done
19326rm -f conf$$subs.sh
19327
19328cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
19329cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
19330_ACEOF
19331sed -n '
19332h
19333s/^/S["/; s/!.*/"]=/
19334p
19335g
19336s/^[^!]*!//
19337:repl
19338t repl
19339s/'"$ac_delim"'$//
19340t delim
19341:nl
19342h
19343s/\(.\{148\}\)..*/\1/
19344t more1
19345s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
19346p
19347n
19348b repl
19349:more1
19350s/["\\]/\\&/g; s/^/"/; s/$/"\\/
19351p
19352g
19353s/.\{148\}//
19354t nl
19355:delim
19356h
19357s/\(.\{148\}\)..*/\1/
19358t more2
19359s/["\\]/\\&/g; s/^/"/; s/$/"/
19360p
19361b
19362:more2
19363s/["\\]/\\&/g; s/^/"/; s/$/"\\/
19364p
19365g
19366s/.\{148\}//
19367t delim
19368' <conf$$subs.awk | sed '
19369/^[^""]/{
19370 N
19371 s/\n//
19372}
19373' >>$CONFIG_STATUS || ac_write_fail=1
19374rm -f conf$$subs.awk
19375cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
19376_ACAWK
19377cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
19378 for (key in S) S_is_set[key] = 1
19379 FS = ""
19380
19381}
19382{
19383 line = $ 0
19384 nfields = split(line, field, "@")
19385 substed = 0
19386 len = length(field[1])
19387 for (i = 2; i < nfields; i++) {
19388 key = field[i]
19389 keylen = length(key)
19390 if (S_is_set[key]) {
19391 value = S[key]
19392 line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
19393 len += length(value) + length(field[++i])
19394 substed = 1
19395 } else
19396 len += 1 + keylen
19397 }
19398
19399 print line
19400}
19401
19402_ACAWK
19403_ACEOF
19404cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
19405if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
19406 sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
19407else
19408 cat
19409fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
19410 || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
19411_ACEOF
19412
19413# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
19414# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
19415# trailing colons and then remove the whole line if VPATH becomes empty
19416# (actually we leave an empty line to preserve line numbers).
19417if test "x$srcdir" = x.; then
19418 ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
19419h
19420s///
19421s/^/:/
19422s/[ ]*$/:/
19423s/:\$(srcdir):/:/g
19424s/:\${srcdir}:/:/g
19425s/:@srcdir@:/:/g
19426s/^:*//
19427s/:*$//
19428x
19429s/\(=[ ]*\).*/\1/
19430G
19431s/\n//
19432s/^[^=]*=[ ]*$//
19433}'
19434fi
19435 36058
19436cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 36059ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
19437fi # 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
19438 36064
19439# Set up the scripts for CONFIG_HEADERS section. 36065cat >>$CONFIG_STATUS <<_ACEOF
19440# No need to generate them if there are no CONFIG_HEADERS. 36066cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
19441# This happens for instance with `./config.status Makefile'. 36067/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
19442if test -n "$CONFIG_HEADERS"; then 36068_ACEOF
19443cat >"$ac_tmp/defines.awk" <<\_ACAWK || 36069sed '
19444BEGIN { 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
19445_ACEOF 36081_ACEOF
19446 36082
19447# Transform confdefs.h into an awk script `defines.awk', embedded as
19448# here-document in config.status, that substitutes the proper values into
19449# config.h.in to produce config.h.
19450 36083
19451# Create a delimiter string that does not exist in confdefs.h, to ease
19452# handling of long lines.
19453ac_delim='%!_!# ' 36084ac_delim='%!_!# '
19454for ac_last_try in false false :; do 36085for ac_last_try in false false false false false :; do
19455 ac_tt=`sed -n "/$ac_delim/p" confdefs.h` 36086 cat >conf$$subs.sed <<_ACEOF
19456 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
19457 break 36096 break
19458 elif $ac_last_try; then 36097 elif $ac_last_try; then
19459 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; }; }
19460 else 36101 else
19461 ac_delim="$ac_delim!$ac_delim _$ac_delim!! " 36102 ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
19462 fi 36103 fi
19463done 36104done
19464 36105
19465# 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`
19466# likewise P contains macro parameters if any. Preserve backslash 36107if test -n "$ac_eof"; then
19467# newline sequences. 36108 ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
36109 ac_eof=`expr $ac_eof + 1`
36110fi
19468 36111
19469ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* 36112cat >>$CONFIG_STATUS <<_ACEOF
19470sed -n ' 36113cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
19471s/.\{148\}/&'"$ac_delim"'/g 36114/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
19472t rset 36115_ACEOF
19473:rset 36116sed '
19474s/^[ ]*#[ ]*define[ ][ ]*/ / 36117s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
19475t def 36118s/^/s,@/; s/!/@,|#_!!_#|/
19476d 36119:n
19477:def 36120t n
19478s/\\$// 36121s/'"$ac_delim"'$/,g/; t
19479t bsnl 36122s/$/\\/; p
19480s/["\\]/\\&/g 36123N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
19481s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ 36124' >>$CONFIG_STATUS <conf$$subs.sed
19482D["\1"]=" \3"/p 36125rm -f conf$$subs.sed
19483s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p 36126cat >>$CONFIG_STATUS <<_ACEOF
19484d 36127:end
19485:bsnl 36128s/|#_!!_#|//g
19486s/["\\]/\\&/g 36129CEOF$ac_eof
19487s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
19488D["\1"]=" \3\\\\\\n"\\/p
19489t cont
19490s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
19491t cont
19492d
19493:cont
19494n
19495s/.\{148\}/&'"$ac_delim"'/g
19496t clear
19497:clear
19498s/\\$//
19499t bsnlc
19500s/["\\]/\\&/g; s/^/"/; s/$/"/p
19501d
19502:bsnlc
19503s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
19504b cont
19505' <confdefs.h | sed '
19506s/'"$ac_delim"'/"\\\
19507"/g' >>$CONFIG_STATUS || ac_write_fail=1
19508
19509cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
19510 for (key in D) D_is_set[key] = 1
19511 FS = ""
19512}
19513/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
19514 line = \$ 0
19515 split(line, arg, " ")
19516 if (arg[1] == "#") {
19517 defundef = arg[2]
19518 mac1 = arg[3]
19519 } else {
19520 defundef = substr(arg[1], 2)
19521 mac1 = arg[2]
19522 }
19523 split(mac1, mac2, "(") #)
19524 macro = mac2[1]
19525 prefix = substr(line, 1, index(line, defundef) - 1)
19526 if (D_is_set[macro]) {
19527 # Preserve the white space surrounding the "#".
19528 print prefix "define", macro P[macro] D[macro]
19529 next
19530 } else {
19531 # Replace #undef with comments. This is necessary, for example,
19532 # in the case of _POSIX_SOURCE, which is predefined and required
19533 # on some systems where configure will not decide to define it.
19534 if (defundef == "undef") {
19535 print "/*", prefix defundef, macro, "*/"
19536 next
19537 }
19538 }
19539}
19540{ print }
19541_ACAWK
19542_ACEOF 36130_ACEOF
19543cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
19544 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
19545fi # test -n "$CONFIG_HEADERS"
19546 36131
19547 36132
19548eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " 36133# VPATH may cause trouble with some makes, so we remove $(srcdir),
19549shift 36134# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
19550for 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
19551do 36153do
19552 case $ac_tag in 36154 case $ac_tag in
19553 :[FHLC]) ac_mode=$ac_tag; continue;; 36155 :[FHLC]) ac_mode=$ac_tag; continue;;
19554 esac 36156 esac
19555 case $ac_mode$ac_tag in 36157 case $ac_mode$ac_tag in
19556 :[FHL]*:*);; 36158 :[FHL]*:*);;
19557 :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; }; };;
19558 :[FH]-) ac_tag=-:-;; 36162 :[FH]-) ac_tag=-:-;;
19559 :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; 36163 :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
19560 esac 36164 esac
@@ -19573,7 +36177,7 @@ do
19573 for ac_f 36177 for ac_f
19574 do 36178 do
19575 case $ac_f in 36179 case $ac_f in
19576 -) ac_f="$ac_tmp/stdin";; 36180 -) ac_f="$tmp/stdin";;
19577 *) # 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
19578 # (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,
19579 # because $ac_f cannot contain `:'. 36183 # because $ac_f cannot contain `:'.
@@ -19582,34 +36186,26 @@ do
19582 [\\/$]*) false;; 36186 [\\/$]*) false;;
19583 *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; 36187 *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
19584 esac || 36188 esac ||
19585 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; }; };;
19586 esac 36192 esac
19587 case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac 36193 ac_file_inputs="$ac_file_inputs $ac_f"
19588 as_fn_append ac_file_inputs " '$ac_f'"
19589 done 36194 done
19590 36195
19591 # 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
19592 # use $as_me), people would be surprised to read: 36197 # use $as_me), people would be surprised to read:
19593 # /* config.h. Generated by config.status. */ 36198 # /* config.h. Generated by config.status. */
19594 configure_input='Generated from '` 36199 configure_input="Generated from "`IFS=:
19595 $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' 36200 echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
19596 `' by configure.'
19597 if test x"$ac_file" != x-; then 36201 if test x"$ac_file" != x-; then
19598 configure_input="$ac_file. $configure_input" 36202 configure_input="$ac_file. $configure_input"
19599 { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 36203 { echo "$as_me:$LINENO: creating $ac_file" >&5
19600$as_echo "$as_me: creating $ac_file" >&6;} 36204echo "$as_me: creating $ac_file" >&6;}
19601 fi 36205 fi
19602 # Neutralize special characters interpreted by sed in replacement strings.
19603 case $configure_input in #(
19604 *\&* | *\|* | *\\* )
19605 ac_sed_conf_input=`$as_echo "$configure_input" |
19606 sed 's/[\\\\&|]/\\\\&/g'`;; #(
19607 *) ac_sed_conf_input=$configure_input;;
19608 esac
19609 36206
19610 case $ac_tag in 36207 case $ac_tag in
19611 *:-:* | *:-) cat >"$ac_tmp/stdin" \ 36208 *:-:* | *:-) cat >"$tmp/stdin";;
19612 || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
19613 esac 36209 esac
19614 ;; 36210 ;;
19615 esac 36211 esac
@@ -19619,7 +36215,42 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
19619 X"$ac_file" : 'X\(//\)[^/]' \| \ 36215 X"$ac_file" : 'X\(//\)[^/]' \| \
19620 X"$ac_file" : 'X\(//\)$' \| \ 36216 X"$ac_file" : 'X\(//\)$' \| \
19621 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || 36217 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
19622$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" |
19623 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ 36254 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
19624 s//\1/ 36255 s//\1/
19625 q 36256 q
@@ -19637,15 +36268,20 @@ $as_echo X"$ac_file" |
19637 q 36268 q
19638 } 36269 }
19639 s/.*/./; q'` 36270 s/.*/./; q'`
19640 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; }; }; }
19641 ac_builddir=. 36277 ac_builddir=.
19642 36278
19643case "$ac_dir" in 36279case "$ac_dir" in
19644.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; 36280.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
19645*) 36281*)
19646 ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` 36282 ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
19647 # A ".." for each directory in $ac_dir_suffix. 36283 # A ".." for each directory in $ac_dir_suffix.
19648 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,/,,'`
19649 case $ac_top_builddir_sub in 36285 case $ac_top_builddir_sub in
19650 "") ac_top_builddir_sub=. ac_top_build_prefix= ;; 36286 "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
19651 *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; 36287 *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -19685,12 +36321,12 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
19685 esac 36321 esac
19686_ACEOF 36322_ACEOF
19687 36323
19688cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 36324cat >>$CONFIG_STATUS <<\_ACEOF
19689# If the template does not know about datarootdir, expand it. 36325# If the template does not know about datarootdir, expand it.
19690# 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.
19691ac_datarootdir_hack=; ac_datarootdir_seen= 36327ac_datarootdir_hack=; ac_datarootdir_seen=
19692ac_sed_dataroot=' 36328
19693/datarootdir/ { 36329case `sed -n '/datarootdir/ {
19694 p 36330 p
19695 q 36331 q
19696} 36332}
@@ -19698,37 +36334,36 @@ ac_sed_dataroot='
19698/@docdir@/p 36334/@docdir@/p
19699/@infodir@/p 36335/@infodir@/p
19700/@localedir@/p 36336/@localedir@/p
19701/@mandir@/p' 36337/@mandir@/p
19702case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in 36338' $ac_file_inputs` in
19703*datarootdir*) ac_datarootdir_seen=yes;; 36339*datarootdir*) ac_datarootdir_seen=yes;;
19704*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) 36340*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
19705 { $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
19706$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;}
19707_ACEOF 36343_ACEOF
19708cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 36344cat >>$CONFIG_STATUS <<_ACEOF
19709 ac_datarootdir_hack=' 36345 ac_datarootdir_hack='
19710 s&@datadir@&$datadir&g 36346 s&@datadir@&$datadir&g
19711 s&@docdir@&$docdir&g 36347 s&@docdir@&$docdir&g
19712 s&@infodir@&$infodir&g 36348 s&@infodir@&$infodir&g
19713 s&@localedir@&$localedir&g 36349 s&@localedir@&$localedir&g
19714 s&@mandir@&$mandir&g 36350 s&@mandir@&$mandir&g
19715 s&\\\${datarootdir}&$datarootdir&g' ;; 36351 s&\\\${datarootdir}&$datarootdir&g' ;;
19716esac 36352esac
19717_ACEOF 36353_ACEOF
19718 36354
19719# Neutralize VPATH when `$srcdir' = `.'. 36355# Neutralize VPATH when `$srcdir' = `.'.
19720# Shell code in configure.ac might set extrasub. 36356# Shell code in configure.ac might set extrasub.
19721# FIXME: do we really want to maintain this feature? 36357# FIXME: do we really want to maintain this feature?
19722cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 36358cat >>$CONFIG_STATUS <<_ACEOF
19723ac_sed_extra="$ac_vpsub 36359 sed "$ac_vpsub
19724$extrasub 36360$extrasub
19725_ACEOF 36361_ACEOF
19726cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 36362cat >>$CONFIG_STATUS <<\_ACEOF
19727:t 36363:t
19728/@[a-zA-Z_][a-zA-Z_0-9]*@/!b 36364/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
19729s|@configure_input@|$ac_sed_conf_input|;t t 36365s&@configure_input@&$configure_input&;t t
19730s&@top_builddir@&$ac_top_builddir_sub&;t t 36366s&@top_builddir@&$ac_top_builddir_sub&;t t
19731s&@top_build_prefix@&$ac_top_build_prefix&;t t
19732s&@srcdir@&$ac_srcdir&;t t 36367s&@srcdir@&$ac_srcdir&;t t
19733s&@abs_srcdir@&$ac_abs_srcdir&;t t 36368s&@abs_srcdir@&$ac_abs_srcdir&;t t
19734s&@top_srcdir@&$ac_top_srcdir&;t t 36369s&@top_srcdir@&$ac_top_srcdir&;t t
@@ -19738,49 +36373,119 @@ s&@abs_builddir@&$ac_abs_builddir&;t t
19738s&@abs_top_builddir@&$ac_abs_top_builddir&;t t 36373s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
19739s&@INSTALL@&$ac_INSTALL&;t t 36374s&@INSTALL@&$ac_INSTALL&;t t
19740$ac_datarootdir_hack 36375$ac_datarootdir_hack
19741" 36376" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
19742eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
19743 >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
19744 36377
19745test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && 36378test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
19746 { 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"; } &&
19747 { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ 36380 { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
19748 "$ac_tmp/out"`; test -z "$ac_out"; } && 36381 { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
19749 { $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
19750which seems to be undefined. Please make sure it is defined" >&5 36383echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
19751$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;}
19752which seems to be undefined. Please make sure it is defined" >&2;} 36385
19753 36386 rm -f "$tmp/stdin"
19754 rm -f "$ac_tmp/stdin"
19755 case $ac_file in 36387 case $ac_file in
19756 -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; 36388 -) cat "$tmp/out"; rm -f "$tmp/out";;
19757 *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; 36389 *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
19758 esac \ 36390 esac
19759 || as_fn_error $? "could not create $ac_file" "$LINENO" 5
19760 ;; 36391 ;;
19761 :H) 36392 :H)
19762 # 36393 #
19763 # CONFIG_HEADER 36394 # CONFIG_HEADER
19764 # 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
19765 if test x"$ac_file" != x-; then 36474 if test x"$ac_file" != x-; then
19766 { 36475 echo "/* $configure_input */" >"$tmp/config.h"
19767 $as_echo "/* $configure_input */" \ 36476 cat "$ac_result" >>"$tmp/config.h"
19768 && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" 36477 if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
19769 } >"$ac_tmp/config.h" \ 36478 { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
19770 || as_fn_error $? "could not create $ac_file" "$LINENO" 5 36479echo "$as_me: $ac_file is unchanged" >&6;}
19771 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
19772 { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
19773$as_echo "$as_me: $ac_file is unchanged" >&6;}
19774 else 36480 else
19775 rm -f "$ac_file" 36481 rm -f $ac_file
19776 mv "$ac_tmp/config.h" "$ac_file" \ 36482 mv "$tmp/config.h" $ac_file
19777 || as_fn_error $? "could not create $ac_file" "$LINENO" 5
19778 fi 36483 fi
19779 else 36484 else
19780 $as_echo "/* $configure_input */" \ 36485 echo "/* $configure_input */"
19781 && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ 36486 cat "$ac_result"
19782 || as_fn_error $? "could not create -" "$LINENO" 5
19783 fi 36487 fi
36488 rm -f "$tmp/out12"
19784 ;; 36489 ;;
19785 36490
19786 36491
@@ -19789,13 +36494,11 @@ $as_echo "$as_me: $ac_file is unchanged" >&6;}
19789done # for ac_tag 36494done # for ac_tag
19790 36495
19791 36496
19792as_fn_exit 0 36497{ (exit 0); exit 0; }
19793_ACEOF 36498_ACEOF
36499chmod +x $CONFIG_STATUS
19794ac_clean_files=$ac_clean_files_save 36500ac_clean_files=$ac_clean_files_save
19795 36501
19796test $ac_write_fail = 0 ||
19797 as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
19798
19799 36502
19800# configure is writing to config.log, and then calls config.status. 36503# configure is writing to config.log, and then calls config.status.
19801# config.status does its own redirection, appending to config.log. 36504# config.status does its own redirection, appending to config.log.
@@ -19815,11 +36518,7 @@ if test "$no_create" != yes; then
19815 exec 5>>config.log 36518 exec 5>>config.log
19816 # Use ||, not &&, to avoid exiting from the if with $? = 1, which 36519 # Use ||, not &&, to avoid exiting from the if with $? = 1, which
19817 # would make configure fail if this is the last instruction. 36520 # would make configure fail if this is the last instruction.
19818 $ac_cs_success || as_fn_exit 1 36521 $ac_cs_success || { (exit 1); exit 1; }
19819fi
19820if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
19821 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
19822$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
19823fi 36522fi
19824 36523
19825 36524
@@ -19870,7 +36569,6 @@ echo " MD5 password support: $MD5_MSG"
19870echo " libedit support: $LIBEDIT_MSG" 36569echo " libedit support: $LIBEDIT_MSG"
19871echo " Solaris process contract support: $SPC_MSG" 36570echo " Solaris process contract support: $SPC_MSG"
19872echo " Solaris project support: $SP_MSG" 36571echo " Solaris project support: $SP_MSG"
19873echo " ConsoleKit support: $CONSOLEKIT_MSG"
19874echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" 36572echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
19875echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" 36573echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
19876echo " BSD Auth support: $BSD_AUTH_MSG" 36574echo " BSD Auth support: $BSD_AUTH_MSG"
diff --git a/configure.ac b/configure.ac
index f5c65c5a4..f7ce777a5 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],
@@ -1320,7 +1356,7 @@ g.gl_statv = NULL;
1320 AC_MSG_RESULT([yes]) 1356 AC_MSG_RESULT([yes])
1321 ], [ 1357 ], [
1322 AC_MSG_RESULT([no]) 1358 AC_MSG_RESULT([no])
1323 1359
1324]) 1360])
1325 1361
1326AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>]) 1362AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
@@ -1603,7 +1639,7 @@ AC_ARG_WITH([audit],
1603) 1639)
1604 1640
1605AC_ARG_WITH([pie], 1641AC_ARG_WITH([pie],
1606 [ --with-pie Build Position Independent Executables if possible], [ 1642 [ --with-pie Build Position Independent Executables if possible], [
1607 if test "x$withval" = "xno"; then 1643 if test "x$withval" = "xno"; then
1608 use_pie=no 1644 use_pie=no
1609 fi 1645 fi
@@ -1709,6 +1745,7 @@ AC_CHECK_FUNCS([ \
1709 prctl \ 1745 prctl \
1710 pstat \ 1746 pstat \
1711 readpassphrase \ 1747 readpassphrase \
1748 reallocarray \
1712 realpath \ 1749 realpath \
1713 recvmsg \ 1750 recvmsg \
1714 rresvport_af \ 1751 rresvport_af \
@@ -1768,10 +1805,13 @@ AC_LINK_IFELSE(
1768 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).]) 1805 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
1769]) 1806])
1770 1807
1771# PKCS#11 support requires dlopen() and co 1808# PKCS11 depends on OpenSSL.
1772AC_SEARCH_LIBS([dlopen], [dl], 1809if test "x$openssl" = "xyes" ; then
1773 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])] 1810 # PKCS#11 support requires dlopen() and co
1774) 1811 AC_SEARCH_LIBS([dlopen], [dl],
1812 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])]
1813 )
1814fi
1775 1815
1776# IRIX has a const char return value for gai_strerror() 1816# IRIX has a const char return value for gai_strerror()
1777AC_CHECK_FUNCS([gai_strerror], [ 1817AC_CHECK_FUNCS([gai_strerror], [
@@ -2237,6 +2277,13 @@ if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2237 ) 2277 )
2238fi 2278fi
2239 2279
2280if test "x$ac_cv_func_getaddrinfo" = "xyes"; then
2281 AC_CHECK_DECLS(AI_NUMERICSERV, , ,
2282 [#include <sys/types.h>
2283 #include <sys/socket.h>
2284 #include <netdb.h>])
2285fi
2286
2240if test "x$check_for_conflicting_getspnam" = "x1"; then 2287if test "x$check_for_conflicting_getspnam" = "x1"; then
2241 AC_MSG_CHECKING([for conflicting getspnam in shadow.h]) 2288 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
2242 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]], 2289 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
@@ -2260,6 +2307,9 @@ saved_LDFLAGS="$LDFLAGS"
2260AC_ARG_WITH([ssl-dir], 2307AC_ARG_WITH([ssl-dir],
2261 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ], 2308 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2262 [ 2309 [
2310 if test "x$openssl" = "xno" ; then
2311 AC_MSG_ERROR([cannot use --with-ssl-dir when OpenSSL disabled])
2312 fi
2263 if test "x$withval" != "xno" ; then 2313 if test "x$withval" != "xno" ; then
2264 case "$withval" in 2314 case "$withval" in
2265 # Relative paths 2315 # Relative paths
@@ -2292,445 +2342,458 @@ AC_ARG_WITH([ssl-dir],
2292 fi 2342 fi
2293 ] 2343 ]
2294) 2344)
2295LIBS="-lcrypto $LIBS" 2345
2296AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1], 2346AC_ARG_WITH([openssl-header-check],
2297 [Define if your ssl headers are included 2347 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2298 with #include <openssl/header.h>])],
2299 [ 2348 [
2300 dnl Check default openssl install dir 2349 if test "x$withval" = "xno" ; then
2301 if test -n "${need_dash_r}"; then 2350 openssl_check_nonfatal=1
2302 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
2303 else
2304 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
2305 fi 2351 fi
2306 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
2307 AC_CHECK_HEADER([openssl/opensslv.h], ,
2308 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2309 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
2310 [
2311 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2312 ]
2313 )
2314 ] 2352 ]
2315) 2353)
2316 2354
2317# Determine OpenSSL header version 2355openssl_engine=no
2318AC_MSG_CHECKING([OpenSSL header version]) 2356AC_ARG_WITH([ssl-engine],
2319AC_RUN_IFELSE( 2357 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2320 [AC_LANG_PROGRAM([[
2321#include <stdio.h>
2322#include <string.h>
2323#include <openssl/opensslv.h>
2324#define DATA "conftest.sslincver"
2325 ]], [[
2326 FILE *fd;
2327 int rc;
2328
2329 fd = fopen(DATA,"w");
2330 if(fd == NULL)
2331 exit(1);
2332
2333 if ((rc = fprintf(fd ,"%08x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2334 exit(1);
2335
2336 exit(0);
2337 ]])],
2338 [
2339 ssl_header_ver=`cat conftest.sslincver`
2340 AC_MSG_RESULT([$ssl_header_ver])
2341 ],
2342 [
2343 AC_MSG_RESULT([not found])
2344 AC_MSG_ERROR([OpenSSL version header not found.])
2345 ],
2346 [ 2358 [
2347 AC_MSG_WARN([cross compiling: not checking]) 2359 if test "x$openssl" = "xno" ; then
2360 AC_MSG_ERROR([cannot use --with-ssl-engine when OpenSSL disabled])
2361 fi
2362 if test "x$withval" != "xno" ; then
2363 openssl_engine=yes
2364 fi
2348 ] 2365 ]
2349) 2366)
2350 2367
2351# Determine OpenSSL library version 2368if test "x$openssl" = "xyes" ; then
2352AC_MSG_CHECKING([OpenSSL library version]) 2369 LIBS="-lcrypto $LIBS"
2353AC_RUN_IFELSE( 2370 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
2354 [AC_LANG_PROGRAM([[ 2371 [Define if your ssl headers are included
2355#include <stdio.h> 2372 with #include <openssl/header.h>])],
2356#include <string.h> 2373 [
2357#include <openssl/opensslv.h> 2374 dnl Check default openssl install dir
2358#include <openssl/crypto.h> 2375 if test -n "${need_dash_r}"; then
2359#define DATA "conftest.ssllibver" 2376 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
2360 ]], [[ 2377 else
2361 FILE *fd; 2378 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
2362 int rc; 2379 fi
2380 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
2381 AC_CHECK_HEADER([openssl/opensslv.h], ,
2382 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2383 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
2384 [
2385 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2386 ]
2387 )
2388 ]
2389 )
2363 2390
2364 fd = fopen(DATA,"w"); 2391 # Determine OpenSSL header version
2365 if(fd == NULL) 2392 AC_MSG_CHECKING([OpenSSL header version])
2366 exit(1); 2393 AC_RUN_IFELSE(
2394 [AC_LANG_PROGRAM([[
2395 #include <stdio.h>
2396 #include <string.h>
2397 #include <openssl/opensslv.h>
2398 #define DATA "conftest.sslincver"
2399 ]], [[
2400 FILE *fd;
2401 int rc;
2367 2402
2368 if ((rc = fprintf(fd ,"%08x (%s)\n", SSLeay(), 2403 fd = fopen(DATA,"w");
2369 SSLeay_version(SSLEAY_VERSION))) <0) 2404 if(fd == NULL)
2370 exit(1); 2405 exit(1);
2371 2406
2372 exit(0); 2407 if ((rc = fprintf(fd ,"%08x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2373 ]])], 2408 exit(1);
2374 [ 2409
2375 ssl_library_ver=`cat conftest.ssllibver` 2410 exit(0);
2376 # Check version is supported. 2411 ]])],
2377 case "$ssl_library_ver" in 2412 [
2378 0090[[0-7]]*|009080[[0-5]]*) 2413 ssl_header_ver=`cat conftest.sslincver`
2379 AC_MSG_ERROR([OpenSSL >= 0.9.8f required]) 2414 AC_MSG_RESULT([$ssl_header_ver])
2380 ;; 2415 ],
2381 *) ;; 2416 [
2382 esac 2417 AC_MSG_RESULT([not found])
2383 AC_MSG_RESULT([$ssl_library_ver]) 2418 AC_MSG_ERROR([OpenSSL version header not found.])
2384 ], 2419 ],
2385 [ 2420 [
2386 AC_MSG_RESULT([not found]) 2421 AC_MSG_WARN([cross compiling: not checking])
2387 AC_MSG_ERROR([OpenSSL library not found.]) 2422 ]
2388 ], 2423 )
2389 [
2390 AC_MSG_WARN([cross compiling: not checking])
2391 ]
2392)
2393 2424
2394# XXX make --without-openssl work 2425 # Determine OpenSSL library version
2395AC_DEFINE_UNQUOTED([WITH_OPENSSL], [1], [use libcrypto for cryptography]) 2426 AC_MSG_CHECKING([OpenSSL library version])
2396AC_DEFINE_UNQUOTED([WITH_SSH1], [1], [include SSH protocol version 1 support]) 2427 AC_RUN_IFELSE(
2428 [AC_LANG_PROGRAM([[
2429 #include <stdio.h>
2430 #include <string.h>
2431 #include <openssl/opensslv.h>
2432 #include <openssl/crypto.h>
2433 #define DATA "conftest.ssllibver"
2434 ]], [[
2435 FILE *fd;
2436 int rc;
2397 2437
2398AC_ARG_WITH([openssl-header-check], 2438 fd = fopen(DATA,"w");
2399 [ --without-openssl-header-check Disable OpenSSL version consistency check], 2439 if(fd == NULL)
2400 [ if test "x$withval" = "xno" ; then 2440 exit(1);
2401 openssl_check_nonfatal=1
2402 fi
2403 ]
2404)
2405 2441
2406# Sanity check OpenSSL headers 2442 if ((rc = fprintf(fd ,"%08x (%s)\n", SSLeay(),
2407AC_MSG_CHECKING([whether OpenSSL's headers match the library]) 2443 SSLeay_version(SSLEAY_VERSION))) <0)
2408AC_RUN_IFELSE( 2444 exit(1);
2409 [AC_LANG_PROGRAM([[
2410#include <string.h>
2411#include <openssl/opensslv.h>
2412 ]], [[
2413 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
2414 ]])],
2415 [
2416 AC_MSG_RESULT([yes])
2417 ],
2418 [
2419 AC_MSG_RESULT([no])
2420 if test "x$openssl_check_nonfatal" = "x"; then
2421 AC_MSG_ERROR([Your OpenSSL headers do not match your
2422library. Check config.log for details.
2423If you are sure your installation is consistent, you can disable the check
2424by running "./configure --without-openssl-header-check".
2425Also see contrib/findssl.sh for help identifying header/library mismatches.
2426])
2427 else
2428 AC_MSG_WARN([Your OpenSSL headers do not match your
2429library. Check config.log for details.
2430Also see contrib/findssl.sh for help identifying header/library mismatches.])
2431 fi
2432 ],
2433 [
2434 AC_MSG_WARN([cross compiling: not checking])
2435 ]
2436)
2437 2445
2438AC_MSG_CHECKING([if programs using OpenSSL functions will link]) 2446 exit(0);
2439AC_LINK_IFELSE( 2447 ]])],
2440 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]], 2448 [
2441 [[ SSLeay_add_all_algorithms(); ]])], 2449 ssl_library_ver=`cat conftest.ssllibver`
2442 [ 2450 # Check version is supported.
2443 AC_MSG_RESULT([yes]) 2451 case "$ssl_library_ver" in
2444 ], 2452 0090[[0-7]]*|009080[[0-5]]*)
2445 [ 2453 AC_MSG_ERROR([OpenSSL >= 0.9.8f required (have "$ssl_library_ver")])
2446 AC_MSG_RESULT([no]) 2454 ;;
2447 saved_LIBS="$LIBS" 2455 *) ;;
2448 LIBS="$LIBS -ldl" 2456 esac
2449 AC_MSG_CHECKING([if programs using OpenSSL need -ldl]) 2457 AC_MSG_RESULT([$ssl_library_ver])
2450 AC_LINK_IFELSE( 2458 ],
2451 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]], 2459 [
2452 [[ SSLeay_add_all_algorithms(); ]])], 2460 AC_MSG_RESULT([not found])
2453 [ 2461 AC_MSG_ERROR([OpenSSL library not found.])
2454 AC_MSG_RESULT([yes]) 2462 ],
2455 ], 2463 [
2456 [ 2464 AC_MSG_WARN([cross compiling: not checking])
2457 AC_MSG_RESULT([no]) 2465 ]
2458 LIBS="$saved_LIBS" 2466 )
2459 ]
2460 )
2461 ]
2462)
2463 2467
2464AC_CHECK_FUNCS([ \ 2468 # Sanity check OpenSSL headers
2465 BN_is_prime_ex \ 2469 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
2466 DSA_generate_parameters_ex \ 2470 AC_RUN_IFELSE(
2467 EVP_DigestInit_ex \ 2471 [AC_LANG_PROGRAM([[
2468 EVP_DigestFinal_ex \ 2472 #include <string.h>
2469 EVP_MD_CTX_init \ 2473 #include <openssl/opensslv.h>
2470 EVP_MD_CTX_cleanup \ 2474 ]], [[
2471 EVP_MD_CTX_copy_ex \ 2475 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
2472 HMAC_CTX_init \ 2476 ]])],
2473 RSA_generate_key_ex \ 2477 [
2474 RSA_get_default_method \ 2478 AC_MSG_RESULT([yes])
2475]) 2479 ],
2480 [
2481 AC_MSG_RESULT([no])
2482 if test "x$openssl_check_nonfatal" = "x"; then
2483 AC_MSG_ERROR([Your OpenSSL headers do not match your
2484 library. Check config.log for details.
2485 If you are sure your installation is consistent, you can disable the check
2486 by running "./configure --without-openssl-header-check".
2487 Also see contrib/findssl.sh for help identifying header/library mismatches.
2488 ])
2489 else
2490 AC_MSG_WARN([Your OpenSSL headers do not match your
2491 library. Check config.log for details.
2492 Also see contrib/findssl.sh for help identifying header/library mismatches.])
2493 fi
2494 ],
2495 [
2496 AC_MSG_WARN([cross compiling: not checking])
2497 ]
2498 )
2476 2499
2477AC_ARG_WITH([ssl-engine], 2500 AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2478 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ], 2501 AC_LINK_IFELSE(
2479 [ if test "x$withval" != "xno" ; then 2502 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2503 [[ SSLeay_add_all_algorithms(); ]])],
2504 [
2505 AC_MSG_RESULT([yes])
2506 ],
2507 [
2508 AC_MSG_RESULT([no])
2509 saved_LIBS="$LIBS"
2510 LIBS="$LIBS -ldl"
2511 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2512 AC_LINK_IFELSE(
2513 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2514 [[ SSLeay_add_all_algorithms(); ]])],
2515 [
2516 AC_MSG_RESULT([yes])
2517 ],
2518 [
2519 AC_MSG_RESULT([no])
2520 LIBS="$saved_LIBS"
2521 ]
2522 )
2523 ]
2524 )
2525
2526 AC_CHECK_FUNCS([ \
2527 BN_is_prime_ex \
2528 DSA_generate_parameters_ex \
2529 EVP_DigestInit_ex \
2530 EVP_DigestFinal_ex \
2531 EVP_MD_CTX_init \
2532 EVP_MD_CTX_cleanup \
2533 EVP_MD_CTX_copy_ex \
2534 HMAC_CTX_init \
2535 RSA_generate_key_ex \
2536 RSA_get_default_method \
2537 ])
2538
2539 if test "x$openssl_engine" = "xyes" ; then
2480 AC_MSG_CHECKING([for OpenSSL ENGINE support]) 2540 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2481 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 2541 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2482#include <openssl/engine.h> 2542 #include <openssl/engine.h>
2483 ]], [[ 2543 ]], [[
2484 ENGINE_load_builtin_engines(); 2544 ENGINE_load_builtin_engines();
2485 ENGINE_register_all_complete(); 2545 ENGINE_register_all_complete();
2486 ]])], 2546 ]])],
2487 [ AC_MSG_RESULT([yes]) 2547 [ AC_MSG_RESULT([yes])
2488 AC_DEFINE([USE_OPENSSL_ENGINE], [1], 2548 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
2489 [Enable OpenSSL engine support]) 2549 [Enable OpenSSL engine support])
2490 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found]) 2550 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2491 ]) 2551 ])
2492 fi ] 2552 fi
2493)
2494 2553
2495# Check for OpenSSL without EVP_aes_{192,256}_cbc 2554 # Check for OpenSSL without EVP_aes_{192,256}_cbc
2496AC_MSG_CHECKING([whether OpenSSL has crippled AES support]) 2555 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2497AC_LINK_IFELSE( 2556 AC_LINK_IFELSE(
2498 [AC_LANG_PROGRAM([[ 2557 [AC_LANG_PROGRAM([[
2499#include <string.h> 2558 #include <string.h>
2500#include <openssl/evp.h> 2559 #include <openssl/evp.h>
2501 ]], [[ 2560 ]], [[
2502 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL); 2561 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
2503 ]])], 2562 ]])],
2504 [ 2563 [
2505 AC_MSG_RESULT([no]) 2564 AC_MSG_RESULT([no])
2506 ], 2565 ],
2507 [ 2566 [
2508 AC_MSG_RESULT([yes]) 2567 AC_MSG_RESULT([yes])
2509 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1], 2568 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
2510 [libcrypto is missing AES 192 and 256 bit functions]) 2569 [libcrypto is missing AES 192 and 256 bit functions])
2511 ] 2570 ]
2512) 2571 )
2513 2572
2514# Check for OpenSSL with EVP_aes_*ctr 2573 # Check for OpenSSL with EVP_aes_*ctr
2515AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP]) 2574 AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP])
2516AC_LINK_IFELSE( 2575 AC_LINK_IFELSE(
2517 [AC_LANG_PROGRAM([[ 2576 [AC_LANG_PROGRAM([[
2518#include <string.h> 2577 #include <string.h>
2519#include <openssl/evp.h> 2578 #include <openssl/evp.h>
2520 ]], [[ 2579 ]], [[
2521 exit(EVP_aes_128_ctr() == NULL || 2580 exit(EVP_aes_128_ctr() == NULL ||
2522 EVP_aes_192_cbc() == NULL || 2581 EVP_aes_192_cbc() == NULL ||
2523 EVP_aes_256_cbc() == NULL); 2582 EVP_aes_256_cbc() == NULL);
2524 ]])], 2583 ]])],
2525 [ 2584 [
2526 AC_MSG_RESULT([yes]) 2585 AC_MSG_RESULT([yes])
2527 AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1], 2586 AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1],
2528 [libcrypto has EVP AES CTR]) 2587 [libcrypto has EVP AES CTR])
2529 ], 2588 ],
2530 [ 2589 [
2531 AC_MSG_RESULT([no]) 2590 AC_MSG_RESULT([no])
2532 ] 2591 ]
2533) 2592 )
2534 2593
2535# Check for OpenSSL with EVP_aes_*gcm 2594 # Check for OpenSSL with EVP_aes_*gcm
2536AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP]) 2595 AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP])
2537AC_LINK_IFELSE( 2596 AC_LINK_IFELSE(
2538 [AC_LANG_PROGRAM([[ 2597 [AC_LANG_PROGRAM([[
2539#include <string.h> 2598 #include <string.h>
2540#include <openssl/evp.h> 2599 #include <openssl/evp.h>
2541 ]], [[ 2600 ]], [[
2542 exit(EVP_aes_128_gcm() == NULL || 2601 exit(EVP_aes_128_gcm() == NULL ||
2543 EVP_aes_256_gcm() == NULL || 2602 EVP_aes_256_gcm() == NULL ||
2544 EVP_CTRL_GCM_SET_IV_FIXED == 0 || 2603 EVP_CTRL_GCM_SET_IV_FIXED == 0 ||
2545 EVP_CTRL_GCM_IV_GEN == 0 || 2604 EVP_CTRL_GCM_IV_GEN == 0 ||
2546 EVP_CTRL_GCM_SET_TAG == 0 || 2605 EVP_CTRL_GCM_SET_TAG == 0 ||
2547 EVP_CTRL_GCM_GET_TAG == 0 || 2606 EVP_CTRL_GCM_GET_TAG == 0 ||
2548 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0); 2607 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0);
2549 ]])], 2608 ]])],
2550 [ 2609 [
2551 AC_MSG_RESULT([yes]) 2610 AC_MSG_RESULT([yes])
2552 AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1], 2611 AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1],
2553 [libcrypto has EVP AES GCM]) 2612 [libcrypto has EVP AES GCM])
2554 ], 2613 ],
2555 [ 2614 [
2556 AC_MSG_RESULT([no]) 2615 AC_MSG_RESULT([no])
2557 unsupported_algorithms="$unsupported_cipers \ 2616 unsupported_algorithms="$unsupported_cipers \
2558 aes128-gcm@openssh.com aes256-gcm@openssh.com" 2617 aes128-gcm@openssh.com aes256-gcm@openssh.com"
2559 ] 2618 ]
2560) 2619 )
2561 2620
2562AC_SEARCH_LIBS([EVP_CIPHER_CTX_ctrl], [crypto], 2621 AC_SEARCH_LIBS([EVP_CIPHER_CTX_ctrl], [crypto],
2563 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_CTRL], [1], 2622 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_CTRL], [1],
2564 [Define if libcrypto has EVP_CIPHER_CTX_ctrl])]) 2623 [Define if libcrypto has EVP_CIPHER_CTX_ctrl])])
2565 2624
2566AC_MSG_CHECKING([if EVP_DigestUpdate returns an int]) 2625 AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2567AC_LINK_IFELSE( 2626 AC_LINK_IFELSE(
2568 [AC_LANG_PROGRAM([[ 2627 [AC_LANG_PROGRAM([[
2569#include <string.h> 2628 #include <string.h>
2570#include <openssl/evp.h> 2629 #include <openssl/evp.h>
2571 ]], [[ 2630 ]], [[
2572 if(EVP_DigestUpdate(NULL, NULL,0)) 2631 if(EVP_DigestUpdate(NULL, NULL,0))
2573 exit(0); 2632 exit(0);
2574 ]])], 2633 ]])],
2575 [ 2634 [
2576 AC_MSG_RESULT([yes]) 2635 AC_MSG_RESULT([yes])
2577 ], 2636 ],
2578 [ 2637 [
2579 AC_MSG_RESULT([no]) 2638 AC_MSG_RESULT([no])
2580 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1], 2639 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
2581 [Define if EVP_DigestUpdate returns void]) 2640 [Define if EVP_DigestUpdate returns void])
2582 ] 2641 ]
2583) 2642 )
2584 2643
2585# Some systems want crypt() from libcrypt, *not* the version in OpenSSL, 2644 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2586# because the system crypt() is more featureful. 2645 # because the system crypt() is more featureful.
2587if test "x$check_for_libcrypt_before" = "x1"; then 2646 if test "x$check_for_libcrypt_before" = "x1"; then
2588 AC_CHECK_LIB([crypt], [crypt]) 2647 AC_CHECK_LIB([crypt], [crypt])
2589fi 2648 fi
2590 2649
2591# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the 2650 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2592# version in OpenSSL. 2651 # version in OpenSSL.
2593if test "x$check_for_libcrypt_later" = "x1"; then 2652 if test "x$check_for_libcrypt_later" = "x1"; then
2594 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"]) 2653 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
2595fi 2654 fi
2596AC_CHECK_FUNCS([crypt DES_crypt]) 2655 AC_CHECK_FUNCS([crypt DES_crypt])
2597 2656
2598# Search for SHA256 support in libc and/or OpenSSL 2657 # Search for SHA256 support in libc and/or OpenSSL
2599AC_CHECK_FUNCS([SHA256_Update EVP_sha256], , 2658 AC_CHECK_FUNCS([SHA256_Update EVP_sha256], ,
2600 [unsupported_algorithms="$unsupported_algorithms \ 2659 [unsupported_algorithms="$unsupported_algorithms \
2601 hmac-sha2-256 hmac-sha2-512 \ 2660 hmac-sha2-256 hmac-sha2-512 \
2602 diffie-hellman-group-exchange-sha256 \ 2661 diffie-hellman-group-exchange-sha256 \
2603 hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com" 2662 hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com"
2604 ] 2663 ]
2605) 2664 )
2606# Search for RIPE-MD support in OpenSSL 2665 # Search for RIPE-MD support in OpenSSL
2607AC_CHECK_FUNCS([EVP_ripemd160], , 2666 AC_CHECK_FUNCS([EVP_ripemd160], ,
2608 [unsupported_algorithms="$unsupported_algorithms \ 2667 [unsupported_algorithms="$unsupported_algorithms \
2609 hmac-ripemd160 2668 hmac-ripemd160
2610 hmac-ripemd160@openssh.com 2669 hmac-ripemd160@openssh.com
2611 hmac-ripemd160-etm@openssh.com" 2670 hmac-ripemd160-etm@openssh.com"
2612 ] 2671 ]
2613) 2672 )
2614 2673
2615# Check complete ECC support in OpenSSL 2674 # Check complete ECC support in OpenSSL
2616AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1]) 2675 AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1])
2617AC_LINK_IFELSE( 2676 AC_LINK_IFELSE(
2618 [AC_LANG_PROGRAM([[ 2677 [AC_LANG_PROGRAM([[
2619#include <openssl/ec.h> 2678 #include <openssl/ec.h>
2620#include <openssl/ecdh.h> 2679 #include <openssl/ecdh.h>
2621#include <openssl/ecdsa.h> 2680 #include <openssl/ecdsa.h>
2622#include <openssl/evp.h> 2681 #include <openssl/evp.h>
2623#include <openssl/objects.h> 2682 #include <openssl/objects.h>
2624#include <openssl/opensslv.h> 2683 #include <openssl/opensslv.h>
2625#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */ 2684 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2626# error "OpenSSL < 0.9.8g has unreliable ECC code" 2685 # error "OpenSSL < 0.9.8g has unreliable ECC code"
2627#endif 2686 #endif
2628 ]], [[ 2687 ]], [[
2629 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); 2688 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
2630 const EVP_MD *m = EVP_sha256(); /* We need this too */ 2689 const EVP_MD *m = EVP_sha256(); /* We need this too */
2631 ]])], 2690 ]])],
2632 [ AC_MSG_RESULT([yes]) 2691 [ AC_MSG_RESULT([yes])
2633 enable_nistp256=1 ], 2692 enable_nistp256=1 ],
2634 [ AC_MSG_RESULT([no]) ] 2693 [ AC_MSG_RESULT([no]) ]
2635) 2694 )
2636 2695
2637AC_MSG_CHECKING([whether OpenSSL has NID_secp384r1]) 2696 AC_MSG_CHECKING([whether OpenSSL has NID_secp384r1])
2638AC_LINK_IFELSE( 2697 AC_LINK_IFELSE(
2639 [AC_LANG_PROGRAM([[ 2698 [AC_LANG_PROGRAM([[
2640#include <openssl/ec.h> 2699 #include <openssl/ec.h>
2641#include <openssl/ecdh.h> 2700 #include <openssl/ecdh.h>
2642#include <openssl/ecdsa.h> 2701 #include <openssl/ecdsa.h>
2643#include <openssl/evp.h> 2702 #include <openssl/evp.h>
2644#include <openssl/objects.h> 2703 #include <openssl/objects.h>
2645#include <openssl/opensslv.h> 2704 #include <openssl/opensslv.h>
2646#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */ 2705 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2647# error "OpenSSL < 0.9.8g has unreliable ECC code" 2706 # error "OpenSSL < 0.9.8g has unreliable ECC code"
2648#endif 2707 #endif
2649 ]], [[ 2708 ]], [[
2650 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1); 2709 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1);
2651 const EVP_MD *m = EVP_sha384(); /* We need this too */ 2710 const EVP_MD *m = EVP_sha384(); /* We need this too */
2652 ]])], 2711 ]])],
2653 [ AC_MSG_RESULT([yes]) 2712 [ AC_MSG_RESULT([yes])
2654 enable_nistp384=1 ], 2713 enable_nistp384=1 ],
2655 [ AC_MSG_RESULT([no]) ] 2714 [ AC_MSG_RESULT([no]) ]
2656) 2715 )
2657 2716
2658AC_MSG_CHECKING([whether OpenSSL has NID_secp521r1]) 2717 AC_MSG_CHECKING([whether OpenSSL has NID_secp521r1])
2659AC_LINK_IFELSE( 2718 AC_LINK_IFELSE(
2660 [AC_LANG_PROGRAM([[
2661#include <openssl/ec.h>
2662#include <openssl/ecdh.h>
2663#include <openssl/ecdsa.h>
2664#include <openssl/evp.h>
2665#include <openssl/objects.h>
2666#include <openssl/opensslv.h>
2667#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2668# error "OpenSSL < 0.9.8g has unreliable ECC code"
2669#endif
2670 ]], [[
2671 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2672 const EVP_MD *m = EVP_sha512(); /* We need this too */
2673 ]])],
2674 [ AC_MSG_RESULT([yes])
2675 AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional])
2676 AC_RUN_IFELSE(
2677 [AC_LANG_PROGRAM([[ 2719 [AC_LANG_PROGRAM([[
2678#include <openssl/ec.h> 2720 #include <openssl/ec.h>
2679#include <openssl/ecdh.h> 2721 #include <openssl/ecdh.h>
2680#include <openssl/ecdsa.h> 2722 #include <openssl/ecdsa.h>
2681#include <openssl/evp.h> 2723 #include <openssl/evp.h>
2682#include <openssl/objects.h> 2724 #include <openssl/objects.h>
2683#include <openssl/opensslv.h> 2725 #include <openssl/opensslv.h>
2684 ]],[[ 2726 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2727 # error "OpenSSL < 0.9.8g has unreliable ECC code"
2728 #endif
2729 ]], [[
2685 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1); 2730 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2686 const EVP_MD *m = EVP_sha512(); /* We need this too */ 2731 const EVP_MD *m = EVP_sha512(); /* We need this too */
2687 exit(e == NULL || m == NULL);
2688 ]])], 2732 ]])],
2689 [ AC_MSG_RESULT([yes]) 2733 [ AC_MSG_RESULT([yes])
2690 enable_nistp521=1 ], 2734 AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional])
2691 [ AC_MSG_RESULT([no]) ], 2735 AC_RUN_IFELSE(
2692 [ AC_MSG_WARN([cross-compiling: assuming yes]) 2736 [AC_LANG_PROGRAM([[
2693 enable_nistp521=1 ] 2737 #include <openssl/ec.h>
2694 )], 2738 #include <openssl/ecdh.h>
2695 AC_MSG_RESULT([no]) 2739 #include <openssl/ecdsa.h>
2696) 2740 #include <openssl/evp.h>
2741 #include <openssl/objects.h>
2742 #include <openssl/opensslv.h>
2743 ]],[[
2744 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2745 const EVP_MD *m = EVP_sha512(); /* We need this too */
2746 exit(e == NULL || m == NULL);
2747 ]])],
2748 [ AC_MSG_RESULT([yes])
2749 enable_nistp521=1 ],
2750 [ AC_MSG_RESULT([no]) ],
2751 [ AC_MSG_WARN([cross-compiling: assuming yes])
2752 enable_nistp521=1 ]
2753 )],
2754 AC_MSG_RESULT([no])
2755 )
2697 2756
2698COMMENT_OUT_ECC="#no ecc#" 2757 COMMENT_OUT_ECC="#no ecc#"
2699TEST_SSH_ECC=no 2758 TEST_SSH_ECC=no
2700 2759
2701if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \ 2760 if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \
2702 test x$enable_nistp521 = x1; then 2761 test x$enable_nistp521 = x1; then
2703 AC_DEFINE(OPENSSL_HAS_ECC, [1], [OpenSSL has ECC]) 2762 AC_DEFINE(OPENSSL_HAS_ECC, [1], [OpenSSL has ECC])
2704fi 2763 fi
2705if test x$enable_nistp256 = x1; then 2764 if test x$enable_nistp256 = x1; then
2706 AC_DEFINE([OPENSSL_HAS_NISTP256], [1], 2765 AC_DEFINE([OPENSSL_HAS_NISTP256], [1],
2707 [libcrypto has NID_X9_62_prime256v1]) 2766 [libcrypto has NID_X9_62_prime256v1])
2708 TEST_SSH_ECC=yes 2767 TEST_SSH_ECC=yes
2709 COMMENT_OUT_ECC="" 2768 COMMENT_OUT_ECC=""
2710else 2769 else
2711 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp256 \ 2770 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp256 \
2712 ecdh-sha2-nistp256 ecdsa-sha2-nistp256-cert-v01@openssh.com" 2771 ecdh-sha2-nistp256 ecdsa-sha2-nistp256-cert-v01@openssh.com"
2713fi 2772 fi
2714if test x$enable_nistp384 = x1; then 2773 if test x$enable_nistp384 = x1; then
2715 AC_DEFINE([OPENSSL_HAS_NISTP384], [1], [libcrypto has NID_secp384r1]) 2774 AC_DEFINE([OPENSSL_HAS_NISTP384], [1], [libcrypto has NID_secp384r1])
2716 TEST_SSH_ECC=yes 2775 TEST_SSH_ECC=yes
2717 COMMENT_OUT_ECC="" 2776 COMMENT_OUT_ECC=""
2718else 2777 else
2719 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp384 \ 2778 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp384 \
2720 ecdh-sha2-nistp384 ecdsa-sha2-nistp384-cert-v01@openssh.com" 2779 ecdh-sha2-nistp384 ecdsa-sha2-nistp384-cert-v01@openssh.com"
2721fi 2780 fi
2722if test x$enable_nistp521 = x1; then 2781 if test x$enable_nistp521 = x1; then
2723 AC_DEFINE([OPENSSL_HAS_NISTP521], [1], [libcrypto has NID_secp521r1]) 2782 AC_DEFINE([OPENSSL_HAS_NISTP521], [1], [libcrypto has NID_secp521r1])
2724 TEST_SSH_ECC=yes 2783 TEST_SSH_ECC=yes
2725 COMMENT_OUT_ECC="" 2784 COMMENT_OUT_ECC=""
2785 else
2786 unsupported_algorithms="$unsupported_algorithms ecdh-sha2-nistp521 \
2787 ecdsa-sha2-nistp521 ecdsa-sha2-nistp521-cert-v01@openssh.com"
2788 fi
2789
2790 AC_SUBST([TEST_SSH_ECC])
2791 AC_SUBST([COMMENT_OUT_ECC])
2726else 2792else
2727 unsupported_algorithms="$unsupported_algorithms ecdh-sha2-nistp521 \ 2793 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
2728 ecdsa-sha2-nistp521 ecdsa-sha2-nistp521-cert-v01@openssh.com" 2794 AC_CHECK_FUNCS([crypt])
2729fi 2795fi
2730 2796
2731AC_SUBST([TEST_SSH_ECC])
2732AC_SUBST([COMMENT_OUT_ECC])
2733
2734AC_CHECK_FUNCS([ \ 2797AC_CHECK_FUNCS([ \
2735 arc4random \ 2798 arc4random \
2736 arc4random_buf \ 2799 arc4random_buf \
@@ -2751,28 +2814,30 @@ LIBS="$saved_LIBS"
2751### Configure cryptographic random number support 2814### Configure cryptographic random number support
2752 2815
2753# Check wheter OpenSSL seeds itself 2816# Check wheter OpenSSL seeds itself
2754AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded]) 2817if test "x$openssl" = "xyes" ; then
2755AC_RUN_IFELSE( 2818 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
2756 [AC_LANG_PROGRAM([[ 2819 AC_RUN_IFELSE(
2757#include <string.h> 2820 [AC_LANG_PROGRAM([[
2758#include <openssl/rand.h> 2821 #include <string.h>
2759 ]], [[ 2822 #include <openssl/rand.h>
2760 exit(RAND_status() == 1 ? 0 : 1); 2823 ]], [[
2761 ]])], 2824 exit(RAND_status() == 1 ? 0 : 1);
2762 [ 2825 ]])],
2763 OPENSSL_SEEDS_ITSELF=yes 2826 [
2764 AC_MSG_RESULT([yes]) 2827 OPENSSL_SEEDS_ITSELF=yes
2765 ], 2828 AC_MSG_RESULT([yes])
2766 [ 2829 ],
2767 AC_MSG_RESULT([no]) 2830 [
2768 ], 2831 AC_MSG_RESULT([no])
2769 [ 2832 ],
2770 AC_MSG_WARN([cross compiling: assuming yes]) 2833 [
2771 # This is safe, since we will fatal() at runtime if 2834 AC_MSG_WARN([cross compiling: assuming yes])
2772 # OpenSSL is not seeded correctly. 2835 # This is safe, since we will fatal() at runtime if
2773 OPENSSL_SEEDS_ITSELF=yes 2836 # OpenSSL is not seeded correctly.
2774 ] 2837 OPENSSL_SEEDS_ITSELF=yes
2775) 2838 ]
2839 )
2840fi
2776 2841
2777# PRNGD TCP socket 2842# PRNGD TCP socket
2778AC_ARG_WITH([prngd-port], 2843AC_ARG_WITH([prngd-port],
@@ -2854,8 +2919,10 @@ elif test ! -z "$PRNGD_SOCKET" ; then
2854 RAND_MSG="PRNGd socket $PRNGD_SOCKET" 2919 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2855elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then 2920elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2856 AC_DEFINE([OPENSSL_PRNG_ONLY], [1], 2921 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
2857 [Define if you want OpenSSL's internally seeded PRNG only]) 2922 [Define if you want the OpenSSL internally seeded PRNG only])
2858 RAND_MSG="OpenSSL internal ONLY" 2923 RAND_MSG="OpenSSL internal ONLY"
2924elif test "x$openssl" = "xno" ; then
2925 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])
2859else 2926else
2860 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]) 2927 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])
2861fi 2928fi
@@ -2917,7 +2984,7 @@ if test "x$PAM_MSG" = "xyes" ; then
2917 which takes only one argument to pam_strerror]) 2984 which takes only one argument to pam_strerror])
2918 AC_MSG_RESULT([yes]) 2985 AC_MSG_RESULT([yes])
2919 PAM_MSG="yes (old library)" 2986 PAM_MSG="yes (old library)"
2920 2987
2921 ]) 2988 ])
2922fi 2989fi
2923 2990
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/debian/.git-dpm b/debian/.git-dpm
index 7713e7a1b..c476ca7ec 100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@ -1,8 +1,8 @@
1# see git-dpm(1) from git-dpm package 1# see git-dpm(1) from git-dpm package
2581424965d2d722a991c3247d4c0bb5950cb4fc5 28698446b972003b63dfe5dcbdb86acfe986afb85
3581424965d2d722a991c3247d4c0bb5950cb4fc5 38698446b972003b63dfe5dcbdb86acfe986afb85
4487bdb3a5ef6075887b830ccb8a0b14f6da78e93 4baccdb349b31c47cd76fb63211f754ed33a9707e
5487bdb3a5ef6075887b830ccb8a0b14f6da78e93 5baccdb349b31c47cd76fb63211f754ed33a9707e
6openssh_6.7p1.orig.tar.gz 6openssh_6.8p1.orig.tar.gz
714e5fbed710ade334d65925e080d1aaeb9c85bf6 7cdbc51e46a902b30d263b05fdc71340920e91c92
81351367 81475953
diff --git a/debian/changelog b/debian/changelog
index 29fd1f72b..4363b82ef 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,71 @@
1openssh (1:6.8p1-1) UNRELEASED; urgency=medium
2
3 * New upstream release (http://www.openssh.com/txt/release-6.8):
4 - sshd(8): UseDNS now defaults to 'no'. Configurations that match
5 against the client host name (via sshd_config or authorized_keys) may
6 need to re-enable it or convert to matching against addresses.
7 - Add FingerprintHash option to ssh(1) and sshd(8), and equivalent
8 command-line flags to the other tools to control algorithm used for
9 key fingerprints. The default changes from MD5 to SHA256 and format
10 from hex to base64.
11 Fingerprints now have the hash algorithm prepended. An example of the
12 new format: SHA256:mVPwvezndPv/ARoIadVY98vAC0g+P/5633yTC4d/wXE
13 Please note that visual host keys will also be different.
14 - ssh(1), sshd(8): Experimental host key rotation support. Add a
15 protocol extension for a server to inform a client of all its
16 available host keys after authentication has completed. The client
17 may record the keys in known_hosts, allowing it to upgrade to better
18 host key algorithms and a server to gracefully rotate its keys.
19 The client side of this is controlled by a UpdateHostkeys config
20 option (default off).
21 - ssh(1): Add a ssh_config HostbasedKeyType option to control which host
22 public key types are tried during host-based authentication.
23 - ssh(1), sshd(8): Fix connection-killing host key mismatch errors when
24 sshd offers multiple ECDSA keys of different lengths.
25 - ssh(1): When host name canonicalisation is enabled, try to parse host
26 names as addresses before looking them up for canonicalisation. Fixes
27 bz#2074 and avoids needless DNS lookups in some cases.
28 - ssh(1), ssh-keysign(8): Make ed25519 keys work for host based
29 authentication.
30 - sshd(8): SSH protocol v.1 workaround for the Meyer, et al,
31 Bleichenbacher Side Channel Attack. Fake up a bignum key before RSA
32 decryption.
33 - sshd(8): Remember which public keys have been used for authentication
34 and refuse to accept previously-used keys. This allows
35 AuthenticationMethods=publickey,publickey to require that users
36 authenticate using two _different_ public keys.
37 - sshd(8): add sshd_config HostbasedAcceptedKeyTypes and
38 PubkeyAcceptedKeyTypes options to allow sshd to control what public
39 key types will be accepted (closes: #481133). Currently defaults to
40 all.
41 - sshd(8): Don't count partial authentication success as a failure
42 against MaxAuthTries.
43 - ssh(1): Add RevokedHostKeys option for the client to allow text-file
44 or KRL-based revocation of host keys.
45 - ssh-keygen(1), sshd(8): Permit KRLs that revoke certificates by serial
46 number or key ID without scoping to a particular CA.
47 - ssh(1): Add a "Match canonical" criteria that allows ssh_config Match
48 blocks to trigger only in the second config pass.
49 - ssh(1): Add a -G option to ssh that causes it to parse its
50 configuration and dump the result to stdout, similar to "sshd -T".
51 - ssh(1): Allow Match criteria to be negated. E.g. "Match !host".
52 - ssh-keyscan(1): ssh-keyscan has been made much more robust against
53 servers that hang or violate the SSH protocol (closes: #241119).
54 - ssh(1), ssh-keygen(1): Fix regression bz#2306: Key path names were
55 being lost as comment fields (closes: #787776).
56 - ssh(1): Allow ssh_config Port options set in the second config parse
57 phase to be applied (they were being ignored; closes: #774369).
58 - ssh(1): Tweak config re-parsing with host canonicalisation - make the
59 second pass through the config files always run when host name
60 canonicalisation is enabled (and not whenever the host name changes)
61 - ssh(1): Fix passing of wildcard forward bind addresses when connection
62 multiplexing is in use.
63 - ssh-keygen(1): Fix broken private key conversion from non-OpenSSH
64 formats.
65 - ssh-keygen(1): Fix KRL generation bug when multiple CAs are in use.
66
67 -- Colin Watson <cjwatson@debian.org> Wed, 19 Aug 2015 15:19:54 +0100
68
1openssh (1:6.7p1-6) unstable; urgency=medium 69openssh (1:6.7p1-6) unstable; urgency=medium
2 70
3 [ Martin Pitt ] 71 [ Martin Pitt ]
diff --git a/debian/patches/auth-log-verbosity.patch b/debian/patches/auth-log-verbosity.patch
index 84a14cfb8..491656be2 100644
--- a/debian/patches/auth-log-verbosity.patch
+++ b/debian/patches/auth-log-verbosity.patch
@@ -1,4 +1,4 @@
1From 1ecd5db58295874d8b9a7ce98fe1880ab08fbcaf Mon Sep 17 00:00:00 2001 1From c9c2ebb4680ea6872218b1e4519fe31a2043a27a Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@debian.org> 2From: Colin Watson <cjwatson@debian.org>
3Date: Sun, 9 Feb 2014 16:10:02 +0000 3Date: Sun, 9 Feb 2014 16:10:02 +0000
4Subject: Quieten logs when multiple from= restrictions are used 4Subject: Quieten logs when multiple from= restrictions are used
@@ -16,10 +16,10 @@ Patch-Name: auth-log-verbosity.patch
16 4 files changed, 32 insertions(+), 9 deletions(-) 16 4 files changed, 32 insertions(+), 9 deletions(-)
17 17
18diff --git a/auth-options.c b/auth-options.c 18diff --git a/auth-options.c b/auth-options.c
19index f3d9c9d..d4d22d7 100644 19index 4f0da9c..3fa236e 100644
20--- a/auth-options.c 20--- a/auth-options.c
21+++ b/auth-options.c 21+++ b/auth-options.c
22@@ -54,9 +54,20 @@ int forced_tun_device = -1; 22@@ -58,9 +58,20 @@ int forced_tun_device = -1;
23 /* "principals=" option. */ 23 /* "principals=" option. */
24 char *authorized_principals = NULL; 24 char *authorized_principals = NULL;
25 25
@@ -40,7 +40,7 @@ index f3d9c9d..d4d22d7 100644
40 auth_clear_options(void) 40 auth_clear_options(void)
41 { 41 {
42 no_agent_forwarding_flag = 0; 42 no_agent_forwarding_flag = 0;
43@@ -284,10 +295,13 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum) 43@@ -288,10 +299,13 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum)
44 /* FALLTHROUGH */ 44 /* FALLTHROUGH */
45 case 0: 45 case 0:
46 free(patterns); 46 free(patterns);
@@ -58,7 +58,7 @@ index f3d9c9d..d4d22d7 100644
58 auth_debug_add("Your host '%.200s' is not " 58 auth_debug_add("Your host '%.200s' is not "
59 "permitted to use this key for login.", 59 "permitted to use this key for login.",
60 remote_host); 60 remote_host);
61@@ -511,11 +525,14 @@ parse_option_list(u_char *optblob, size_t optblob_len, struct passwd *pw, 61@@ -514,11 +528,14 @@ parse_option_list(struct sshbuf *oblob, struct passwd *pw,
62 break; 62 break;
63 case 0: 63 case 0:
64 /* no match */ 64 /* no match */
@@ -79,7 +79,7 @@ index f3d9c9d..d4d22d7 100644
79 "is not permitted to use this " 79 "is not permitted to use this "
80 "certificate for login.", 80 "certificate for login.",
81diff --git a/auth-options.h b/auth-options.h 81diff --git a/auth-options.h b/auth-options.h
82index 7455c94..a3f0a02 100644 82index 34852e5..1653855 100644
83--- a/auth-options.h 83--- a/auth-options.h
84+++ b/auth-options.h 84+++ b/auth-options.h
85@@ -33,6 +33,7 @@ extern int forced_tun_device; 85@@ -33,6 +33,7 @@ extern int forced_tun_device;
@@ -89,12 +89,12 @@ index 7455c94..a3f0a02 100644
89+void auth_start_parse_options(void); 89+void auth_start_parse_options(void);
90 int auth_parse_options(struct passwd *, char *, char *, u_long); 90 int auth_parse_options(struct passwd *, char *, char *, u_long);
91 void auth_clear_options(void); 91 void auth_clear_options(void);
92 int auth_cert_options(Key *, struct passwd *); 92 int auth_cert_options(struct sshkey *, struct passwd *);
93diff --git a/auth-rsa.c b/auth-rsa.c 93diff --git a/auth-rsa.c b/auth-rsa.c
94index e9f4ede..5d7bdcb 100644 94index cbd971b..4cf2163 100644
95--- a/auth-rsa.c 95--- a/auth-rsa.c
96+++ b/auth-rsa.c 96+++ b/auth-rsa.c
97@@ -179,6 +179,8 @@ rsa_key_allowed_in_file(struct passwd *pw, char *file, 97@@ -181,6 +181,8 @@ rsa_key_allowed_in_file(struct passwd *pw, char *file,
98 if ((f = auth_openkeyfile(file, pw, options.strict_modes)) == NULL) 98 if ((f = auth_openkeyfile(file, pw, options.strict_modes)) == NULL)
99 return 0; 99 return 0;
100 100
@@ -104,10 +104,10 @@ index e9f4ede..5d7bdcb 100644
104 * Go though the accepted keys, looking for the current key. If 104 * Go though the accepted keys, looking for the current key. If
105 * found, perform a challenge-response dialog to verify that the 105 * found, perform a challenge-response dialog to verify that the
106diff --git a/auth2-pubkey.c b/auth2-pubkey.c 106diff --git a/auth2-pubkey.c b/auth2-pubkey.c
107index f3ca965..f78b046 100644 107index d943efa..0bda5c9 100644
108--- a/auth2-pubkey.c 108--- a/auth2-pubkey.c
109+++ b/auth2-pubkey.c 109+++ b/auth2-pubkey.c
110@@ -263,6 +263,7 @@ match_principals_file(char *file, struct passwd *pw, struct sshkey_cert *cert) 110@@ -282,6 +282,7 @@ match_principals_file(char *file, struct passwd *pw, struct sshkey_cert *cert)
111 restore_uid(); 111 restore_uid();
112 return 0; 112 return 0;
113 } 113 }
@@ -115,7 +115,7 @@ index f3ca965..f78b046 100644
115 while (read_keyfile_line(f, file, line, sizeof(line), &linenum) != -1) { 115 while (read_keyfile_line(f, file, line, sizeof(line), &linenum) != -1) {
116 /* Skip leading whitespace. */ 116 /* Skip leading whitespace. */
117 for (cp = line; *cp == ' ' || *cp == '\t'; cp++) 117 for (cp = line; *cp == ' ' || *cp == '\t'; cp++)
118@@ -324,6 +325,7 @@ check_authkeys_file(FILE *f, char *file, Key* key, struct passwd *pw) 118@@ -343,6 +344,7 @@ check_authkeys_file(FILE *f, char *file, Key* key, struct passwd *pw)
119 found_key = 0; 119 found_key = 0;
120 120
121 found = NULL; 121 found = NULL;
@@ -123,7 +123,7 @@ index f3ca965..f78b046 100644
123 while (read_keyfile_line(f, file, line, sizeof(line), &linenum) != -1) { 123 while (read_keyfile_line(f, file, line, sizeof(line), &linenum) != -1) {
124 char *cp, *key_options = NULL; 124 char *cp, *key_options = NULL;
125 if (found != NULL) 125 if (found != NULL)
126@@ -459,6 +461,7 @@ user_cert_trusted_ca(struct passwd *pw, Key *key) 126@@ -482,6 +484,7 @@ user_cert_trusted_ca(struct passwd *pw, Key *key)
127 if (key_cert_check_authority(key, 0, 1, 127 if (key_cert_check_authority(key, 0, 1,
128 principals_file == NULL ? pw->pw_name : NULL, &reason) != 0) 128 principals_file == NULL ? pw->pw_name : NULL, &reason) != 0)
129 goto fail_reason; 129 goto fail_reason;
diff --git a/debian/patches/authorized-keys-man-symlink.patch b/debian/patches/authorized-keys-man-symlink.patch
index 6afb0420b..eb398f6a4 100644
--- a/debian/patches/authorized-keys-man-symlink.patch
+++ b/debian/patches/authorized-keys-man-symlink.patch
@@ -1,4 +1,4 @@
1From 19b0441502c07401dd6d418f8f81cc7f1a44ccb1 Mon Sep 17 00:00:00 2001 1From 8a1a563ee326222155c74454e11e6ed62297c403 Mon Sep 17 00:00:00 2001
2From: Tomas Pospisek <tpo_deb@sourcepole.ch> 2From: Tomas Pospisek <tpo_deb@sourcepole.ch>
3Date: Sun, 9 Feb 2014 16:10:07 +0000 3Date: Sun, 9 Feb 2014 16:10:07 +0000
4Subject: Install authorized_keys(5) as a symlink to sshd(8) 4Subject: Install authorized_keys(5) as a symlink to sshd(8)
@@ -13,10 +13,10 @@ Patch-Name: authorized-keys-man-symlink.patch
13 1 file changed, 1 insertion(+) 13 1 file changed, 1 insertion(+)
14 14
15diff --git a/Makefile.in b/Makefile.in 15diff --git a/Makefile.in b/Makefile.in
16index c4cb8ea..a4402e9 100644 16index c406aec..37cb023 100644
17--- a/Makefile.in 17--- a/Makefile.in
18+++ b/Makefile.in 18+++ b/Makefile.in
19@@ -309,6 +309,7 @@ install-files: 19@@ -325,6 +325,7 @@ install-files:
20 $(INSTALL) -m 644 sshd_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/sshd_config.5 20 $(INSTALL) -m 644 sshd_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/sshd_config.5
21 $(INSTALL) -m 644 ssh_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/ssh_config.5 21 $(INSTALL) -m 644 ssh_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/ssh_config.5
22 $(INSTALL) -m 644 sshd.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8 22 $(INSTALL) -m 644 sshd.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
diff --git a/debian/patches/consolekit.patch b/debian/patches/consolekit.patch
index e50c77f62..0438b8f74 100644
--- a/debian/patches/consolekit.patch
+++ b/debian/patches/consolekit.patch
@@ -1,15 +1,14 @@
1From f51fe0c55e54c12db952624e980d18f39c41e581 Mon Sep 17 00:00:00 2001 1From 8b3111d597316954caaf8ddf2e7746491976c248 Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@ubuntu.com> 2From: Colin Watson <cjwatson@ubuntu.com>
3Date: Sun, 9 Feb 2014 16:09:57 +0000 3Date: Sun, 9 Feb 2014 16:09:57 +0000
4Subject: Add support for registering ConsoleKit sessions on login 4Subject: Add support for registering ConsoleKit sessions on login
5 5
6Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1450 6Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1450
7Last-Updated: 2014-10-07 7Last-Updated: 2015-08-19
8 8
9Patch-Name: consolekit.patch 9Patch-Name: consolekit.patch
10--- 10---
11 Makefile.in | 3 +- 11 Makefile.in | 3 +-
12 configure | 132 +++++++++++++++++++++++++++++++
13 configure.ac | 25 ++++++ 12 configure.ac | 25 ++++++
14 consolekit.c | 241 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 13 consolekit.c | 241 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
15 consolekit.h | 24 ++++++ 14 consolekit.h | 24 ++++++
@@ -19,15 +18,15 @@ Patch-Name: consolekit.patch
19 monitor_wrap.h | 4 + 18 monitor_wrap.h | 4 +
20 session.c | 13 ++++ 19 session.c | 13 ++++
21 session.h | 6 ++ 20 session.h | 6 ++
22 11 files changed, 521 insertions(+), 1 deletion(-) 21 10 files changed, 389 insertions(+), 1 deletion(-)
23 create mode 100644 consolekit.c 22 create mode 100644 consolekit.c
24 create mode 100644 consolekit.h 23 create mode 100644 consolekit.h
25 24
26diff --git a/Makefile.in b/Makefile.in 25diff --git a/Makefile.in b/Makefile.in
27index 086d8dd..c4cb8ea 100644 26index 3d2a328..c406aec 100644
28--- a/Makefile.in 27--- a/Makefile.in
29+++ b/Makefile.in 28+++ b/Makefile.in
30@@ -107,7 +107,8 @@ SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \ 29@@ -111,7 +111,8 @@ SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \
31 sftp-server.o sftp-common.o \ 30 sftp-server.o sftp-common.o \
32 roaming_common.o roaming_serv.o \ 31 roaming_common.o roaming_serv.o \
33 sandbox-null.o sandbox-rlimit.o sandbox-systrace.o sandbox-darwin.o \ 32 sandbox-null.o sandbox-rlimit.o sandbox-systrace.o sandbox-darwin.o \
@@ -37,175 +36,11 @@ index 086d8dd..c4cb8ea 100644
37 36
38 MANPAGES = moduli.5.out scp.1.out ssh-add.1.out ssh-agent.1.out ssh-keygen.1.out ssh-keyscan.1.out ssh.1.out sshd.8.out sftp-server.8.out sftp.1.out ssh-keysign.8.out ssh-pkcs11-helper.8.out sshd_config.5.out ssh_config.5.out 37 MANPAGES = moduli.5.out scp.1.out ssh-add.1.out ssh-agent.1.out ssh-keygen.1.out ssh-keyscan.1.out ssh.1.out sshd.8.out sftp-server.8.out sftp.1.out ssh-keysign.8.out ssh-pkcs11-helper.8.out sshd_config.5.out ssh_config.5.out
39 MANPAGES_IN = moduli.5 scp.1 ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh-keyscan.1 ssh.1 sshd.8 sftp-server.8 sftp.1 ssh-keysign.8 ssh-pkcs11-helper.8 sshd_config.5 ssh_config.5 38 MANPAGES_IN = moduli.5 scp.1 ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh-keyscan.1 ssh.1 sshd.8 sftp-server.8 sftp.1 ssh-keysign.8 ssh-pkcs11-helper.8 sshd_config.5 ssh_config.5
40diff --git a/configure b/configure
41index ea5f200..7be478a 100755
42--- a/configure
43+++ b/configure
44@@ -739,6 +739,7 @@ with_privsep_user
45 with_sandbox
46 with_selinux
47 with_kerberos5
48+with_consolekit
49 with_privsep_path
50 with_xauth
51 enable_strip
52@@ -1430,6 +1431,7 @@ Optional Packages:
53 --with-sandbox=style Specify privilege separation sandbox (no, darwin, rlimit, systrace, seccomp_filter, capsicum)
54 --with-selinux Enable SELinux support
55 --with-kerberos5=PATH Enable Kerberos 5 support
56+ --with-consolekit Enable ConsoleKit support
57 --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)
58 --with-xauth=PATH Specify path to xauth program
59 --with-maildir=/path/to/mail Specify your system mail directory
60@@ -17211,6 +17213,135 @@ fi
61
62
63
64+# Check whether user wants ConsoleKit support
65+CONSOLEKIT_MSG="no"
66+LIBCK_CONNECTOR=""
67+
68+# Check whether --with-consolekit was given.
69+if test "${with_consolekit+set}" = set; then :
70+ withval=$with_consolekit; if test "x$withval" != "xno" ; then
71+ if test -n "$ac_tool_prefix"; then
72+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
73+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
74+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
75+$as_echo_n "checking for $ac_word... " >&6; }
76+if ${ac_cv_path_PKGCONFIG+:} false; then :
77+ $as_echo_n "(cached) " >&6
78+else
79+ case $PKGCONFIG in
80+ [\\/]* | ?:[\\/]*)
81+ ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path.
82+ ;;
83+ *)
84+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
85+for as_dir in $PATH
86+do
87+ IFS=$as_save_IFS
88+ test -z "$as_dir" && as_dir=.
89+ for ac_exec_ext in '' $ac_executable_extensions; do
90+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
91+ ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
92+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
93+ break 2
94+ fi
95+done
96+ done
97+IFS=$as_save_IFS
98+
99+ ;;
100+esac
101+fi
102+PKGCONFIG=$ac_cv_path_PKGCONFIG
103+if test -n "$PKGCONFIG"; then
104+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5
105+$as_echo "$PKGCONFIG" >&6; }
106+else
107+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
108+$as_echo "no" >&6; }
109+fi
110+
111+
112+fi
113+if test -z "$ac_cv_path_PKGCONFIG"; then
114+ ac_pt_PKGCONFIG=$PKGCONFIG
115+ # Extract the first word of "pkg-config", so it can be a program name with args.
116+set dummy pkg-config; ac_word=$2
117+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
118+$as_echo_n "checking for $ac_word... " >&6; }
119+if ${ac_cv_path_ac_pt_PKGCONFIG+:} false; then :
120+ $as_echo_n "(cached) " >&6
121+else
122+ case $ac_pt_PKGCONFIG in
123+ [\\/]* | ?:[\\/]*)
124+ ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # Let the user override the test with a path.
125+ ;;
126+ *)
127+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
128+for as_dir in $PATH
129+do
130+ IFS=$as_save_IFS
131+ test -z "$as_dir" && as_dir=.
132+ for ac_exec_ext in '' $ac_executable_extensions; do
133+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
134+ ac_cv_path_ac_pt_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
135+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
136+ break 2
137+ fi
138+done
139+ done
140+IFS=$as_save_IFS
141+
142+ ;;
143+esac
144+fi
145+ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG
146+if test -n "$ac_pt_PKGCONFIG"; then
147+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5
148+$as_echo "$ac_pt_PKGCONFIG" >&6; }
149+else
150+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
151+$as_echo "no" >&6; }
152+fi
153+
154+ if test "x$ac_pt_PKGCONFIG" = x; then
155+ PKGCONFIG="no"
156+ else
157+ case $cross_compiling:$ac_tool_warned in
158+yes:)
159+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
160+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
161+ac_tool_warned=yes ;;
162+esac
163+ PKGCONFIG=$ac_pt_PKGCONFIG
164+ fi
165+else
166+ PKGCONFIG="$ac_cv_path_PKGCONFIG"
167+fi
168+
169+ if test "$PKGCONFIG" != "no"; then
170+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ck-connector" >&5
171+$as_echo_n "checking for ck-connector... " >&6; }
172+ if $PKGCONFIG --exists ck-connector; then
173+ CKCON_CFLAGS=`$PKGCONFIG --cflags ck-connector`
174+ CKCON_LIBS=`$PKGCONFIG --libs ck-connector`
175+ CPPFLAGS="$CPPFLAGS $CKCON_CFLAGS"
176+ SSHDLIBS="$SSHDLIBS $CKCON_LIBS"
177+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
178+$as_echo "yes" >&6; }
179+
180+$as_echo "#define USE_CONSOLEKIT 1" >>confdefs.h
181+
182+ CONSOLEKIT_MSG="yes"
183+ else
184+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
185+$as_echo "no" >&6; }
186+ fi
187+ fi
188+ fi
189+
190+fi
191+
192+
193 # Looking for programs, paths and files
194
195 PRIVSEP_PATH=/var/empty
196@@ -19739,6 +19870,7 @@ echo " MD5 password support: $MD5_MSG"
197 echo " libedit support: $LIBEDIT_MSG"
198 echo " Solaris process contract support: $SPC_MSG"
199 echo " Solaris project support: $SP_MSG"
200+echo " ConsoleKit support: $CONSOLEKIT_MSG"
201 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
202 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
203 echo " BSD Auth support: $BSD_AUTH_MSG"
204diff --git a/configure.ac b/configure.ac 39diff --git a/configure.ac b/configure.ac
205index 7f160f1..f5c65c5 100644 40index 5f606ea..f7ce777 100644
206--- a/configure.ac 41--- a/configure.ac
207+++ b/configure.ac 42+++ b/configure.ac
208@@ -4113,6 +4113,30 @@ AC_ARG_WITH([kerberos5], 43@@ -4180,6 +4180,30 @@ AC_ARG_WITH([kerberos5],
209 AC_SUBST([GSSLIBS]) 44 AC_SUBST([GSSLIBS])
210 AC_SUBST([K5LIBS]) 45 AC_SUBST([K5LIBS])
211 46
@@ -236,7 +71,7 @@ index 7f160f1..f5c65c5 100644
236 # Looking for programs, paths and files 71 # Looking for programs, paths and files
237 72
238 PRIVSEP_PATH=/var/empty 73 PRIVSEP_PATH=/var/empty
239@@ -4914,6 +4938,7 @@ echo " MD5 password support: $MD5_MSG" 74@@ -4981,6 +5005,7 @@ echo " MD5 password support: $MD5_MSG"
240 echo " libedit support: $LIBEDIT_MSG" 75 echo " libedit support: $LIBEDIT_MSG"
241 echo " Solaris process contract support: $SPC_MSG" 76 echo " Solaris process contract support: $SPC_MSG"
242 echo " Solaris project support: $SP_MSG" 77 echo " Solaris project support: $SP_MSG"
@@ -522,20 +357,20 @@ index 0000000..8ce3716
522+ 357+
523+#endif /* USE_CONSOLEKIT */ 358+#endif /* USE_CONSOLEKIT */
524diff --git a/monitor.c b/monitor.c 359diff --git a/monitor.c b/monitor.c
525index 94b194d..cc15ce4 100644 360index 6ff05e4..ce7ba07 100644
526--- a/monitor.c 361--- a/monitor.c
527+++ b/monitor.c 362+++ b/monitor.c
528@@ -100,6 +100,9 @@ 363@@ -104,6 +104,9 @@
529 #include "ssh2.h"
530 #include "roaming.h"
531 #include "authfd.h" 364 #include "authfd.h"
365 #include "match.h"
366 #include "ssherr.h"
532+#ifdef USE_CONSOLEKIT 367+#ifdef USE_CONSOLEKIT
533+#include "consolekit.h" 368+#include "consolekit.h"
534+#endif 369+#endif
535 370
536 #ifdef GSSAPI 371 #ifdef GSSAPI
537 static Gssctxt *gsscontext = NULL; 372 static Gssctxt *gsscontext = NULL;
538@@ -190,6 +193,10 @@ int mm_answer_audit_command(int, Buffer *); 373@@ -169,6 +172,10 @@ int mm_answer_audit_command(int, Buffer *);
539 374
540 static int monitor_read_log(struct monitor *); 375 static int monitor_read_log(struct monitor *);
541 376
@@ -546,7 +381,7 @@ index 94b194d..cc15ce4 100644
546 static Authctxt *authctxt; 381 static Authctxt *authctxt;
547 382
548 #ifdef WITH_SSH1 383 #ifdef WITH_SSH1
549@@ -282,6 +289,9 @@ struct mon_table mon_dispatch_postauth20[] = { 384@@ -261,6 +268,9 @@ struct mon_table mon_dispatch_postauth20[] = {
550 {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event}, 385 {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event},
551 {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT, mm_answer_audit_command}, 386 {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT, mm_answer_audit_command},
552 #endif 387 #endif
@@ -556,7 +391,7 @@ index 94b194d..cc15ce4 100644
556 {0, 0, NULL} 391 {0, 0, NULL}
557 }; 392 };
558 393
559@@ -327,6 +337,9 @@ struct mon_table mon_dispatch_postauth15[] = { 394@@ -306,6 +316,9 @@ struct mon_table mon_dispatch_postauth15[] = {
560 {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event}, 395 {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event},
561 {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT|MON_ONCE, mm_answer_audit_command}, 396 {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT|MON_ONCE, mm_answer_audit_command},
562 #endif 397 #endif
@@ -566,7 +401,7 @@ index 94b194d..cc15ce4 100644
566 #endif /* WITH_SSH1 */ 401 #endif /* WITH_SSH1 */
567 {0, 0, NULL} 402 {0, 0, NULL}
568 }; 403 };
569@@ -509,6 +522,9 @@ monitor_child_postauth(struct monitor *pmonitor) 404@@ -488,6 +501,9 @@ monitor_child_postauth(struct monitor *pmonitor)
570 monitor_permit(mon_dispatch, MONITOR_REQ_PTY, 1); 405 monitor_permit(mon_dispatch, MONITOR_REQ_PTY, 1);
571 monitor_permit(mon_dispatch, MONITOR_REQ_PTYCLEANUP, 1); 406 monitor_permit(mon_dispatch, MONITOR_REQ_PTYCLEANUP, 1);
572 } 407 }
@@ -576,7 +411,7 @@ index 94b194d..cc15ce4 100644
576 411
577 for (;;) 412 for (;;)
578 monitor_read(pmonitor, mon_dispatch, NULL); 413 monitor_read(pmonitor, mon_dispatch, NULL);
579@@ -2296,3 +2312,29 @@ mm_answer_gss_updatecreds(int socket, Buffer *m) { 414@@ -2187,3 +2203,29 @@ mm_answer_gss_updatecreds(int socket, Buffer *m) {
580 415
581 #endif /* GSSAPI */ 416 #endif /* GSSAPI */
582 417
@@ -607,7 +442,7 @@ index 94b194d..cc15ce4 100644
607+} 442+}
608+#endif /* USE_CONSOLEKIT */ 443+#endif /* USE_CONSOLEKIT */
609diff --git a/monitor.h b/monitor.h 444diff --git a/monitor.h b/monitor.h
610index 4d5e8fa..10ba59e 100644 445index 2d82b8b..fd8d92c 100644
611--- a/monitor.h 446--- a/monitor.h
612+++ b/monitor.h 447+++ b/monitor.h
613@@ -70,6 +70,8 @@ enum monitor_reqtype { 448@@ -70,6 +70,8 @@ enum monitor_reqtype {
@@ -620,10 +455,10 @@ index 4d5e8fa..10ba59e 100644
620 455
621 struct mm_master; 456 struct mm_master;
622diff --git a/monitor_wrap.c b/monitor_wrap.c 457diff --git a/monitor_wrap.c b/monitor_wrap.c
623index 6dc890a..4c57d4d 100644 458index 5aa9c47..a5f4e9d 100644
624--- a/monitor_wrap.c 459--- a/monitor_wrap.c
625+++ b/monitor_wrap.c 460+++ b/monitor_wrap.c
626@@ -1363,3 +1363,33 @@ mm_ssh_gssapi_update_creds(ssh_gssapi_ccache *store) 461@@ -1150,3 +1150,33 @@ mm_ssh_gssapi_update_creds(ssh_gssapi_ccache *store)
627 462
628 #endif /* GSSAPI */ 463 #endif /* GSSAPI */
629 464
@@ -658,11 +493,11 @@ index 6dc890a..4c57d4d 100644
658+} 493+}
659+#endif /* USE_CONSOLEKIT */ 494+#endif /* USE_CONSOLEKIT */
660diff --git a/monitor_wrap.h b/monitor_wrap.h 495diff --git a/monitor_wrap.h b/monitor_wrap.h
661index 9c2ee49..00e93fe 100644 496index 4d1e899..f99c31c 100644
662--- a/monitor_wrap.h 497--- a/monitor_wrap.h
663+++ b/monitor_wrap.h 498+++ b/monitor_wrap.h
664@@ -111,4 +111,8 @@ void *mm_zalloc(struct mm_master *, u_int, u_int); 499@@ -108,4 +108,8 @@ int mm_skey_respond(void *, u_int, char **);
665 void mm_zfree(struct mm_master *, void *); 500 /* zlib allocation hooks */
666 void mm_init_compression(struct mm_master *); 501 void mm_init_compression(struct mm_master *);
667 502
668+#ifdef USE_CONSOLEKIT 503+#ifdef USE_CONSOLEKIT
@@ -671,10 +506,10 @@ index 9c2ee49..00e93fe 100644
671+ 506+
672 #endif /* _MM_WRAP_H_ */ 507 #endif /* _MM_WRAP_H_ */
673diff --git a/session.c b/session.c 508diff --git a/session.c b/session.c
674index 6f389ac..6250c20 100644 509index d4b7725..785833f 100644
675--- a/session.c 510--- a/session.c
676+++ b/session.c 511+++ b/session.c
677@@ -93,6 +93,7 @@ 512@@ -94,6 +94,7 @@
678 #include "kex.h" 513 #include "kex.h"
679 #include "monitor_wrap.h" 514 #include "monitor_wrap.h"
680 #include "sftp.h" 515 #include "sftp.h"
@@ -682,7 +517,7 @@ index 6f389ac..6250c20 100644
682 517
683 #if defined(KRB5) && defined(USE_AFS) 518 #if defined(KRB5) && defined(USE_AFS)
684 #include <kafs.h> 519 #include <kafs.h>
685@@ -1143,6 +1144,9 @@ do_setup_env(Session *s, const char *shell) 520@@ -1144,6 +1145,9 @@ do_setup_env(Session *s, const char *shell)
686 #if !defined (HAVE_LOGIN_CAP) && !defined (HAVE_CYGWIN) 521 #if !defined (HAVE_LOGIN_CAP) && !defined (HAVE_CYGWIN)
687 char *path = NULL; 522 char *path = NULL;
688 #endif 523 #endif
@@ -692,7 +527,7 @@ index 6f389ac..6250c20 100644
692 527
693 /* Initialize the environment. */ 528 /* Initialize the environment. */
694 envsize = 100; 529 envsize = 100;
695@@ -1287,6 +1291,11 @@ do_setup_env(Session *s, const char *shell) 530@@ -1288,6 +1292,11 @@ do_setup_env(Session *s, const char *shell)
696 child_set_env(&env, &envsize, "KRB5CCNAME", 531 child_set_env(&env, &envsize, "KRB5CCNAME",
697 s->authctxt->krb5_ccname); 532 s->authctxt->krb5_ccname);
698 #endif 533 #endif
@@ -704,7 +539,7 @@ index 6f389ac..6250c20 100644
704 #ifdef USE_PAM 539 #ifdef USE_PAM
705 /* 540 /*
706 * Pull in any environment variables that may have 541 * Pull in any environment variables that may have
707@@ -2350,6 +2359,10 @@ session_pty_cleanup2(Session *s) 542@@ -2351,6 +2360,10 @@ session_pty_cleanup2(Session *s)
708 543
709 debug("session_pty_cleanup: session %d release %s", s->self, s->tty); 544 debug("session_pty_cleanup: session %d release %s", s->self, s->tty);
710 545
diff --git a/debian/patches/debian-banner.patch b/debian/patches/debian-banner.patch
index ab64cbed5..5bc70a566 100644
--- a/debian/patches/debian-banner.patch
+++ b/debian/patches/debian-banner.patch
@@ -1,4 +1,4 @@
1From 114c8a8fb488cbe39507edb75c51198a4b9e8b24 Mon Sep 17 00:00:00 2001 1From 2c31a85436f1eac46e185382c2aa15406ae6c0ac Mon Sep 17 00:00:00 2001
2From: Kees Cook <kees@debian.org> 2From: Kees Cook <kees@debian.org>
3Date: Sun, 9 Feb 2014 16:10:06 +0000 3Date: Sun, 9 Feb 2014 16:10:06 +0000
4Subject: Add DebianBanner server configuration option 4Subject: Add DebianBanner server configuration option
@@ -8,7 +8,7 @@ initial protocol handshake, for those scared by package-versioning.patch.
8 8
9Bug-Debian: http://bugs.debian.org/562048 9Bug-Debian: http://bugs.debian.org/562048
10Forwarded: not-needed 10Forwarded: not-needed
11Last-Update: 2014-10-07 11Last-Update: 2015-08-19
12 12
13Patch-Name: debian-banner.patch 13Patch-Name: debian-banner.patch
14--- 14---
@@ -19,45 +19,45 @@ Patch-Name: debian-banner.patch
19 4 files changed, 18 insertions(+), 1 deletion(-) 19 4 files changed, 18 insertions(+), 1 deletion(-)
20 20
21diff --git a/servconf.c b/servconf.c 21diff --git a/servconf.c b/servconf.c
22index a252487..6c7741a 100644 22index b3a2841..bec53e0 100644
23--- a/servconf.c 23--- a/servconf.c
24+++ b/servconf.c 24+++ b/servconf.c
25@@ -160,6 +160,7 @@ initialize_server_options(ServerOptions *options) 25@@ -166,6 +166,7 @@ initialize_server_options(ServerOptions *options)
26 options->ip_qos_interactive = -1;
27 options->ip_qos_bulk = -1; 26 options->ip_qos_bulk = -1;
28 options->version_addendum = NULL; 27 options->version_addendum = NULL;
28 options->fingerprint_hash = -1;
29+ options->debian_banner = -1; 29+ options->debian_banner = -1;
30 } 30 }
31 31
32 void 32 /* Returns 1 if a string option is unset or set to "none" or 0 otherwise. */
33@@ -321,6 +322,8 @@ fill_default_server_options(ServerOptions *options) 33@@ -342,6 +343,8 @@ fill_default_server_options(ServerOptions *options)
34 options->fwd_opts.streamlocal_bind_mask = 0177;
35 if (options->fwd_opts.streamlocal_bind_unlink == -1)
36 options->fwd_opts.streamlocal_bind_unlink = 0; 34 options->fwd_opts.streamlocal_bind_unlink = 0;
35 if (options->fingerprint_hash == -1)
36 options->fingerprint_hash = SSH_FP_HASH_DEFAULT;
37+ if (options->debian_banner == -1) 37+ if (options->debian_banner == -1)
38+ options->debian_banner = 1; 38+ options->debian_banner = 1;
39 /* Turn privilege separation on by default */ 39 /* Turn privilege separation on by default */
40 if (use_privsep == -1) 40 if (use_privsep == -1)
41 use_privsep = PRIVSEP_NOSANDBOX; 41 use_privsep = PRIVSEP_NOSANDBOX;
42@@ -373,6 +376,7 @@ typedef enum { 42@@ -412,6 +415,7 @@ typedef enum {
43 sAuthenticationMethods, sHostKeyAgent, sPermitUserRC, 43 sAuthenticationMethods, sHostKeyAgent, sPermitUserRC,
44 sStreamLocalBindMask, sStreamLocalBindUnlink, 44 sStreamLocalBindMask, sStreamLocalBindUnlink,
45 sAllowStreamLocalForwarding, 45 sAllowStreamLocalForwarding, sFingerprintHash,
46+ sDebianBanner, 46+ sDebianBanner,
47 sDeprecated, sUnsupported 47 sDeprecated, sUnsupported
48 } ServerOpCodes; 48 } ServerOpCodes;
49 49
50@@ -514,6 +518,7 @@ static struct { 50@@ -556,6 +560,7 @@ static struct {
51 { "streamlocalbindmask", sStreamLocalBindMask, SSHCFG_ALL },
52 { "streamlocalbindunlink", sStreamLocalBindUnlink, SSHCFG_ALL }, 51 { "streamlocalbindunlink", sStreamLocalBindUnlink, SSHCFG_ALL },
53 { "allowstreamlocalforwarding", sAllowStreamLocalForwarding, SSHCFG_ALL }, 52 { "allowstreamlocalforwarding", sAllowStreamLocalForwarding, SSHCFG_ALL },
53 { "fingerprinthash", sFingerprintHash, SSHCFG_GLOBAL },
54+ { "debianbanner", sDebianBanner, SSHCFG_GLOBAL }, 54+ { "debianbanner", sDebianBanner, SSHCFG_GLOBAL },
55 { NULL, sBadOption, 0 } 55 { NULL, sBadOption, 0 }
56 }; 56 };
57 57
58@@ -1697,6 +1702,10 @@ process_server_config_line(ServerOptions *options, char *line, 58@@ -1777,6 +1782,10 @@ process_server_config_line(ServerOptions *options, char *line,
59 intptr = &options->fwd_opts.streamlocal_bind_unlink; 59 options->fingerprint_hash = value;
60 goto parse_flag; 60 break;
61 61
62+ case sDebianBanner: 62+ case sDebianBanner:
63+ intptr = &options->debian_banner; 63+ intptr = &options->debian_banner;
@@ -67,23 +67,23 @@ index a252487..6c7741a 100644
67 logit("%s line %d: Deprecated option %s", 67 logit("%s line %d: Deprecated option %s",
68 filename, linenum, arg); 68 filename, linenum, arg);
69diff --git a/servconf.h b/servconf.h 69diff --git a/servconf.h b/servconf.h
70index f8265a8..fa48804 100644 70index d2ed4d7..ed0f171 100644
71--- a/servconf.h 71--- a/servconf.h
72+++ b/servconf.h 72+++ b/servconf.h
73@@ -188,6 +188,8 @@ typedef struct { 73@@ -192,6 +192,8 @@ typedef struct {
74
75 u_int num_auth_methods;
76 char *auth_methods[MAX_AUTH_METHODS]; 74 char *auth_methods[MAX_AUTH_METHODS];
75
76 int fingerprint_hash;
77+ 77+
78+ int debian_banner; 78+ int debian_banner;
79 } ServerOptions; 79 } ServerOptions;
80 80
81 /* Information about the incoming connection as used by Match */ 81 /* Information about the incoming connection as used by Match */
82diff --git a/sshd.c b/sshd.c 82diff --git a/sshd.c b/sshd.c
83index 1710e71..87331c1 100644 83index c362209..5435968 100644
84--- a/sshd.c 84--- a/sshd.c
85+++ b/sshd.c 85+++ b/sshd.c
86@@ -443,7 +443,8 @@ sshd_exchange_identification(int sock_in, int sock_out) 86@@ -442,7 +442,8 @@ sshd_exchange_identification(int sock_in, int sock_out)
87 } 87 }
88 88
89 xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s%s", 89 xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s%s",
@@ -94,10 +94,10 @@ index 1710e71..87331c1 100644
94 options.version_addendum, newline); 94 options.version_addendum, newline);
95 95
96diff --git a/sshd_config.5 b/sshd_config.5 96diff --git a/sshd_config.5 b/sshd_config.5
97index 2843048..58997d3 100644 97index d14576e..ec58635 100644
98--- a/sshd_config.5 98--- a/sshd_config.5
99+++ b/sshd_config.5 99+++ b/sshd_config.5
100@@ -447,6 +447,11 @@ or 100@@ -476,6 +476,11 @@ or
101 .Dq no . 101 .Dq no .
102 The default is 102 The default is
103 .Dq delayed . 103 .Dq delayed .
diff --git a/debian/patches/debian-config.patch b/debian/patches/debian-config.patch
index f995717fa..a346ba678 100644
--- a/debian/patches/debian-config.patch
+++ b/debian/patches/debian-config.patch
@@ -1,4 +1,4 @@
1From 581424965d2d722a991c3247d4c0bb5950cb4fc5 Mon Sep 17 00:00:00 2001 1From 8698446b972003b63dfe5dcbdb86acfe986afb85 Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@debian.org> 2From: Colin Watson <cjwatson@debian.org>
3Date: Sun, 9 Feb 2014 16:10:18 +0000 3Date: Sun, 9 Feb 2014 16:10:18 +0000
4Subject: Various Debian-specific configuration changes 4Subject: Various Debian-specific configuration changes
@@ -22,7 +22,7 @@ debian/openssh-server.postinst.
22 22
23Author: Russ Allbery <rra@debian.org> 23Author: Russ Allbery <rra@debian.org>
24Forwarded: not-needed 24Forwarded: not-needed
25Last-Update: 2015-03-22 25Last-Update: 2015-08-19
26 26
27Patch-Name: debian-config.patch 27Patch-Name: debian-config.patch
28--- 28---
@@ -34,10 +34,10 @@ Patch-Name: debian-config.patch
34 5 files changed, 51 insertions(+), 3 deletions(-) 34 5 files changed, 51 insertions(+), 3 deletions(-)
35 35
36diff --git a/readconf.c b/readconf.c 36diff --git a/readconf.c b/readconf.c
37index 0648867..29338b6 100644 37index 2ef8d7b..66a62f2 100644
38--- a/readconf.c 38--- a/readconf.c
39+++ b/readconf.c 39+++ b/readconf.c
40@@ -1681,7 +1681,7 @@ fill_default_options(Options * options) 40@@ -1748,7 +1748,7 @@ fill_default_options(Options * options)
41 if (options->forward_x11 == -1) 41 if (options->forward_x11 == -1)
42 options->forward_x11 = 0; 42 options->forward_x11 = 0;
43 if (options->forward_x11_trusted == -1) 43 if (options->forward_x11_trusted == -1)
@@ -71,10 +71,10 @@ index 228e5ab..c9386aa 100644
71+ GSSAPIAuthentication yes 71+ GSSAPIAuthentication yes
72+ GSSAPIDelegateCredentials no 72+ GSSAPIDelegateCredentials no
73diff --git a/ssh_config.5 b/ssh_config.5 73diff --git a/ssh_config.5 b/ssh_config.5
74index a1005ba..da3c177 100644 74index 3bd80fd..da8e544 100644
75--- a/ssh_config.5 75--- a/ssh_config.5
76+++ b/ssh_config.5 76+++ b/ssh_config.5
77@@ -71,6 +71,22 @@ Since the first obtained value for each parameter is used, more 77@@ -74,6 +74,22 @@ Since the first obtained value for each parameter is used, more
78 host-specific declarations should be given near the beginning of the 78 host-specific declarations should be given near the beginning of the
79 file, and general defaults at the end. 79 file, and general defaults at the end.
80 .Pp 80 .Pp
@@ -97,7 +97,7 @@ index a1005ba..da3c177 100644
97 The configuration file has the following format: 97 The configuration file has the following format:
98 .Pp 98 .Pp
99 Empty lines and lines starting with 99 Empty lines and lines starting with
100@@ -673,7 +689,8 @@ token used for the session will be set to expire after 20 minutes. 100@@ -715,7 +731,8 @@ token used for the session will be set to expire after 20 minutes.
101 Remote clients will be refused access after this time. 101 Remote clients will be refused access after this time.
102 .Pp 102 .Pp
103 The default is 103 The default is
@@ -108,7 +108,7 @@ index a1005ba..da3c177 100644
108 See the X11 SECURITY extension specification for full details on 108 See the X11 SECURITY extension specification for full details on
109 the restrictions imposed on untrusted clients. 109 the restrictions imposed on untrusted clients.
110diff --git a/sshd_config b/sshd_config 110diff --git a/sshd_config b/sshd_config
111index d9b8594..4db32f5 100644 111index a71ad19..3391233 100644
112--- a/sshd_config 112--- a/sshd_config
113+++ b/sshd_config 113+++ b/sshd_config
114@@ -41,6 +41,7 @@ 114@@ -41,6 +41,7 @@
@@ -120,7 +120,7 @@ index d9b8594..4db32f5 100644
120 #StrictModes yes 120 #StrictModes yes
121 #MaxAuthTries 6 121 #MaxAuthTries 6
122diff --git a/sshd_config.5 b/sshd_config.5 122diff --git a/sshd_config.5 b/sshd_config.5
123index 7396b23..7aa7b47 100644 123index 453d741..db1f2fd 100644
124--- a/sshd_config.5 124--- a/sshd_config.5
125+++ b/sshd_config.5 125+++ b/sshd_config.5
126@@ -57,6 +57,31 @@ Arguments may optionally be enclosed in double quotes 126@@ -57,6 +57,31 @@ Arguments may optionally be enclosed in double quotes
diff --git a/debian/patches/dnssec-sshfp.patch b/debian/patches/dnssec-sshfp.patch
index 0212ea841..97fe79aef 100644
--- a/debian/patches/dnssec-sshfp.patch
+++ b/debian/patches/dnssec-sshfp.patch
@@ -1,4 +1,4 @@
1From 4ac9937c1d9f1901ab0694114d76e59a138aae96 Mon Sep 17 00:00:00 2001 1From 5cbcc7353649b84b5a7528e583458ee9473fd527 Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@debian.org> 2From: Colin Watson <cjwatson@debian.org>
3Date: Sun, 9 Feb 2014 16:10:01 +0000 3Date: Sun, 9 Feb 2014 16:10:01 +0000
4Subject: Force use of DNSSEC even if "options edns0" isn't in resolv.conf 4Subject: Force use of DNSSEC even if "options edns0" isn't in resolv.conf
@@ -18,10 +18,10 @@ Patch-Name: dnssec-sshfp.patch
18 3 files changed, 21 insertions(+), 6 deletions(-) 18 3 files changed, 21 insertions(+), 6 deletions(-)
19 19
20diff --git a/dns.c b/dns.c 20diff --git a/dns.c b/dns.c
21index c4d073c..e5872c1 100644 21index f201b60..a406f58 100644
22--- a/dns.c 22--- a/dns.c
23+++ b/dns.c 23+++ b/dns.c
24@@ -203,6 +203,7 @@ verify_host_key_dns(const char *hostname, struct sockaddr *address, 24@@ -206,6 +206,7 @@ verify_host_key_dns(const char *hostname, struct sockaddr *address,
25 { 25 {
26 u_int counter; 26 u_int counter;
27 int result; 27 int result;
@@ -29,7 +29,7 @@ index c4d073c..e5872c1 100644
29 struct rrsetinfo *fingerprints = NULL; 29 struct rrsetinfo *fingerprints = NULL;
30 30
31 u_int8_t hostkey_algorithm; 31 u_int8_t hostkey_algorithm;
32@@ -226,8 +227,19 @@ verify_host_key_dns(const char *hostname, struct sockaddr *address, 32@@ -229,8 +230,19 @@ verify_host_key_dns(const char *hostname, struct sockaddr *address,
33 return -1; 33 return -1;
34 } 34 }
35 35
diff --git a/debian/patches/doc-hash-tab-completion.patch b/debian/patches/doc-hash-tab-completion.patch
index 8e6cfa575..35d589353 100644
--- a/debian/patches/doc-hash-tab-completion.patch
+++ b/debian/patches/doc-hash-tab-completion.patch
@@ -1,4 +1,4 @@
1From 2fd0b3814e27d584efa6df92845a7354e7c2de6c Mon Sep 17 00:00:00 2001 1From b0146d5a8c1b9d87f4255cbee40b31c938fea2f8 Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@debian.org> 2From: Colin Watson <cjwatson@debian.org>
3Date: Sun, 9 Feb 2014 16:10:11 +0000 3Date: Sun, 9 Feb 2014 16:10:11 +0000
4Subject: Document that HashKnownHosts may break tab-completion 4Subject: Document that HashKnownHosts may break tab-completion
@@ -13,10 +13,10 @@ Patch-Name: doc-hash-tab-completion.patch
13 1 file changed, 3 insertions(+) 13 1 file changed, 3 insertions(+)
14 14
15diff --git a/ssh_config.5 b/ssh_config.5 15diff --git a/ssh_config.5 b/ssh_config.5
16index d68b45a..a1005ba 100644 16index 8abcf40..3bd80fd 100644
17--- a/ssh_config.5 17--- a/ssh_config.5
18+++ b/ssh_config.5 18+++ b/ssh_config.5
19@@ -759,6 +759,9 @@ Note that existing names and addresses in known hosts files 19@@ -801,6 +801,9 @@ Note that existing names and addresses in known hosts files
20 will not be converted automatically, 20 will not be converted automatically,
21 but may be manually hashed using 21 but may be manually hashed using
22 .Xr ssh-keygen 1 . 22 .Xr ssh-keygen 1 .
diff --git a/debian/patches/doc-upstart.patch b/debian/patches/doc-upstart.patch
index c1ce1bcae..8002929ab 100644
--- a/debian/patches/doc-upstart.patch
+++ b/debian/patches/doc-upstart.patch
@@ -1,4 +1,4 @@
1From 252e76b3ad6e83a798e479a2beba5be7000ff85e Mon Sep 17 00:00:00 2001 1From c679bacbff13edaa44255c4f4c32ef5bc0f4ccbc Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@ubuntu.com> 2From: Colin Watson <cjwatson@ubuntu.com>
3Date: Sun, 9 Feb 2014 16:10:12 +0000 3Date: Sun, 9 Feb 2014 16:10:12 +0000
4Subject: Refer to ssh's Upstart job as well as its init script 4Subject: Refer to ssh's Upstart job as well as its init script
@@ -12,7 +12,7 @@ Patch-Name: doc-upstart.patch
12 1 file changed, 4 insertions(+), 1 deletion(-) 12 1 file changed, 4 insertions(+), 1 deletion(-)
13 13
14diff --git a/sshd.8 b/sshd.8 14diff --git a/sshd.8 b/sshd.8
15index 3538208..f8f9eac 100644 15index 8dba6cf..e198017 100644
16--- a/sshd.8 16--- a/sshd.8
17+++ b/sshd.8 17+++ b/sshd.8
18@@ -67,7 +67,10 @@ over an insecure network. 18@@ -67,7 +67,10 @@ over an insecure network.
diff --git a/debian/patches/gnome-ssh-askpass2-icon.patch b/debian/patches/gnome-ssh-askpass2-icon.patch
index 84fe03acc..79efb8971 100644
--- a/debian/patches/gnome-ssh-askpass2-icon.patch
+++ b/debian/patches/gnome-ssh-askpass2-icon.patch
@@ -1,4 +1,4 @@
1From 1195b028cb9f402633cfdcae6ec34bf63b4ab771 Mon Sep 17 00:00:00 2001 1From 02662744e60e6bbe532ff22c7f563026a7424b6c Mon Sep 17 00:00:00 2001
2From: Vincent Untz <vuntz@ubuntu.com> 2From: Vincent Untz <vuntz@ubuntu.com>
3Date: Sun, 9 Feb 2014 16:10:16 +0000 3Date: Sun, 9 Feb 2014 16:10:16 +0000
4Subject: Give the ssh-askpass-gnome window a default icon 4Subject: Give the ssh-askpass-gnome window a default icon
diff --git a/debian/patches/gssapi.patch b/debian/patches/gssapi.patch
index e8cbc1083..b3c437194 100644
--- a/debian/patches/gssapi.patch
+++ b/debian/patches/gssapi.patch
@@ -1,4 +1,4 @@
1From 1c1b6fa17982eb622e2c4e8f4a279f2113f57413 Mon Sep 17 00:00:00 2001 1From 06879e71614170580ffa7568ec5c009f60a9d084 Mon Sep 17 00:00:00 2001
2From: Simon Wilkinson <simon@sxw.org.uk> 2From: Simon Wilkinson <simon@sxw.org.uk>
3Date: Sun, 9 Feb 2014 16:09:48 +0000 3Date: Sun, 9 Feb 2014 16:09:48 +0000
4Subject: GSSAPI key exchange support 4Subject: GSSAPI key exchange support
@@ -17,26 +17,25 @@ have it merged into the main openssh package rather than having separate
17security history. 17security history.
18 18
19Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1242 19Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1242
20Last-Updated: 2014-10-07 20Last-Updated: 2015-08-19
21 21
22Patch-Name: gssapi.patch 22Patch-Name: gssapi.patch
23--- 23---
24 ChangeLog.gssapi | 113 +++++++++++++++++++ 24 ChangeLog.gssapi | 113 +++++++++++++++++++
25 Makefile.in | 3 +- 25 Makefile.in | 5 +-
26 auth-krb5.c | 17 ++- 26 auth-krb5.c | 17 ++-
27 auth2-gss.c | 48 +++++++- 27 auth2-gss.c | 48 +++++++-
28 auth2.c | 2 + 28 auth2.c | 2 +
29 clientloop.c | 13 +++ 29 clientloop.c | 13 +++
30 config.h.in | 6 + 30 config.h.in | 6 +
31 configure | 57 ++++++++++
32 configure.ac | 24 ++++ 31 configure.ac | 24 ++++
33 gss-genr.c | 275 ++++++++++++++++++++++++++++++++++++++++++++- 32 gss-genr.c | 275 ++++++++++++++++++++++++++++++++++++++++++++-
34 gss-serv-krb5.c | 85 ++++++++++++-- 33 gss-serv-krb5.c | 85 ++++++++++++--
35 gss-serv.c | 221 +++++++++++++++++++++++++++++++----- 34 gss-serv.c | 221 +++++++++++++++++++++++++++++++-----
36 kex.c | 16 +++ 35 kex.c | 16 +++
37 kex.h | 14 +++ 36 kex.h | 14 +++
38 kexgssc.c | 332 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 37 kexgssc.c | 336 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
39 kexgsss.c | 290 ++++++++++++++++++++++++++++++++++++++++++++++++ 38 kexgsss.c | 295 ++++++++++++++++++++++++++++++++++++++++++++++++
40 monitor.c | 108 +++++++++++++++++- 39 monitor.c | 108 +++++++++++++++++-
41 monitor.h | 3 + 40 monitor.h | 3 +
42 monitor_wrap.c | 47 +++++++- 41 monitor_wrap.c | 47 +++++++-
@@ -48,13 +47,13 @@ Patch-Name: gssapi.patch
48 ssh-gss.h | 41 ++++++- 47 ssh-gss.h | 41 ++++++-
49 ssh_config | 2 + 48 ssh_config | 2 +
50 ssh_config.5 | 34 +++++- 49 ssh_config.5 | 34 +++++-
51 sshconnect2.c | 124 ++++++++++++++++++++- 50 sshconnect2.c | 124 +++++++++++++++++++-
52 sshd.c | 110 ++++++++++++++++++ 51 sshd.c | 110 ++++++++++++++++++
53 sshd_config | 2 + 52 sshd_config | 2 +
54 sshd_config.5 | 28 +++++ 53 sshd_config.5 | 28 +++++
55 sshkey.c | 3 +- 54 sshkey.c | 3 +-
56 sshkey.h | 1 + 55 sshkey.h | 1 +
57 33 files changed, 2052 insertions(+), 59 deletions(-) 56 32 files changed, 2005 insertions(+), 60 deletions(-)
58 create mode 100644 ChangeLog.gssapi 57 create mode 100644 ChangeLog.gssapi
59 create mode 100644 kexgssc.c 58 create mode 100644 kexgssc.c
60 create mode 100644 kexgsss.c 59 create mode 100644 kexgsss.c
@@ -179,21 +178,23 @@ index 0000000..f117a33
179+ (from jbasney AT ncsa.uiuc.edu) 178+ (from jbasney AT ncsa.uiuc.edu)
180+ <gssapi-with-mic support is Bugzilla #1008> 179+ <gssapi-with-mic support is Bugzilla #1008>
181diff --git a/Makefile.in b/Makefile.in 180diff --git a/Makefile.in b/Makefile.in
182index 06be3d5..086d8dd 100644 181index 40cc7aa..3d2a328 100644
183--- a/Makefile.in 182--- a/Makefile.in
184+++ b/Makefile.in 183+++ b/Makefile.in
185@@ -82,6 +82,7 @@ LIBSSH_OBJS=${LIBOPENSSH_OBJS} \ 184@@ -91,7 +91,8 @@ LIBSSH_OBJS=${LIBOPENSSH_OBJS} \
186 atomicio.o key.o dispatch.o kex.o mac.o uidswap.o uuencode.o misc.o \ 185 sc25519.o ge25519.o fe25519.o ed25519.o verify.o hash.o blocks.o \
187 monitor_fdpass.o rijndael.o ssh-dss.o ssh-ecdsa.o ssh-rsa.o dh.o \ 186 kex.o kexdh.o kexgex.o kexecdh.o kexc25519.o \
188 kexdh.o kexgex.o kexdhc.o kexgexc.o bufec.o kexecdh.o kexecdhc.o \ 187 kexdhc.o kexgexc.o kexecdhc.o kexc25519c.o \
189+ kexgssc.o \ 188- kexdhs.o kexgexs.o kexecdhs.o kexc25519s.o
190 msg.o progressmeter.o dns.o entropy.o gss-genr.o umac.o umac128.o \ 189+ kexdhs.o kexgexs.o kexecdhs.o kexc25519s.o \
191 ssh-pkcs11.o krl.o smult_curve25519_ref.o \ 190+ kexgssc.o
192 kexc25519.o kexc25519c.o poly1305.o chacha.o cipher-chachapoly.o \ 191
193@@ -101,7 +102,7 @@ SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \ 192 SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \
193 sshconnect.o sshconnect1.o sshconnect2.o mux.o \
194@@ -105,7 +106,7 @@ SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \
195 auth-skey.o auth-bsdauth.o auth2-hostbased.o auth2-kbdint.o \
194 auth2-none.o auth2-passwd.o auth2-pubkey.o \ 196 auth2-none.o auth2-passwd.o auth2-pubkey.o \
195 monitor_mm.o monitor.o monitor_wrap.o kexdhs.o kexgexs.o kexecdhs.o \ 197 monitor_mm.o monitor.o monitor_wrap.o auth-krb5.o \
196 kexc25519s.o auth-krb5.o \
197- auth2-gss.o gss-serv.o gss-serv-krb5.o \ 198- auth2-gss.o gss-serv.o gss-serv-krb5.o \
198+ auth2-gss.o gss-serv.o gss-serv-krb5.o kexgsss.o \ 199+ auth2-gss.o gss-serv.o gss-serv-krb5.o kexgsss.o \
199 loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \ 200 loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \
@@ -251,11 +252,11 @@ index 0089b18..ec47869 100644
251 return (krb5_cc_resolve(ctx, ccname, ccache)); 252 return (krb5_cc_resolve(ctx, ccname, ccache));
252 } 253 }
253diff --git a/auth2-gss.c b/auth2-gss.c 254diff --git a/auth2-gss.c b/auth2-gss.c
254index 447f896..284f364 100644 255index 1ca8357..3b5036d 100644
255--- a/auth2-gss.c 256--- a/auth2-gss.c
256+++ b/auth2-gss.c 257+++ b/auth2-gss.c
257@@ -1,7 +1,7 @@ 258@@ -1,7 +1,7 @@
258 /* $OpenBSD: auth2-gss.c,v 1.21 2014/02/26 20:28:44 djm Exp $ */ 259 /* $OpenBSD: auth2-gss.c,v 1.22 2015/01/19 20:07:45 markus Exp $ */
259 260
260 /* 261 /*
261- * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. 262- * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
@@ -263,9 +264,9 @@ index 447f896..284f364 100644
263 * 264 *
264 * Redistribution and use in source and binary forms, with or without 265 * Redistribution and use in source and binary forms, with or without
265 * modification, are permitted provided that the following conditions 266 * modification, are permitted provided that the following conditions
266@@ -53,6 +53,40 @@ static void input_gssapi_mic(int type, u_int32_t plen, void *ctxt); 267@@ -53,6 +53,40 @@ static int input_gssapi_mic(int type, u_int32_t plen, void *ctxt);
267 static void input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt); 268 static int input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt);
268 static void input_gssapi_errtok(int, u_int32_t, void *); 269 static int input_gssapi_errtok(int, u_int32_t, void *);
269 270
270+/* 271+/*
271+ * The 'gssapi_keyex' userauth mechanism. 272+ * The 'gssapi_keyex' userauth mechanism.
@@ -304,7 +305,7 @@ index 447f896..284f364 100644
304 /* 305 /*
305 * We only support those mechanisms that we know about (ie ones that we know 306 * We only support those mechanisms that we know about (ie ones that we know
306 * how to check local user kuserok and the like) 307 * how to check local user kuserok and the like)
307@@ -236,7 +270,8 @@ input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt) 308@@ -238,7 +272,8 @@ input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt)
308 309
309 packet_check_eom(); 310 packet_check_eom();
310 311
@@ -314,7 +315,7 @@ index 447f896..284f364 100644
314 315
315 authctxt->postponed = 0; 316 authctxt->postponed = 0;
316 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL); 317 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
317@@ -271,7 +306,8 @@ input_gssapi_mic(int type, u_int32_t plen, void *ctxt) 318@@ -274,7 +309,8 @@ input_gssapi_mic(int type, u_int32_t plen, void *ctxt)
318 gssbuf.length = buffer_len(&b); 319 gssbuf.length = buffer_len(&b);
319 320
320 if (!GSS_ERROR(PRIVSEP(ssh_gssapi_checkmic(gssctxt, &gssbuf, &mic)))) 321 if (!GSS_ERROR(PRIVSEP(ssh_gssapi_checkmic(gssctxt, &gssbuf, &mic))))
@@ -324,8 +325,8 @@ index 447f896..284f364 100644
324 else 325 else
325 logit("GSSAPI MIC check failed"); 326 logit("GSSAPI MIC check failed");
326 327
327@@ -286,6 +322,12 @@ input_gssapi_mic(int type, u_int32_t plen, void *ctxt) 328@@ -290,6 +326,12 @@ input_gssapi_mic(int type, u_int32_t plen, void *ctxt)
328 userauth_finish(authctxt, authenticated, "gssapi-with-mic", NULL); 329 return 0;
329 } 330 }
330 331
331+Authmethod method_gsskeyex = { 332+Authmethod method_gsskeyex = {
@@ -338,7 +339,7 @@ index 447f896..284f364 100644
338 "gssapi-with-mic", 339 "gssapi-with-mic",
339 userauth_gssapi, 340 userauth_gssapi,
340diff --git a/auth2.c b/auth2.c 341diff --git a/auth2.c b/auth2.c
341index d9b440a..2f0d565 100644 342index 7177962..3f49bdc 100644
342--- a/auth2.c 343--- a/auth2.c
343+++ b/auth2.c 344+++ b/auth2.c
344@@ -70,6 +70,7 @@ extern Authmethod method_passwd; 345@@ -70,6 +70,7 @@ extern Authmethod method_passwd;
@@ -358,12 +359,12 @@ index d9b440a..2f0d565 100644
358 #endif 359 #endif
359 &method_passwd, 360 &method_passwd,
360diff --git a/clientloop.c b/clientloop.c 361diff --git a/clientloop.c b/clientloop.c
361index 397c965..f9175e3 100644 362index a9c8a90..7df9413 100644
362--- a/clientloop.c 363--- a/clientloop.c
363+++ b/clientloop.c 364+++ b/clientloop.c
364@@ -111,6 +111,10 @@ 365@@ -114,6 +114,10 @@
365 #include "msg.h" 366 #include "ssherr.h"
366 #include "roaming.h" 367 #include "hostfile.h"
367 368
368+#ifdef GSSAPI 369+#ifdef GSSAPI
369+#include "ssh-gss.h" 370+#include "ssh-gss.h"
@@ -387,12 +388,12 @@ index 397c965..f9175e3 100644
387+ 388+
388 if (need_rekeying || packet_need_rekeying()) { 389 if (need_rekeying || packet_need_rekeying()) {
389 debug("need rekeying"); 390 debug("need rekeying");
390 xxx_kex->done = 0; 391 active_state->kex->done = 0;
391diff --git a/config.h.in b/config.h.in 392diff --git a/config.h.in b/config.h.in
392index 16d6206..a9a8b7a 100644 393index 7e7e38e..6c7de98 100644
393--- a/config.h.in 394--- a/config.h.in
394+++ b/config.h.in 395+++ b/config.h.in
395@@ -1622,6 +1622,9 @@ 396@@ -1623,6 +1623,9 @@
396 /* Use btmp to log bad logins */ 397 /* Use btmp to log bad logins */
397 #undef USE_BTMP 398 #undef USE_BTMP
398 399
@@ -402,7 +403,7 @@ index 16d6206..a9a8b7a 100644
402 /* Use libedit for sftp */ 403 /* Use libedit for sftp */
403 #undef USE_LIBEDIT 404 #undef USE_LIBEDIT
404 405
405@@ -1637,6 +1640,9 @@ 406@@ -1638,6 +1641,9 @@
406 /* Use PIPES instead of a socketpair() */ 407 /* Use PIPES instead of a socketpair() */
407 #undef USE_PIPES 408 #undef USE_PIPES
408 409
@@ -412,79 +413,11 @@ index 16d6206..a9a8b7a 100644
412 /* Define if you have Solaris process contracts */ 413 /* Define if you have Solaris process contracts */
413 #undef USE_SOLARIS_PROCESS_CONTRACTS 414 #undef USE_SOLARIS_PROCESS_CONTRACTS
414 415
415diff --git a/configure b/configure
416index 6815388..ea5f200 100755
417--- a/configure
418+++ b/configure
419@@ -7168,6 +7168,63 @@ $as_echo "#define SSH_TUN_COMPAT_AF 1" >>confdefs.h
420
421 $as_echo "#define SSH_TUN_PREPEND_AF 1" >>confdefs.h
422
423+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have the Security Authorization Session API" >&5
424+$as_echo_n "checking if we have the Security Authorization Session API... " >&6; }
425+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
426+/* end confdefs.h. */
427+#include <Security/AuthSession.h>
428+int
429+main ()
430+{
431+SessionCreate(0, 0);
432+ ;
433+ return 0;
434+}
435+_ACEOF
436+if ac_fn_c_try_compile "$LINENO"; then :
437+ ac_cv_use_security_session_api="yes"
438+
439+$as_echo "#define USE_SECURITY_SESSION_API 1" >>confdefs.h
440+
441+ LIBS="$LIBS -framework Security"
442+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
443+$as_echo "yes" >&6; }
444+else
445+ ac_cv_use_security_session_api="no"
446+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
447+$as_echo "no" >&6; }
448+fi
449+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
450+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have an in-memory credentials cache" >&5
451+$as_echo_n "checking if we have an in-memory credentials cache... " >&6; }
452+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
453+/* end confdefs.h. */
454+#include <Kerberos/Kerberos.h>
455+int
456+main ()
457+{
458+cc_context_t c;
459+ (void) cc_initialize (&c, 0, NULL, NULL);
460+ ;
461+ return 0;
462+}
463+_ACEOF
464+if ac_fn_c_try_compile "$LINENO"; then :
465+
466+$as_echo "#define USE_CCAPI 1" >>confdefs.h
467+
468+ LIBS="$LIBS -framework Security"
469+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
470+$as_echo "yes" >&6; }
471+ if test "x$ac_cv_use_security_session_api" = "xno"; then
472+ as_fn_error $? "*** Need a security framework to use the credentials cache API ***" "$LINENO" 5
473+ fi
474+else
475+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
476+$as_echo "no" >&6; }
477+
478+fi
479+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
480
481 ac_fn_c_check_decl "$LINENO" "AU_IPv4" "ac_cv_have_decl_AU_IPv4" "$ac_includes_default"
482 if test "x$ac_cv_have_decl_AU_IPv4" = xyes; then :
483diff --git a/configure.ac b/configure.ac 416diff --git a/configure.ac b/configure.ac
484index 67c4486..90e81e1 100644 417index b4d6598..216a9fd 100644
485--- a/configure.ac 418--- a/configure.ac
486+++ b/configure.ac 419+++ b/configure.ac
487@@ -584,6 +584,30 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) 420@@ -620,6 +620,30 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
488 [Use tunnel device compatibility to OpenBSD]) 421 [Use tunnel device compatibility to OpenBSD])
489 AC_DEFINE([SSH_TUN_PREPEND_AF], [1], 422 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
490 [Prepend the address family to IP tunnel traffic]) 423 [Prepend the address family to IP tunnel traffic])
@@ -516,11 +449,11 @@ index 67c4486..90e81e1 100644
516 AC_CHECK_DECL([AU_IPv4], [], 449 AC_CHECK_DECL([AU_IPv4], [],
517 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records]) 450 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
518diff --git a/gss-genr.c b/gss-genr.c 451diff --git a/gss-genr.c b/gss-genr.c
519index b39281b..1e569ad 100644 452index 60ac65f..5610f0b 100644
520--- a/gss-genr.c 453--- a/gss-genr.c
521+++ b/gss-genr.c 454+++ b/gss-genr.c
522@@ -1,7 +1,7 @@ 455@@ -1,7 +1,7 @@
523 /* $OpenBSD: gss-genr.c,v 1.22 2013/11/08 00:39:15 djm Exp $ */ 456 /* $OpenBSD: gss-genr.c,v 1.23 2015/01/20 23:14:00 deraadt Exp $ */
524 457
525 /* 458 /*
526- * Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved. 459- * Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved.
@@ -528,7 +461,7 @@ index b39281b..1e569ad 100644
528 * 461 *
529 * Redistribution and use in source and binary forms, with or without 462 * Redistribution and use in source and binary forms, with or without
530 * modification, are permitted provided that the following conditions 463 * modification, are permitted provided that the following conditions
531@@ -39,12 +39,167 @@ 464@@ -40,12 +40,167 @@
532 #include "buffer.h" 465 #include "buffer.h"
533 #include "log.h" 466 #include "log.h"
534 #include "ssh2.h" 467 #include "ssh2.h"
@@ -696,7 +629,7 @@ index b39281b..1e569ad 100644
696 /* Check that the OID in a data stream matches that in the context */ 629 /* Check that the OID in a data stream matches that in the context */
697 int 630 int
698 ssh_gssapi_check_oid(Gssctxt *ctx, void *data, size_t len) 631 ssh_gssapi_check_oid(Gssctxt *ctx, void *data, size_t len)
699@@ -197,7 +352,7 @@ ssh_gssapi_init_ctx(Gssctxt *ctx, int deleg_creds, gss_buffer_desc *recv_tok, 632@@ -198,7 +353,7 @@ ssh_gssapi_init_ctx(Gssctxt *ctx, int deleg_creds, gss_buffer_desc *recv_tok,
700 } 633 }
701 634
702 ctx->major = gss_init_sec_context(&ctx->minor, 635 ctx->major = gss_init_sec_context(&ctx->minor,
@@ -705,7 +638,7 @@ index b39281b..1e569ad 100644
705 GSS_C_MUTUAL_FLAG | GSS_C_INTEG_FLAG | deleg_flag, 638 GSS_C_MUTUAL_FLAG | GSS_C_INTEG_FLAG | deleg_flag,
706 0, NULL, recv_tok, NULL, send_tok, flags, NULL); 639 0, NULL, recv_tok, NULL, send_tok, flags, NULL);
707 640
708@@ -227,8 +382,42 @@ ssh_gssapi_import_name(Gssctxt *ctx, const char *host) 641@@ -228,8 +383,42 @@ ssh_gssapi_import_name(Gssctxt *ctx, const char *host)
709 } 642 }
710 643
711 OM_uint32 644 OM_uint32
@@ -748,7 +681,7 @@ index b39281b..1e569ad 100644
748 if ((ctx->major = gss_get_mic(&ctx->minor, ctx->context, 681 if ((ctx->major = gss_get_mic(&ctx->minor, ctx->context,
749 GSS_C_QOP_DEFAULT, buffer, hash))) 682 GSS_C_QOP_DEFAULT, buffer, hash)))
750 ssh_gssapi_error(ctx); 683 ssh_gssapi_error(ctx);
751@@ -236,6 +425,19 @@ ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_t buffer, gss_buffer_t hash) 684@@ -237,6 +426,19 @@ ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_t buffer, gss_buffer_t hash)
752 return (ctx->major); 685 return (ctx->major);
753 } 686 }
754 687
@@ -768,7 +701,7 @@ index b39281b..1e569ad 100644
768 void 701 void
769 ssh_gssapi_buildmic(Buffer *b, const char *user, const char *service, 702 ssh_gssapi_buildmic(Buffer *b, const char *user, const char *service,
770 const char *context) 703 const char *context)
771@@ -249,11 +451,16 @@ ssh_gssapi_buildmic(Buffer *b, const char *user, const char *service, 704@@ -250,11 +452,16 @@ ssh_gssapi_buildmic(Buffer *b, const char *user, const char *service,
772 } 705 }
773 706
774 int 707 int
@@ -786,7 +719,7 @@ index b39281b..1e569ad 100644
786 719
787 /* RFC 4462 says we MUST NOT do SPNEGO */ 720 /* RFC 4462 says we MUST NOT do SPNEGO */
788 if (oid->length == spnego_oid.length && 721 if (oid->length == spnego_oid.length &&
789@@ -263,6 +470,10 @@ ssh_gssapi_check_mechanism(Gssctxt **ctx, gss_OID oid, const char *host) 722@@ -264,6 +471,10 @@ ssh_gssapi_check_mechanism(Gssctxt **ctx, gss_OID oid, const char *host)
790 ssh_gssapi_build_ctx(ctx); 723 ssh_gssapi_build_ctx(ctx);
791 ssh_gssapi_set_oid(*ctx, oid); 724 ssh_gssapi_set_oid(*ctx, oid);
792 major = ssh_gssapi_import_name(*ctx, host); 725 major = ssh_gssapi_import_name(*ctx, host);
@@ -797,7 +730,7 @@ index b39281b..1e569ad 100644
797 if (!GSS_ERROR(major)) { 730 if (!GSS_ERROR(major)) {
798 major = ssh_gssapi_init_ctx(*ctx, 0, GSS_C_NO_BUFFER, &token, 731 major = ssh_gssapi_init_ctx(*ctx, 0, GSS_C_NO_BUFFER, &token,
799 NULL); 732 NULL);
800@@ -272,10 +483,66 @@ ssh_gssapi_check_mechanism(Gssctxt **ctx, gss_OID oid, const char *host) 733@@ -273,10 +484,66 @@ ssh_gssapi_check_mechanism(Gssctxt **ctx, gss_OID oid, const char *host)
801 GSS_C_NO_BUFFER); 734 GSS_C_NO_BUFFER);
802 } 735 }
803 736
@@ -992,11 +925,11 @@ index 795992d..fd8b371 100644
992 925
993 #endif /* KRB5 */ 926 #endif /* KRB5 */
994diff --git a/gss-serv.c b/gss-serv.c 927diff --git a/gss-serv.c b/gss-serv.c
995index 5c59924..50fa438 100644 928index e7b8c52..539862d 100644
996--- a/gss-serv.c 929--- a/gss-serv.c
997+++ b/gss-serv.c 930+++ b/gss-serv.c
998@@ -1,7 +1,7 @@ 931@@ -1,7 +1,7 @@
999 /* $OpenBSD: gss-serv.c,v 1.27 2014/07/03 03:34:09 djm Exp $ */ 932 /* $OpenBSD: gss-serv.c,v 1.28 2015/01/20 23:14:00 deraadt Exp $ */
1000 933
1001 /* 934 /*
1002- * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. 935- * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
@@ -1004,7 +937,7 @@ index 5c59924..50fa438 100644
1004 * 937 *
1005 * Redistribution and use in source and binary forms, with or without 938 * Redistribution and use in source and binary forms, with or without
1006 * modification, are permitted provided that the following conditions 939 * modification, are permitted provided that the following conditions
1007@@ -45,15 +45,21 @@ 940@@ -44,15 +44,21 @@
1008 #include "channels.h" 941 #include "channels.h"
1009 #include "session.h" 942 #include "session.h"
1010 #include "misc.h" 943 #include "misc.h"
@@ -1028,7 +961,7 @@ index 5c59924..50fa438 100644
1028 961
1029 #ifdef KRB5 962 #ifdef KRB5
1030 extern ssh_gssapi_mech gssapi_kerberos_mech; 963 extern ssh_gssapi_mech gssapi_kerberos_mech;
1031@@ -100,25 +106,32 @@ ssh_gssapi_acquire_cred(Gssctxt *ctx) 964@@ -99,25 +105,32 @@ ssh_gssapi_acquire_cred(Gssctxt *ctx)
1032 char lname[NI_MAXHOST]; 965 char lname[NI_MAXHOST];
1033 gss_OID_set oidset; 966 gss_OID_set oidset;
1034 967
@@ -1075,7 +1008,7 @@ index 5c59924..50fa438 100644
1075 } 1008 }
1076 1009
1077 /* Privileged */ 1010 /* Privileged */
1078@@ -133,6 +146,29 @@ ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid) 1011@@ -132,6 +145,29 @@ ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid)
1079 } 1012 }
1080 1013
1081 /* Unprivileged */ 1014 /* Unprivileged */
@@ -1105,7 +1038,7 @@ index 5c59924..50fa438 100644
1105 void 1038 void
1106 ssh_gssapi_supported_oids(gss_OID_set *oidset) 1039 ssh_gssapi_supported_oids(gss_OID_set *oidset)
1107 { 1040 {
1108@@ -142,7 +178,9 @@ ssh_gssapi_supported_oids(gss_OID_set *oidset) 1041@@ -141,7 +177,9 @@ ssh_gssapi_supported_oids(gss_OID_set *oidset)
1109 gss_OID_set supported; 1042 gss_OID_set supported;
1110 1043
1111 gss_create_empty_oid_set(&min_status, oidset); 1044 gss_create_empty_oid_set(&min_status, oidset);
@@ -1116,7 +1049,7 @@ index 5c59924..50fa438 100644
1116 1049
1117 while (supported_mechs[i]->name != NULL) { 1050 while (supported_mechs[i]->name != NULL) {
1118 if (GSS_ERROR(gss_test_oid_set_member(&min_status, 1051 if (GSS_ERROR(gss_test_oid_set_member(&min_status,
1119@@ -268,8 +306,48 @@ OM_uint32 1052@@ -267,8 +305,48 @@ OM_uint32
1120 ssh_gssapi_getclient(Gssctxt *ctx, ssh_gssapi_client *client) 1053 ssh_gssapi_getclient(Gssctxt *ctx, ssh_gssapi_client *client)
1121 { 1054 {
1122 int i = 0; 1055 int i = 0;
@@ -1166,7 +1099,7 @@ index 5c59924..50fa438 100644
1166 1099
1167 client->mech = NULL; 1100 client->mech = NULL;
1168 1101
1169@@ -284,6 +362,13 @@ ssh_gssapi_getclient(Gssctxt *ctx, ssh_gssapi_client *client) 1102@@ -283,6 +361,13 @@ ssh_gssapi_getclient(Gssctxt *ctx, ssh_gssapi_client *client)
1170 if (client->mech == NULL) 1103 if (client->mech == NULL)
1171 return GSS_S_FAILURE; 1104 return GSS_S_FAILURE;
1172 1105
@@ -1180,7 +1113,7 @@ index 5c59924..50fa438 100644
1180 if ((ctx->major = gss_display_name(&ctx->minor, ctx->client, 1113 if ((ctx->major = gss_display_name(&ctx->minor, ctx->client,
1181 &client->displayname, NULL))) { 1114 &client->displayname, NULL))) {
1182 ssh_gssapi_error(ctx); 1115 ssh_gssapi_error(ctx);
1183@@ -301,6 +386,8 @@ ssh_gssapi_getclient(Gssctxt *ctx, ssh_gssapi_client *client) 1116@@ -300,6 +385,8 @@ ssh_gssapi_getclient(Gssctxt *ctx, ssh_gssapi_client *client)
1184 return (ctx->major); 1117 return (ctx->major);
1185 } 1118 }
1186 1119
@@ -1189,7 +1122,7 @@ index 5c59924..50fa438 100644
1189 /* We can't copy this structure, so we just move the pointer to it */ 1122 /* We can't copy this structure, so we just move the pointer to it */
1190 client->creds = ctx->client_creds; 1123 client->creds = ctx->client_creds;
1191 ctx->client_creds = GSS_C_NO_CREDENTIAL; 1124 ctx->client_creds = GSS_C_NO_CREDENTIAL;
1192@@ -348,7 +435,7 @@ ssh_gssapi_do_child(char ***envp, u_int *envsizep) 1125@@ -347,7 +434,7 @@ ssh_gssapi_do_child(char ***envp, u_int *envsizep)
1193 1126
1194 /* Privileged */ 1127 /* Privileged */
1195 int 1128 int
@@ -1198,7 +1131,7 @@ index 5c59924..50fa438 100644
1198 { 1131 {
1199 OM_uint32 lmin; 1132 OM_uint32 lmin;
1200 1133
1201@@ -358,9 +445,11 @@ ssh_gssapi_userok(char *user) 1134@@ -357,9 +444,11 @@ ssh_gssapi_userok(char *user)
1202 return 0; 1135 return 0;
1203 } 1136 }
1204 if (gssapi_client.mech && gssapi_client.mech->userok) 1137 if (gssapi_client.mech && gssapi_client.mech->userok)
@@ -1212,7 +1145,7 @@ index 5c59924..50fa438 100644
1212 /* Destroy delegated credentials if userok fails */ 1145 /* Destroy delegated credentials if userok fails */
1213 gss_release_buffer(&lmin, &gssapi_client.displayname); 1146 gss_release_buffer(&lmin, &gssapi_client.displayname);
1214 gss_release_buffer(&lmin, &gssapi_client.exportedname); 1147 gss_release_buffer(&lmin, &gssapi_client.exportedname);
1215@@ -374,14 +463,90 @@ ssh_gssapi_userok(char *user) 1148@@ -373,14 +462,90 @@ ssh_gssapi_userok(char *user)
1216 return (0); 1149 return (0);
1217 } 1150 }
1218 1151
@@ -1310,11 +1243,11 @@ index 5c59924..50fa438 100644
1310 1243
1311 #endif 1244 #endif
1312diff --git a/kex.c b/kex.c 1245diff --git a/kex.c b/kex.c
1313index a173e70..891852b 100644 1246index 8c2b001..be938ad 100644
1314--- a/kex.c 1247--- a/kex.c
1315+++ b/kex.c 1248+++ b/kex.c
1316@@ -53,6 +53,10 @@ 1249@@ -55,6 +55,10 @@
1317 #include "roaming.h" 1250 #include "sshbuf.h"
1318 #include "digest.h" 1251 #include "digest.h"
1319 1252
1320+#ifdef GSSAPI 1253+#ifdef GSSAPI
@@ -1324,8 +1257,8 @@ index a173e70..891852b 100644
1324 #if OPENSSL_VERSION_NUMBER >= 0x00907000L 1257 #if OPENSSL_VERSION_NUMBER >= 0x00907000L
1325 # if defined(HAVE_EVP_SHA256) 1258 # if defined(HAVE_EVP_SHA256)
1326 # define evp_ssh_sha256 EVP_sha256 1259 # define evp_ssh_sha256 EVP_sha256
1327@@ -96,6 +100,14 @@ static const struct kexalg kexalgs[] = { 1260@@ -97,6 +101,14 @@ static const struct kexalg kexalgs[] = {
1328 #endif /* HAVE_EVP_SHA256 */ 1261 #endif /* HAVE_EVP_SHA256 || !WITH_OPENSSL */
1329 { NULL, -1, -1, -1}, 1262 { NULL, -1, -1, -1},
1330 }; 1263 };
1331+static const struct kexalg kexalg_prefixes[] = { 1264+static const struct kexalg kexalg_prefixes[] = {
@@ -1339,7 +1272,7 @@ index a173e70..891852b 100644
1339 1272
1340 char * 1273 char *
1341 kex_alg_list(char sep) 1274 kex_alg_list(char sep)
1342@@ -124,6 +136,10 @@ kex_alg_by_name(const char *name) 1275@@ -129,6 +141,10 @@ kex_alg_by_name(const char *name)
1343 if (strcmp(k->name, name) == 0) 1276 if (strcmp(k->name, name) == 0)
1344 return k; 1277 return k;
1345 } 1278 }
@@ -1351,10 +1284,10 @@ index a173e70..891852b 100644
1351 } 1284 }
1352 1285
1353diff --git a/kex.h b/kex.h 1286diff --git a/kex.h b/kex.h
1354index 4c40ec8..c179a4d 100644 1287index f70b81f..7194b14 100644
1355--- a/kex.h 1288--- a/kex.h
1356+++ b/kex.h 1289+++ b/kex.h
1357@@ -76,6 +76,9 @@ enum kex_exchange { 1290@@ -93,6 +93,9 @@ enum kex_exchange {
1358 KEX_DH_GEX_SHA256, 1291 KEX_DH_GEX_SHA256,
1359 KEX_ECDH_SHA2, 1292 KEX_ECDH_SHA2,
1360 KEX_C25519_SHA256, 1293 KEX_C25519_SHA256,
@@ -1364,8 +1297,8 @@ index 4c40ec8..c179a4d 100644
1364 KEX_MAX 1297 KEX_MAX
1365 }; 1298 };
1366 1299
1367@@ -135,6 +138,12 @@ struct Kex { 1300@@ -139,6 +142,12 @@ struct kex {
1368 int flags; 1301 u_int flags;
1369 int hash_alg; 1302 int hash_alg;
1370 int ec_nid; 1303 int ec_nid;
1371+#ifdef GSSAPI 1304+#ifdef GSSAPI
@@ -1376,25 +1309,25 @@ index 4c40ec8..c179a4d 100644
1376+#endif 1309+#endif
1377 char *client_version_string; 1310 char *client_version_string;
1378 char *server_version_string; 1311 char *server_version_string;
1379 int (*verify_host_key)(Key *); 1312 int (*verify_host_key)(struct sshkey *, struct ssh *);
1380@@ -167,6 +176,11 @@ void kexecdh_server(Kex *); 1313@@ -184,6 +193,11 @@ int kexecdh_server(struct ssh *);
1381 void kexc25519_client(Kex *); 1314 int kexc25519_client(struct ssh *);
1382 void kexc25519_server(Kex *); 1315 int kexc25519_server(struct ssh *);
1383 1316
1384+#ifdef GSSAPI 1317+#ifdef GSSAPI
1385+void kexgss_client(Kex *); 1318+int kexgss_client(struct ssh *);
1386+void kexgss_server(Kex *); 1319+int kexgss_server(struct ssh *);
1387+#endif 1320+#endif
1388+ 1321+
1389 void 1322 int kex_dh_hash(const char *, const char *,
1390 kex_dh_hash(char *, char *, char *, int, char *, int, u_char *, int, 1323 const u_char *, size_t, const u_char *, size_t, const u_char *, size_t,
1391 BIGNUM *, BIGNUM *, BIGNUM *, u_char **, u_int *); 1324 const BIGNUM *, const BIGNUM *, const BIGNUM *, u_char *, size_t *);
1392diff --git a/kexgssc.c b/kexgssc.c 1325diff --git a/kexgssc.c b/kexgssc.c
1393new file mode 100644 1326new file mode 100644
1394index 0000000..92a31c5 1327index 0000000..a49bac2
1395--- /dev/null 1328--- /dev/null
1396+++ b/kexgssc.c 1329+++ b/kexgssc.c
1397@@ -0,0 +1,332 @@ 1330@@ -0,0 +1,336 @@
1398+/* 1331+/*
1399+ * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved. 1332+ * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved.
1400+ * 1333+ *
@@ -1439,43 +1372,46 @@ index 0000000..92a31c5
1439+#include "log.h" 1372+#include "log.h"
1440+#include "packet.h" 1373+#include "packet.h"
1441+#include "dh.h" 1374+#include "dh.h"
1375+#include "digest.h"
1442+ 1376+
1443+#include "ssh-gss.h" 1377+#include "ssh-gss.h"
1444+ 1378+
1445+void 1379+int
1446+kexgss_client(Kex *kex) { 1380+kexgss_client(struct ssh *ssh) {
1447+ gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; 1381+ gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER;
1448+ gss_buffer_desc recv_tok, gssbuf, msg_tok, *token_ptr; 1382+ gss_buffer_desc recv_tok, gssbuf, msg_tok, *token_ptr;
1449+ Gssctxt *ctxt; 1383+ Gssctxt *ctxt;
1450+ OM_uint32 maj_status, min_status, ret_flags; 1384+ OM_uint32 maj_status, min_status, ret_flags;
1451+ u_int klen, kout, slen = 0, hashlen, strlen; 1385+ u_int klen, kout, slen = 0, strlen;
1452+ DH *dh; 1386+ DH *dh;
1453+ BIGNUM *dh_server_pub = NULL; 1387+ BIGNUM *dh_server_pub = NULL;
1454+ BIGNUM *shared_secret = NULL; 1388+ BIGNUM *shared_secret = NULL;
1455+ BIGNUM *p = NULL; 1389+ BIGNUM *p = NULL;
1456+ BIGNUM *g = NULL; 1390+ BIGNUM *g = NULL;
1457+ u_char *kbuf, *hash; 1391+ u_char *kbuf;
1458+ u_char *serverhostkey = NULL; 1392+ u_char *serverhostkey = NULL;
1459+ u_char *empty = ""; 1393+ u_char *empty = "";
1460+ char *msg; 1394+ char *msg;
1461+ int type = 0; 1395+ int type = 0;
1462+ int first = 1; 1396+ int first = 1;
1463+ int nbits = 0, min = DH_GRP_MIN, max = DH_GRP_MAX; 1397+ int nbits = 0, min = DH_GRP_MIN, max = DH_GRP_MAX;
1398+ u_char hash[SSH_DIGEST_MAX_LENGTH];
1399+ size_t hashlen;
1464+ 1400+
1465+ /* Initialise our GSSAPI world */ 1401+ /* Initialise our GSSAPI world */
1466+ ssh_gssapi_build_ctx(&ctxt); 1402+ ssh_gssapi_build_ctx(&ctxt);
1467+ if (ssh_gssapi_id_kex(ctxt, kex->name, kex->kex_type) 1403+ if (ssh_gssapi_id_kex(ctxt, ssh->kex->name, ssh->kex->kex_type)
1468+ == GSS_C_NO_OID) 1404+ == GSS_C_NO_OID)
1469+ fatal("Couldn't identify host exchange"); 1405+ fatal("Couldn't identify host exchange");
1470+ 1406+
1471+ if (ssh_gssapi_import_name(ctxt, kex->gss_host)) 1407+ if (ssh_gssapi_import_name(ctxt, ssh->kex->gss_host))
1472+ fatal("Couldn't import hostname"); 1408+ fatal("Couldn't import hostname");
1473+ 1409+
1474+ if (kex->gss_client && 1410+ if (ssh->kex->gss_client &&
1475+ ssh_gssapi_client_identity(ctxt, kex->gss_client)) 1411+ ssh_gssapi_client_identity(ctxt, ssh->kex->gss_client))
1476+ fatal("Couldn't acquire client credentials"); 1412+ fatal("Couldn't acquire client credentials");
1477+ 1413+
1478+ switch (kex->kex_type) { 1414+ switch (ssh->kex->kex_type) {
1479+ case KEX_GSS_GRP1_SHA1: 1415+ case KEX_GSS_GRP1_SHA1:
1480+ dh = dh_new_group1(); 1416+ dh = dh_new_group1();
1481+ break; 1417+ break;
@@ -1484,7 +1420,7 @@ index 0000000..92a31c5
1484+ break; 1420+ break;
1485+ case KEX_GSS_GEX_SHA1: 1421+ case KEX_GSS_GEX_SHA1:
1486+ debug("Doing group exchange\n"); 1422+ debug("Doing group exchange\n");
1487+ nbits = dh_estimate(kex->we_need * 8); 1423+ nbits = dh_estimate(ssh->kex->we_need * 8);
1488+ packet_start(SSH2_MSG_KEXGSS_GROUPREQ); 1424+ packet_start(SSH2_MSG_KEXGSS_GROUPREQ);
1489+ packet_put_int(min); 1425+ packet_put_int(min);
1490+ packet_put_int(nbits); 1426+ packet_put_int(nbits);
@@ -1509,11 +1445,11 @@ index 0000000..92a31c5
1509+ dh = dh_new_group(g, p); 1445+ dh = dh_new_group(g, p);
1510+ break; 1446+ break;
1511+ default: 1447+ default:
1512+ fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); 1448+ fatal("%s: Unexpected KEX type %d", __func__, ssh->kex->kex_type);
1513+ } 1449+ }
1514+ 1450+
1515+ /* Step 1 - e is dh->pub_key */ 1451+ /* Step 1 - e is dh->pub_key */
1516+ dh_gen_key(dh, kex->we_need * 8); 1452+ dh_gen_key(dh, ssh->kex->we_need * 8);
1517+ 1453+
1518+ /* This is f, we initialise it now to make life easier */ 1454+ /* This is f, we initialise it now to make life easier */
1519+ dh_server_pub = BN_new(); 1455+ dh_server_pub = BN_new();
@@ -1526,7 +1462,7 @@ index 0000000..92a31c5
1526+ debug("Calling gss_init_sec_context"); 1462+ debug("Calling gss_init_sec_context");
1527+ 1463+
1528+ maj_status = ssh_gssapi_init_ctx(ctxt, 1464+ maj_status = ssh_gssapi_init_ctx(ctxt,
1529+ kex->gss_deleg_creds, token_ptr, &send_tok, 1465+ ssh->kex->gss_deleg_creds, token_ptr, &send_tok,
1530+ &ret_flags); 1466+ &ret_flags);
1531+ 1467+
1532+ if (GSS_ERROR(maj_status)) { 1468+ if (GSS_ERROR(maj_status)) {
@@ -1659,38 +1595,39 @@ index 0000000..92a31c5
1659+ memset(kbuf, 0, klen); 1595+ memset(kbuf, 0, klen);
1660+ free(kbuf); 1596+ free(kbuf);
1661+ 1597+
1662+ switch (kex->kex_type) { 1598+ hashlen = sizeof(hash);
1599+ switch (ssh->kex->kex_type) {
1663+ case KEX_GSS_GRP1_SHA1: 1600+ case KEX_GSS_GRP1_SHA1:
1664+ case KEX_GSS_GRP14_SHA1: 1601+ case KEX_GSS_GRP14_SHA1:
1665+ kex_dh_hash( kex->client_version_string, 1602+ kex_dh_hash( ssh->kex->client_version_string,
1666+ kex->server_version_string, 1603+ ssh->kex->server_version_string,
1667+ buffer_ptr(&kex->my), buffer_len(&kex->my), 1604+ buffer_ptr(ssh->kex->my), buffer_len(ssh->kex->my),
1668+ buffer_ptr(&kex->peer), buffer_len(&kex->peer), 1605+ buffer_ptr(ssh->kex->peer), buffer_len(ssh->kex->peer),
1669+ (serverhostkey ? serverhostkey : empty), slen, 1606+ (serverhostkey ? serverhostkey : empty), slen,
1670+ dh->pub_key, /* e */ 1607+ dh->pub_key, /* e */
1671+ dh_server_pub, /* f */ 1608+ dh_server_pub, /* f */
1672+ shared_secret, /* K */ 1609+ shared_secret, /* K */
1673+ &hash, &hashlen 1610+ hash, &hashlen
1674+ ); 1611+ );
1675+ break; 1612+ break;
1676+ case KEX_GSS_GEX_SHA1: 1613+ case KEX_GSS_GEX_SHA1:
1677+ kexgex_hash( 1614+ kexgex_hash(
1678+ kex->hash_alg, 1615+ ssh->kex->hash_alg,
1679+ kex->client_version_string, 1616+ ssh->kex->client_version_string,
1680+ kex->server_version_string, 1617+ ssh->kex->server_version_string,
1681+ buffer_ptr(&kex->my), buffer_len(&kex->my), 1618+ buffer_ptr(ssh->kex->my), buffer_len(ssh->kex->my),
1682+ buffer_ptr(&kex->peer), buffer_len(&kex->peer), 1619+ buffer_ptr(ssh->kex->peer), buffer_len(ssh->kex->peer),
1683+ (serverhostkey ? serverhostkey : empty), slen, 1620+ (serverhostkey ? serverhostkey : empty), slen,
1684+ min, nbits, max, 1621+ min, nbits, max,
1685+ dh->p, dh->g, 1622+ dh->p, dh->g,
1686+ dh->pub_key, 1623+ dh->pub_key,
1687+ dh_server_pub, 1624+ dh_server_pub,
1688+ shared_secret, 1625+ shared_secret,
1689+ &hash, &hashlen 1626+ hash, &hashlen
1690+ ); 1627+ );
1691+ break; 1628+ break;
1692+ default: 1629+ default:
1693+ fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); 1630+ fatal("%s: Unexpected KEX type %d", __func__, ssh->kex->kex_type);
1694+ } 1631+ }
1695+ 1632+
1696+ gssbuf.value = hash; 1633+ gssbuf.value = hash;
@@ -1707,13 +1644,13 @@ index 0000000..92a31c5
1707+ BN_clear_free(dh_server_pub); 1644+ BN_clear_free(dh_server_pub);
1708+ 1645+
1709+ /* save session id */ 1646+ /* save session id */
1710+ if (kex->session_id == NULL) { 1647+ if (ssh->kex->session_id == NULL) {
1711+ kex->session_id_len = hashlen; 1648+ ssh->kex->session_id_len = hashlen;
1712+ kex->session_id = xmalloc(kex->session_id_len); 1649+ ssh->kex->session_id = xmalloc(ssh->kex->session_id_len);
1713+ memcpy(kex->session_id, hash, kex->session_id_len); 1650+ memcpy(ssh->kex->session_id, hash, ssh->kex->session_id_len);
1714+ } 1651+ }
1715+ 1652+
1716+ if (kex->gss_deleg_creds) 1653+ if (ssh->kex->gss_deleg_creds)
1717+ ssh_gssapi_credentials_updated(ctxt); 1654+ ssh_gssapi_credentials_updated(ctxt);
1718+ 1655+
1719+ if (gss_kex_context == NULL) 1656+ if (gss_kex_context == NULL)
@@ -1721,18 +1658,18 @@ index 0000000..92a31c5
1721+ else 1658+ else
1722+ ssh_gssapi_delete_ctx(&ctxt); 1659+ ssh_gssapi_delete_ctx(&ctxt);
1723+ 1660+
1724+ kex_derive_keys_bn(kex, hash, hashlen, shared_secret); 1661+ kex_derive_keys_bn(ssh, hash, hashlen, shared_secret);
1725+ BN_clear_free(shared_secret); 1662+ BN_clear_free(shared_secret);
1726+ kex_finish(kex); 1663+ return kex_send_newkeys(ssh);
1727+} 1664+}
1728+ 1665+
1729+#endif /* GSSAPI */ 1666+#endif /* GSSAPI */
1730diff --git a/kexgsss.c b/kexgsss.c 1667diff --git a/kexgsss.c b/kexgsss.c
1731new file mode 100644 1668new file mode 100644
1732index 0000000..6a0ece8 1669index 0000000..0847469
1733--- /dev/null 1670--- /dev/null
1734+++ b/kexgsss.c 1671+++ b/kexgsss.c
1735@@ -0,0 +1,290 @@ 1672@@ -0,0 +1,295 @@
1736+/* 1673+/*
1737+ * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved. 1674+ * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved.
1738+ * 1675+ *
@@ -1779,11 +1716,12 @@ index 0000000..6a0ece8
1779+#include "monitor_wrap.h" 1716+#include "monitor_wrap.h"
1780+#include "misc.h" 1717+#include "misc.h"
1781+#include "servconf.h" 1718+#include "servconf.h"
1719+#include "digest.h"
1782+ 1720+
1783+extern ServerOptions options; 1721+extern ServerOptions options;
1784+ 1722+
1785+void 1723+int
1786+kexgss_server(Kex *kex) 1724+kexgss_server(struct ssh *ssh)
1787+{ 1725+{
1788+ OM_uint32 maj_status, min_status; 1726+ OM_uint32 maj_status, min_status;
1789+ 1727+
@@ -1798,8 +1736,8 @@ index 0000000..6a0ece8
1798+ gss_buffer_desc gssbuf, recv_tok, msg_tok; 1736+ gss_buffer_desc gssbuf, recv_tok, msg_tok;
1799+ gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; 1737+ gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER;
1800+ Gssctxt *ctxt = NULL; 1738+ Gssctxt *ctxt = NULL;
1801+ u_int slen, klen, kout, hashlen; 1739+ u_int slen, klen, kout;
1802+ u_char *kbuf, *hash; 1740+ u_char *kbuf;
1803+ DH *dh; 1741+ DH *dh;
1804+ int min = -1, max = -1, nbits = -1; 1742+ int min = -1, max = -1, nbits = -1;
1805+ BIGNUM *shared_secret = NULL; 1743+ BIGNUM *shared_secret = NULL;
@@ -1807,6 +1745,8 @@ index 0000000..6a0ece8
1807+ int type = 0; 1745+ int type = 0;
1808+ gss_OID oid; 1746+ gss_OID oid;
1809+ char *mechs; 1747+ char *mechs;
1748+ u_char hash[SSH_DIGEST_MAX_LENGTH];
1749+ size_t hashlen;
1810+ 1750+
1811+ /* Initialise GSSAPI */ 1751+ /* Initialise GSSAPI */
1812+ 1752+
@@ -1819,8 +1759,8 @@ index 0000000..6a0ece8
1819+ free(mechs); 1759+ free(mechs);
1820+ } 1760+ }
1821+ 1761+
1822+ debug2("%s: Identifying %s", __func__, kex->name); 1762+ debug2("%s: Identifying %s", __func__, ssh->kex->name);
1823+ oid = ssh_gssapi_id_kex(NULL, kex->name, kex->kex_type); 1763+ oid = ssh_gssapi_id_kex(NULL, ssh->kex->name, ssh->kex->kex_type);
1824+ if (oid == GSS_C_NO_OID) 1764+ if (oid == GSS_C_NO_OID)
1825+ fatal("Unknown gssapi mechanism"); 1765+ fatal("Unknown gssapi mechanism");
1826+ 1766+
@@ -1829,7 +1769,7 @@ index 0000000..6a0ece8
1829+ if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, oid)))) 1769+ if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, oid))))
1830+ fatal("Unable to acquire credentials for the server"); 1770+ fatal("Unable to acquire credentials for the server");
1831+ 1771+
1832+ switch (kex->kex_type) { 1772+ switch (ssh->kex->kex_type) {
1833+ case KEX_GSS_GRP1_SHA1: 1773+ case KEX_GSS_GRP1_SHA1:
1834+ dh = dh_new_group1(); 1774+ dh = dh_new_group1();
1835+ break; 1775+ break;
@@ -1860,10 +1800,10 @@ index 0000000..6a0ece8
1860+ packet_write_wait(); 1800+ packet_write_wait();
1861+ break; 1801+ break;
1862+ default: 1802+ default:
1863+ fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); 1803+ fatal("%s: Unexpected KEX type %d", __func__, ssh->kex->kex_type);
1864+ } 1804+ }
1865+ 1805+
1866+ dh_gen_key(dh, kex->we_need * 8); 1806+ dh_gen_key(dh, ssh->kex->we_need * 8);
1867+ 1807+
1868+ do { 1808+ do {
1869+ debug("Wait SSH2_MSG_GSSAPI_INIT"); 1809+ debug("Wait SSH2_MSG_GSSAPI_INIT");
@@ -1946,43 +1886,44 @@ index 0000000..6a0ece8
1946+ memset(kbuf, 0, klen); 1886+ memset(kbuf, 0, klen);
1947+ free(kbuf); 1887+ free(kbuf);
1948+ 1888+
1949+ switch (kex->kex_type) { 1889+ hashlen = sizeof(hash);
1890+ switch (ssh->kex->kex_type) {
1950+ case KEX_GSS_GRP1_SHA1: 1891+ case KEX_GSS_GRP1_SHA1:
1951+ case KEX_GSS_GRP14_SHA1: 1892+ case KEX_GSS_GRP14_SHA1:
1952+ kex_dh_hash( 1893+ kex_dh_hash(
1953+ kex->client_version_string, kex->server_version_string, 1894+ ssh->kex->client_version_string, ssh->kex->server_version_string,
1954+ buffer_ptr(&kex->peer), buffer_len(&kex->peer), 1895+ buffer_ptr(ssh->kex->peer), buffer_len(ssh->kex->peer),
1955+ buffer_ptr(&kex->my), buffer_len(&kex->my), 1896+ buffer_ptr(ssh->kex->my), buffer_len(ssh->kex->my),
1956+ NULL, 0, /* Change this if we start sending host keys */ 1897+ NULL, 0, /* Change this if we start sending host keys */
1957+ dh_client_pub, dh->pub_key, shared_secret, 1898+ dh_client_pub, dh->pub_key, shared_secret,
1958+ &hash, &hashlen 1899+ hash, &hashlen
1959+ ); 1900+ );
1960+ break; 1901+ break;
1961+ case KEX_GSS_GEX_SHA1: 1902+ case KEX_GSS_GEX_SHA1:
1962+ kexgex_hash( 1903+ kexgex_hash(
1963+ kex->hash_alg, 1904+ ssh->kex->hash_alg,
1964+ kex->client_version_string, kex->server_version_string, 1905+ ssh->kex->client_version_string, ssh->kex->server_version_string,
1965+ buffer_ptr(&kex->peer), buffer_len(&kex->peer), 1906+ buffer_ptr(ssh->kex->peer), buffer_len(ssh->kex->peer),
1966+ buffer_ptr(&kex->my), buffer_len(&kex->my), 1907+ buffer_ptr(ssh->kex->my), buffer_len(ssh->kex->my),
1967+ NULL, 0, 1908+ NULL, 0,
1968+ min, nbits, max, 1909+ min, nbits, max,
1969+ dh->p, dh->g, 1910+ dh->p, dh->g,
1970+ dh_client_pub, 1911+ dh_client_pub,
1971+ dh->pub_key, 1912+ dh->pub_key,
1972+ shared_secret, 1913+ shared_secret,
1973+ &hash, &hashlen 1914+ hash, &hashlen
1974+ ); 1915+ );
1975+ break; 1916+ break;
1976+ default: 1917+ default:
1977+ fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); 1918+ fatal("%s: Unexpected KEX type %d", __func__, ssh->kex->kex_type);
1978+ } 1919+ }
1979+ 1920+
1980+ BN_clear_free(dh_client_pub); 1921+ BN_clear_free(dh_client_pub);
1981+ 1922+
1982+ if (kex->session_id == NULL) { 1923+ if (ssh->kex->session_id == NULL) {
1983+ kex->session_id_len = hashlen; 1924+ ssh->kex->session_id_len = hashlen;
1984+ kex->session_id = xmalloc(kex->session_id_len); 1925+ ssh->kex->session_id = xmalloc(ssh->kex->session_id_len);
1985+ memcpy(kex->session_id, hash, kex->session_id_len); 1926+ memcpy(ssh->kex->session_id, hash, ssh->kex->session_id_len);
1986+ } 1927+ }
1987+ 1928+
1988+ gssbuf.value = hash; 1929+ gssbuf.value = hash;
@@ -2013,21 +1954,22 @@ index 0000000..6a0ece8
2013+ 1954+
2014+ DH_free(dh); 1955+ DH_free(dh);
2015+ 1956+
2016+ kex_derive_keys_bn(kex, hash, hashlen, shared_secret); 1957+ kex_derive_keys_bn(ssh, hash, hashlen, shared_secret);
2017+ BN_clear_free(shared_secret); 1958+ BN_clear_free(shared_secret);
2018+ kex_finish(kex); 1959+ kex_send_newkeys(ssh);
2019+ 1960+
2020+ /* If this was a rekey, then save out any delegated credentials we 1961+ /* If this was a rekey, then save out any delegated credentials we
2021+ * just exchanged. */ 1962+ * just exchanged. */
2022+ if (options.gss_store_rekey) 1963+ if (options.gss_store_rekey)
2023+ ssh_gssapi_rekey_creds(); 1964+ ssh_gssapi_rekey_creds();
1965+ return 0;
2024+} 1966+}
2025+#endif /* GSSAPI */ 1967+#endif /* GSSAPI */
2026diff --git a/monitor.c b/monitor.c 1968diff --git a/monitor.c b/monitor.c
2027index dbe29f1..b0896ef 100644 1969index bab6ce8..a2027e5 100644
2028--- a/monitor.c 1970--- a/monitor.c
2029+++ b/monitor.c 1971+++ b/monitor.c
2030@@ -178,6 +178,8 @@ int mm_answer_gss_setup_ctx(int, Buffer *); 1972@@ -157,6 +157,8 @@ int mm_answer_gss_setup_ctx(int, Buffer *);
2031 int mm_answer_gss_accept_ctx(int, Buffer *); 1973 int mm_answer_gss_accept_ctx(int, Buffer *);
2032 int mm_answer_gss_userok(int, Buffer *); 1974 int mm_answer_gss_userok(int, Buffer *);
2033 int mm_answer_gss_checkmic(int, Buffer *); 1975 int mm_answer_gss_checkmic(int, Buffer *);
@@ -2036,7 +1978,7 @@ index dbe29f1..b0896ef 100644
2036 #endif 1978 #endif
2037 1979
2038 #ifdef SSH_AUDIT_EVENTS 1980 #ifdef SSH_AUDIT_EVENTS
2039@@ -255,11 +257,18 @@ struct mon_table mon_dispatch_proto20[] = { 1981@@ -234,11 +236,18 @@ struct mon_table mon_dispatch_proto20[] = {
2040 {MONITOR_REQ_GSSSTEP, MON_ISAUTH, mm_answer_gss_accept_ctx}, 1982 {MONITOR_REQ_GSSSTEP, MON_ISAUTH, mm_answer_gss_accept_ctx},
2041 {MONITOR_REQ_GSSUSEROK, MON_AUTH, mm_answer_gss_userok}, 1983 {MONITOR_REQ_GSSUSEROK, MON_AUTH, mm_answer_gss_userok},
2042 {MONITOR_REQ_GSSCHECKMIC, MON_ISAUTH, mm_answer_gss_checkmic}, 1984 {MONITOR_REQ_GSSCHECKMIC, MON_ISAUTH, mm_answer_gss_checkmic},
@@ -2055,7 +1997,7 @@ index dbe29f1..b0896ef 100644
2055 #ifdef WITH_OPENSSL 1997 #ifdef WITH_OPENSSL
2056 {MONITOR_REQ_MODULI, 0, mm_answer_moduli}, 1998 {MONITOR_REQ_MODULI, 0, mm_answer_moduli},
2057 #endif 1999 #endif
2058@@ -374,6 +383,10 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor) 2000@@ -353,6 +362,10 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
2059 /* Permit requests for moduli and signatures */ 2001 /* Permit requests for moduli and signatures */
2060 monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1); 2002 monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1);
2061 monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1); 2003 monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1);
@@ -2066,7 +2008,7 @@ index dbe29f1..b0896ef 100644
2066 } else { 2008 } else {
2067 mon_dispatch = mon_dispatch_proto15; 2009 mon_dispatch = mon_dispatch_proto15;
2068 2010
2069@@ -482,6 +495,10 @@ monitor_child_postauth(struct monitor *pmonitor) 2011@@ -461,6 +474,10 @@ monitor_child_postauth(struct monitor *pmonitor)
2070 monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1); 2012 monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1);
2071 monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1); 2013 monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1);
2072 monitor_permit(mon_dispatch, MONITOR_REQ_TERM, 1); 2014 monitor_permit(mon_dispatch, MONITOR_REQ_TERM, 1);
@@ -2077,21 +2019,21 @@ index dbe29f1..b0896ef 100644
2077 } else { 2019 } else {
2078 mon_dispatch = mon_dispatch_postauth15; 2020 mon_dispatch = mon_dispatch_postauth15;
2079 monitor_permit(mon_dispatch, MONITOR_REQ_TERM, 1); 2021 monitor_permit(mon_dispatch, MONITOR_REQ_TERM, 1);
2080@@ -1861,6 +1878,13 @@ mm_get_kex(Buffer *m) 2022@@ -1860,6 +1877,13 @@ monitor_apply_keystate(struct monitor *pmonitor)
2081 kex->kex[KEX_ECDH_SHA2] = kexecdh_server; 2023 # endif
2082 #endif 2024 #endif /* WITH_OPENSSL */
2083 kex->kex[KEX_C25519_SHA256] = kexc25519_server; 2025 kex->kex[KEX_C25519_SHA256] = kexc25519_server;
2084+#ifdef GSSAPI 2026+#ifdef GSSAPI
2085+ if (options.gss_keyex) { 2027+ if (options.gss_keyex) {
2086+ kex->kex[KEX_GSS_GRP1_SHA1] = kexgss_server; 2028+ kex->kex[KEX_GSS_GRP1_SHA1] = kexgss_server;
2087+ kex->kex[KEX_GSS_GRP14_SHA1] = kexgss_server; 2029+ kex->kex[KEX_GSS_GRP14_SHA1] = kexgss_server;
2088+ kex->kex[KEX_GSS_GEX_SHA1] = kexgss_server; 2030+ kex->kex[KEX_GSS_GEX_SHA1] = kexgss_server;
2089+ } 2031+ }
2090+#endif 2032+#endif
2091 kex->server = 1; 2033 kex->load_host_public_key=&get_hostkey_public_by_type;
2092 kex->hostkey_type = buffer_get_int(m); 2034 kex->load_host_private_key=&get_hostkey_private_by_type;
2093 kex->kex_type = buffer_get_int(m); 2035 kex->host_key_index=&get_hostkey_index;
2094@@ -2068,6 +2092,9 @@ mm_answer_gss_setup_ctx(int sock, Buffer *m) 2036@@ -1959,6 +1983,9 @@ mm_answer_gss_setup_ctx(int sock, Buffer *m)
2095 OM_uint32 major; 2037 OM_uint32 major;
2096 u_int len; 2038 u_int len;
2097 2039
@@ -2101,7 +2043,7 @@ index dbe29f1..b0896ef 100644
2101 goid.elements = buffer_get_string(m, &len); 2043 goid.elements = buffer_get_string(m, &len);
2102 goid.length = len; 2044 goid.length = len;
2103 2045
2104@@ -2095,6 +2122,9 @@ mm_answer_gss_accept_ctx(int sock, Buffer *m) 2046@@ -1986,6 +2013,9 @@ mm_answer_gss_accept_ctx(int sock, Buffer *m)
2105 OM_uint32 flags = 0; /* GSI needs this */ 2047 OM_uint32 flags = 0; /* GSI needs this */
2106 u_int len; 2048 u_int len;
2107 2049
@@ -2111,7 +2053,7 @@ index dbe29f1..b0896ef 100644
2111 in.value = buffer_get_string(m, &len); 2053 in.value = buffer_get_string(m, &len);
2112 in.length = len; 2054 in.length = len;
2113 major = ssh_gssapi_accept_ctx(gsscontext, &in, &out, &flags); 2055 major = ssh_gssapi_accept_ctx(gsscontext, &in, &out, &flags);
2114@@ -2112,6 +2142,7 @@ mm_answer_gss_accept_ctx(int sock, Buffer *m) 2056@@ -2003,6 +2033,7 @@ mm_answer_gss_accept_ctx(int sock, Buffer *m)
2115 monitor_permit(mon_dispatch, MONITOR_REQ_GSSSTEP, 0); 2057 monitor_permit(mon_dispatch, MONITOR_REQ_GSSSTEP, 0);
2116 monitor_permit(mon_dispatch, MONITOR_REQ_GSSUSEROK, 1); 2058 monitor_permit(mon_dispatch, MONITOR_REQ_GSSUSEROK, 1);
2117 monitor_permit(mon_dispatch, MONITOR_REQ_GSSCHECKMIC, 1); 2059 monitor_permit(mon_dispatch, MONITOR_REQ_GSSCHECKMIC, 1);
@@ -2119,7 +2061,7 @@ index dbe29f1..b0896ef 100644
2119 } 2061 }
2120 return (0); 2062 return (0);
2121 } 2063 }
2122@@ -2123,6 +2154,9 @@ mm_answer_gss_checkmic(int sock, Buffer *m) 2064@@ -2014,6 +2045,9 @@ mm_answer_gss_checkmic(int sock, Buffer *m)
2123 OM_uint32 ret; 2065 OM_uint32 ret;
2124 u_int len; 2066 u_int len;
2125 2067
@@ -2129,7 +2071,7 @@ index dbe29f1..b0896ef 100644
2129 gssbuf.value = buffer_get_string(m, &len); 2071 gssbuf.value = buffer_get_string(m, &len);
2130 gssbuf.length = len; 2072 gssbuf.length = len;
2131 mic.value = buffer_get_string(m, &len); 2073 mic.value = buffer_get_string(m, &len);
2132@@ -2149,7 +2183,11 @@ mm_answer_gss_userok(int sock, Buffer *m) 2074@@ -2040,7 +2074,11 @@ mm_answer_gss_userok(int sock, Buffer *m)
2133 { 2075 {
2134 int authenticated; 2076 int authenticated;
2135 2077
@@ -2142,7 +2084,7 @@ index dbe29f1..b0896ef 100644
2142 2084
2143 buffer_clear(m); 2085 buffer_clear(m);
2144 buffer_put_int(m, authenticated); 2086 buffer_put_int(m, authenticated);
2145@@ -2162,5 +2200,73 @@ mm_answer_gss_userok(int sock, Buffer *m) 2087@@ -2053,5 +2091,73 @@ mm_answer_gss_userok(int sock, Buffer *m)
2146 /* Monitor loop will terminate if authenticated */ 2088 /* Monitor loop will terminate if authenticated */
2147 return (authenticated); 2089 return (authenticated);
2148 } 2090 }
@@ -2217,7 +2159,7 @@ index dbe29f1..b0896ef 100644
2217 #endif /* GSSAPI */ 2159 #endif /* GSSAPI */
2218 2160
2219diff --git a/monitor.h b/monitor.h 2161diff --git a/monitor.h b/monitor.h
2220index 5bc41b5..7f32b0c 100644 2162index 93b8b66..bc50ade 100644
2221--- a/monitor.h 2163--- a/monitor.h
2222+++ b/monitor.h 2164+++ b/monitor.h
2223@@ -65,6 +65,9 @@ enum monitor_reqtype { 2165@@ -65,6 +65,9 @@ enum monitor_reqtype {
@@ -2231,10 +2173,10 @@ index 5bc41b5..7f32b0c 100644
2231 2173
2232 struct mm_master; 2174 struct mm_master;
2233diff --git a/monitor_wrap.c b/monitor_wrap.c 2175diff --git a/monitor_wrap.c b/monitor_wrap.c
2234index 45dc169..e476f0d 100644 2176index b379f05..b667218 100644
2235--- a/monitor_wrap.c 2177--- a/monitor_wrap.c
2236+++ b/monitor_wrap.c 2178+++ b/monitor_wrap.c
2237@@ -1281,7 +1281,7 @@ mm_ssh_gssapi_checkmic(Gssctxt *ctx, gss_buffer_t gssbuf, gss_buffer_t gssmic) 2179@@ -1068,7 +1068,7 @@ mm_ssh_gssapi_checkmic(Gssctxt *ctx, gss_buffer_t gssbuf, gss_buffer_t gssmic)
2238 } 2180 }
2239 2181
2240 int 2182 int
@@ -2243,7 +2185,7 @@ index 45dc169..e476f0d 100644
2243 { 2185 {
2244 Buffer m; 2186 Buffer m;
2245 int authenticated = 0; 2187 int authenticated = 0;
2246@@ -1298,5 +1298,50 @@ mm_ssh_gssapi_userok(char *user) 2188@@ -1085,5 +1085,50 @@ mm_ssh_gssapi_userok(char *user)
2247 debug3("%s: user %sauthenticated",__func__, authenticated ? "" : "not "); 2189 debug3("%s: user %sauthenticated",__func__, authenticated ? "" : "not ");
2248 return (authenticated); 2190 return (authenticated);
2249 } 2191 }
@@ -2295,7 +2237,7 @@ index 45dc169..e476f0d 100644
2295 #endif /* GSSAPI */ 2237 #endif /* GSSAPI */
2296 2238
2297diff --git a/monitor_wrap.h b/monitor_wrap.h 2239diff --git a/monitor_wrap.h b/monitor_wrap.h
2298index 18c2501..a4e9d24 100644 2240index e18784a..0c770e8 100644
2299--- a/monitor_wrap.h 2241--- a/monitor_wrap.h
2300+++ b/monitor_wrap.h 2242+++ b/monitor_wrap.h
2301@@ -58,8 +58,10 @@ BIGNUM *mm_auth_rsa_generate_challenge(Key *); 2243@@ -58,8 +58,10 @@ BIGNUM *mm_auth_rsa_generate_challenge(Key *);
@@ -2311,10 +2253,10 @@ index 18c2501..a4e9d24 100644
2311 2253
2312 #ifdef USE_PAM 2254 #ifdef USE_PAM
2313diff --git a/readconf.c b/readconf.c 2255diff --git a/readconf.c b/readconf.c
2314index 7948ce1..9127e93 100644 2256index 42a2961..254dbce 100644
2315--- a/readconf.c 2257--- a/readconf.c
2316+++ b/readconf.c 2258+++ b/readconf.c
2317@@ -142,6 +142,8 @@ typedef enum { 2259@@ -147,6 +147,8 @@ typedef enum {
2318 oClearAllForwardings, oNoHostAuthenticationForLocalhost, 2260 oClearAllForwardings, oNoHostAuthenticationForLocalhost,
2319 oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout, 2261 oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout,
2320 oAddressFamily, oGssAuthentication, oGssDelegateCreds, 2262 oAddressFamily, oGssAuthentication, oGssDelegateCreds,
@@ -2323,7 +2265,7 @@ index 7948ce1..9127e93 100644
2323 oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, 2265 oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly,
2324 oSendEnv, oControlPath, oControlMaster, oControlPersist, 2266 oSendEnv, oControlPath, oControlMaster, oControlPersist,
2325 oHashKnownHosts, 2267 oHashKnownHosts,
2326@@ -185,10 +187,19 @@ static struct { 2268@@ -191,10 +193,19 @@ static struct {
2327 { "afstokenpassing", oUnsupported }, 2269 { "afstokenpassing", oUnsupported },
2328 #if defined(GSSAPI) 2270 #if defined(GSSAPI)
2329 { "gssapiauthentication", oGssAuthentication }, 2271 { "gssapiauthentication", oGssAuthentication },
@@ -2343,7 +2285,7 @@ index 7948ce1..9127e93 100644
2343 #endif 2285 #endif
2344 { "fallbacktorsh", oDeprecated }, 2286 { "fallbacktorsh", oDeprecated },
2345 { "usersh", oDeprecated }, 2287 { "usersh", oDeprecated },
2346@@ -865,10 +876,30 @@ parse_time: 2288@@ -892,10 +903,30 @@ parse_time:
2347 intptr = &options->gss_authentication; 2289 intptr = &options->gss_authentication;
2348 goto parse_flag; 2290 goto parse_flag;
2349 2291
@@ -2374,7 +2316,7 @@ index 7948ce1..9127e93 100644
2374 case oBatchMode: 2316 case oBatchMode:
2375 intptr = &options->batch_mode; 2317 intptr = &options->batch_mode;
2376 goto parse_flag; 2318 goto parse_flag;
2377@@ -1538,7 +1569,12 @@ initialize_options(Options * options) 2319@@ -1601,7 +1632,12 @@ initialize_options(Options * options)
2378 options->pubkey_authentication = -1; 2320 options->pubkey_authentication = -1;
2379 options->challenge_response_authentication = -1; 2321 options->challenge_response_authentication = -1;
2380 options->gss_authentication = -1; 2322 options->gss_authentication = -1;
@@ -2387,7 +2329,7 @@ index 7948ce1..9127e93 100644
2387 options->password_authentication = -1; 2329 options->password_authentication = -1;
2388 options->kbd_interactive_authentication = -1; 2330 options->kbd_interactive_authentication = -1;
2389 options->kbd_interactive_devices = NULL; 2331 options->kbd_interactive_devices = NULL;
2390@@ -1661,8 +1697,14 @@ fill_default_options(Options * options) 2332@@ -1728,8 +1764,14 @@ fill_default_options(Options * options)
2391 options->challenge_response_authentication = 1; 2333 options->challenge_response_authentication = 1;
2392 if (options->gss_authentication == -1) 2334 if (options->gss_authentication == -1)
2393 options->gss_authentication = 0; 2335 options->gss_authentication = 0;
@@ -2403,7 +2345,7 @@ index 7948ce1..9127e93 100644
2403 options->password_authentication = 1; 2345 options->password_authentication = 1;
2404 if (options->kbd_interactive_authentication == -1) 2346 if (options->kbd_interactive_authentication == -1)
2405diff --git a/readconf.h b/readconf.h 2347diff --git a/readconf.h b/readconf.h
2406index 0b9cb77..0e29889 100644 2348index 576b9e3..ef39c4c 100644
2407--- a/readconf.h 2349--- a/readconf.h
2408+++ b/readconf.h 2350+++ b/readconf.h
2409@@ -45,7 +45,12 @@ typedef struct { 2351@@ -45,7 +45,12 @@ typedef struct {
@@ -2420,10 +2362,10 @@ index 0b9cb77..0e29889 100644
2420 * authentication. */ 2362 * authentication. */
2421 int kbd_interactive_authentication; /* Try keyboard-interactive auth. */ 2363 int kbd_interactive_authentication; /* Try keyboard-interactive auth. */
2422diff --git a/servconf.c b/servconf.c 2364diff --git a/servconf.c b/servconf.c
2423index b7f3294..cb3c831 100644 2365index 3185462..f68c0d0 100644
2424--- a/servconf.c 2366--- a/servconf.c
2425+++ b/servconf.c 2367+++ b/servconf.c
2426@@ -109,7 +109,10 @@ initialize_server_options(ServerOptions *options) 2368@@ -114,7 +114,10 @@ initialize_server_options(ServerOptions *options)
2427 options->kerberos_ticket_cleanup = -1; 2369 options->kerberos_ticket_cleanup = -1;
2428 options->kerberos_get_afs_token = -1; 2370 options->kerberos_get_afs_token = -1;
2429 options->gss_authentication=-1; 2371 options->gss_authentication=-1;
@@ -2434,7 +2376,7 @@ index b7f3294..cb3c831 100644
2434 options->password_authentication = -1; 2376 options->password_authentication = -1;
2435 options->kbd_interactive_authentication = -1; 2377 options->kbd_interactive_authentication = -1;
2436 options->challenge_response_authentication = -1; 2378 options->challenge_response_authentication = -1;
2437@@ -250,8 +253,14 @@ fill_default_server_options(ServerOptions *options) 2379@@ -269,8 +272,14 @@ fill_default_server_options(ServerOptions *options)
2438 options->kerberos_get_afs_token = 0; 2380 options->kerberos_get_afs_token = 0;
2439 if (options->gss_authentication == -1) 2381 if (options->gss_authentication == -1)
2440 options->gss_authentication = 0; 2382 options->gss_authentication = 0;
@@ -2449,10 +2391,10 @@ index b7f3294..cb3c831 100644
2449 if (options->password_authentication == -1) 2391 if (options->password_authentication == -1)
2450 options->password_authentication = 1; 2392 options->password_authentication = 1;
2451 if (options->kbd_interactive_authentication == -1) 2393 if (options->kbd_interactive_authentication == -1)
2452@@ -352,7 +361,9 @@ typedef enum { 2394@@ -391,7 +400,9 @@ typedef enum {
2453 sBanner, sUseDNS, sHostbasedAuthentication, 2395 sBanner, sUseDNS, sHostbasedAuthentication,
2454 sHostbasedUsesNameFromPacketOnly, sClientAliveInterval, 2396 sHostbasedUsesNameFromPacketOnly, sHostbasedAcceptedKeyTypes,
2455 sClientAliveCountMax, sAuthorizedKeysFile, 2397 sClientAliveInterval, sClientAliveCountMax, sAuthorizedKeysFile,
2456- sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel, 2398- sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel,
2457+ sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor, 2399+ sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor,
2458+ sGssKeyEx, sGssStoreRekey, 2400+ sGssKeyEx, sGssStoreRekey,
@@ -2460,7 +2402,7 @@ index b7f3294..cb3c831 100644
2460 sMatch, sPermitOpen, sForceCommand, sChrootDirectory, 2402 sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
2461 sUsePrivilegeSeparation, sAllowAgentForwarding, 2403 sUsePrivilegeSeparation, sAllowAgentForwarding,
2462 sHostCertificate, 2404 sHostCertificate,
2463@@ -421,10 +432,20 @@ static struct { 2405@@ -462,10 +473,20 @@ static struct {
2464 #ifdef GSSAPI 2406 #ifdef GSSAPI
2465 { "gssapiauthentication", sGssAuthentication, SSHCFG_ALL }, 2407 { "gssapiauthentication", sGssAuthentication, SSHCFG_ALL },
2466 { "gssapicleanupcredentials", sGssCleanupCreds, SSHCFG_GLOBAL }, 2408 { "gssapicleanupcredentials", sGssCleanupCreds, SSHCFG_GLOBAL },
@@ -2481,7 +2423,7 @@ index b7f3294..cb3c831 100644
2481 { "passwordauthentication", sPasswordAuthentication, SSHCFG_ALL }, 2423 { "passwordauthentication", sPasswordAuthentication, SSHCFG_ALL },
2482 { "kbdinteractiveauthentication", sKbdInteractiveAuthentication, SSHCFG_ALL }, 2424 { "kbdinteractiveauthentication", sKbdInteractiveAuthentication, SSHCFG_ALL },
2483 { "challengeresponseauthentication", sChallengeResponseAuthentication, SSHCFG_GLOBAL }, 2425 { "challengeresponseauthentication", sChallengeResponseAuthentication, SSHCFG_GLOBAL },
2484@@ -1104,10 +1125,22 @@ process_server_config_line(ServerOptions *options, char *line, 2426@@ -1166,10 +1187,22 @@ process_server_config_line(ServerOptions *options, char *line,
2485 intptr = &options->gss_authentication; 2427 intptr = &options->gss_authentication;
2486 goto parse_flag; 2428 goto parse_flag;
2487 2429
@@ -2504,7 +2446,7 @@ index b7f3294..cb3c831 100644
2504 case sPasswordAuthentication: 2446 case sPasswordAuthentication:
2505 intptr = &options->password_authentication; 2447 intptr = &options->password_authentication;
2506 goto parse_flag; 2448 goto parse_flag;
2507@@ -2042,7 +2075,10 @@ dump_config(ServerOptions *o) 2449@@ -2125,7 +2158,10 @@ dump_config(ServerOptions *o)
2508 #endif 2450 #endif
2509 #ifdef GSSAPI 2451 #ifdef GSSAPI
2510 dump_cfg_fmtint(sGssAuthentication, o->gss_authentication); 2452 dump_cfg_fmtint(sGssAuthentication, o->gss_authentication);
@@ -2516,10 +2458,10 @@ index b7f3294..cb3c831 100644
2516 dump_cfg_fmtint(sPasswordAuthentication, o->password_authentication); 2458 dump_cfg_fmtint(sPasswordAuthentication, o->password_authentication);
2517 dump_cfg_fmtint(sKbdInteractiveAuthentication, 2459 dump_cfg_fmtint(sKbdInteractiveAuthentication,
2518diff --git a/servconf.h b/servconf.h 2460diff --git a/servconf.h b/servconf.h
2519index 766db3a..f8265a8 100644 2461index 9922f0c..d2ed4d7 100644
2520--- a/servconf.h 2462--- a/servconf.h
2521+++ b/servconf.h 2463+++ b/servconf.h
2522@@ -113,7 +113,10 @@ typedef struct { 2464@@ -115,7 +115,10 @@ typedef struct {
2523 int kerberos_get_afs_token; /* If true, try to get AFS token if 2465 int kerberos_get_afs_token; /* If true, try to get AFS token if
2524 * authenticated with Kerberos. */ 2466 * authenticated with Kerberos. */
2525 int gss_authentication; /* If true, permit GSSAPI authentication */ 2467 int gss_authentication; /* If true, permit GSSAPI authentication */
@@ -2647,10 +2589,10 @@ index 03a228f..228e5ab 100644
2647 # CheckHostIP yes 2589 # CheckHostIP yes
2648 # AddressFamily any 2590 # AddressFamily any
2649diff --git a/ssh_config.5 b/ssh_config.5 2591diff --git a/ssh_config.5 b/ssh_config.5
2650index f9ede7a..e6649ac 100644 2592index 140d0ba..4476171 100644
2651--- a/ssh_config.5 2593--- a/ssh_config.5
2652+++ b/ssh_config.5 2594+++ b/ssh_config.5
2653@@ -701,11 +701,43 @@ Specifies whether user authentication based on GSSAPI is allowed. 2595@@ -743,11 +743,43 @@ Specifies whether user authentication based on GSSAPI is allowed.
2654 The default is 2596 The default is
2655 .Dq no . 2597 .Dq no .
2656 Note that this option applies to protocol version 2 only. 2598 Note that this option applies to protocol version 2 only.
@@ -2696,12 +2638,12 @@ index f9ede7a..e6649ac 100644
2696 Indicates that 2638 Indicates that
2697 .Xr ssh 1 2639 .Xr ssh 1
2698diff --git a/sshconnect2.c b/sshconnect2.c 2640diff --git a/sshconnect2.c b/sshconnect2.c
2699index 68f7f4f..7b478f1 100644 2641index ba56f64..faa8ec5 100644
2700--- a/sshconnect2.c 2642--- a/sshconnect2.c
2701+++ b/sshconnect2.c 2643+++ b/sshconnect2.c
2702@@ -159,9 +159,34 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port) 2644@@ -160,9 +160,34 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port)
2703 char *myproposal[PROPOSAL_MAX] = { KEX_CLIENT }; 2645 struct kex *kex;
2704 Kex *kex; 2646 int r;
2705 2647
2706+#ifdef GSSAPI 2648+#ifdef GSSAPI
2707+ char *orig = NULL, *gss = NULL; 2649+ char *orig = NULL, *gss = NULL;
@@ -2734,7 +2676,7 @@ index 68f7f4f..7b478f1 100644
2734 if (options.ciphers == (char *)-1) { 2676 if (options.ciphers == (char *)-1) {
2735 logit("No valid ciphers for protocol version 2 given, using defaults."); 2677 logit("No valid ciphers for protocol version 2 given, using defaults.");
2736 options.ciphers = NULL; 2678 options.ciphers = NULL;
2737@@ -199,6 +224,17 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port) 2679@@ -200,6 +225,17 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port)
2738 myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal( 2680 myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal(
2739 myproposal[PROPOSAL_KEX_ALGS]); 2681 myproposal[PROPOSAL_KEX_ALGS]);
2740 2682
@@ -2752,8 +2694,8 @@ index 68f7f4f..7b478f1 100644
2752 if (options.rekey_limit || options.rekey_interval) 2694 if (options.rekey_limit || options.rekey_interval)
2753 packet_set_rekey_limits((u_int32_t)options.rekey_limit, 2695 packet_set_rekey_limits((u_int32_t)options.rekey_limit,
2754 (time_t)options.rekey_interval); 2696 (time_t)options.rekey_interval);
2755@@ -213,10 +249,30 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port) 2697@@ -218,10 +254,30 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port)
2756 kex->kex[KEX_ECDH_SHA2] = kexecdh_client; 2698 # endif
2757 #endif 2699 #endif
2758 kex->kex[KEX_C25519_SHA256] = kexc25519_client; 2700 kex->kex[KEX_C25519_SHA256] = kexc25519_client;
2759+#ifdef GSSAPI 2701+#ifdef GSSAPI
@@ -2780,18 +2722,18 @@ index 68f7f4f..7b478f1 100644
2780+ } 2722+ }
2781+#endif 2723+#endif
2782+ 2724+
2783 xxx_kex = kex; 2725 dispatch_run(DISPATCH_BLOCK, &kex->done, active_state);
2784 2726
2785 dispatch_run(DISPATCH_BLOCK, &kex->done, kex); 2727 if (options.use_roaming && !kex->roaming) {
2786@@ -306,6 +362,7 @@ void input_gssapi_token(int type, u_int32_t, void *); 2728@@ -313,6 +369,7 @@ int input_gssapi_token(int type, u_int32_t, void *);
2787 void input_gssapi_hash(int type, u_int32_t, void *); 2729 int input_gssapi_hash(int type, u_int32_t, void *);
2788 void input_gssapi_error(int, u_int32_t, void *); 2730 int input_gssapi_error(int, u_int32_t, void *);
2789 void input_gssapi_errtok(int, u_int32_t, void *); 2731 int input_gssapi_errtok(int, u_int32_t, void *);
2790+int userauth_gsskeyex(Authctxt *authctxt); 2732+int userauth_gsskeyex(Authctxt *authctxt);
2791 #endif 2733 #endif
2792 2734
2793 void userauth(Authctxt *, char *); 2735 void userauth(Authctxt *, char *);
2794@@ -321,6 +378,11 @@ static char *authmethods_get(void); 2736@@ -328,6 +385,11 @@ static char *authmethods_get(void);
2795 2737
2796 Authmethod authmethods[] = { 2738 Authmethod authmethods[] = {
2797 #ifdef GSSAPI 2739 #ifdef GSSAPI
@@ -2803,7 +2745,7 @@ index 68f7f4f..7b478f1 100644
2803 {"gssapi-with-mic", 2745 {"gssapi-with-mic",
2804 userauth_gssapi, 2746 userauth_gssapi,
2805 NULL, 2747 NULL,
2806@@ -617,19 +679,31 @@ userauth_gssapi(Authctxt *authctxt) 2748@@ -634,19 +696,31 @@ userauth_gssapi(Authctxt *authctxt)
2807 static u_int mech = 0; 2749 static u_int mech = 0;
2808 OM_uint32 min; 2750 OM_uint32 min;
2809 int ok = 0; 2751 int ok = 0;
@@ -2837,7 +2779,7 @@ index 68f7f4f..7b478f1 100644
2837 ok = 1; /* Mechanism works */ 2779 ok = 1; /* Mechanism works */
2838 } else { 2780 } else {
2839 mech++; 2781 mech++;
2840@@ -726,8 +800,8 @@ input_gssapi_response(int type, u_int32_t plen, void *ctxt) 2782@@ -743,8 +817,8 @@ input_gssapi_response(int type, u_int32_t plen, void *ctxt)
2841 { 2783 {
2842 Authctxt *authctxt = ctxt; 2784 Authctxt *authctxt = ctxt;
2843 Gssctxt *gssctxt; 2785 Gssctxt *gssctxt;
@@ -2848,9 +2790,9 @@ index 68f7f4f..7b478f1 100644
2848 2790
2849 if (authctxt == NULL) 2791 if (authctxt == NULL)
2850 fatal("input_gssapi_response: no authentication context"); 2792 fatal("input_gssapi_response: no authentication context");
2851@@ -836,6 +910,48 @@ input_gssapi_error(int type, u_int32_t plen, void *ctxt) 2793@@ -857,6 +931,48 @@ input_gssapi_error(int type, u_int32_t plen, void *ctxt)
2852 free(msg);
2853 free(lang); 2794 free(lang);
2795 return 0;
2854 } 2796 }
2855+ 2797+
2856+int 2798+int
@@ -2898,12 +2840,12 @@ index 68f7f4f..7b478f1 100644
2898 2840
2899 int 2841 int
2900diff --git a/sshd.c b/sshd.c 2842diff --git a/sshd.c b/sshd.c
2901index 481d001..e6706a8 100644 2843index e1c767c..cf38bae 100644
2902--- a/sshd.c 2844--- a/sshd.c
2903+++ b/sshd.c 2845+++ b/sshd.c
2904@@ -123,6 +123,10 @@ 2846@@ -125,6 +125,10 @@
2905 #include "ssh-sandbox.h"
2906 #include "version.h" 2847 #include "version.h"
2848 #include "ssherr.h"
2907 2849
2908+#ifdef USE_SECURITY_SESSION_API 2850+#ifdef USE_SECURITY_SESSION_API
2909+#include <Security/AuthSession.h> 2851+#include <Security/AuthSession.h>
@@ -2912,7 +2854,7 @@ index 481d001..e6706a8 100644
2912 #ifndef O_NOCTTY 2854 #ifndef O_NOCTTY
2913 #define O_NOCTTY 0 2855 #define O_NOCTTY 0
2914 #endif 2856 #endif
2915@@ -1745,10 +1749,13 @@ main(int ac, char **av) 2857@@ -1815,10 +1819,13 @@ main(int ac, char **av)
2916 logit("Disabling protocol version 1. Could not load host key"); 2858 logit("Disabling protocol version 1. Could not load host key");
2917 options.protocol &= ~SSH_PROTO_1; 2859 options.protocol &= ~SSH_PROTO_1;
2918 } 2860 }
@@ -2926,7 +2868,7 @@ index 481d001..e6706a8 100644
2926 if (!(options.protocol & (SSH_PROTO_1|SSH_PROTO_2))) { 2868 if (!(options.protocol & (SSH_PROTO_1|SSH_PROTO_2))) {
2927 logit("sshd: no hostkeys available -- exiting."); 2869 logit("sshd: no hostkeys available -- exiting.");
2928 exit(1); 2870 exit(1);
2929@@ -2060,6 +2067,60 @@ main(int ac, char **av) 2871@@ -2132,6 +2139,60 @@ main(int ac, char **av)
2930 remote_ip, remote_port, 2872 remote_ip, remote_port,
2931 get_local_ipaddr(sock_in), get_local_port()); 2873 get_local_ipaddr(sock_in), get_local_port());
2932 2874
@@ -2987,7 +2929,7 @@ index 481d001..e6706a8 100644
2987 /* 2929 /*
2988 * We don't want to listen forever unless the other side 2930 * We don't want to listen forever unless the other side
2989 * successfully authenticates itself. So we set up an alarm which is 2931 * successfully authenticates itself. So we set up an alarm which is
2990@@ -2482,6 +2543,48 @@ do_ssh2_kex(void) 2932@@ -2561,6 +2622,48 @@ do_ssh2_kex(void)
2991 myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = compat_pkalg_proposal( 2933 myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = compat_pkalg_proposal(
2992 list_hostkey_types()); 2934 list_hostkey_types());
2993 2935
@@ -3034,10 +2976,10 @@ index 481d001..e6706a8 100644
3034+#endif 2976+#endif
3035+ 2977+
3036 /* start key exchange */ 2978 /* start key exchange */
3037 kex = kex_setup(myproposal); 2979 if ((r = kex_setup(active_state, myproposal)) != 0)
3038 #ifdef WITH_OPENSSL 2980 fatal("kex_setup: %s", ssh_err(r));
3039@@ -2492,6 +2595,13 @@ do_ssh2_kex(void) 2981@@ -2575,6 +2678,13 @@ do_ssh2_kex(void)
3040 kex->kex[KEX_ECDH_SHA2] = kexecdh_server; 2982 # endif
3041 #endif 2983 #endif
3042 kex->kex[KEX_C25519_SHA256] = kexc25519_server; 2984 kex->kex[KEX_C25519_SHA256] = kexc25519_server;
3043+#ifdef GSSAPI 2985+#ifdef GSSAPI
@@ -3051,7 +2993,7 @@ index 481d001..e6706a8 100644
3051 kex->client_version_string=client_version_string; 2993 kex->client_version_string=client_version_string;
3052 kex->server_version_string=server_version_string; 2994 kex->server_version_string=server_version_string;
3053diff --git a/sshd_config b/sshd_config 2995diff --git a/sshd_config b/sshd_config
3054index e9045bc..d9b8594 100644 2996index c9042ac..a71ad19 100644
3055--- a/sshd_config 2997--- a/sshd_config
3056+++ b/sshd_config 2998+++ b/sshd_config
3057@@ -84,6 +84,8 @@ AuthorizedKeysFile .ssh/authorized_keys 2999@@ -84,6 +84,8 @@ AuthorizedKeysFile .ssh/authorized_keys
@@ -3064,10 +3006,10 @@ index e9045bc..d9b8594 100644
3064 # Set this to 'yes' to enable PAM authentication, account processing, 3006 # Set this to 'yes' to enable PAM authentication, account processing,
3065 # and session processing. If this is enabled, PAM authentication will 3007 # and session processing. If this is enabled, PAM authentication will
3066diff --git a/sshd_config.5 b/sshd_config.5 3008diff --git a/sshd_config.5 b/sshd_config.5
3067index fd44abe..c8b43da 100644 3009index 6dce0c7..0331496 100644
3068--- a/sshd_config.5 3010--- a/sshd_config.5
3069+++ b/sshd_config.5 3011+++ b/sshd_config.5
3070@@ -527,12 +527,40 @@ Specifies whether user authentication based on GSSAPI is allowed. 3012@@ -564,12 +564,40 @@ Specifies whether user authentication based on GSSAPI is allowed.
3071 The default is 3013 The default is
3072 .Dq no . 3014 .Dq no .
3073 Note that this option applies to protocol version 2 only. 3015 Note that this option applies to protocol version 2 only.
@@ -3105,14 +3047,14 @@ index fd44abe..c8b43da 100644
3105+successful connection rekeying. This option can be used to accepted renewed 3047+successful connection rekeying. This option can be used to accepted renewed
3106+or updated credentials from a compatible client. The default is 3048+or updated credentials from a compatible client. The default is
3107+.Dq no . 3049+.Dq no .
3108 .It Cm HostbasedAuthentication 3050 .It Cm HostbasedAcceptedKeyTypes
3109 Specifies whether rhosts or /etc/hosts.equiv authentication together 3051 Specifies the key types that will be accepted for hostbased authentication
3110 with successful public key client host authentication is allowed 3052 as a comma-separated pattern list.
3111diff --git a/sshkey.c b/sshkey.c 3053diff --git a/sshkey.c b/sshkey.c
3112index fdd0c8a..1a96eae 100644 3054index 4768790..cd5992e 100644
3113--- a/sshkey.c 3055--- a/sshkey.c
3114+++ b/sshkey.c 3056+++ b/sshkey.c
3115@@ -110,6 +110,7 @@ static const struct keytype keytypes[] = { 3057@@ -116,6 +116,7 @@ static const struct keytype keytypes[] = {
3116 { "ssh-dss-cert-v00@openssh.com", "DSA-CERT-V00", 3058 { "ssh-dss-cert-v00@openssh.com", "DSA-CERT-V00",
3117 KEY_DSA_CERT_V00, 0, 1 }, 3059 KEY_DSA_CERT_V00, 0, 1 },
3118 #endif /* WITH_OPENSSL */ 3060 #endif /* WITH_OPENSSL */
@@ -3120,7 +3062,7 @@ index fdd0c8a..1a96eae 100644
3120 { NULL, NULL, -1, -1, 0 } 3062 { NULL, NULL, -1, -1, 0 }
3121 }; 3063 };
3122 3064
3123@@ -198,7 +199,7 @@ key_alg_list(int certs_only, int plain_only) 3065@@ -204,7 +205,7 @@ key_alg_list(int certs_only, int plain_only)
3124 const struct keytype *kt; 3066 const struct keytype *kt;
3125 3067
3126 for (kt = keytypes; kt->type != -1; kt++) { 3068 for (kt = keytypes; kt->type != -1; kt++) {
@@ -3130,7 +3072,7 @@ index fdd0c8a..1a96eae 100644
3130 if ((certs_only && !kt->cert) || (plain_only && kt->cert)) 3072 if ((certs_only && !kt->cert) || (plain_only && kt->cert))
3131 continue; 3073 continue;
3132diff --git a/sshkey.h b/sshkey.h 3074diff --git a/sshkey.h b/sshkey.h
3133index 450b30c..b573e7f 100644 3075index 62c1c3e..9314e85 100644
3134--- a/sshkey.h 3076--- a/sshkey.h
3135+++ b/sshkey.h 3077+++ b/sshkey.h
3136@@ -64,6 +64,7 @@ enum sshkey_types { 3078@@ -64,6 +64,7 @@ enum sshkey_types {
diff --git a/debian/patches/helpful-wait-terminate.patch b/debian/patches/helpful-wait-terminate.patch
index de43f2a80..6ea643210 100644
--- a/debian/patches/helpful-wait-terminate.patch
+++ b/debian/patches/helpful-wait-terminate.patch
@@ -1,4 +1,4 @@
1From aca34215fc0e85d6b49e04f0a3cd0db79732125e Mon Sep 17 00:00:00 2001 1From 9a440da8025dbc120803ee09c2a7ac8c638d31c2 Mon Sep 17 00:00:00 2001
2From: Matthew Vernon <matthew@debian.org> 2From: Matthew Vernon <matthew@debian.org>
3Date: Sun, 9 Feb 2014 16:09:56 +0000 3Date: Sun, 9 Feb 2014 16:09:56 +0000
4Subject: Mention ~& when waiting for forwarded connections to terminate 4Subject: Mention ~& when waiting for forwarded connections to terminate
@@ -12,7 +12,7 @@ Patch-Name: helpful-wait-terminate.patch
12 1 file changed, 1 insertion(+), 1 deletion(-) 12 1 file changed, 1 insertion(+), 1 deletion(-)
13 13
14diff --git a/serverloop.c b/serverloop.c 14diff --git a/serverloop.c b/serverloop.c
15index e92f9e2..813e5bf 100644 15index 306ac36..68f0251 100644
16--- a/serverloop.c 16--- a/serverloop.c
17+++ b/serverloop.c 17+++ b/serverloop.c
18@@ -687,7 +687,7 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg) 18@@ -687,7 +687,7 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
diff --git a/debian/patches/keepalive-extensions.patch b/debian/patches/keepalive-extensions.patch
index 15acabc0e..0adfbd2b5 100644
--- a/debian/patches/keepalive-extensions.patch
+++ b/debian/patches/keepalive-extensions.patch
@@ -1,4 +1,4 @@
1From bd3abc2f732da3a61e4158b915480808957a4357 Mon Sep 17 00:00:00 2001 1From 7efad61f1e562f504a5ff3fb0ae90ac05a208e66 Mon Sep 17 00:00:00 2001
2From: Richard Kettlewell <rjk@greenend.org.uk> 2From: Richard Kettlewell <rjk@greenend.org.uk>
3Date: Sun, 9 Feb 2014 16:09:52 +0000 3Date: Sun, 9 Feb 2014 16:09:52 +0000
4Subject: Various keepalive extensions 4Subject: Various keepalive extensions
@@ -16,7 +16,7 @@ keepalives.
16Author: Ian Jackson <ian@chiark.greenend.org.uk> 16Author: Ian Jackson <ian@chiark.greenend.org.uk>
17Author: Matthew Vernon <matthew@debian.org> 17Author: Matthew Vernon <matthew@debian.org>
18Author: Colin Watson <cjwatson@debian.org> 18Author: Colin Watson <cjwatson@debian.org>
19Last-Update: 2014-10-07 19Last-Update: 2015-08-19
20 20
21Patch-Name: keepalive-extensions.patch 21Patch-Name: keepalive-extensions.patch
22--- 22---
@@ -26,27 +26,27 @@ Patch-Name: keepalive-extensions.patch
26 3 files changed, 34 insertions(+), 4 deletions(-) 26 3 files changed, 34 insertions(+), 4 deletions(-)
27 27
28diff --git a/readconf.c b/readconf.c 28diff --git a/readconf.c b/readconf.c
29index bc879eb..337818c 100644 29index 278fe15..1d2d596 100644
30--- a/readconf.c 30--- a/readconf.c
31+++ b/readconf.c 31+++ b/readconf.c
32@@ -153,6 +153,7 @@ typedef enum { 32@@ -159,6 +159,7 @@ typedef enum {
33 oCanonicalDomains, oCanonicalizeHostname, oCanonicalizeMaxDots,
34 oCanonicalizeFallbackLocal, oCanonicalizePermittedCNAMEs, 33 oCanonicalizeFallbackLocal, oCanonicalizePermittedCNAMEs,
35 oStreamLocalBindMask, oStreamLocalBindUnlink, 34 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys,
35 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes,
36+ oProtocolKeepAlives, oSetupTimeOut, 36+ oProtocolKeepAlives, oSetupTimeOut,
37 oIgnoredUnknownOption, oDeprecated, oUnsupported 37 oIgnoredUnknownOption, oDeprecated, oUnsupported
38 } OpCodes; 38 } OpCodes;
39 39
40@@ -278,6 +279,8 @@ static struct { 40@@ -288,6 +289,8 @@ static struct {
41 { "streamlocalbindmask", oStreamLocalBindMask }, 41 { "updatehostkeys", oUpdateHostkeys },
42 { "streamlocalbindunlink", oStreamLocalBindUnlink }, 42 { "hostbasedkeytypes", oHostbasedKeyTypes },
43 { "ignoreunknown", oIgnoreUnknown }, 43 { "ignoreunknown", oIgnoreUnknown },
44+ { "protocolkeepalives", oProtocolKeepAlives }, 44+ { "protocolkeepalives", oProtocolKeepAlives },
45+ { "setuptimeout", oSetupTimeOut }, 45+ { "setuptimeout", oSetupTimeOut },
46 46
47 { NULL, oBadOption } 47 { NULL, oBadOption }
48 }; 48 };
49@@ -1271,6 +1274,8 @@ parse_int: 49@@ -1299,6 +1302,8 @@ parse_int:
50 goto parse_flag; 50 goto parse_flag;
51 51
52 case oServerAliveInterval: 52 case oServerAliveInterval:
@@ -55,7 +55,7 @@ index bc879eb..337818c 100644
55 intptr = &options->server_alive_interval; 55 intptr = &options->server_alive_interval;
56 goto parse_time; 56 goto parse_time;
57 57
58@@ -1791,8 +1796,13 @@ fill_default_options(Options * options) 58@@ -1858,8 +1863,13 @@ fill_default_options(Options * options)
59 options->rekey_interval = 0; 59 options->rekey_interval = 0;
60 if (options->verify_host_key_dns == -1) 60 if (options->verify_host_key_dns == -1)
61 options->verify_host_key_dns = 0; 61 options->verify_host_key_dns = 0;
@@ -72,10 +72,10 @@ index bc879eb..337818c 100644
72 options->server_alive_count_max = 3; 72 options->server_alive_count_max = 3;
73 if (options->control_master == -1) 73 if (options->control_master == -1)
74diff --git a/ssh_config.5 b/ssh_config.5 74diff --git a/ssh_config.5 b/ssh_config.5
75index 01f1f7f..ea92ea8 100644 75index dd35dd8..250c0d1 100644
76--- a/ssh_config.5 76--- a/ssh_config.5
77+++ b/ssh_config.5 77+++ b/ssh_config.5
78@@ -205,8 +205,12 @@ Valid arguments are 78@@ -233,8 +233,12 @@ Valid arguments are
79 If set to 79 If set to
80 .Dq yes , 80 .Dq yes ,
81 passphrase/password querying will be disabled. 81 passphrase/password querying will be disabled.
@@ -89,7 +89,7 @@ index 01f1f7f..ea92ea8 100644
89 The argument must be 89 The argument must be
90 .Dq yes 90 .Dq yes
91 or 91 or
92@@ -1336,8 +1340,15 @@ from the server, 92@@ -1420,8 +1424,15 @@ from the server,
93 will send a message through the encrypted 93 will send a message through the encrypted
94 channel to request a response from the server. 94 channel to request a response from the server.
95 The default 95 The default
@@ -106,7 +106,7 @@ index 01f1f7f..ea92ea8 100644
106 .It Cm StreamLocalBindMask 106 .It Cm StreamLocalBindMask
107 Sets the octal file creation mode mask 107 Sets the octal file creation mode mask
108 .Pq umask 108 .Pq umask
109@@ -1403,6 +1414,12 @@ Specifies whether the system should send TCP keepalive messages to the 109@@ -1487,6 +1498,12 @@ Specifies whether the system should send TCP keepalive messages to the
110 other side. 110 other side.
111 If they are sent, death of the connection or crash of one 111 If they are sent, death of the connection or crash of one
112 of the machines will be properly noticed. 112 of the machines will be properly noticed.
@@ -120,10 +120,10 @@ index 01f1f7f..ea92ea8 100644
120 connections will die if the route is down temporarily, and some people 120 connections will die if the route is down temporarily, and some people
121 find it annoying. 121 find it annoying.
122diff --git a/sshd_config.5 b/sshd_config.5 122diff --git a/sshd_config.5 b/sshd_config.5
123index c8b43da..2843048 100644 123index 0331496..d14576e 100644
124--- a/sshd_config.5 124--- a/sshd_config.5
125+++ b/sshd_config.5 125+++ b/sshd_config.5
126@@ -1307,6 +1307,9 @@ This avoids infinitely hanging sessions. 126@@ -1392,6 +1392,9 @@ This avoids infinitely hanging sessions.
127 .Pp 127 .Pp
128 To disable TCP keepalive messages, the value should be set to 128 To disable TCP keepalive messages, the value should be set to
129 .Dq no . 129 .Dq no .
diff --git a/debian/patches/lintian-symlink-pickiness.patch b/debian/patches/lintian-symlink-pickiness.patch
index 81b924e35..7aa035726 100644
--- a/debian/patches/lintian-symlink-pickiness.patch
+++ b/debian/patches/lintian-symlink-pickiness.patch
@@ -1,4 +1,4 @@
1From 248d3bb8de371b55aaf3a8f544c15f3a25eb7339 Mon Sep 17 00:00:00 2001 1From 90fc009420a03c598d6f003df5466191ab4d12b2 Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@debian.org> 2From: Colin Watson <cjwatson@debian.org>
3Date: Sun, 9 Feb 2014 16:10:08 +0000 3Date: Sun, 9 Feb 2014 16:10:08 +0000
4Subject: Fix picky lintian errors about slogin symlinks 4Subject: Fix picky lintian errors about slogin symlinks
@@ -15,10 +15,10 @@ Patch-Name: lintian-symlink-pickiness.patch
15 1 file changed, 2 insertions(+), 2 deletions(-) 15 1 file changed, 2 insertions(+), 2 deletions(-)
16 16
17diff --git a/Makefile.in b/Makefile.in 17diff --git a/Makefile.in b/Makefile.in
18index a4402e9..4eab574 100644 18index 37cb023..f52f903 100644
19--- a/Makefile.in 19--- a/Makefile.in
20+++ b/Makefile.in 20+++ b/Makefile.in
21@@ -315,9 +315,9 @@ install-files: 21@@ -331,9 +331,9 @@ install-files:
22 $(INSTALL) -m 644 ssh-keysign.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8 22 $(INSTALL) -m 644 ssh-keysign.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8
23 $(INSTALL) -m 644 ssh-pkcs11-helper.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8 23 $(INSTALL) -m 644 ssh-pkcs11-helper.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8
24 -rm -f $(DESTDIR)$(bindir)/slogin 24 -rm -f $(DESTDIR)$(bindir)/slogin
diff --git a/debian/patches/mention-ssh-keygen-on-keychange.patch b/debian/patches/mention-ssh-keygen-on-keychange.patch
index f90c7e2b1..127ed9f9e 100644
--- a/debian/patches/mention-ssh-keygen-on-keychange.patch
+++ b/debian/patches/mention-ssh-keygen-on-keychange.patch
@@ -1,4 +1,4 @@
1From 064453886f4c3d8ac0b0c8d015ad614c8bce3b42 Mon Sep 17 00:00:00 2001 1From aedcf9cb37f512b929ce895ba1fccc9ca39166b0 Mon Sep 17 00:00:00 2001
2From: Scott Moser <smoser@ubuntu.com> 2From: Scott Moser <smoser@ubuntu.com>
3Date: Sun, 9 Feb 2014 16:10:03 +0000 3Date: Sun, 9 Feb 2014 16:10:03 +0000
4Subject: Mention ssh-keygen in ssh fingerprint changed warning 4Subject: Mention ssh-keygen in ssh fingerprint changed warning
@@ -13,10 +13,10 @@ Patch-Name: mention-ssh-keygen-on-keychange.patch
13 1 file changed, 6 insertions(+), 1 deletion(-) 13 1 file changed, 6 insertions(+), 1 deletion(-)
14 14
15diff --git a/sshconnect.c b/sshconnect.c 15diff --git a/sshconnect.c b/sshconnect.c
16index 26116d2..ab83d0c 100644 16index 0073c6e..6065dff 100644
17--- a/sshconnect.c 17--- a/sshconnect.c
18+++ b/sshconnect.c 18+++ b/sshconnect.c
19@@ -1066,9 +1066,12 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port, 19@@ -1078,9 +1078,12 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
20 error("%s. This could either mean that", key_msg); 20 error("%s. This could either mean that", key_msg);
21 error("DNS SPOOFING is happening or the IP address for the host"); 21 error("DNS SPOOFING is happening or the IP address for the host");
22 error("and its host key have changed at the same time."); 22 error("and its host key have changed at the same time.");
@@ -30,7 +30,7 @@ index 26116d2..ab83d0c 100644
30 } 30 }
31 /* The host key has changed. */ 31 /* The host key has changed. */
32 warn_changed_key(host_key); 32 warn_changed_key(host_key);
33@@ -1076,6 +1079,8 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port, 33@@ -1088,6 +1091,8 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
34 user_hostfiles[0]); 34 user_hostfiles[0]);
35 error("Offending %s key in %s:%lu", key_type(host_found->key), 35 error("Offending %s key in %s:%lu", key_type(host_found->key),
36 host_found->file, host_found->line); 36 host_found->file, host_found->line);
diff --git a/debian/patches/no-openssl-version-status.patch b/debian/patches/no-openssl-version-status.patch
index dfcef83b0..f4d8bca66 100644
--- a/debian/patches/no-openssl-version-status.patch
+++ b/debian/patches/no-openssl-version-status.patch
@@ -1,4 +1,4 @@
1From 37fd625165d0df302e441d9cad9bcc742378eef5 Mon Sep 17 00:00:00 2001 1From 6b85aa42144010401906754b98f9876651669163 Mon Sep 17 00:00:00 2001
2From: Kurt Roeckx <kurt@roeckx.be> 2From: Kurt Roeckx <kurt@roeckx.be>
3Date: Sun, 9 Feb 2014 16:10:14 +0000 3Date: Sun, 9 Feb 2014 16:10:14 +0000
4Subject: Don't check the status field of the OpenSSL version 4Subject: Don't check the status field of the OpenSSL version
@@ -23,10 +23,10 @@ Patch-Name: no-openssl-version-status.patch
23 2 files changed, 4 insertions(+), 3 deletions(-) 23 2 files changed, 4 insertions(+), 3 deletions(-)
24 24
25diff --git a/openbsd-compat/openssl-compat.c b/openbsd-compat/openssl-compat.c 25diff --git a/openbsd-compat/openssl-compat.c b/openbsd-compat/openssl-compat.c
26index 36570e4..defd5fb 100644 26index 63a660c..3f62403 100644
27--- a/openbsd-compat/openssl-compat.c 27--- a/openbsd-compat/openssl-compat.c
28+++ b/openbsd-compat/openssl-compat.c 28+++ b/openbsd-compat/openssl-compat.c
29@@ -34,7 +34,7 @@ 29@@ -36,7 +36,7 @@
30 /* 30 /*
31 * OpenSSL version numbers: MNNFFPPS: major minor fix patch status 31 * OpenSSL version numbers: MNNFFPPS: major minor fix patch status
32 * We match major, minor, fix and status (not patch) for <1.0.0. 32 * We match major, minor, fix and status (not patch) for <1.0.0.
@@ -35,7 +35,7 @@ index 36570e4..defd5fb 100644
35 * allow 1.0.1 to work with 1.0.0). Going backwards is only allowed 35 * allow 1.0.1 to work with 1.0.0). Going backwards is only allowed
36 * within a patch series. 36 * within a patch series.
37 */ 37 */
38@@ -55,10 +55,10 @@ ssh_compatible_openssl(long headerver, long libver) 38@@ -57,10 +57,10 @@ ssh_compatible_openssl(long headerver, long libver)
39 } 39 }
40 40
41 /* 41 /*
diff --git a/debian/patches/openbsd-docs.patch b/debian/patches/openbsd-docs.patch
index 37ad675d4..f5b96f4a1 100644
--- a/debian/patches/openbsd-docs.patch
+++ b/debian/patches/openbsd-docs.patch
@@ -1,4 +1,4 @@
1From 0b9407d3023938b02bccf7dd1874a871d0cc8eb5 Mon Sep 17 00:00:00 2001 1From 96c2797aaa79d687e75dc56f40f7102131d87fb1 Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@debian.org> 2From: Colin Watson <cjwatson@debian.org>
3Date: Sun, 9 Feb 2014 16:10:09 +0000 3Date: Sun, 9 Feb 2014 16:10:09 +0000
4Subject: Adjust various OpenBSD-specific references in manual pages 4Subject: Adjust various OpenBSD-specific references in manual pages
@@ -44,10 +44,10 @@ index ef0de08..149846c 100644
44 .Sh SEE ALSO 44 .Sh SEE ALSO
45 .Xr ssh-keygen 1 , 45 .Xr ssh-keygen 1 ,
46diff --git a/ssh-keygen.1 b/ssh-keygen.1 46diff --git a/ssh-keygen.1 b/ssh-keygen.1
47index 723a016..79b948c 100644 47index 9b93666..19bed1e 100644
48--- a/ssh-keygen.1 48--- a/ssh-keygen.1
49+++ b/ssh-keygen.1 49+++ b/ssh-keygen.1
50@@ -172,9 +172,7 @@ key in 50@@ -174,9 +174,7 @@ key in
51 .Pa ~/.ssh/id_ed25519 51 .Pa ~/.ssh/id_ed25519
52 or 52 or
53 .Pa ~/.ssh/id_rsa . 53 .Pa ~/.ssh/id_rsa .
@@ -58,7 +58,7 @@ index 723a016..79b948c 100644
58 .Pp 58 .Pp
59 Normally this program generates the key and asks for a file in which 59 Normally this program generates the key and asks for a file in which
60 to store the private key. 60 to store the private key.
61@@ -221,9 +219,7 @@ For each of the key types (rsa1, rsa, dsa, ecdsa and ed25519) 61@@ -223,9 +221,7 @@ For each of the key types (rsa1, rsa, dsa, ecdsa and ed25519)
62 for which host keys 62 for which host keys
63 do not exist, generate the host keys with the default key file path, 63 do not exist, generate the host keys with the default key file path,
64 an empty passphrase, default bits for the key type, and default comment. 64 an empty passphrase, default bits for the key type, and default comment.
@@ -69,7 +69,7 @@ index 723a016..79b948c 100644
69 .It Fl a Ar rounds 69 .It Fl a Ar rounds
70 When saving a new-format private key (i.e. an ed25519 key or any SSH protocol 70 When saving a new-format private key (i.e. an ed25519 key or any SSH protocol
71 2 key when the 71 2 key when the
72@@ -628,7 +624,7 @@ option. 72@@ -638,7 +634,7 @@ option.
73 Valid generator values are 2, 3, and 5. 73 Valid generator values are 2, 3, and 5.
74 .Pp 74 .Pp
75 Screened DH groups may be installed in 75 Screened DH groups may be installed in
@@ -78,7 +78,7 @@ index 723a016..79b948c 100644
78 It is important that this file contains moduli of a range of bit lengths and 78 It is important that this file contains moduli of a range of bit lengths and
79 that both ends of a connection share common moduli. 79 that both ends of a connection share common moduli.
80 .Sh CERTIFICATES 80 .Sh CERTIFICATES
81@@ -827,7 +823,7 @@ on all machines 81@@ -837,7 +833,7 @@ on all machines
82 where the user wishes to log in using public key authentication. 82 where the user wishes to log in using public key authentication.
83 There is no need to keep the contents of this file secret. 83 There is no need to keep the contents of this file secret.
84 .Pp 84 .Pp
@@ -88,10 +88,10 @@ index 723a016..79b948c 100644
88 The file format is described in 88 The file format is described in
89 .Xr moduli 5 . 89 .Xr moduli 5 .
90diff --git a/ssh.1 b/ssh.1 90diff --git a/ssh.1 b/ssh.1
91index 7f6ab77..de178cd 100644 91index 53c711a..04de6cf 100644
92--- a/ssh.1 92--- a/ssh.1
93+++ b/ssh.1 93+++ b/ssh.1
94@@ -753,6 +753,10 @@ Protocol 1 is restricted to using only RSA keys, 94@@ -766,6 +766,10 @@ Protocol 1 is restricted to using only RSA keys,
95 but protocol 2 may use any. 95 but protocol 2 may use any.
96 The HISTORY section of 96 The HISTORY section of
97 .Xr ssl 8 97 .Xr ssl 8
@@ -103,7 +103,7 @@ index 7f6ab77..de178cd 100644
103 .Pp 103 .Pp
104 The file 104 The file
105diff --git a/sshd.8 b/sshd.8 105diff --git a/sshd.8 b/sshd.8
106index eaeac45..3538208 100644 106index fc2154c..8dba6cf 100644
107--- a/sshd.8 107--- a/sshd.8
108+++ b/sshd.8 108+++ b/sshd.8
109@@ -67,7 +67,7 @@ over an insecure network. 109@@ -67,7 +67,7 @@ over an insecure network.
@@ -133,10 +133,10 @@ index eaeac45..3538208 100644
133 .Xr sshd_config 5 , 133 .Xr sshd_config 5 ,
134 .Xr inetd 8 , 134 .Xr inetd 8 ,
135diff --git a/sshd_config.5 b/sshd_config.5 135diff --git a/sshd_config.5 b/sshd_config.5
136index 58997d3..7396b23 100644 136index ec58635..453d741 100644
137--- a/sshd_config.5 137--- a/sshd_config.5
138+++ b/sshd_config.5 138+++ b/sshd_config.5
139@@ -303,8 +303,7 @@ This option is only available for protocol version 2. 139@@ -322,8 +322,7 @@ This option is only available for protocol version 2.
140 By default, no banner is displayed. 140 By default, no banner is displayed.
141 .It Cm ChallengeResponseAuthentication 141 .It Cm ChallengeResponseAuthentication
142 Specifies whether challenge-response authentication is allowed (e.g. via 142 Specifies whether challenge-response authentication is allowed (e.g. via
diff --git a/debian/patches/package-versioning.patch b/debian/patches/package-versioning.patch
index 07a28af9a..11674a915 100644
--- a/debian/patches/package-versioning.patch
+++ b/debian/patches/package-versioning.patch
@@ -1,4 +1,4 @@
1From 8679c96f74ee7dbea6c15c764b036fbab7372740 Mon Sep 17 00:00:00 2001 1From 9f6aded97671ee8b9164f0524b3ac622d827dcde Mon Sep 17 00:00:00 2001
2From: Matthew Vernon <matthew@debian.org> 2From: Matthew Vernon <matthew@debian.org>
3Date: Sun, 9 Feb 2014 16:10:05 +0000 3Date: Sun, 9 Feb 2014 16:10:05 +0000
4Subject: Include the Debian version in our identification 4Subject: Include the Debian version in our identification
@@ -19,10 +19,10 @@ Patch-Name: package-versioning.patch
19 3 files changed, 9 insertions(+), 4 deletions(-) 19 3 files changed, 9 insertions(+), 4 deletions(-)
20 20
21diff --git a/sshconnect.c b/sshconnect.c 21diff --git a/sshconnect.c b/sshconnect.c
22index ab83d0c..563405e 100644 22index 6065dff..a6c9e20 100644
23--- a/sshconnect.c 23--- a/sshconnect.c
24+++ b/sshconnect.c 24+++ b/sshconnect.c
25@@ -521,10 +521,10 @@ send_client_banner(int connection_out, int minor1) 25@@ -524,10 +524,10 @@ send_client_banner(int connection_out, int minor1)
26 /* Send our own protocol version identification. */ 26 /* Send our own protocol version identification. */
27 if (compat20) { 27 if (compat20) {
28 xasprintf(&client_version_string, "SSH-%d.%d-%.100s\r\n", 28 xasprintf(&client_version_string, "SSH-%d.%d-%.100s\r\n",
@@ -36,10 +36,10 @@ index ab83d0c..563405e 100644
36 if (roaming_atomicio(vwrite, connection_out, client_version_string, 36 if (roaming_atomicio(vwrite, connection_out, client_version_string,
37 strlen(client_version_string)) != strlen(client_version_string)) 37 strlen(client_version_string)) != strlen(client_version_string))
38diff --git a/sshd.c b/sshd.c 38diff --git a/sshd.c b/sshd.c
39index 48a14dd..1710e71 100644 39index 3b4e97c..c362209 100644
40--- a/sshd.c 40--- a/sshd.c
41+++ b/sshd.c 41+++ b/sshd.c
42@@ -443,7 +443,7 @@ sshd_exchange_identification(int sock_in, int sock_out) 42@@ -442,7 +442,7 @@ sshd_exchange_identification(int sock_in, int sock_out)
43 } 43 }
44 44
45 xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s%s", 45 xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s%s",
@@ -49,11 +49,11 @@ index 48a14dd..1710e71 100644
49 options.version_addendum, newline); 49 options.version_addendum, newline);
50 50
51diff --git a/version.h b/version.h 51diff --git a/version.h b/version.h
52index cc8a079..0fee7c3 100644 52index dfe3ee9..94569ac 100644
53--- a/version.h 53--- a/version.h
54+++ b/version.h 54+++ b/version.h
55@@ -3,4 +3,9 @@ 55@@ -3,4 +3,9 @@
56 #define SSH_VERSION "OpenSSH_6.7" 56 #define SSH_VERSION "OpenSSH_6.8"
57 57
58 #define SSH_PORTABLE "p1" 58 #define SSH_PORTABLE "p1"
59-#define SSH_RELEASE SSH_VERSION SSH_PORTABLE 59-#define SSH_RELEASE SSH_VERSION SSH_PORTABLE
diff --git a/debian/patches/quieter-signals.patch b/debian/patches/quieter-signals.patch
index 6d9a2f9c0..ff16b9850 100644
--- a/debian/patches/quieter-signals.patch
+++ b/debian/patches/quieter-signals.patch
@@ -1,4 +1,4 @@
1From dc028c5992b4b14cca380b6ad2115fcc6907a8b7 Mon Sep 17 00:00:00 2001 1From 34592a434851697537873eed1eb83ba0a640c5c8 Mon Sep 17 00:00:00 2001
2From: Peter Samuelson <peter@p12n.org> 2From: Peter Samuelson <peter@p12n.org>
3Date: Sun, 9 Feb 2014 16:09:55 +0000 3Date: Sun, 9 Feb 2014 16:09:55 +0000
4Subject: Reduce severity of "Killed by signal %d" 4Subject: Reduce severity of "Killed by signal %d"
@@ -22,10 +22,10 @@ Patch-Name: quieter-signals.patch
22 1 file changed, 4 insertions(+), 2 deletions(-) 22 1 file changed, 4 insertions(+), 2 deletions(-)
23 23
24diff --git a/clientloop.c b/clientloop.c 24diff --git a/clientloop.c b/clientloop.c
25index 046ca8b..0180774 100644 25index 156a196..45cef88 100644
26--- a/clientloop.c 26--- a/clientloop.c
27+++ b/clientloop.c 27+++ b/clientloop.c
28@@ -1705,8 +1705,10 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) 28@@ -1707,8 +1707,10 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
29 exit_status = 0; 29 exit_status = 0;
30 } 30 }
31 31
diff --git a/debian/patches/restore-tcp-wrappers.patch b/debian/patches/restore-tcp-wrappers.patch
index c590f52ce..c9da26f7d 100644
--- a/debian/patches/restore-tcp-wrappers.patch
+++ b/debian/patches/restore-tcp-wrappers.patch
@@ -1,4 +1,4 @@
1From b25d6dd3b6b5a2cb93723586c56d6fa0277ea56a Mon Sep 17 00:00:00 2001 1From 7df209aed8ded9a6cab34e704576998786bdc890 Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@debian.org> 2From: Colin Watson <cjwatson@debian.org>
3Date: Tue, 7 Oct 2014 13:22:41 +0100 3Date: Tue, 7 Oct 2014 13:22:41 +0100
4Subject: Restore TCP wrappers support 4Subject: Restore TCP wrappers support
@@ -28,10 +28,10 @@ Patch-Name: restore-tcp-wrappers.patch
28 3 files changed, 89 insertions(+) 28 3 files changed, 89 insertions(+)
29 29
30diff --git a/configure.ac b/configure.ac 30diff --git a/configure.ac b/configure.ac
31index 90e81e1..7f160f1 100644 31index 216a9fd..5f606ea 100644
32--- a/configure.ac 32--- a/configure.ac
33+++ b/configure.ac 33+++ b/configure.ac
34@@ -1404,6 +1404,62 @@ AC_ARG_WITH([skey], 34@@ -1440,6 +1440,62 @@ AC_ARG_WITH([skey],
35 ] 35 ]
36 ) 36 )
37 37
@@ -94,7 +94,7 @@ index 90e81e1..7f160f1 100644
94 # Check whether user wants to use ldns 94 # Check whether user wants to use ldns
95 LDNS_MSG="no" 95 LDNS_MSG="no"
96 AC_ARG_WITH(ldns, 96 AC_ARG_WITH(ldns,
97@@ -4853,6 +4909,7 @@ echo " KerberosV support: $KRB5_MSG" 97@@ -4920,6 +4976,7 @@ echo " KerberosV support: $KRB5_MSG"
98 echo " SELinux support: $SELINUX_MSG" 98 echo " SELinux support: $SELINUX_MSG"
99 echo " Smartcard support: $SCARD_MSG" 99 echo " Smartcard support: $SCARD_MSG"
100 echo " S/KEY support: $SKEY_MSG" 100 echo " S/KEY support: $SKEY_MSG"
@@ -103,7 +103,7 @@ index 90e81e1..7f160f1 100644
103 echo " libedit support: $LIBEDIT_MSG" 103 echo " libedit support: $LIBEDIT_MSG"
104 echo " Solaris process contract support: $SPC_MSG" 104 echo " Solaris process contract support: $SPC_MSG"
105diff --git a/sshd.8 b/sshd.8 105diff --git a/sshd.8 b/sshd.8
106index 01459d6..eaeac45 100644 106index 3c53f7c..fc2154c 100644
107--- a/sshd.8 107--- a/sshd.8
108+++ b/sshd.8 108+++ b/sshd.8
109@@ -851,6 +851,12 @@ the user's home directory becomes accessible. 109@@ -851,6 +851,12 @@ the user's home directory becomes accessible.
@@ -128,10 +128,10 @@ index 01459d6..eaeac45 100644
128 .Xr moduli 5 , 128 .Xr moduli 5 ,
129 .Xr sshd_config 5 , 129 .Xr sshd_config 5 ,
130diff --git a/sshd.c b/sshd.c 130diff --git a/sshd.c b/sshd.c
131index e6706a8..3a6be65 100644 131index cf38bae..9cbe8c4 100644
132--- a/sshd.c 132--- a/sshd.c
133+++ b/sshd.c 133+++ b/sshd.c
134@@ -127,6 +127,13 @@ 134@@ -129,6 +129,13 @@
135 #include <Security/AuthSession.h> 135 #include <Security/AuthSession.h>
136 #endif 136 #endif
137 137
@@ -145,7 +145,7 @@ index e6706a8..3a6be65 100644
145 #ifndef O_NOCTTY 145 #ifndef O_NOCTTY
146 #define O_NOCTTY 0 146 #define O_NOCTTY 0
147 #endif 147 #endif
148@@ -2061,6 +2068,24 @@ main(int ac, char **av) 148@@ -2133,6 +2140,24 @@ main(int ac, char **av)
149 #ifdef SSH_AUDIT_EVENTS 149 #ifdef SSH_AUDIT_EVENTS
150 audit_connection_from(remote_ip, remote_port); 150 audit_connection_from(remote_ip, remote_port);
151 #endif 151 #endif
diff --git a/debian/patches/scp-quoting.patch b/debian/patches/scp-quoting.patch
index ee006da93..52e709112 100644
--- a/debian/patches/scp-quoting.patch
+++ b/debian/patches/scp-quoting.patch
@@ -1,4 +1,4 @@
1From fd174c13c46191abdb33c0a45545573a8e06b061 Mon Sep 17 00:00:00 2001 1From 4f55e60d2296feba17b473b2146a75debe29993a Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Nicolas=20Valc=C3=A1rcel?= <nvalcarcel@ubuntu.com> 2From: =?UTF-8?q?Nicolas=20Valc=C3=A1rcel?= <nvalcarcel@ubuntu.com>
3Date: Sun, 9 Feb 2014 16:09:59 +0000 3Date: Sun, 9 Feb 2014 16:09:59 +0000
4Subject: Adjust scp quoting in verbose mode 4Subject: Adjust scp quoting in verbose mode
@@ -17,10 +17,10 @@ Patch-Name: scp-quoting.patch
17 1 file changed, 10 insertions(+), 2 deletions(-) 17 1 file changed, 10 insertions(+), 2 deletions(-)
18 18
19diff --git a/scp.c b/scp.c 19diff --git a/scp.c b/scp.c
20index 1ec3b70..a1b318b 100644 20index 887b014..afa4a2f 100644
21--- a/scp.c 21--- a/scp.c
22+++ b/scp.c 22+++ b/scp.c
23@@ -189,8 +189,16 @@ do_local_cmd(arglist *a) 23@@ -190,8 +190,16 @@ do_local_cmd(arglist *a)
24 24
25 if (verbose_mode) { 25 if (verbose_mode) {
26 fprintf(stderr, "Executing:"); 26 fprintf(stderr, "Executing:");
diff --git a/debian/patches/selinux-role.patch b/debian/patches/selinux-role.patch
index 1fa0bf928..da53671e3 100644
--- a/debian/patches/selinux-role.patch
+++ b/debian/patches/selinux-role.patch
@@ -1,4 +1,4 @@
1From c9638aa44d787849cea1ae273f0908c6313fd19b Mon Sep 17 00:00:00 2001 1From b9e97e15e25e4c836cb550213e3ee59b19096f9d Mon Sep 17 00:00:00 2001
2From: Manoj Srivastava <srivasta@debian.org> 2From: Manoj Srivastava <srivasta@debian.org>
3Date: Sun, 9 Feb 2014 16:09:49 +0000 3Date: Sun, 9 Feb 2014 16:09:49 +0000
4Subject: Handle SELinux authorisation roles 4Subject: Handle SELinux authorisation roles
@@ -9,7 +9,7 @@ SELinux maintainer, so we'll keep it until we have something better.
9 9
10Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1641 10Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1641
11Bug-Debian: http://bugs.debian.org/394795 11Bug-Debian: http://bugs.debian.org/394795
12Last-Update: 2013-09-14 12Last-Update: 2015-08-19
13 13
14Patch-Name: selinux-role.patch 14Patch-Name: selinux-role.patch
15--- 15---
@@ -32,10 +32,10 @@ Patch-Name: selinux-role.patch
32 16 files changed, 104 insertions(+), 31 deletions(-) 32 16 files changed, 104 insertions(+), 31 deletions(-)
33 33
34diff --git a/auth.h b/auth.h 34diff --git a/auth.h b/auth.h
35index d081c94..f099e98 100644 35index db86037..4985cd8 100644
36--- a/auth.h 36--- a/auth.h
37+++ b/auth.h 37+++ b/auth.h
38@@ -59,6 +59,7 @@ struct Authctxt { 38@@ -62,6 +62,7 @@ struct Authctxt {
39 char *service; 39 char *service;
40 struct passwd *pw; /* set if 'valid' */ 40 struct passwd *pw; /* set if 'valid' */
41 char *style; 41 char *style;
@@ -44,10 +44,10 @@ index d081c94..f099e98 100644
44 char *info; /* Extra info for next auth_log */ 44 char *info; /* Extra info for next auth_log */
45 #ifdef BSD_AUTH 45 #ifdef BSD_AUTH
46diff --git a/auth1.c b/auth1.c 46diff --git a/auth1.c b/auth1.c
47index 5038828..52b17db 100644 47index 5073c49..dd00648 100644
48--- a/auth1.c 48--- a/auth1.c
49+++ b/auth1.c 49+++ b/auth1.c
50@@ -381,7 +381,7 @@ void 50@@ -383,7 +383,7 @@ void
51 do_authentication(Authctxt *authctxt) 51 do_authentication(Authctxt *authctxt)
52 { 52 {
53 u_int ulen; 53 u_int ulen;
@@ -56,7 +56,7 @@ index 5038828..52b17db 100644
56 56
57 /* Get the name of the user that we wish to log in as. */ 57 /* Get the name of the user that we wish to log in as. */
58 packet_read_expect(SSH_CMSG_USER); 58 packet_read_expect(SSH_CMSG_USER);
59@@ -390,11 +390,17 @@ do_authentication(Authctxt *authctxt) 59@@ -392,11 +392,17 @@ do_authentication(Authctxt *authctxt)
60 user = packet_get_cstring(&ulen); 60 user = packet_get_cstring(&ulen);
61 packet_check_eom(); 61 packet_check_eom();
62 62
@@ -75,10 +75,10 @@ index 5038828..52b17db 100644
75 /* Verify that the user is a valid user. */ 75 /* Verify that the user is a valid user. */
76 if ((authctxt->pw = PRIVSEP(getpwnamallow(user))) != NULL) 76 if ((authctxt->pw = PRIVSEP(getpwnamallow(user))) != NULL)
77diff --git a/auth2.c b/auth2.c 77diff --git a/auth2.c b/auth2.c
78index 2f0d565..fa1a588 100644 78index 3f49bdc..6eb3cc7 100644
79--- a/auth2.c 79--- a/auth2.c
80+++ b/auth2.c 80+++ b/auth2.c
81@@ -217,7 +217,7 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt) 81@@ -216,7 +216,7 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt)
82 { 82 {
83 Authctxt *authctxt = ctxt; 83 Authctxt *authctxt = ctxt;
84 Authmethod *m = NULL; 84 Authmethod *m = NULL;
@@ -87,7 +87,7 @@ index 2f0d565..fa1a588 100644
87 int authenticated = 0; 87 int authenticated = 0;
88 88
89 if (authctxt == NULL) 89 if (authctxt == NULL)
90@@ -229,8 +229,13 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt) 90@@ -228,8 +228,13 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt)
91 debug("userauth-request for user %s service %s method %s", user, service, method); 91 debug("userauth-request for user %s service %s method %s", user, service, method);
92 debug("attempt %d failures %d", authctxt->attempt, authctxt->failures); 92 debug("attempt %d failures %d", authctxt->attempt, authctxt->failures);
93 93
@@ -101,7 +101,7 @@ index 2f0d565..fa1a588 100644
101 101
102 if (authctxt->attempt++ == 0) { 102 if (authctxt->attempt++ == 0) {
103 /* setup auth context */ 103 /* setup auth context */
104@@ -254,8 +259,9 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt) 104@@ -253,8 +258,9 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt)
105 use_privsep ? " [net]" : ""); 105 use_privsep ? " [net]" : "");
106 authctxt->service = xstrdup(service); 106 authctxt->service = xstrdup(service);
107 authctxt->style = style ? xstrdup(style) : NULL; 107 authctxt->style = style ? xstrdup(style) : NULL;
@@ -113,10 +113,10 @@ index 2f0d565..fa1a588 100644
113 if (auth2_setup_methods_lists(authctxt) != 0) 113 if (auth2_setup_methods_lists(authctxt) != 0)
114 packet_disconnect("no authentication methods enabled"); 114 packet_disconnect("no authentication methods enabled");
115diff --git a/monitor.c b/monitor.c 115diff --git a/monitor.c b/monitor.c
116index b0896ef..94b194d 100644 116index a2027e5..6ff05e4 100644
117--- a/monitor.c 117--- a/monitor.c
118+++ b/monitor.c 118+++ b/monitor.c
119@@ -148,6 +148,7 @@ int mm_answer_sign(int, Buffer *); 119@@ -127,6 +127,7 @@ int mm_answer_sign(int, Buffer *);
120 int mm_answer_pwnamallow(int, Buffer *); 120 int mm_answer_pwnamallow(int, Buffer *);
121 int mm_answer_auth2_read_banner(int, Buffer *); 121 int mm_answer_auth2_read_banner(int, Buffer *);
122 int mm_answer_authserv(int, Buffer *); 122 int mm_answer_authserv(int, Buffer *);
@@ -124,7 +124,7 @@ index b0896ef..94b194d 100644
124 int mm_answer_authpassword(int, Buffer *); 124 int mm_answer_authpassword(int, Buffer *);
125 int mm_answer_bsdauthquery(int, Buffer *); 125 int mm_answer_bsdauthquery(int, Buffer *);
126 int mm_answer_bsdauthrespond(int, Buffer *); 126 int mm_answer_bsdauthrespond(int, Buffer *);
127@@ -229,6 +230,7 @@ struct mon_table mon_dispatch_proto20[] = { 127@@ -208,6 +209,7 @@ struct mon_table mon_dispatch_proto20[] = {
128 {MONITOR_REQ_SIGN, MON_ONCE, mm_answer_sign}, 128 {MONITOR_REQ_SIGN, MON_ONCE, mm_answer_sign},
129 {MONITOR_REQ_PWNAM, MON_ONCE, mm_answer_pwnamallow}, 129 {MONITOR_REQ_PWNAM, MON_ONCE, mm_answer_pwnamallow},
130 {MONITOR_REQ_AUTHSERV, MON_ONCE, mm_answer_authserv}, 130 {MONITOR_REQ_AUTHSERV, MON_ONCE, mm_answer_authserv},
@@ -132,7 +132,7 @@ index b0896ef..94b194d 100644
132 {MONITOR_REQ_AUTH2_READ_BANNER, MON_ONCE, mm_answer_auth2_read_banner}, 132 {MONITOR_REQ_AUTH2_READ_BANNER, MON_ONCE, mm_answer_auth2_read_banner},
133 {MONITOR_REQ_AUTHPASSWORD, MON_AUTH, mm_answer_authpassword}, 133 {MONITOR_REQ_AUTHPASSWORD, MON_AUTH, mm_answer_authpassword},
134 #ifdef USE_PAM 134 #ifdef USE_PAM
135@@ -841,6 +843,7 @@ mm_answer_pwnamallow(int sock, Buffer *m) 135@@ -879,6 +881,7 @@ mm_answer_pwnamallow(int sock, Buffer *m)
136 else { 136 else {
137 /* Allow service/style information on the auth context */ 137 /* Allow service/style information on the auth context */
138 monitor_permit(mon_dispatch, MONITOR_REQ_AUTHSERV, 1); 138 monitor_permit(mon_dispatch, MONITOR_REQ_AUTHSERV, 1);
@@ -140,7 +140,7 @@ index b0896ef..94b194d 100644
140 monitor_permit(mon_dispatch, MONITOR_REQ_AUTH2_READ_BANNER, 1); 140 monitor_permit(mon_dispatch, MONITOR_REQ_AUTH2_READ_BANNER, 1);
141 } 141 }
142 #ifdef USE_PAM 142 #ifdef USE_PAM
143@@ -871,14 +874,37 @@ mm_answer_authserv(int sock, Buffer *m) 143@@ -909,14 +912,37 @@ mm_answer_authserv(int sock, Buffer *m)
144 144
145 authctxt->service = buffer_get_string(m, NULL); 145 authctxt->service = buffer_get_string(m, NULL);
146 authctxt->style = buffer_get_string(m, NULL); 146 authctxt->style = buffer_get_string(m, NULL);
@@ -180,7 +180,7 @@ index b0896ef..94b194d 100644
180 return (0); 180 return (0);
181 } 181 }
182 182
183@@ -1485,7 +1511,7 @@ mm_answer_pty(int sock, Buffer *m) 183@@ -1540,7 +1566,7 @@ mm_answer_pty(int sock, Buffer *m)
184 res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty)); 184 res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty));
185 if (res == 0) 185 if (res == 0)
186 goto error; 186 goto error;
@@ -190,7 +190,7 @@ index b0896ef..94b194d 100644
190 buffer_put_int(m, 1); 190 buffer_put_int(m, 1);
191 buffer_put_cstring(m, s->tty); 191 buffer_put_cstring(m, s->tty);
192diff --git a/monitor.h b/monitor.h 192diff --git a/monitor.h b/monitor.h
193index 7f32b0c..4d5e8fa 100644 193index bc50ade..2d82b8b 100644
194--- a/monitor.h 194--- a/monitor.h
195+++ b/monitor.h 195+++ b/monitor.h
196@@ -68,6 +68,8 @@ enum monitor_reqtype { 196@@ -68,6 +68,8 @@ enum monitor_reqtype {
@@ -203,10 +203,10 @@ index 7f32b0c..4d5e8fa 100644
203 203
204 struct mm_master; 204 struct mm_master;
205diff --git a/monitor_wrap.c b/monitor_wrap.c 205diff --git a/monitor_wrap.c b/monitor_wrap.c
206index e476f0d..6dc890a 100644 206index b667218..5aa9c47 100644
207--- a/monitor_wrap.c 207--- a/monitor_wrap.c
208+++ b/monitor_wrap.c 208+++ b/monitor_wrap.c
209@@ -324,10 +324,10 @@ mm_auth2_read_banner(void) 209@@ -329,10 +329,10 @@ mm_auth2_read_banner(void)
210 return (banner); 210 return (banner);
211 } 211 }
212 212
@@ -219,7 +219,7 @@ index e476f0d..6dc890a 100644
219 { 219 {
220 Buffer m; 220 Buffer m;
221 221
222@@ -336,12 +336,30 @@ mm_inform_authserv(char *service, char *style) 222@@ -341,12 +341,30 @@ mm_inform_authserv(char *service, char *style)
223 buffer_init(&m); 223 buffer_init(&m);
224 buffer_put_cstring(&m, service); 224 buffer_put_cstring(&m, service);
225 buffer_put_cstring(&m, style ? style : ""); 225 buffer_put_cstring(&m, style ? style : "");
@@ -251,13 +251,13 @@ index e476f0d..6dc890a 100644
251 int 251 int
252 mm_auth_password(Authctxt *authctxt, char *password) 252 mm_auth_password(Authctxt *authctxt, char *password)
253diff --git a/monitor_wrap.h b/monitor_wrap.h 253diff --git a/monitor_wrap.h b/monitor_wrap.h
254index a4e9d24..9c2ee49 100644 254index 0c770e8..4d1e899 100644
255--- a/monitor_wrap.h 255--- a/monitor_wrap.h
256+++ b/monitor_wrap.h 256+++ b/monitor_wrap.h
257@@ -41,7 +41,8 @@ void mm_log_handler(LogLevel, const char *, void *); 257@@ -41,7 +41,8 @@ void mm_log_handler(LogLevel, const char *, void *);
258 int mm_is_monitor(void); 258 int mm_is_monitor(void);
259 DH *mm_choose_dh(int, int, int); 259 DH *mm_choose_dh(int, int, int);
260 int mm_key_sign(Key *, u_char **, u_int *, u_char *, u_int); 260 int mm_key_sign(Key *, u_char **, u_int *, const u_char *, u_int);
261-void mm_inform_authserv(char *, char *); 261-void mm_inform_authserv(char *, char *);
262+void mm_inform_authserv(char *, char *, char *); 262+void mm_inform_authserv(char *, char *, char *);
263+void mm_inform_authrole(char *); 263+void mm_inform_authrole(char *);
@@ -396,10 +396,10 @@ index 1c7a45d..436ae7c 100644
396 char *platform_krb5_get_principal_name(const char *); 396 char *platform_krb5_get_principal_name(const char *);
397 int platform_sys_dir_uid(uid_t); 397 int platform_sys_dir_uid(uid_t);
398diff --git a/session.c b/session.c 398diff --git a/session.c b/session.c
399index 3e96557..6f389ac 100644 399index 54bac36..d4b7725 100644
400--- a/session.c 400--- a/session.c
401+++ b/session.c 401+++ b/session.c
402@@ -1486,7 +1486,7 @@ safely_chroot(const char *path, uid_t uid) 402@@ -1487,7 +1487,7 @@ safely_chroot(const char *path, uid_t uid)
403 403
404 /* Set login name, uid, gid, and groups. */ 404 /* Set login name, uid, gid, and groups. */
405 void 405 void
@@ -408,7 +408,7 @@ index 3e96557..6f389ac 100644
408 { 408 {
409 char *chroot_path, *tmp; 409 char *chroot_path, *tmp;
410 #ifdef USE_LIBIAF 410 #ifdef USE_LIBIAF
411@@ -1517,7 +1517,7 @@ do_setusercontext(struct passwd *pw) 411@@ -1518,7 +1518,7 @@ do_setusercontext(struct passwd *pw)
412 endgrent(); 412 endgrent();
413 #endif 413 #endif
414 414
@@ -417,7 +417,7 @@ index 3e96557..6f389ac 100644
417 417
418 if (options.chroot_directory != NULL && 418 if (options.chroot_directory != NULL &&
419 strcasecmp(options.chroot_directory, "none") != 0) { 419 strcasecmp(options.chroot_directory, "none") != 0) {
420@@ -1676,7 +1676,7 @@ do_child(Session *s, const char *command) 420@@ -1677,7 +1677,7 @@ do_child(Session *s, const char *command)
421 421
422 /* Force a password change */ 422 /* Force a password change */
423 if (s->authctxt->force_pwchange) { 423 if (s->authctxt->force_pwchange) {
@@ -426,7 +426,7 @@ index 3e96557..6f389ac 100644
426 child_close_fds(); 426 child_close_fds();
427 do_pwchange(s); 427 do_pwchange(s);
428 exit(1); 428 exit(1);
429@@ -1703,7 +1703,7 @@ do_child(Session *s, const char *command) 429@@ -1704,7 +1704,7 @@ do_child(Session *s, const char *command)
430 /* When PAM is enabled we rely on it to do the nologin check */ 430 /* When PAM is enabled we rely on it to do the nologin check */
431 if (!options.use_pam) 431 if (!options.use_pam)
432 do_nologin(pw); 432 do_nologin(pw);
@@ -435,7 +435,7 @@ index 3e96557..6f389ac 100644
435 /* 435 /*
436 * PAM session modules in do_setusercontext may have 436 * PAM session modules in do_setusercontext may have
437 * generated messages, so if this in an interactive 437 * generated messages, so if this in an interactive
438@@ -2114,7 +2114,7 @@ session_pty_req(Session *s) 438@@ -2115,7 +2115,7 @@ session_pty_req(Session *s)
439 tty_parse_modes(s->ttyfd, &n_bytes); 439 tty_parse_modes(s->ttyfd, &n_bytes);
440 440
441 if (!use_privsep) 441 if (!use_privsep)
@@ -458,10 +458,10 @@ index 6a2f35e..ef6593c 100644
458 const char *value); 458 const char *value);
459 459
460diff --git a/sshd.c b/sshd.c 460diff --git a/sshd.c b/sshd.c
461index 3a6be65..48a14dd 100644 461index 9cbe8c4..3b4e97c 100644
462--- a/sshd.c 462--- a/sshd.c
463+++ b/sshd.c 463+++ b/sshd.c
464@@ -772,7 +772,7 @@ privsep_postauth(Authctxt *authctxt) 464@@ -781,7 +781,7 @@ privsep_postauth(Authctxt *authctxt)
465 explicit_bzero(rnd, sizeof(rnd)); 465 explicit_bzero(rnd, sizeof(rnd));
466 466
467 /* Drop privileges */ 467 /* Drop privileges */
@@ -471,7 +471,7 @@ index 3a6be65..48a14dd 100644
471 skip: 471 skip:
472 /* It is safe now to apply the key state */ 472 /* It is safe now to apply the key state */
473diff --git a/sshpty.c b/sshpty.c 473diff --git a/sshpty.c b/sshpty.c
474index a2059b7..3512ec8 100644 474index d2ff8c1..f7b1f6d 100644
475--- a/sshpty.c 475--- a/sshpty.c
476+++ b/sshpty.c 476+++ b/sshpty.c
477@@ -187,7 +187,7 @@ pty_change_window_size(int ptyfd, u_int row, u_int col, 477@@ -187,7 +187,7 @@ pty_change_window_size(int ptyfd, u_int row, u_int col,
@@ -483,7 +483,7 @@ index a2059b7..3512ec8 100644
483 { 483 {
484 struct group *grp; 484 struct group *grp;
485 gid_t gid; 485 gid_t gid;
486@@ -214,7 +214,7 @@ pty_setowner(struct passwd *pw, const char *tty) 486@@ -209,7 +209,7 @@ pty_setowner(struct passwd *pw, const char *tty)
487 strerror(errno)); 487 strerror(errno));
488 488
489 #ifdef WITH_SELINUX 489 #ifdef WITH_SELINUX
diff --git a/debian/patches/shell-path.patch b/debian/patches/shell-path.patch
index 07e20f03d..549ef38dd 100644
--- a/debian/patches/shell-path.patch
+++ b/debian/patches/shell-path.patch
@@ -1,4 +1,4 @@
1From 66377fbb52584b41bd7f6f19116107fbbad41058 Mon Sep 17 00:00:00 2001 1From 8a8bbc66b8eefd7c679d5769f087209188deafe7 Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@debian.org> 2From: Colin Watson <cjwatson@debian.org>
3Date: Sun, 9 Feb 2014 16:10:00 +0000 3Date: Sun, 9 Feb 2014 16:10:00 +0000
4Subject: Look for $SHELL on the path for ProxyCommand/LocalCommand 4Subject: Look for $SHELL on the path for ProxyCommand/LocalCommand
@@ -16,10 +16,10 @@ Patch-Name: shell-path.patch
16 1 file changed, 2 insertions(+), 2 deletions(-) 16 1 file changed, 2 insertions(+), 2 deletions(-)
17 17
18diff --git a/sshconnect.c b/sshconnect.c 18diff --git a/sshconnect.c b/sshconnect.c
19index ac09eae..26116d2 100644 19index 9e51506..0073c6e 100644
20--- a/sshconnect.c 20--- a/sshconnect.c
21+++ b/sshconnect.c 21+++ b/sshconnect.c
22@@ -228,7 +228,7 @@ ssh_proxy_connect(const char *host, u_short port, const char *proxy_command) 22@@ -231,7 +231,7 @@ ssh_proxy_connect(const char *host, u_short port, const char *proxy_command)
23 /* Execute the proxy command. Note that we gave up any 23 /* Execute the proxy command. Note that we gave up any
24 extra privileges above. */ 24 extra privileges above. */
25 signal(SIGPIPE, SIG_DFL); 25 signal(SIGPIPE, SIG_DFL);
@@ -28,7 +28,7 @@ index ac09eae..26116d2 100644
28 perror(argv[0]); 28 perror(argv[0]);
29 exit(1); 29 exit(1);
30 } 30 }
31@@ -1416,7 +1416,7 @@ ssh_local_cmd(const char *args) 31@@ -1470,7 +1470,7 @@ ssh_local_cmd(const char *args)
32 if (pid == 0) { 32 if (pid == 0) {
33 signal(SIGPIPE, SIG_DFL); 33 signal(SIGPIPE, SIG_DFL);
34 debug3("Executing %s -c \"%s\"", shell, args); 34 debug3("Executing %s -c \"%s\"", shell, args);
diff --git a/debian/patches/sigstop.patch b/debian/patches/sigstop.patch
index 1eaa7758b..80e775dc1 100644
--- a/debian/patches/sigstop.patch
+++ b/debian/patches/sigstop.patch
@@ -1,4 +1,4 @@
1From 689f465c66059e527974c6d4ea8e95f04d5abab7 Mon Sep 17 00:00:00 2001 1From a8e779107942d044d281461c609ec29129dec51e Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@debian.org> 2From: Colin Watson <cjwatson@debian.org>
3Date: Sun, 9 Feb 2014 16:10:17 +0000 3Date: Sun, 9 Feb 2014 16:10:17 +0000
4Subject: Support synchronisation with service supervisor using SIGSTOP 4Subject: Support synchronisation with service supervisor using SIGSTOP
@@ -13,10 +13,10 @@ Patch-Name: sigstop.patch
13 1 file changed, 10 insertions(+) 13 1 file changed, 10 insertions(+)
14 14
15diff --git a/sshd.c b/sshd.c 15diff --git a/sshd.c b/sshd.c
16index 87331c1..23d5a64 100644 16index 5435968..f8db3ae 100644
17--- a/sshd.c 17--- a/sshd.c
18+++ b/sshd.c 18+++ b/sshd.c
19@@ -1958,6 +1958,16 @@ main(int ac, char **av) 19@@ -2030,6 +2030,16 @@ main(int ac, char **av)
20 } 20 }
21 } 21 }
22 22
diff --git a/debian/patches/ssh-agent-setgid.patch b/debian/patches/ssh-agent-setgid.patch
index 9c3ddc86e..b382252a3 100644
--- a/debian/patches/ssh-agent-setgid.patch
+++ b/debian/patches/ssh-agent-setgid.patch
@@ -1,4 +1,4 @@
1From 78dd041bb6ad29ceb35f05b539b09ccf761eaee2 Mon Sep 17 00:00:00 2001 1From 101d1dd7f95d75f1862c541a5b8d4032d4623d53 Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@debian.org> 2From: Colin Watson <cjwatson@debian.org>
3Date: Sun, 9 Feb 2014 16:10:13 +0000 3Date: Sun, 9 Feb 2014 16:10:13 +0000
4Subject: Document consequences of ssh-agent being setgid in ssh-agent(1) 4Subject: Document consequences of ssh-agent being setgid in ssh-agent(1)
@@ -13,10 +13,10 @@ Patch-Name: ssh-agent-setgid.patch
13 1 file changed, 15 insertions(+) 13 1 file changed, 15 insertions(+)
14 14
15diff --git a/ssh-agent.1 b/ssh-agent.1 15diff --git a/ssh-agent.1 b/ssh-agent.1
16index a1e634f..f2c4080 100644 16index 6759afe..25de326 100644
17--- a/ssh-agent.1 17--- a/ssh-agent.1
18+++ b/ssh-agent.1 18+++ b/ssh-agent.1
19@@ -172,6 +172,21 @@ environment variable holds the agent's process ID. 19@@ -181,6 +181,21 @@ environment variable holds the agent's process ID.
20 .Pp 20 .Pp
21 The agent exits automatically when the command given on the command 21 The agent exits automatically when the command given on the command
22 line terminates. 22 line terminates.
diff --git a/debian/patches/ssh-argv0.patch b/debian/patches/ssh-argv0.patch
index 0ccf7c42b..0fe3b6da4 100644
--- a/debian/patches/ssh-argv0.patch
+++ b/debian/patches/ssh-argv0.patch
@@ -1,4 +1,4 @@
1From cbd5cb03866f6df50c82d26588b73135d05bf245 Mon Sep 17 00:00:00 2001 1From fac628fd57d3d357b86d77987f896d6289240345 Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@debian.org> 2From: Colin Watson <cjwatson@debian.org>
3Date: Sun, 9 Feb 2014 16:10:10 +0000 3Date: Sun, 9 Feb 2014 16:10:10 +0000
4Subject: ssh(1): Refer to ssh-argv0(1) 4Subject: ssh(1): Refer to ssh-argv0(1)
@@ -18,10 +18,10 @@ Patch-Name: ssh-argv0.patch
18 1 file changed, 1 insertion(+) 18 1 file changed, 1 insertion(+)
19 19
20diff --git a/ssh.1 b/ssh.1 20diff --git a/ssh.1 b/ssh.1
21index de178cd..2606b15 100644 21index 04de6cf..c8892fe 100644
22--- a/ssh.1 22--- a/ssh.1
23+++ b/ssh.1 23+++ b/ssh.1
24@@ -1458,6 +1458,7 @@ if an error occurred. 24@@ -1471,6 +1471,7 @@ if an error occurred.
25 .Xr sftp 1 , 25 .Xr sftp 1 ,
26 .Xr ssh-add 1 , 26 .Xr ssh-add 1 ,
27 .Xr ssh-agent 1 , 27 .Xr ssh-agent 1 ,
diff --git a/debian/patches/ssh-vulnkey-compat.patch b/debian/patches/ssh-vulnkey-compat.patch
index 427ee6be1..28b98f527 100644
--- a/debian/patches/ssh-vulnkey-compat.patch
+++ b/debian/patches/ssh-vulnkey-compat.patch
@@ -1,4 +1,4 @@
1From e6836d7c98c75d3252de56c2f3ea07e12c817e00 Mon Sep 17 00:00:00 2001 1From d027dea6b4b659a7ad537e452db563763302eabd Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@ubuntu.com> 2From: Colin Watson <cjwatson@ubuntu.com>
3Date: Sun, 9 Feb 2014 16:09:50 +0000 3Date: Sun, 9 Feb 2014 16:09:50 +0000
4Subject: Accept obsolete ssh-vulnkey configuration options 4Subject: Accept obsolete ssh-vulnkey configuration options
@@ -17,10 +17,10 @@ Patch-Name: ssh-vulnkey-compat.patch
17 2 files changed, 2 insertions(+) 17 2 files changed, 2 insertions(+)
18 18
19diff --git a/readconf.c b/readconf.c 19diff --git a/readconf.c b/readconf.c
20index 9127e93..bc879eb 100644 20index 254dbce..278fe15 100644
21--- a/readconf.c 21--- a/readconf.c
22+++ b/readconf.c 22+++ b/readconf.c
23@@ -174,6 +174,7 @@ static struct { 23@@ -180,6 +180,7 @@ static struct {
24 { "passwordauthentication", oPasswordAuthentication }, 24 { "passwordauthentication", oPasswordAuthentication },
25 { "kbdinteractiveauthentication", oKbdInteractiveAuthentication }, 25 { "kbdinteractiveauthentication", oKbdInteractiveAuthentication },
26 { "kbdinteractivedevices", oKbdInteractiveDevices }, 26 { "kbdinteractivedevices", oKbdInteractiveDevices },
@@ -29,10 +29,10 @@ index 9127e93..bc879eb 100644
29 { "pubkeyauthentication", oPubkeyAuthentication }, 29 { "pubkeyauthentication", oPubkeyAuthentication },
30 { "dsaauthentication", oPubkeyAuthentication }, /* alias */ 30 { "dsaauthentication", oPubkeyAuthentication }, /* alias */
31diff --git a/servconf.c b/servconf.c 31diff --git a/servconf.c b/servconf.c
32index cb3c831..a252487 100644 32index f68c0d0..b3a2841 100644
33--- a/servconf.c 33--- a/servconf.c
34+++ b/servconf.c 34+++ b/servconf.c
35@@ -462,6 +462,7 @@ static struct { 35@@ -503,6 +503,7 @@ static struct {
36 { "x11uselocalhost", sX11UseLocalhost, SSHCFG_ALL }, 36 { "x11uselocalhost", sX11UseLocalhost, SSHCFG_ALL },
37 { "xauthlocation", sXAuthLocation, SSHCFG_GLOBAL }, 37 { "xauthlocation", sXAuthLocation, SSHCFG_GLOBAL },
38 { "strictmodes", sStrictModes, SSHCFG_GLOBAL }, 38 { "strictmodes", sStrictModes, SSHCFG_GLOBAL },
diff --git a/debian/patches/ssh1-keepalive.patch b/debian/patches/ssh1-keepalive.patch
index 2e5fa306d..e6bc72440 100644
--- a/debian/patches/ssh1-keepalive.patch
+++ b/debian/patches/ssh1-keepalive.patch
@@ -1,4 +1,4 @@
1From cbbc8577950b93090171c7394bcdeb68b7c3cd0c Mon Sep 17 00:00:00 2001 1From 396f7d932b391fc92ac7ccdf8813f49564e2bbab Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@debian.org> 2From: Colin Watson <cjwatson@debian.org>
3Date: Sun, 9 Feb 2014 16:09:51 +0000 3Date: Sun, 9 Feb 2014 16:09:51 +0000
4Subject: Partial server keep-alive implementation for SSH1 4Subject: Partial server keep-alive implementation for SSH1
@@ -13,10 +13,10 @@ Patch-Name: ssh1-keepalive.patch
13 2 files changed, 19 insertions(+), 11 deletions(-) 13 2 files changed, 19 insertions(+), 11 deletions(-)
14 14
15diff --git a/clientloop.c b/clientloop.c 15diff --git a/clientloop.c b/clientloop.c
16index f9175e3..046ca8b 100644 16index 7df9413..156a196 100644
17--- a/clientloop.c 17--- a/clientloop.c
18+++ b/clientloop.c 18+++ b/clientloop.c
19@@ -563,16 +563,21 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt) 19@@ -564,16 +564,21 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt)
20 static void 20 static void
21 server_alive_check(void) 21 server_alive_check(void)
22 { 22 {
@@ -47,7 +47,7 @@ index f9175e3..046ca8b 100644
47 } 47 }
48 48
49 /* 49 /*
50@@ -634,7 +639,7 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, 50@@ -635,7 +640,7 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp,
51 */ 51 */
52 52
53 timeout_secs = INT_MAX; /* we use INT_MAX to mean no timeout */ 53 timeout_secs = INT_MAX; /* we use INT_MAX to mean no timeout */
@@ -57,10 +57,10 @@ index f9175e3..046ca8b 100644
57 server_alive_time = now + options.server_alive_interval; 57 server_alive_time = now + options.server_alive_interval;
58 } 58 }
59diff --git a/ssh_config.5 b/ssh_config.5 59diff --git a/ssh_config.5 b/ssh_config.5
60index e6649ac..01f1f7f 100644 60index 4476171..dd35dd8 100644
61--- a/ssh_config.5 61--- a/ssh_config.5
62+++ b/ssh_config.5 62+++ b/ssh_config.5
63@@ -1325,7 +1325,10 @@ If, for example, 63@@ -1409,7 +1409,10 @@ If, for example,
64 .Cm ServerAliveCountMax 64 .Cm ServerAliveCountMax
65 is left at the default, if the server becomes unresponsive, 65 is left at the default, if the server becomes unresponsive,
66 ssh will disconnect after approximately 45 seconds. 66 ssh will disconnect after approximately 45 seconds.
diff --git a/debian/patches/syslog-level-silent.patch b/debian/patches/syslog-level-silent.patch
index bfc236927..d760e6c19 100644
--- a/debian/patches/syslog-level-silent.patch
+++ b/debian/patches/syslog-level-silent.patch
@@ -1,4 +1,4 @@
1From 69f7c00e04d1baa01a9038eeb764cfed0830fb19 Mon Sep 17 00:00:00 2001 1From fbe5bd9e957ea90404158b3a3c11a6b91fe6f010 Mon Sep 17 00:00:00 2001
2From: Jonathan David Amery <jdamery@ysolde.ucam.org> 2From: Jonathan David Amery <jdamery@ysolde.ucam.org>
3Date: Sun, 9 Feb 2014 16:09:54 +0000 3Date: Sun, 9 Feb 2014 16:09:54 +0000
4Subject: "LogLevel SILENT" compatibility 4Subject: "LogLevel SILENT" compatibility
@@ -33,10 +33,10 @@ index 32e1d2e..53e7b65 100644
33 { "FATAL", SYSLOG_LEVEL_FATAL }, 33 { "FATAL", SYSLOG_LEVEL_FATAL },
34 { "ERROR", SYSLOG_LEVEL_ERROR }, 34 { "ERROR", SYSLOG_LEVEL_ERROR },
35diff --git a/ssh.c b/ssh.c 35diff --git a/ssh.c b/ssh.c
36index 26e9681..5bce695 100644 36index 0ad82f0..e8be6fe 100644
37--- a/ssh.c 37--- a/ssh.c
38+++ b/ssh.c 38+++ b/ssh.c
39@@ -989,7 +989,7 @@ main(int ac, char **av) 39@@ -1107,7 +1107,7 @@ main(int ac, char **av)
40 /* Do not allocate a tty if stdin is not a tty. */ 40 /* Do not allocate a tty if stdin is not a tty. */
41 if ((!isatty(fileno(stdin)) || stdin_null_flag) && 41 if ((!isatty(fileno(stdin)) || stdin_null_flag) &&
42 options.request_tty != REQUEST_TTY_FORCE) { 42 options.request_tty != REQUEST_TTY_FORCE) {
diff --git a/debian/patches/user-group-modes.patch b/debian/patches/user-group-modes.patch
index e4e4657f3..8ce3d1f71 100644
--- a/debian/patches/user-group-modes.patch
+++ b/debian/patches/user-group-modes.patch
@@ -1,4 +1,4 @@
1From 28ea747089f695e58a476a2849133402d4f86b92 Mon Sep 17 00:00:00 2001 1From 39b2121148a0aa016a648446823c8f02c5fd95b3 Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@debian.org> 2From: Colin Watson <cjwatson@debian.org>
3Date: Sun, 9 Feb 2014 16:09:58 +0000 3Date: Sun, 9 Feb 2014 16:09:58 +0000
4Subject: Allow harmless group-writability 4Subject: Allow harmless group-writability
@@ -28,10 +28,10 @@ Patch-Name: user-group-modes.patch
28 8 files changed, 82 insertions(+), 29 deletions(-) 28 8 files changed, 82 insertions(+), 29 deletions(-)
29 29
30diff --git a/auth-rhosts.c b/auth-rhosts.c 30diff --git a/auth-rhosts.c b/auth-rhosts.c
31index b5bedee..11fcca6 100644 31index ee9e827..2ff2cff 100644
32--- a/auth-rhosts.c 32--- a/auth-rhosts.c
33+++ b/auth-rhosts.c 33+++ b/auth-rhosts.c
34@@ -256,8 +256,7 @@ auth_rhosts2_raw(struct passwd *pw, const char *client_user, const char *hostnam 34@@ -271,8 +271,7 @@ auth_rhosts2_raw(struct passwd *pw, const char *client_user, const char *hostnam
35 return 0; 35 return 0;
36 } 36 }
37 if (options.strict_modes && 37 if (options.strict_modes &&
@@ -41,7 +41,7 @@ index b5bedee..11fcca6 100644
41 logit("Rhosts authentication refused for %.100s: " 41 logit("Rhosts authentication refused for %.100s: "
42 "bad ownership or modes for home directory.", pw->pw_name); 42 "bad ownership or modes for home directory.", pw->pw_name);
43 auth_debug_add("Rhosts authentication refused for %.100s: " 43 auth_debug_add("Rhosts authentication refused for %.100s: "
44@@ -283,8 +282,7 @@ auth_rhosts2_raw(struct passwd *pw, const char *client_user, const char *hostnam 44@@ -298,8 +297,7 @@ auth_rhosts2_raw(struct passwd *pw, const char *client_user, const char *hostnam
45 * allowing access to their account by anyone. 45 * allowing access to their account by anyone.
46 */ 46 */
47 if (options.strict_modes && 47 if (options.strict_modes &&
@@ -52,10 +52,10 @@ index b5bedee..11fcca6 100644
52 pw->pw_name, buf); 52 pw->pw_name, buf);
53 auth_debug_add("Bad file modes for %.200s", buf); 53 auth_debug_add("Bad file modes for %.200s", buf);
54diff --git a/auth.c b/auth.c 54diff --git a/auth.c b/auth.c
55index 5e60682..18de51a 100644 55index f9b7673..41e3876 100644
56--- a/auth.c 56--- a/auth.c
57+++ b/auth.c 57+++ b/auth.c
58@@ -421,8 +421,7 @@ check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host, 58@@ -423,8 +423,7 @@ check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host,
59 user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); 59 user_hostfile = tilde_expand_filename(userfile, pw->pw_uid);
60 if (options.strict_modes && 60 if (options.strict_modes &&
61 (stat(user_hostfile, &st) == 0) && 61 (stat(user_hostfile, &st) == 0) &&
@@ -65,7 +65,7 @@ index 5e60682..18de51a 100644
65 logit("Authentication refused for %.100s: " 65 logit("Authentication refused for %.100s: "
66 "bad owner or modes for %.200s", 66 "bad owner or modes for %.200s",
67 pw->pw_name, user_hostfile); 67 pw->pw_name, user_hostfile);
68@@ -484,8 +483,7 @@ auth_secure_path(const char *name, struct stat *stp, const char *pw_dir, 68@@ -486,8 +485,7 @@ auth_secure_path(const char *name, struct stat *stp, const char *pw_dir,
69 snprintf(err, errlen, "%s is not a regular file", buf); 69 snprintf(err, errlen, "%s is not a regular file", buf);
70 return -1; 70 return -1;
71 } 71 }
@@ -75,7 +75,7 @@ index 5e60682..18de51a 100644
75 snprintf(err, errlen, "bad ownership or modes for file %s", 75 snprintf(err, errlen, "bad ownership or modes for file %s",
76 buf); 76 buf);
77 return -1; 77 return -1;
78@@ -500,8 +498,7 @@ auth_secure_path(const char *name, struct stat *stp, const char *pw_dir, 78@@ -502,8 +500,7 @@ auth_secure_path(const char *name, struct stat *stp, const char *pw_dir,
79 strlcpy(buf, cp, sizeof(buf)); 79 strlcpy(buf, cp, sizeof(buf));
80 80
81 if (stat(buf, &st) < 0 || 81 if (stat(buf, &st) < 0 ||
@@ -86,7 +86,7 @@ index 5e60682..18de51a 100644
86 "bad ownership or modes for directory %s", buf); 86 "bad ownership or modes for directory %s", buf);
87 return -1; 87 return -1;
88diff --git a/misc.c b/misc.c 88diff --git a/misc.c b/misc.c
89index 94b05b0..c25ccd8 100644 89index 38af3df..d745480 100644
90--- a/misc.c 90--- a/misc.c
91+++ b/misc.c 91+++ b/misc.c
92@@ -50,8 +50,9 @@ 92@@ -50,8 +50,9 @@
@@ -216,10 +216,10 @@ index f35ec39..9a23e6e 100644
216- return 0; 216- return 0;
217-} 217-}
218diff --git a/readconf.c b/readconf.c 218diff --git a/readconf.c b/readconf.c
219index 337818c..0648867 100644 219index 1d2d596..2ef8d7b 100644
220--- a/readconf.c 220--- a/readconf.c
221+++ b/readconf.c 221+++ b/readconf.c
222@@ -38,6 +38,8 @@ 222@@ -39,6 +39,8 @@
223 #include <stdio.h> 223 #include <stdio.h>
224 #include <string.h> 224 #include <string.h>
225 #include <unistd.h> 225 #include <unistd.h>
@@ -228,7 +228,7 @@ index 337818c..0648867 100644
228 #ifdef HAVE_UTIL_H 228 #ifdef HAVE_UTIL_H
229 #include <util.h> 229 #include <util.h>
230 #endif 230 #endif
231@@ -1516,8 +1518,7 @@ read_config_file(const char *filename, struct passwd *pw, const char *host, 231@@ -1579,8 +1581,7 @@ read_config_file(const char *filename, struct passwd *pw, const char *host,
232 232
233 if (fstat(fileno(f), &sb) == -1) 233 if (fstat(fileno(f), &sb) == -1)
234 fatal("fstat %s: %s", filename, strerror(errno)); 234 fatal("fstat %s: %s", filename, strerror(errno));
@@ -239,10 +239,10 @@ index 337818c..0648867 100644
239 } 239 }
240 240
241diff --git a/ssh.1 b/ssh.1 241diff --git a/ssh.1 b/ssh.1
242index fa5cfb2..7f6ab77 100644 242index da64b71..53c711a 100644
243--- a/ssh.1 243--- a/ssh.1
244+++ b/ssh.1 244+++ b/ssh.1
245@@ -1342,6 +1342,8 @@ The file format and configuration options are described in 245@@ -1355,6 +1355,8 @@ The file format and configuration options are described in
246 .Xr ssh_config 5 . 246 .Xr ssh_config 5 .
247 Because of the potential for abuse, this file must have strict permissions: 247 Because of the potential for abuse, this file must have strict permissions:
248 read/write for the user, and not writable by others. 248 read/write for the user, and not writable by others.
@@ -252,10 +252,10 @@ index fa5cfb2..7f6ab77 100644
252 .It Pa ~/.ssh/environment 252 .It Pa ~/.ssh/environment
253 Contains additional definitions for environment variables; see 253 Contains additional definitions for environment variables; see
254diff --git a/ssh_config.5 b/ssh_config.5 254diff --git a/ssh_config.5 b/ssh_config.5
255index ea92ea8..d68b45a 100644 255index 250c0d1..8abcf40 100644
256--- a/ssh_config.5 256--- a/ssh_config.5
257+++ b/ssh_config.5 257+++ b/ssh_config.5
258@@ -1587,6 +1587,8 @@ The format of this file is described above. 258@@ -1701,6 +1701,8 @@ The format of this file is described above.
259 This file is used by the SSH client. 259 This file is used by the SSH client.
260 Because of the potential for abuse, this file must have strict permissions: 260 Because of the potential for abuse, this file must have strict permissions:
261 read/write for the user, and not accessible by others. 261 read/write for the user, and not accessible by others.
diff --git a/debian/rules b/debian/rules
index 570e6519f..d377ed2b0 100755
--- a/debian/rules
+++ b/debian/rules
@@ -148,7 +148,10 @@ ifeq ($(RUN_TESTS),yes)
148 $(MAKE) -C build-deb regress-prep 148 $(MAKE) -C build-deb regress-prep
149 $(MAKE) -C build-deb $(PARALLEL) \ 149 $(MAKE) -C build-deb $(PARALLEL) \
150 regress/unittests/sshbuf/test_sshbuf \ 150 regress/unittests/sshbuf/test_sshbuf \
151 regress/unittests/sshkey/test_sshkey 151 regress/unittests/sshkey/test_sshkey \
152 regress/unittests/bitmap/test_bitmap \
153 regress/unittests/hostkeys/test_hostkeys \
154 regress/unittests/kex/test_kex
152 $(MAKE) -C build-deb/regress \ 155 $(MAKE) -C build-deb/regress \
153 .OBJDIR="$(CURDIR)/build-deb/regress" \ 156 .OBJDIR="$(CURDIR)/build-deb/regress" \
154 .CURDIR="$(CURDIR)/regress" \ 157 .CURDIR="$(CURDIR)/regress" \
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 e5872c190..a406f5864 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;
@@ -209,12 +212,12 @@ verify_host_key_dns(const char *hostname, struct sockaddr *address,
209 u_int8_t hostkey_algorithm; 212 u_int8_t hostkey_algorithm;
210 u_int8_t hostkey_digest_type = SSHFP_HASH_RESERVED; 213 u_int8_t hostkey_digest_type = SSHFP_HASH_RESERVED;
211 u_char *hostkey_digest; 214 u_char *hostkey_digest;
212 u_int hostkey_digest_len; 215 size_t hostkey_digest_len;
213 216
214 u_int8_t dnskey_algorithm; 217 u_int8_t dnskey_algorithm;
215 u_int8_t dnskey_digest_type; 218 u_int8_t dnskey_digest_type;
216 u_char *dnskey_digest; 219 u_char *dnskey_digest;
217 u_int dnskey_digest_len; 220 size_t dnskey_digest_len;
218 221
219 *flags = 0; 222 *flags = 0;
220 223
@@ -303,7 +306,7 @@ verify_host_key_dns(const char *hostname, struct sockaddr *address,
303 free(dnskey_digest); 306 free(dnskey_digest);
304 } 307 }
305 308
306 free(hostkey_digest); /* from key_fingerprint_raw() */ 309 free(hostkey_digest); /* from sshkey_fingerprint_raw() */
307 freerrset(fingerprints); 310 freerrset(fingerprints);
308 311
309 if (*flags & DNS_VERIFY_FOUND) 312 if (*flags & DNS_VERIFY_FOUND)
@@ -321,13 +324,13 @@ verify_host_key_dns(const char *hostname, struct sockaddr *address,
321 * Export the fingerprint of a key as a DNS resource record 324 * Export the fingerprint of a key as a DNS resource record
322 */ 325 */
323int 326int
324export_dns_rr(const char *hostname, Key *key, FILE *f, int generic) 327export_dns_rr(const char *hostname, struct sshkey *key, FILE *f, int generic)
325{ 328{
326 u_int8_t rdata_pubkey_algorithm = 0; 329 u_int8_t rdata_pubkey_algorithm = 0;
327 u_int8_t rdata_digest_type = SSHFP_HASH_RESERVED; 330 u_int8_t rdata_digest_type = SSHFP_HASH_RESERVED;
328 u_int8_t dtype; 331 u_int8_t dtype;
329 u_char *rdata_digest; 332 u_char *rdata_digest;
330 u_int i, rdata_digest_len; 333 size_t i, rdata_digest_len;
331 int success = 0; 334 int success = 0;
332 335
333 for (dtype = SSHFP_HASH_SHA1; dtype < SSHFP_HASH_MAX; dtype++) { 336 for (dtype = SSHFP_HASH_SHA1; dtype < SSHFP_HASH_MAX; dtype++) {
@@ -335,7 +338,7 @@ export_dns_rr(const char *hostname, Key *key, FILE *f, int generic)
335 if (dns_read_key(&rdata_pubkey_algorithm, &rdata_digest_type, 338 if (dns_read_key(&rdata_pubkey_algorithm, &rdata_digest_type,
336 &rdata_digest, &rdata_digest_len, key)) { 339 &rdata_digest, &rdata_digest_len, key)) {
337 if (generic) { 340 if (generic) {
338 fprintf(f, "%s IN TYPE%d \\# %d %02x %02x ", 341 fprintf(f, "%s IN TYPE%d \\# %zu %02x %02x ",
339 hostname, DNS_RDATATYPE_SSHFP, 342 hostname, DNS_RDATATYPE_SSHFP,
340 2 + rdata_digest_len, 343 2 + rdata_digest_len,
341 rdata_pubkey_algorithm, rdata_digest_type); 344 rdata_pubkey_algorithm, rdata_digest_type);
@@ -346,7 +349,7 @@ export_dns_rr(const char *hostname, Key *key, FILE *f, int generic)
346 for (i = 0; i < rdata_digest_len; i++) 349 for (i = 0; i < rdata_digest_len; i++)
347 fprintf(f, "%02x", rdata_digest[i]); 350 fprintf(f, "%02x", rdata_digest[i]);
348 fprintf(f, "\n"); 351 fprintf(f, "\n");
349 free(rdata_digest); /* from key_fingerprint_raw() */ 352 free(rdata_digest); /* from sshkey_fingerprint_raw() */
350 success = 1; 353 success = 1;
351 } 354 }
352 } 355 }
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 1e569adc3..5610f0bf2 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-2009 Simon Wilkinson. All rights reserved. 4 * Copyright (c) 2001-2009 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 50fa43834..539862d67 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-2009 Simon Wilkinson. All rights reserved. 4 * Copyright (c) 2001-2009 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 891852b54..be938ad04 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#ifdef GSSAPI 58#ifdef GSSAPI
@@ -66,12 +68,12 @@ extern const EVP_MD *evp_ssh_sha256(void);
66#endif 68#endif
67 69
68/* prototype */ 70/* prototype */
69static void kex_kexinit_finish(Kex *); 71static int kex_choose_conf(struct ssh *);
70static void kex_choose_conf(Kex *); 72static int kex_input_newkeys(int, u_int32_t, void *);
71 73
72struct kexalg { 74struct kexalg {
73 char *name; 75 char *name;
74 int type; 76 u_int type;
75 int ec_nid; 77 int ec_nid;
76 int hash_alg; 78 int hash_alg;
77}; 79};
@@ -93,11 +95,10 @@ static const struct kexalg kexalgs[] = {
93 SSH_DIGEST_SHA512 }, 95 SSH_DIGEST_SHA512 },
94# endif /* OPENSSL_HAS_NISTP521 */ 96# endif /* OPENSSL_HAS_NISTP521 */
95#endif /* OPENSSL_HAS_ECC */ 97#endif /* OPENSSL_HAS_ECC */
96 { KEX_DH1, KEX_DH_GRP1_SHA1, 0, SSH_DIGEST_SHA1 },
97#endif /* WITH_OPENSSL */ 98#endif /* WITH_OPENSSL */
98#ifdef HAVE_EVP_SHA256 99#if defined(HAVE_EVP_SHA256) || !defined(WITH_OPENSSL)
99 { KEX_CURVE25519_SHA256, KEX_C25519_SHA256, 0, SSH_DIGEST_SHA256 }, 100 { KEX_CURVE25519_SHA256, KEX_C25519_SHA256, 0, SSH_DIGEST_SHA256 },
100#endif /* HAVE_EVP_SHA256 */ 101#endif /* HAVE_EVP_SHA256 || !WITH_OPENSSL */
101 { NULL, -1, -1, -1}, 102 { NULL, -1, -1, -1},
102}; 103};
103static const struct kexalg kexalg_prefixes[] = { 104static const struct kexalg kexalg_prefixes[] = {
@@ -112,7 +113,7 @@ static const struct kexalg kexalg_prefixes[] = {
112char * 113char *
113kex_alg_list(char sep) 114kex_alg_list(char sep)
114{ 115{
115 char *ret = NULL; 116 char *ret = NULL, *tmp;
116 size_t nlen, rlen = 0; 117 size_t nlen, rlen = 0;
117 const struct kexalg *k; 118 const struct kexalg *k;
118 119
@@ -120,7 +121,11 @@ kex_alg_list(char sep)
120 if (ret != NULL) 121 if (ret != NULL)
121 ret[rlen++] = sep; 122 ret[rlen++] = sep;
122 nlen = strlen(k->name); 123 nlen = strlen(k->name);
123 ret = xrealloc(ret, 1, rlen + nlen + 2); 124 if ((tmp = realloc(ret, rlen + nlen + 2)) == NULL) {
125 free(ret);
126 return NULL;
127 }
128 ret = tmp;
124 memcpy(ret + rlen, k->name, nlen + 1); 129 memcpy(ret + rlen, k->name, nlen + 1);
125 rlen += nlen; 130 rlen += nlen;
126 } 131 }
@@ -151,7 +156,8 @@ kex_names_valid(const char *names)
151 156
152 if (names == NULL || strcmp(names, "") == 0) 157 if (names == NULL || strcmp(names, "") == 0)
153 return 0; 158 return 0;
154 s = cp = xstrdup(names); 159 if ((s = cp = strdup(names)) == NULL)
160 return 0;
155 for ((p = strsep(&cp, ",")); p && *p != '\0'; 161 for ((p = strsep(&cp, ",")); p && *p != '\0';
156 (p = strsep(&cp, ","))) { 162 (p = strsep(&cp, ","))) {
157 if (kex_alg_by_name(p) == NULL) { 163 if (kex_alg_by_name(p) == NULL) {
@@ -166,56 +172,75 @@ kex_names_valid(const char *names)
166} 172}
167 173
168/* put algorithm proposal into buffer */ 174/* put algorithm proposal into buffer */
169static void 175int
170kex_prop2buf(Buffer *b, char *proposal[PROPOSAL_MAX]) 176kex_prop2buf(struct sshbuf *b, char *proposal[PROPOSAL_MAX])
171{ 177{
172 u_int i; 178 u_int i;
179 int r;
180
181 sshbuf_reset(b);
173 182
174 buffer_clear(b);
175 /* 183 /*
176 * add a dummy cookie, the cookie will be overwritten by 184 * add a dummy cookie, the cookie will be overwritten by
177 * kex_send_kexinit(), each time a kexinit is set 185 * kex_send_kexinit(), each time a kexinit is set
178 */ 186 */
179 for (i = 0; i < KEX_COOKIE_LEN; i++) 187 for (i = 0; i < KEX_COOKIE_LEN; i++) {
180 buffer_put_char(b, 0); 188 if ((r = sshbuf_put_u8(b, 0)) != 0)
181 for (i = 0; i < PROPOSAL_MAX; i++) 189 return r;
182 buffer_put_cstring(b, proposal[i]); 190 }
183 buffer_put_char(b, 0); /* first_kex_packet_follows */ 191 for (i = 0; i < PROPOSAL_MAX; i++) {
184 buffer_put_int(b, 0); /* uint32 reserved */ 192 if ((r = sshbuf_put_cstring(b, proposal[i])) != 0)
193 return r;
194 }
195 if ((r = sshbuf_put_u8(b, 0)) != 0 || /* first_kex_packet_follows */
196 (r = sshbuf_put_u32(b, 0)) != 0) /* uint32 reserved */
197 return r;
198 return 0;
185} 199}
186 200
187/* parse buffer and return algorithm proposal */ 201/* parse buffer and return algorithm proposal */
188static char ** 202int
189kex_buf2prop(Buffer *raw, int *first_kex_follows) 203kex_buf2prop(struct sshbuf *raw, int *first_kex_follows, char ***propp)
190{ 204{
191 Buffer b; 205 struct sshbuf *b = NULL;
206 u_char v;
192 u_int i; 207 u_int i;
193 char **proposal; 208 char **proposal = NULL;
194 209 int r;
195 proposal = xcalloc(PROPOSAL_MAX, sizeof(char *)); 210
196 211 *propp = NULL;
197 buffer_init(&b); 212 if ((proposal = calloc(PROPOSAL_MAX, sizeof(char *))) == NULL)
198 buffer_append(&b, buffer_ptr(raw), buffer_len(raw)); 213 return SSH_ERR_ALLOC_FAIL;
199 /* skip cookie */ 214 if ((b = sshbuf_fromb(raw)) == NULL) {
200 for (i = 0; i < KEX_COOKIE_LEN; i++) 215 r = SSH_ERR_ALLOC_FAIL;
201 buffer_get_char(&b); 216 goto out;
217 }
218 if ((r = sshbuf_consume(b, KEX_COOKIE_LEN)) != 0) /* skip cookie */
219 goto out;
202 /* extract kex init proposal strings */ 220 /* extract kex init proposal strings */
203 for (i = 0; i < PROPOSAL_MAX; i++) { 221 for (i = 0; i < PROPOSAL_MAX; i++) {
204 proposal[i] = buffer_get_cstring(&b,NULL); 222 if ((r = sshbuf_get_cstring(b, &(proposal[i]), NULL)) != 0)
223 goto out;
205 debug2("kex_parse_kexinit: %s", proposal[i]); 224 debug2("kex_parse_kexinit: %s", proposal[i]);
206 } 225 }
207 /* first kex follows / reserved */ 226 /* first kex follows / reserved */
208 i = buffer_get_char(&b); 227 if ((r = sshbuf_get_u8(b, &v)) != 0 ||
228 (r = sshbuf_get_u32(b, &i)) != 0)
229 goto out;
209 if (first_kex_follows != NULL) 230 if (first_kex_follows != NULL)
210 *first_kex_follows = i; 231 *first_kex_follows = i;
211 debug2("kex_parse_kexinit: first_kex_follows %d ", i); 232 debug2("kex_parse_kexinit: first_kex_follows %d ", v);
212 i = buffer_get_int(&b);
213 debug2("kex_parse_kexinit: reserved %u ", i); 233 debug2("kex_parse_kexinit: reserved %u ", i);
214 buffer_free(&b); 234 r = 0;
215 return proposal; 235 *propp = proposal;
236 out:
237 if (r != 0 && proposal != NULL)
238 kex_prop_free(proposal);
239 sshbuf_free(b);
240 return r;
216} 241}
217 242
218static void 243void
219kex_prop_free(char **proposal) 244kex_prop_free(char **proposal)
220{ 245{
221 u_int i; 246 u_int i;
@@ -226,97 +251,111 @@ kex_prop_free(char **proposal)
226} 251}
227 252
228/* ARGSUSED */ 253/* ARGSUSED */
229static void 254static int
230kex_protocol_error(int type, u_int32_t seq, void *ctxt) 255kex_protocol_error(int type, u_int32_t seq, void *ctxt)
231{ 256{
232 error("Hm, kex protocol error: type %d seq %u", type, seq); 257 error("Hm, kex protocol error: type %d seq %u", type, seq);
258 return 0;
233} 259}
234 260
235static void 261static void
236kex_reset_dispatch(void) 262kex_reset_dispatch(struct ssh *ssh)
237{ 263{
238 dispatch_range(SSH2_MSG_TRANSPORT_MIN, 264 ssh_dispatch_range(ssh, SSH2_MSG_TRANSPORT_MIN,
239 SSH2_MSG_TRANSPORT_MAX, &kex_protocol_error); 265 SSH2_MSG_TRANSPORT_MAX, &kex_protocol_error);
240 dispatch_set(SSH2_MSG_KEXINIT, &kex_input_kexinit); 266 ssh_dispatch_set(ssh, SSH2_MSG_KEXINIT, &kex_input_kexinit);
241} 267}
242 268
243void 269int
244kex_finish(Kex *kex) 270kex_send_newkeys(struct ssh *ssh)
245{ 271{
246 kex_reset_dispatch(); 272 int r;
247 273
248 packet_start(SSH2_MSG_NEWKEYS); 274 kex_reset_dispatch(ssh);
249 packet_send(); 275 if ((r = sshpkt_start(ssh, SSH2_MSG_NEWKEYS)) != 0 ||
250 /* packet_write_wait(); */ 276 (r = sshpkt_send(ssh)) != 0)
277 return r;
251 debug("SSH2_MSG_NEWKEYS sent"); 278 debug("SSH2_MSG_NEWKEYS sent");
252
253 debug("expecting SSH2_MSG_NEWKEYS"); 279 debug("expecting SSH2_MSG_NEWKEYS");
254 packet_read_expect(SSH2_MSG_NEWKEYS); 280 ssh_dispatch_set(ssh, SSH2_MSG_NEWKEYS, &kex_input_newkeys);
255 packet_check_eom(); 281 return 0;
256 debug("SSH2_MSG_NEWKEYS received"); 282}
283
284static int
285kex_input_newkeys(int type, u_int32_t seq, void *ctxt)
286{
287 struct ssh *ssh = ctxt;
288 struct kex *kex = ssh->kex;
289 int r;
257 290
291 debug("SSH2_MSG_NEWKEYS received");
292 ssh_dispatch_set(ssh, SSH2_MSG_NEWKEYS, &kex_protocol_error);
293 if ((r = sshpkt_get_end(ssh)) != 0)
294 return r;
258 kex->done = 1; 295 kex->done = 1;
259 buffer_clear(&kex->peer); 296 sshbuf_reset(kex->peer);
260 /* buffer_clear(&kex->my); */ 297 /* sshbuf_reset(kex->my); */
261 kex->flags &= ~KEX_INIT_SENT; 298 kex->flags &= ~KEX_INIT_SENT;
262 free(kex->name); 299 free(kex->name);
263 kex->name = NULL; 300 kex->name = NULL;
301 return 0;
264} 302}
265 303
266void 304int
267kex_send_kexinit(Kex *kex) 305kex_send_kexinit(struct ssh *ssh)
268{ 306{
269 u_int32_t rnd = 0;
270 u_char *cookie; 307 u_char *cookie;
271 u_int i; 308 struct kex *kex = ssh->kex;
309 int r;
272 310
273 if (kex == NULL) { 311 if (kex == NULL)
274 error("kex_send_kexinit: no kex, cannot rekey"); 312 return SSH_ERR_INTERNAL_ERROR;
275 return; 313 if (kex->flags & KEX_INIT_SENT)
276 } 314 return 0;
277 if (kex->flags & KEX_INIT_SENT) {
278 debug("KEX_INIT_SENT");
279 return;
280 }
281 kex->done = 0; 315 kex->done = 0;
282 316
283 /* generate a random cookie */ 317 /* generate a random cookie */
284 if (buffer_len(&kex->my) < KEX_COOKIE_LEN) 318 if (sshbuf_len(kex->my) < KEX_COOKIE_LEN)
285 fatal("kex_send_kexinit: kex proposal too short"); 319 return SSH_ERR_INVALID_FORMAT;
286 cookie = buffer_ptr(&kex->my); 320 if ((cookie = sshbuf_mutable_ptr(kex->my)) == NULL)
287 for (i = 0; i < KEX_COOKIE_LEN; i++) { 321 return SSH_ERR_INTERNAL_ERROR;
288 if (i % 4 == 0) 322 arc4random_buf(cookie, KEX_COOKIE_LEN);
289 rnd = arc4random(); 323
290 cookie[i] = rnd; 324 if ((r = sshpkt_start(ssh, SSH2_MSG_KEXINIT)) != 0 ||
291 rnd >>= 8; 325 (r = sshpkt_putb(ssh, kex->my)) != 0 ||
292 } 326 (r = sshpkt_send(ssh)) != 0)
293 packet_start(SSH2_MSG_KEXINIT); 327 return r;
294 packet_put_raw(buffer_ptr(&kex->my), buffer_len(&kex->my));
295 packet_send();
296 debug("SSH2_MSG_KEXINIT sent"); 328 debug("SSH2_MSG_KEXINIT sent");
297 kex->flags |= KEX_INIT_SENT; 329 kex->flags |= KEX_INIT_SENT;
330 return 0;
298} 331}
299 332
300/* ARGSUSED */ 333/* ARGSUSED */
301void 334int
302kex_input_kexinit(int type, u_int32_t seq, void *ctxt) 335kex_input_kexinit(int type, u_int32_t seq, void *ctxt)
303{ 336{
304 char *ptr; 337 struct ssh *ssh = ctxt;
305 u_int i, dlen; 338 struct kex *kex = ssh->kex;
306 Kex *kex = (Kex *)ctxt; 339 const u_char *ptr;
340 u_int i;
341 size_t dlen;
342 int r;
307 343
308 debug("SSH2_MSG_KEXINIT received"); 344 debug("SSH2_MSG_KEXINIT received");
309 if (kex == NULL) 345 if (kex == NULL)
310 fatal("kex_input_kexinit: no kex, cannot rekey"); 346 return SSH_ERR_INVALID_ARGUMENT;
311 347
312 ptr = packet_get_raw(&dlen); 348 ptr = sshpkt_ptr(ssh, &dlen);
313 buffer_append(&kex->peer, ptr, dlen); 349 if ((r = sshbuf_put(kex->peer, ptr, dlen)) != 0)
350 return r;
314 351
315 /* discard packet */ 352 /* discard packet */
316 for (i = 0; i < KEX_COOKIE_LEN; i++) 353 for (i = 0; i < KEX_COOKIE_LEN; i++)
317 packet_get_char(); 354 if ((r = sshpkt_get_u8(ssh, NULL)) != 0)
355 return r;
318 for (i = 0; i < PROPOSAL_MAX; i++) 356 for (i = 0; i < PROPOSAL_MAX; i++)
319 free(packet_get_string(NULL)); 357 if ((r = sshpkt_get_string(ssh, NULL, NULL)) != 0)
358 return r;
320 /* 359 /*
321 * XXX RFC4253 sec 7: "each side MAY guess" - currently no supported 360 * XXX RFC4253 sec 7: "each side MAY guess" - currently no supported
322 * KEX method has the server move first, but a server might be using 361 * KEX method has the server move first, but a server might be using
@@ -327,55 +366,129 @@ kex_input_kexinit(int type, u_int32_t seq, void *ctxt)
327 * for cases where the server *doesn't* go first. I guess we should 366 * for cases where the server *doesn't* go first. I guess we should
328 * ignore it when it is set for these cases, which is what we do now. 367 * ignore it when it is set for these cases, which is what we do now.
329 */ 368 */
330 (void) packet_get_char(); /* first_kex_follows */ 369 if ((r = sshpkt_get_u8(ssh, NULL)) != 0 || /* first_kex_follows */
331 (void) packet_get_int(); /* reserved */ 370 (r = sshpkt_get_u32(ssh, NULL)) != 0 || /* reserved */
332 packet_check_eom(); 371 (r = sshpkt_get_end(ssh)) != 0)
372 return r;
373
374 if (!(kex->flags & KEX_INIT_SENT))
375 if ((r = kex_send_kexinit(ssh)) != 0)
376 return r;
377 if ((r = kex_choose_conf(ssh)) != 0)
378 return r;
379
380 if (kex->kex_type < KEX_MAX && kex->kex[kex->kex_type] != NULL)
381 return (kex->kex[kex->kex_type])(ssh);
333 382
334 kex_kexinit_finish(kex); 383 return SSH_ERR_INTERNAL_ERROR;
335} 384}
336 385
337Kex * 386int
338kex_setup(char *proposal[PROPOSAL_MAX]) 387kex_new(struct ssh *ssh, char *proposal[PROPOSAL_MAX], struct kex **kexp)
339{ 388{
340 Kex *kex; 389 struct kex *kex;
341 390 int r;
342 kex = xcalloc(1, sizeof(*kex)); 391
343 buffer_init(&kex->peer); 392 *kexp = NULL;
344 buffer_init(&kex->my); 393 if ((kex = calloc(1, sizeof(*kex))) == NULL)
345 kex_prop2buf(&kex->my, proposal); 394 return SSH_ERR_ALLOC_FAIL;
395 if ((kex->peer = sshbuf_new()) == NULL ||
396 (kex->my = sshbuf_new()) == NULL) {
397 r = SSH_ERR_ALLOC_FAIL;
398 goto out;
399 }
400 if ((r = kex_prop2buf(kex->my, proposal)) != 0)
401 goto out;
346 kex->done = 0; 402 kex->done = 0;
403 kex_reset_dispatch(ssh);
404 r = 0;
405 *kexp = kex;
406 out:
407 if (r != 0)
408 kex_free(kex);
409 return r;
410}
347 411
348 kex_send_kexinit(kex); /* we start */ 412void
349 kex_reset_dispatch(); 413kex_free_newkeys(struct newkeys *newkeys)
350 414{
351 return kex; 415 if (newkeys == NULL)
416 return;
417 if (newkeys->enc.key) {
418 explicit_bzero(newkeys->enc.key, newkeys->enc.key_len);
419 free(newkeys->enc.key);
420 newkeys->enc.key = NULL;
421 }
422 if (newkeys->enc.iv) {
423 explicit_bzero(newkeys->enc.iv, newkeys->enc.block_size);
424 free(newkeys->enc.iv);
425 newkeys->enc.iv = NULL;
426 }
427 free(newkeys->enc.name);
428 explicit_bzero(&newkeys->enc, sizeof(newkeys->enc));
429 free(newkeys->comp.name);
430 explicit_bzero(&newkeys->comp, sizeof(newkeys->comp));
431 mac_clear(&newkeys->mac);
432 if (newkeys->mac.key) {
433 explicit_bzero(newkeys->mac.key, newkeys->mac.key_len);
434 free(newkeys->mac.key);
435 newkeys->mac.key = NULL;
436 }
437 free(newkeys->mac.name);
438 explicit_bzero(&newkeys->mac, sizeof(newkeys->mac));
439 explicit_bzero(newkeys, sizeof(*newkeys));
440 free(newkeys);
352} 441}
353 442
354static void 443void
355kex_kexinit_finish(Kex *kex) 444kex_free(struct kex *kex)
356{ 445{
357 if (!(kex->flags & KEX_INIT_SENT)) 446 u_int mode;
358 kex_send_kexinit(kex);
359 447
360 kex_choose_conf(kex); 448#ifdef WITH_OPENSSL
449 if (kex->dh)
450 DH_free(kex->dh);
451#ifdef OPENSSL_HAS_ECC
452 if (kex->ec_client_key)
453 EC_KEY_free(kex->ec_client_key);
454#endif /* OPENSSL_HAS_ECC */
455#endif /* WITH_OPENSSL */
456 for (mode = 0; mode < MODE_MAX; mode++) {
457 kex_free_newkeys(kex->newkeys[mode]);
458 kex->newkeys[mode] = NULL;
459 }
460 sshbuf_free(kex->peer);
461 sshbuf_free(kex->my);
462 free(kex->session_id);
463 free(kex->client_version_string);
464 free(kex->server_version_string);
465 free(kex);
466}
361 467
362 if (kex->kex_type >= 0 && kex->kex_type < KEX_MAX && 468int
363 kex->kex[kex->kex_type] != NULL) { 469kex_setup(struct ssh *ssh, char *proposal[PROPOSAL_MAX])
364 (kex->kex[kex->kex_type])(kex); 470{
365 } else { 471 int r;
366 fatal("Unsupported key exchange %d", kex->kex_type); 472
473 if ((r = kex_new(ssh, proposal, &ssh->kex)) != 0)
474 return r;
475 if ((r = kex_send_kexinit(ssh)) != 0) { /* we start */
476 kex_free(ssh->kex);
477 ssh->kex = NULL;
478 return r;
367 } 479 }
480 return 0;
368} 481}
369 482
370static void 483static int
371choose_enc(Enc *enc, char *client, char *server) 484choose_enc(struct sshenc *enc, char *client, char *server)
372{ 485{
373 char *name = match_list(client, server, NULL); 486 char *name = match_list(client, server, NULL);
487
374 if (name == NULL) 488 if (name == NULL)
375 fatal("no matching cipher found: client %s server %s", 489 return SSH_ERR_NO_CIPHER_ALG_MATCH;
376 client, server);
377 if ((enc->cipher = cipher_by_name(name)) == NULL) 490 if ((enc->cipher = cipher_by_name(name)) == NULL)
378 fatal("matching cipher is not supported: %s", name); 491 return SSH_ERR_INTERNAL_ERROR;
379 enc->name = name; 492 enc->name = name;
380 enc->enabled = 0; 493 enc->enabled = 0;
381 enc->iv = NULL; 494 enc->iv = NULL;
@@ -383,31 +496,34 @@ choose_enc(Enc *enc, char *client, char *server)
383 enc->key = NULL; 496 enc->key = NULL;
384 enc->key_len = cipher_keylen(enc->cipher); 497 enc->key_len = cipher_keylen(enc->cipher);
385 enc->block_size = cipher_blocksize(enc->cipher); 498 enc->block_size = cipher_blocksize(enc->cipher);
499 return 0;
386} 500}
387 501
388static void 502static int
389choose_mac(Mac *mac, char *client, char *server) 503choose_mac(struct ssh *ssh, struct sshmac *mac, char *client, char *server)
390{ 504{
391 char *name = match_list(client, server, NULL); 505 char *name = match_list(client, server, NULL);
506
392 if (name == NULL) 507 if (name == NULL)
393 fatal("no matching mac found: client %s server %s", 508 return SSH_ERR_NO_MAC_ALG_MATCH;
394 client, server);
395 if (mac_setup(mac, name) < 0) 509 if (mac_setup(mac, name) < 0)
396 fatal("unsupported mac %s", name); 510 return SSH_ERR_INTERNAL_ERROR;
397 /* truncate the key */ 511 /* truncate the key */
398 if (datafellows & SSH_BUG_HMAC) 512 if (ssh->compat & SSH_BUG_HMAC)
399 mac->key_len = 16; 513 mac->key_len = 16;
400 mac->name = name; 514 mac->name = name;
401 mac->key = NULL; 515 mac->key = NULL;
402 mac->enabled = 0; 516 mac->enabled = 0;
517 return 0;
403} 518}
404 519
405static void 520static int
406choose_comp(Comp *comp, char *client, char *server) 521choose_comp(struct sshcomp *comp, char *client, char *server)
407{ 522{
408 char *name = match_list(client, server, NULL); 523 char *name = match_list(client, server, NULL);
524
409 if (name == NULL) 525 if (name == NULL)
410 fatal("no matching comp found: client %s server %s", client, server); 526 return SSH_ERR_NO_COMPRESS_ALG_MATCH;
411 if (strcmp(name, "zlib@openssh.com") == 0) { 527 if (strcmp(name, "zlib@openssh.com") == 0) {
412 comp->type = COMP_DELAYED; 528 comp->type = COMP_DELAYED;
413 } else if (strcmp(name, "zlib") == 0) { 529 } else if (strcmp(name, "zlib") == 0) {
@@ -415,36 +531,42 @@ choose_comp(Comp *comp, char *client, char *server)
415 } else if (strcmp(name, "none") == 0) { 531 } else if (strcmp(name, "none") == 0) {
416 comp->type = COMP_NONE; 532 comp->type = COMP_NONE;
417 } else { 533 } else {
418 fatal("unsupported comp %s", name); 534 return SSH_ERR_INTERNAL_ERROR;
419 } 535 }
420 comp->name = name; 536 comp->name = name;
537 return 0;
421} 538}
422 539
423static void 540static int
424choose_kex(Kex *k, char *client, char *server) 541choose_kex(struct kex *k, char *client, char *server)
425{ 542{
426 const struct kexalg *kexalg; 543 const struct kexalg *kexalg;
427 544
428 k->name = match_list(client, server, NULL); 545 k->name = match_list(client, server, NULL);
546
429 if (k->name == NULL) 547 if (k->name == NULL)
430 fatal("Unable to negotiate a key exchange method"); 548 return SSH_ERR_NO_KEX_ALG_MATCH;
431 if ((kexalg = kex_alg_by_name(k->name)) == NULL) 549 if ((kexalg = kex_alg_by_name(k->name)) == NULL)
432 fatal("unsupported kex alg %s", k->name); 550 return SSH_ERR_INTERNAL_ERROR;
433 k->kex_type = kexalg->type; 551 k->kex_type = kexalg->type;
434 k->hash_alg = kexalg->hash_alg; 552 k->hash_alg = kexalg->hash_alg;
435 k->ec_nid = kexalg->ec_nid; 553 k->ec_nid = kexalg->ec_nid;
554 return 0;
436} 555}
437 556
438static void 557static int
439choose_hostkeyalg(Kex *k, char *client, char *server) 558choose_hostkeyalg(struct kex *k, char *client, char *server)
440{ 559{
441 char *hostkeyalg = match_list(client, server, NULL); 560 char *hostkeyalg = match_list(client, server, NULL);
561
442 if (hostkeyalg == NULL) 562 if (hostkeyalg == NULL)
443 fatal("no hostkey alg"); 563 return SSH_ERR_NO_HOSTKEY_ALG_MATCH;
444 k->hostkey_type = key_type_from_name(hostkeyalg); 564 k->hostkey_type = sshkey_type_from_name(hostkeyalg);
445 if (k->hostkey_type == KEY_UNSPEC) 565 if (k->hostkey_type == KEY_UNSPEC)
446 fatal("bad hostkey alg '%s'", hostkeyalg); 566 return SSH_ERR_INTERNAL_ERROR;
567 k->hostkey_nid = sshkey_ecdsa_nid_from_name(hostkeyalg);
447 free(hostkeyalg); 568 free(hostkeyalg);
569 return 0;
448} 570}
449 571
450static int 572static int
@@ -471,18 +593,20 @@ proposals_match(char *my[PROPOSAL_MAX], char *peer[PROPOSAL_MAX])
471 return (1); 593 return (1);
472} 594}
473 595
474static void 596static int
475kex_choose_conf(Kex *kex) 597kex_choose_conf(struct ssh *ssh)
476{ 598{
477 Newkeys *newkeys; 599 struct kex *kex = ssh->kex;
478 char **my, **peer; 600 struct newkeys *newkeys;
601 char **my = NULL, **peer = NULL;
479 char **cprop, **sprop; 602 char **cprop, **sprop;
480 int nenc, nmac, ncomp; 603 int nenc, nmac, ncomp;
481 u_int mode, ctos, need, dh_need, authlen; 604 u_int mode, ctos, need, dh_need, authlen;
482 int first_kex_follows, type; 605 int r, first_kex_follows;
483 606
484 my = kex_buf2prop(&kex->my, NULL); 607 if ((r = kex_buf2prop(kex->my, NULL, &my)) != 0 ||
485 peer = kex_buf2prop(&kex->peer, &first_kex_follows); 608 (r = kex_buf2prop(kex->peer, &first_kex_follows, &peer)) != 0)
609 goto out;
486 610
487 if (kex->server) { 611 if (kex->server) {
488 cprop=peer; 612 cprop=peer;
@@ -494,8 +618,9 @@ kex_choose_conf(Kex *kex)
494 618
495 /* Check whether server offers roaming */ 619 /* Check whether server offers roaming */
496 if (!kex->server) { 620 if (!kex->server) {
497 char *roaming; 621 char *roaming = match_list(KEX_RESUME,
498 roaming = match_list(KEX_RESUME, peer[PROPOSAL_KEX_ALGS], NULL); 622 peer[PROPOSAL_KEX_ALGS], NULL);
623
499 if (roaming) { 624 if (roaming) {
500 kex->roaming = 1; 625 kex->roaming = 1;
501 free(roaming); 626 free(roaming);
@@ -504,28 +629,39 @@ kex_choose_conf(Kex *kex)
504 629
505 /* Algorithm Negotiation */ 630 /* Algorithm Negotiation */
506 for (mode = 0; mode < MODE_MAX; mode++) { 631 for (mode = 0; mode < MODE_MAX; mode++) {
507 newkeys = xcalloc(1, sizeof(*newkeys)); 632 if ((newkeys = calloc(1, sizeof(*newkeys))) == NULL) {
633 r = SSH_ERR_ALLOC_FAIL;
634 goto out;
635 }
508 kex->newkeys[mode] = newkeys; 636 kex->newkeys[mode] = newkeys;
509 ctos = (!kex->server && mode == MODE_OUT) || 637 ctos = (!kex->server && mode == MODE_OUT) ||
510 (kex->server && mode == MODE_IN); 638 (kex->server && mode == MODE_IN);
511 nenc = ctos ? PROPOSAL_ENC_ALGS_CTOS : PROPOSAL_ENC_ALGS_STOC; 639 nenc = ctos ? PROPOSAL_ENC_ALGS_CTOS : PROPOSAL_ENC_ALGS_STOC;
512 nmac = ctos ? PROPOSAL_MAC_ALGS_CTOS : PROPOSAL_MAC_ALGS_STOC; 640 nmac = ctos ? PROPOSAL_MAC_ALGS_CTOS : PROPOSAL_MAC_ALGS_STOC;
513 ncomp = ctos ? PROPOSAL_COMP_ALGS_CTOS : PROPOSAL_COMP_ALGS_STOC; 641 ncomp = ctos ? PROPOSAL_COMP_ALGS_CTOS : PROPOSAL_COMP_ALGS_STOC;
514 choose_enc(&newkeys->enc, cprop[nenc], sprop[nenc]); 642 if ((r = choose_enc(&newkeys->enc, cprop[nenc],
515 /* ignore mac for authenticated encryption */ 643 sprop[nenc])) != 0)
644 goto out;
516 authlen = cipher_authlen(newkeys->enc.cipher); 645 authlen = cipher_authlen(newkeys->enc.cipher);
517 if (authlen == 0) 646 /* ignore mac for authenticated encryption */
518 choose_mac(&newkeys->mac, cprop[nmac], sprop[nmac]); 647 if (authlen == 0 &&
519 choose_comp(&newkeys->comp, cprop[ncomp], sprop[ncomp]); 648 (r = choose_mac(ssh, &newkeys->mac, cprop[nmac],
649 sprop[nmac])) != 0)
650 goto out;
651 if ((r = choose_comp(&newkeys->comp, cprop[ncomp],
652 sprop[ncomp])) != 0)
653 goto out;
520 debug("kex: %s %s %s %s", 654 debug("kex: %s %s %s %s",
521 ctos ? "client->server" : "server->client", 655 ctos ? "client->server" : "server->client",
522 newkeys->enc.name, 656 newkeys->enc.name,
523 authlen == 0 ? newkeys->mac.name : "<implicit>", 657 authlen == 0 ? newkeys->mac.name : "<implicit>",
524 newkeys->comp.name); 658 newkeys->comp.name);
525 } 659 }
526 choose_kex(kex, cprop[PROPOSAL_KEX_ALGS], sprop[PROPOSAL_KEX_ALGS]); 660 if ((r = choose_kex(kex, cprop[PROPOSAL_KEX_ALGS],
527 choose_hostkeyalg(kex, cprop[PROPOSAL_SERVER_HOST_KEY_ALGS], 661 sprop[PROPOSAL_KEX_ALGS])) != 0 ||
528 sprop[PROPOSAL_SERVER_HOST_KEY_ALGS]); 662 (r = choose_hostkeyalg(kex, cprop[PROPOSAL_SERVER_HOST_KEY_ALGS],
663 sprop[PROPOSAL_SERVER_HOST_KEY_ALGS])) != 0)
664 goto out;
529 need = dh_need = 0; 665 need = dh_need = 0;
530 for (mode = 0; mode < MODE_MAX; mode++) { 666 for (mode = 0; mode < MODE_MAX; mode++) {
531 newkeys = kex->newkeys[mode]; 667 newkeys = kex->newkeys[mode];
@@ -544,45 +680,47 @@ kex_choose_conf(Kex *kex)
544 680
545 /* ignore the next message if the proposals do not match */ 681 /* ignore the next message if the proposals do not match */
546 if (first_kex_follows && !proposals_match(my, peer) && 682 if (first_kex_follows && !proposals_match(my, peer) &&
547 !(datafellows & SSH_BUG_FIRSTKEX)) { 683 !(ssh->compat & SSH_BUG_FIRSTKEX))
548 type = packet_read(); 684 ssh->dispatch_skip_packets = 1;
549 debug2("skipping next packet (type %u)", type); 685 r = 0;
550 } 686 out:
551
552 kex_prop_free(my); 687 kex_prop_free(my);
553 kex_prop_free(peer); 688 kex_prop_free(peer);
689 return r;
554} 690}
555 691
556static u_char * 692static int
557derive_key(Kex *kex, int id, u_int need, u_char *hash, u_int hashlen, 693derive_key(struct ssh *ssh, int id, u_int need, u_char *hash, u_int hashlen,
558 const u_char *shared_secret, u_int slen) 694 const struct sshbuf *shared_secret, u_char **keyp)
559{ 695{
560 Buffer b; 696 struct kex *kex = ssh->kex;
561 struct ssh_digest_ctx *hashctx; 697 struct ssh_digest_ctx *hashctx = NULL;
562 char c = id; 698 char c = id;
563 u_int have; 699 u_int have;
564 size_t mdsz; 700 size_t mdsz;
565 u_char *digest; 701 u_char *digest;
702 int r;
566 703
567 if ((mdsz = ssh_digest_bytes(kex->hash_alg)) == 0) 704 if ((mdsz = ssh_digest_bytes(kex->hash_alg)) == 0)
568 fatal("bad kex md size %zu", mdsz); 705 return SSH_ERR_INVALID_ARGUMENT;
569 digest = xmalloc(roundup(need, mdsz)); 706 if ((digest = calloc(1, roundup(need, mdsz))) == NULL) {
570 707 r = SSH_ERR_ALLOC_FAIL;
571 buffer_init(&b); 708 goto out;
572 buffer_append(&b, shared_secret, slen); 709 }
573 710
574 /* K1 = HASH(K || H || "A" || session_id) */ 711 /* K1 = HASH(K || H || "A" || session_id) */
575 if ((hashctx = ssh_digest_start(kex->hash_alg)) == NULL) 712 if ((hashctx = ssh_digest_start(kex->hash_alg)) == NULL ||
576 fatal("%s: ssh_digest_start failed", __func__); 713 ssh_digest_update_buffer(hashctx, shared_secret) != 0 ||
577 if (ssh_digest_update_buffer(hashctx, &b) != 0 ||
578 ssh_digest_update(hashctx, hash, hashlen) != 0 || 714 ssh_digest_update(hashctx, hash, hashlen) != 0 ||
579 ssh_digest_update(hashctx, &c, 1) != 0 || 715 ssh_digest_update(hashctx, &c, 1) != 0 ||
580 ssh_digest_update(hashctx, kex->session_id, 716 ssh_digest_update(hashctx, kex->session_id,
581 kex->session_id_len) != 0) 717 kex->session_id_len) != 0 ||
582 fatal("%s: ssh_digest_update failed", __func__); 718 ssh_digest_final(hashctx, digest, mdsz) != 0) {
583 if (ssh_digest_final(hashctx, digest, mdsz) != 0) 719 r = SSH_ERR_LIBCRYPTO_ERROR;
584 fatal("%s: ssh_digest_final failed", __func__); 720 goto out;
721 }
585 ssh_digest_free(hashctx); 722 ssh_digest_free(hashctx);
723 hashctx = NULL;
586 724
587 /* 725 /*
588 * expand key: 726 * expand key:
@@ -590,107 +728,115 @@ derive_key(Kex *kex, int id, u_int need, u_char *hash, u_int hashlen,
590 * Key = K1 || K2 || ... || Kn 728 * Key = K1 || K2 || ... || Kn
591 */ 729 */
592 for (have = mdsz; need > have; have += mdsz) { 730 for (have = mdsz; need > have; have += mdsz) {
593 if ((hashctx = ssh_digest_start(kex->hash_alg)) == NULL) 731 if ((hashctx = ssh_digest_start(kex->hash_alg)) == NULL ||
594 fatal("%s: ssh_digest_start failed", __func__); 732 ssh_digest_update_buffer(hashctx, shared_secret) != 0 ||
595 if (ssh_digest_update_buffer(hashctx, &b) != 0 ||
596 ssh_digest_update(hashctx, hash, hashlen) != 0 || 733 ssh_digest_update(hashctx, hash, hashlen) != 0 ||
597 ssh_digest_update(hashctx, digest, have) != 0) 734 ssh_digest_update(hashctx, digest, have) != 0 ||
598 fatal("%s: ssh_digest_update failed", __func__); 735 ssh_digest_final(hashctx, digest + have, mdsz) != 0) {
599 if (ssh_digest_final(hashctx, digest + have, mdsz) != 0) 736 r = SSH_ERR_LIBCRYPTO_ERROR;
600 fatal("%s: ssh_digest_final failed", __func__); 737 goto out;
738 }
601 ssh_digest_free(hashctx); 739 ssh_digest_free(hashctx);
740 hashctx = NULL;
602 } 741 }
603 buffer_free(&b);
604#ifdef DEBUG_KEX 742#ifdef DEBUG_KEX
605 fprintf(stderr, "key '%c'== ", c); 743 fprintf(stderr, "key '%c'== ", c);
606 dump_digest("key", digest, need); 744 dump_digest("key", digest, need);
607#endif 745#endif
608 return digest; 746 *keyp = digest;
747 digest = NULL;
748 r = 0;
749 out:
750 if (digest)
751 free(digest);
752 ssh_digest_free(hashctx);
753 return r;
609} 754}
610 755
611Newkeys *current_keys[MODE_MAX];
612
613#define NKEYS 6 756#define NKEYS 6
614void 757int
615kex_derive_keys(Kex *kex, u_char *hash, u_int hashlen, 758kex_derive_keys(struct ssh *ssh, u_char *hash, u_int hashlen,
616 const u_char *shared_secret, u_int slen) 759 const struct sshbuf *shared_secret)
617{ 760{
761 struct kex *kex = ssh->kex;
618 u_char *keys[NKEYS]; 762 u_char *keys[NKEYS];
619 u_int i, mode, ctos; 763 u_int i, j, mode, ctos;
764 int r;
620 765
621 for (i = 0; i < NKEYS; i++) { 766 for (i = 0; i < NKEYS; i++) {
622 keys[i] = derive_key(kex, 'A'+i, kex->we_need, hash, hashlen, 767 if ((r = derive_key(ssh, 'A'+i, kex->we_need, hash, hashlen,
623 shared_secret, slen); 768 shared_secret, &keys[i])) != 0) {
769 for (j = 0; j < i; j++)
770 free(keys[j]);
771 return r;
772 }
624 } 773 }
625
626 debug2("kex_derive_keys");
627 for (mode = 0; mode < MODE_MAX; mode++) { 774 for (mode = 0; mode < MODE_MAX; mode++) {
628 current_keys[mode] = kex->newkeys[mode];
629 kex->newkeys[mode] = NULL;
630 ctos = (!kex->server && mode == MODE_OUT) || 775 ctos = (!kex->server && mode == MODE_OUT) ||
631 (kex->server && mode == MODE_IN); 776 (kex->server && mode == MODE_IN);
632 current_keys[mode]->enc.iv = keys[ctos ? 0 : 1]; 777 kex->newkeys[mode]->enc.iv = keys[ctos ? 0 : 1];
633 current_keys[mode]->enc.key = keys[ctos ? 2 : 3]; 778 kex->newkeys[mode]->enc.key = keys[ctos ? 2 : 3];
634 current_keys[mode]->mac.key = keys[ctos ? 4 : 5]; 779 kex->newkeys[mode]->mac.key = keys[ctos ? 4 : 5];
635 } 780 }
781 return 0;
636} 782}
637 783
638#ifdef WITH_OPENSSL 784#ifdef WITH_OPENSSL
639void 785int
640kex_derive_keys_bn(Kex *kex, u_char *hash, u_int hashlen, const BIGNUM *secret) 786kex_derive_keys_bn(struct ssh *ssh, u_char *hash, u_int hashlen,
787 const BIGNUM *secret)
641{ 788{
642 Buffer shared_secret; 789 struct sshbuf *shared_secret;
643 790 int r;
644 buffer_init(&shared_secret); 791
645 buffer_put_bignum2(&shared_secret, secret); 792 if ((shared_secret = sshbuf_new()) == NULL)
646 kex_derive_keys(kex, hash, hashlen, 793 return SSH_ERR_ALLOC_FAIL;
647 buffer_ptr(&shared_secret), buffer_len(&shared_secret)); 794 if ((r = sshbuf_put_bignum2(shared_secret, secret)) == 0)
648 buffer_free(&shared_secret); 795 r = kex_derive_keys(ssh, hash, hashlen, shared_secret);
796 sshbuf_free(shared_secret);
797 return r;
649} 798}
650#endif 799#endif
651 800
652Newkeys *
653kex_get_newkeys(int mode)
654{
655 Newkeys *ret;
656
657 ret = current_keys[mode];
658 current_keys[mode] = NULL;
659 return ret;
660}
661
662#ifdef WITH_SSH1 801#ifdef WITH_SSH1
663void 802int
664derive_ssh1_session_id(BIGNUM *host_modulus, BIGNUM *server_modulus, 803derive_ssh1_session_id(BIGNUM *host_modulus, BIGNUM *server_modulus,
665 u_int8_t cookie[8], u_int8_t id[16]) 804 u_int8_t cookie[8], u_int8_t id[16])
666{ 805{
667 u_int8_t nbuf[2048], obuf[SSH_DIGEST_MAX_LENGTH]; 806 u_int8_t hbuf[2048], sbuf[2048], obuf[SSH_DIGEST_MAX_LENGTH];
668 int len; 807 struct ssh_digest_ctx *hashctx = NULL;
669 struct ssh_digest_ctx *hashctx; 808 size_t hlen, slen;
670 809 int r;
671 if ((hashctx = ssh_digest_start(SSH_DIGEST_MD5)) == NULL) 810
672 fatal("%s: ssh_digest_start", __func__); 811 hlen = BN_num_bytes(host_modulus);
673 812 slen = BN_num_bytes(server_modulus);
674 len = BN_num_bytes(host_modulus); 813 if (hlen < (512 / 8) || (u_int)hlen > sizeof(hbuf) ||
675 if (len < (512 / 8) || (u_int)len > sizeof(nbuf)) 814 slen < (512 / 8) || (u_int)slen > sizeof(sbuf))
676 fatal("%s: bad host modulus (len %d)", __func__, len); 815 return SSH_ERR_KEY_BITS_MISMATCH;
677 BN_bn2bin(host_modulus, nbuf); 816 if (BN_bn2bin(host_modulus, hbuf) <= 0 ||
678 if (ssh_digest_update(hashctx, nbuf, len) != 0) 817 BN_bn2bin(server_modulus, sbuf) <= 0) {
679 fatal("%s: ssh_digest_update failed", __func__); 818 r = SSH_ERR_LIBCRYPTO_ERROR;
680 819 goto out;
681 len = BN_num_bytes(server_modulus); 820 }
682 if (len < (512 / 8) || (u_int)len > sizeof(nbuf)) 821 if ((hashctx = ssh_digest_start(SSH_DIGEST_MD5)) == NULL) {
683 fatal("%s: bad server modulus (len %d)", __func__, len); 822 r = SSH_ERR_ALLOC_FAIL;
684 BN_bn2bin(server_modulus, nbuf); 823 goto out;
685 if (ssh_digest_update(hashctx, nbuf, len) != 0 || 824 }
686 ssh_digest_update(hashctx, cookie, 8) != 0) 825 if (ssh_digest_update(hashctx, hbuf, hlen) != 0 ||
687 fatal("%s: ssh_digest_update failed", __func__); 826 ssh_digest_update(hashctx, sbuf, slen) != 0 ||
688 if (ssh_digest_final(hashctx, obuf, sizeof(obuf)) != 0) 827 ssh_digest_update(hashctx, cookie, 8) != 0 ||
689 fatal("%s: ssh_digest_final failed", __func__); 828 ssh_digest_final(hashctx, obuf, sizeof(obuf)) != 0) {
829 r = SSH_ERR_LIBCRYPTO_ERROR;
830 goto out;
831 }
690 memcpy(id, obuf, ssh_digest_bytes(SSH_DIGEST_MD5)); 832 memcpy(id, obuf, ssh_digest_bytes(SSH_DIGEST_MD5));
691 833 r = 0;
692 explicit_bzero(nbuf, sizeof(nbuf)); 834 out:
835 ssh_digest_free(hashctx);
836 explicit_bzero(hbuf, sizeof(hbuf));
837 explicit_bzero(sbuf, sizeof(sbuf));
693 explicit_bzero(obuf, sizeof(obuf)); 838 explicit_bzero(obuf, sizeof(obuf));
839 return r;
694} 840}
695#endif 841#endif
696 842
@@ -698,16 +844,7 @@ derive_ssh1_session_id(BIGNUM *host_modulus, BIGNUM *server_modulus,
698void 844void
699dump_digest(char *msg, u_char *digest, int len) 845dump_digest(char *msg, u_char *digest, int len)
700{ 846{
701 int i;
702
703 fprintf(stderr, "%s\n", msg); 847 fprintf(stderr, "%s\n", msg);
704 for (i = 0; i < len; i++) { 848 sshbuf_dump_data(digest, len, stderr);
705 fprintf(stderr, "%02x", digest[i]);
706 if (i%32 == 31)
707 fprintf(stderr, "\n");
708 else if (i%8 == 7)
709 fprintf(stderr, " ");
710 }
711 fprintf(stderr, "\n");
712} 849}
713#endif 850#endif
diff --git a/kex.h b/kex.h
index c179a4d06..7194b1453 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,
@@ -84,15 +101,9 @@ enum kex_exchange {
84 101
85#define KEX_INIT_SENT 0x0001 102#define KEX_INIT_SENT 0x0001
86 103
87typedef struct Kex Kex; 104struct sshenc {
88typedef struct Mac Mac;
89typedef struct Comp Comp;
90typedef struct Enc Enc;
91typedef struct Newkeys Newkeys;
92
93struct Enc {
94 char *name; 105 char *name;
95 const Cipher *cipher; 106 const struct sshcipher *cipher;
96 int enabled; 107 int enabled;
97 u_int key_len; 108 u_int key_len;
98 u_int iv_len; 109 u_int iv_len;
@@ -100,42 +111,35 @@ struct Enc {
100 u_char *key; 111 u_char *key;
101 u_char *iv; 112 u_char *iv;
102}; 113};
103struct Mac { 114struct sshcomp {
104 char *name; 115 u_int type;
105 int enabled;
106 u_int mac_len;
107 u_char *key;
108 u_int key_len;
109 int type;
110 int etm; /* Encrypt-then-MAC */
111 struct ssh_hmac_ctx *hmac_ctx;
112 struct umac_ctx *umac_ctx;
113};
114struct Comp {
115 int type;
116 int enabled; 116 int enabled;
117 char *name; 117 char *name;
118}; 118};
119struct Newkeys { 119struct newkeys {
120 Enc enc; 120 struct sshenc enc;
121 Mac mac; 121 struct sshmac mac;
122 Comp comp; 122 struct sshcomp comp;
123}; 123};
124struct Kex { 124
125struct ssh;
126
127struct kex {
125 u_char *session_id; 128 u_char *session_id;
126 u_int session_id_len; 129 size_t session_id_len;
127 Newkeys *newkeys[MODE_MAX]; 130 struct newkeys *newkeys[MODE_MAX];
128 u_int we_need; 131 u_int we_need;
129 u_int dh_need; 132 u_int dh_need;
130 int server; 133 int server;
131 char *name; 134 char *name;
132 int hostkey_type; 135 int hostkey_type;
133 int kex_type; 136 int hostkey_nid;
137 u_int kex_type;
134 int roaming; 138 int roaming;
135 Buffer my; 139 struct sshbuf *my;
136 Buffer peer; 140 struct sshbuf *peer;
137 sig_atomic_t done; 141 sig_atomic_t done;
138 int flags; 142 u_int flags;
139 int hash_alg; 143 int hash_alg;
140 int ec_nid; 144 int ec_nid;
141#ifdef GSSAPI 145#ifdef GSSAPI
@@ -146,73 +150,92 @@ struct Kex {
146#endif 150#endif
147 char *client_version_string; 151 char *client_version_string;
148 char *server_version_string; 152 char *server_version_string;
149 int (*verify_host_key)(Key *); 153 int (*verify_host_key)(struct sshkey *, struct ssh *);
150 Key *(*load_host_public_key)(int); 154 struct sshkey *(*load_host_public_key)(int, int, struct ssh *);
151 Key *(*load_host_private_key)(int); 155 struct sshkey *(*load_host_private_key)(int, int, struct ssh *);
152 int (*host_key_index)(Key *); 156 int (*host_key_index)(struct sshkey *, int, struct ssh *);
153 void (*sign)(Key *, Key *, u_char **, u_int *, u_char *, u_int); 157 int (*sign)(struct sshkey *, struct sshkey *,
154 void (*kex[KEX_MAX])(Kex *); 158 u_char **, size_t *, const u_char *, size_t, u_int);
159 int (*kex[KEX_MAX])(struct ssh *);
160 /* kex specific state */
161 DH *dh; /* DH */
162 u_int min, max, nbits; /* GEX */
163 EC_KEY *ec_client_key; /* ECDH */
164 const EC_GROUP *ec_group; /* ECDH */
165 u_char c25519_client_key[CURVE25519_SIZE]; /* 25519 */
166 u_char c25519_client_pubkey[CURVE25519_SIZE]; /* 25519 */
155}; 167};
156 168
157int kex_names_valid(const char *); 169int kex_names_valid(const char *);
158char *kex_alg_list(char); 170char *kex_alg_list(char);
159 171
160Kex *kex_setup(char *[PROPOSAL_MAX]); 172int kex_new(struct ssh *, char *[PROPOSAL_MAX], struct kex **);
161void kex_finish(Kex *); 173int kex_setup(struct ssh *, char *[PROPOSAL_MAX]);
174void kex_free_newkeys(struct newkeys *);
175void kex_free(struct kex *);
176
177int kex_buf2prop(struct sshbuf *, int *, char ***);
178int kex_prop2buf(struct sshbuf *, char *proposal[PROPOSAL_MAX]);
179void kex_prop_free(char **);
180
181int kex_send_kexinit(struct ssh *);
182int kex_input_kexinit(int, u_int32_t, void *);
183int kex_derive_keys(struct ssh *, u_char *, u_int, const struct sshbuf *);
184int kex_derive_keys_bn(struct ssh *, u_char *, u_int, const BIGNUM *);
185int kex_send_newkeys(struct ssh *);
186
187int kexdh_client(struct ssh *);
188int kexdh_server(struct ssh *);
189int kexgex_client(struct ssh *);
190int kexgex_server(struct ssh *);
191int kexecdh_client(struct ssh *);
192int kexecdh_server(struct ssh *);
193int kexc25519_client(struct ssh *);
194int kexc25519_server(struct ssh *);
162 195
163void kex_send_kexinit(Kex *); 196#ifdef GSSAPI
164void kex_input_kexinit(int, u_int32_t, void *); 197int kexgss_client(struct ssh *);
165void kex_derive_keys(Kex *, u_char *, u_int, const u_char *, u_int); 198int kexgss_server(struct ssh *);
166void kex_derive_keys_bn(Kex *, u_char *, u_int, const BIGNUM *); 199#endif
167 200
168Newkeys *kex_get_newkeys(int); 201int kex_dh_hash(const char *, const char *,
202 const u_char *, size_t, const u_char *, size_t, const u_char *, size_t,
203 const BIGNUM *, const BIGNUM *, const BIGNUM *, u_char *, size_t *);
169 204
170void kexdh_client(Kex *); 205int kexgex_hash(int, const char *, const char *,
171void kexdh_server(Kex *); 206 const u_char *, size_t, const u_char *, size_t, const u_char *, size_t,
172void kexgex_client(Kex *); 207 int, int, int,
173void kexgex_server(Kex *); 208 const BIGNUM *, const BIGNUM *, const BIGNUM *,
174void kexecdh_client(Kex *); 209 const BIGNUM *, const BIGNUM *,
175void kexecdh_server(Kex *); 210 u_char *, size_t *);
176void kexc25519_client(Kex *);
177void kexc25519_server(Kex *);
178 211
179#ifdef GSSAPI 212int kex_ecdh_hash(int, const EC_GROUP *, const char *, const char *,
180void kexgss_client(Kex *); 213 const u_char *, size_t, const u_char *, size_t, const u_char *, size_t,
181void kexgss_server(Kex *); 214 const EC_POINT *, const EC_POINT *, const BIGNUM *, u_char *, size_t *);
182#endif
183 215
184void 216int kex_c25519_hash(int, const char *, const char *, const char *, size_t,
185kex_dh_hash(char *, char *, char *, int, char *, int, u_char *, int, 217 const char *, size_t, const u_char *, size_t, const u_char *, const u_char *,
186 BIGNUM *, BIGNUM *, BIGNUM *, u_char **, u_int *); 218 const u_char *, size_t, u_char *, size_t *);
187void
188kexgex_hash(int, char *, char *, char *, int, char *,
189 int, u_char *, int, int, int, int, BIGNUM *, BIGNUM *, BIGNUM *,
190 BIGNUM *, BIGNUM *, u_char **, u_int *);
191#ifdef OPENSSL_HAS_ECC
192void
193kex_ecdh_hash(int, const EC_GROUP *, char *, char *, char *, int,
194 char *, int, u_char *, int, const EC_POINT *, const EC_POINT *,
195 const BIGNUM *, u_char **, u_int *);
196#endif
197void
198kex_c25519_hash(int, char *, char *, char *, int,
199 char *, int, u_char *, int, const u_char *, const u_char *,
200 const u_char *, u_int, u_char **, u_int *);
201 219
202#define CURVE25519_SIZE 32 220void kexc25519_keygen(u_char key[CURVE25519_SIZE], u_char pub[CURVE25519_SIZE])
203void kexc25519_keygen(u_char[CURVE25519_SIZE], u_char[CURVE25519_SIZE])
204 __attribute__((__bounded__(__minbytes__, 1, CURVE25519_SIZE))) 221 __attribute__((__bounded__(__minbytes__, 1, CURVE25519_SIZE)))
205 __attribute__((__bounded__(__minbytes__, 2, CURVE25519_SIZE))); 222 __attribute__((__bounded__(__minbytes__, 2, CURVE25519_SIZE)));
206void kexc25519_shared_key(const u_char key[CURVE25519_SIZE], 223int kexc25519_shared_key(const u_char key[CURVE25519_SIZE],
207 const u_char pub[CURVE25519_SIZE], Buffer *out) 224 const u_char pub[CURVE25519_SIZE], struct sshbuf *out)
208 __attribute__((__bounded__(__minbytes__, 1, CURVE25519_SIZE))) 225 __attribute__((__bounded__(__minbytes__, 1, CURVE25519_SIZE)))
209 __attribute__((__bounded__(__minbytes__, 2, CURVE25519_SIZE))); 226 __attribute__((__bounded__(__minbytes__, 2, CURVE25519_SIZE)));
210 227
211void 228int
212derive_ssh1_session_id(BIGNUM *, BIGNUM *, u_int8_t[8], u_int8_t[16]); 229derive_ssh1_session_id(BIGNUM *, BIGNUM *, u_int8_t[8], u_int8_t[16]);
213 230
214#if defined(DEBUG_KEX) || defined(DEBUG_KEXDH) || defined(DEBUG_KEXECDH) 231#if defined(DEBUG_KEX) || defined(DEBUG_KEXDH) || defined(DEBUG_KEXECDH)
215void dump_digest(char *, u_char *, int); 232void dump_digest(char *, u_char *, int);
216#endif 233#endif
217 234
235#if !defined(WITH_OPENSSL) || !defined(OPENSSL_HAS_ECC)
236# undef EC_KEY
237# undef EC_GROUP
238# undef EC_POINT
239#endif
240
218#endif 241#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/kexgssc.c b/kexgssc.c
index 92a31c5a3..a49bac295 100644
--- a/kexgssc.c
+++ b/kexgssc.c
@@ -42,43 +42,46 @@
42#include "log.h" 42#include "log.h"
43#include "packet.h" 43#include "packet.h"
44#include "dh.h" 44#include "dh.h"
45#include "digest.h"
45 46
46#include "ssh-gss.h" 47#include "ssh-gss.h"
47 48
48void 49int
49kexgss_client(Kex *kex) { 50kexgss_client(struct ssh *ssh) {
50 gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; 51 gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER;
51 gss_buffer_desc recv_tok, gssbuf, msg_tok, *token_ptr; 52 gss_buffer_desc recv_tok, gssbuf, msg_tok, *token_ptr;
52 Gssctxt *ctxt; 53 Gssctxt *ctxt;
53 OM_uint32 maj_status, min_status, ret_flags; 54 OM_uint32 maj_status, min_status, ret_flags;
54 u_int klen, kout, slen = 0, hashlen, strlen; 55 u_int klen, kout, slen = 0, strlen;
55 DH *dh; 56 DH *dh;
56 BIGNUM *dh_server_pub = NULL; 57 BIGNUM *dh_server_pub = NULL;
57 BIGNUM *shared_secret = NULL; 58 BIGNUM *shared_secret = NULL;
58 BIGNUM *p = NULL; 59 BIGNUM *p = NULL;
59 BIGNUM *g = NULL; 60 BIGNUM *g = NULL;
60 u_char *kbuf, *hash; 61 u_char *kbuf;
61 u_char *serverhostkey = NULL; 62 u_char *serverhostkey = NULL;
62 u_char *empty = ""; 63 u_char *empty = "";
63 char *msg; 64 char *msg;
64 int type = 0; 65 int type = 0;
65 int first = 1; 66 int first = 1;
66 int nbits = 0, min = DH_GRP_MIN, max = DH_GRP_MAX; 67 int nbits = 0, min = DH_GRP_MIN, max = DH_GRP_MAX;
68 u_char hash[SSH_DIGEST_MAX_LENGTH];
69 size_t hashlen;
67 70
68 /* Initialise our GSSAPI world */ 71 /* Initialise our GSSAPI world */
69 ssh_gssapi_build_ctx(&ctxt); 72 ssh_gssapi_build_ctx(&ctxt);
70 if (ssh_gssapi_id_kex(ctxt, kex->name, kex->kex_type) 73 if (ssh_gssapi_id_kex(ctxt, ssh->kex->name, ssh->kex->kex_type)
71 == GSS_C_NO_OID) 74 == GSS_C_NO_OID)
72 fatal("Couldn't identify host exchange"); 75 fatal("Couldn't identify host exchange");
73 76
74 if (ssh_gssapi_import_name(ctxt, kex->gss_host)) 77 if (ssh_gssapi_import_name(ctxt, ssh->kex->gss_host))
75 fatal("Couldn't import hostname"); 78 fatal("Couldn't import hostname");
76 79
77 if (kex->gss_client && 80 if (ssh->kex->gss_client &&
78 ssh_gssapi_client_identity(ctxt, kex->gss_client)) 81 ssh_gssapi_client_identity(ctxt, ssh->kex->gss_client))
79 fatal("Couldn't acquire client credentials"); 82 fatal("Couldn't acquire client credentials");
80 83
81 switch (kex->kex_type) { 84 switch (ssh->kex->kex_type) {
82 case KEX_GSS_GRP1_SHA1: 85 case KEX_GSS_GRP1_SHA1:
83 dh = dh_new_group1(); 86 dh = dh_new_group1();
84 break; 87 break;
@@ -87,7 +90,7 @@ kexgss_client(Kex *kex) {
87 break; 90 break;
88 case KEX_GSS_GEX_SHA1: 91 case KEX_GSS_GEX_SHA1:
89 debug("Doing group exchange\n"); 92 debug("Doing group exchange\n");
90 nbits = dh_estimate(kex->we_need * 8); 93 nbits = dh_estimate(ssh->kex->we_need * 8);
91 packet_start(SSH2_MSG_KEXGSS_GROUPREQ); 94 packet_start(SSH2_MSG_KEXGSS_GROUPREQ);
92 packet_put_int(min); 95 packet_put_int(min);
93 packet_put_int(nbits); 96 packet_put_int(nbits);
@@ -112,11 +115,11 @@ kexgss_client(Kex *kex) {
112 dh = dh_new_group(g, p); 115 dh = dh_new_group(g, p);
113 break; 116 break;
114 default: 117 default:
115 fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); 118 fatal("%s: Unexpected KEX type %d", __func__, ssh->kex->kex_type);
116 } 119 }
117 120
118 /* Step 1 - e is dh->pub_key */ 121 /* Step 1 - e is dh->pub_key */
119 dh_gen_key(dh, kex->we_need * 8); 122 dh_gen_key(dh, ssh->kex->we_need * 8);
120 123
121 /* This is f, we initialise it now to make life easier */ 124 /* This is f, we initialise it now to make life easier */
122 dh_server_pub = BN_new(); 125 dh_server_pub = BN_new();
@@ -129,7 +132,7 @@ kexgss_client(Kex *kex) {
129 debug("Calling gss_init_sec_context"); 132 debug("Calling gss_init_sec_context");
130 133
131 maj_status = ssh_gssapi_init_ctx(ctxt, 134 maj_status = ssh_gssapi_init_ctx(ctxt,
132 kex->gss_deleg_creds, token_ptr, &send_tok, 135 ssh->kex->gss_deleg_creds, token_ptr, &send_tok,
133 &ret_flags); 136 &ret_flags);
134 137
135 if (GSS_ERROR(maj_status)) { 138 if (GSS_ERROR(maj_status)) {
@@ -262,38 +265,39 @@ kexgss_client(Kex *kex) {
262 memset(kbuf, 0, klen); 265 memset(kbuf, 0, klen);
263 free(kbuf); 266 free(kbuf);
264 267
265 switch (kex->kex_type) { 268 hashlen = sizeof(hash);
269 switch (ssh->kex->kex_type) {
266 case KEX_GSS_GRP1_SHA1: 270 case KEX_GSS_GRP1_SHA1:
267 case KEX_GSS_GRP14_SHA1: 271 case KEX_GSS_GRP14_SHA1:
268 kex_dh_hash( kex->client_version_string, 272 kex_dh_hash( ssh->kex->client_version_string,
269 kex->server_version_string, 273 ssh->kex->server_version_string,
270 buffer_ptr(&kex->my), buffer_len(&kex->my), 274 buffer_ptr(ssh->kex->my), buffer_len(ssh->kex->my),
271 buffer_ptr(&kex->peer), buffer_len(&kex->peer), 275 buffer_ptr(ssh->kex->peer), buffer_len(ssh->kex->peer),
272 (serverhostkey ? serverhostkey : empty), slen, 276 (serverhostkey ? serverhostkey : empty), slen,
273 dh->pub_key, /* e */ 277 dh->pub_key, /* e */
274 dh_server_pub, /* f */ 278 dh_server_pub, /* f */
275 shared_secret, /* K */ 279 shared_secret, /* K */
276 &hash, &hashlen 280 hash, &hashlen
277 ); 281 );
278 break; 282 break;
279 case KEX_GSS_GEX_SHA1: 283 case KEX_GSS_GEX_SHA1:
280 kexgex_hash( 284 kexgex_hash(
281 kex->hash_alg, 285 ssh->kex->hash_alg,
282 kex->client_version_string, 286 ssh->kex->client_version_string,
283 kex->server_version_string, 287 ssh->kex->server_version_string,
284 buffer_ptr(&kex->my), buffer_len(&kex->my), 288 buffer_ptr(ssh->kex->my), buffer_len(ssh->kex->my),
285 buffer_ptr(&kex->peer), buffer_len(&kex->peer), 289 buffer_ptr(ssh->kex->peer), buffer_len(ssh->kex->peer),
286 (serverhostkey ? serverhostkey : empty), slen, 290 (serverhostkey ? serverhostkey : empty), slen,
287 min, nbits, max, 291 min, nbits, max,
288 dh->p, dh->g, 292 dh->p, dh->g,
289 dh->pub_key, 293 dh->pub_key,
290 dh_server_pub, 294 dh_server_pub,
291 shared_secret, 295 shared_secret,
292 &hash, &hashlen 296 hash, &hashlen
293 ); 297 );
294 break; 298 break;
295 default: 299 default:
296 fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); 300 fatal("%s: Unexpected KEX type %d", __func__, ssh->kex->kex_type);
297 } 301 }
298 302
299 gssbuf.value = hash; 303 gssbuf.value = hash;
@@ -310,13 +314,13 @@ kexgss_client(Kex *kex) {
310 BN_clear_free(dh_server_pub); 314 BN_clear_free(dh_server_pub);
311 315
312 /* save session id */ 316 /* save session id */
313 if (kex->session_id == NULL) { 317 if (ssh->kex->session_id == NULL) {
314 kex->session_id_len = hashlen; 318 ssh->kex->session_id_len = hashlen;
315 kex->session_id = xmalloc(kex->session_id_len); 319 ssh->kex->session_id = xmalloc(ssh->kex->session_id_len);
316 memcpy(kex->session_id, hash, kex->session_id_len); 320 memcpy(ssh->kex->session_id, hash, ssh->kex->session_id_len);
317 } 321 }
318 322
319 if (kex->gss_deleg_creds) 323 if (ssh->kex->gss_deleg_creds)
320 ssh_gssapi_credentials_updated(ctxt); 324 ssh_gssapi_credentials_updated(ctxt);
321 325
322 if (gss_kex_context == NULL) 326 if (gss_kex_context == NULL)
@@ -324,9 +328,9 @@ kexgss_client(Kex *kex) {
324 else 328 else
325 ssh_gssapi_delete_ctx(&ctxt); 329 ssh_gssapi_delete_ctx(&ctxt);
326 330
327 kex_derive_keys_bn(kex, hash, hashlen, shared_secret); 331 kex_derive_keys_bn(ssh, hash, hashlen, shared_secret);
328 BN_clear_free(shared_secret); 332 BN_clear_free(shared_secret);
329 kex_finish(kex); 333 return kex_send_newkeys(ssh);
330} 334}
331 335
332#endif /* GSSAPI */ 336#endif /* GSSAPI */
diff --git a/kexgsss.c b/kexgsss.c
index 6a0ece84b..0847469af 100644
--- a/kexgsss.c
+++ b/kexgsss.c
@@ -44,11 +44,12 @@
44#include "monitor_wrap.h" 44#include "monitor_wrap.h"
45#include "misc.h" 45#include "misc.h"
46#include "servconf.h" 46#include "servconf.h"
47#include "digest.h"
47 48
48extern ServerOptions options; 49extern ServerOptions options;
49 50
50void 51int
51kexgss_server(Kex *kex) 52kexgss_server(struct ssh *ssh)
52{ 53{
53 OM_uint32 maj_status, min_status; 54 OM_uint32 maj_status, min_status;
54 55
@@ -63,8 +64,8 @@ kexgss_server(Kex *kex)
63 gss_buffer_desc gssbuf, recv_tok, msg_tok; 64 gss_buffer_desc gssbuf, recv_tok, msg_tok;
64 gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; 65 gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER;
65 Gssctxt *ctxt = NULL; 66 Gssctxt *ctxt = NULL;
66 u_int slen, klen, kout, hashlen; 67 u_int slen, klen, kout;
67 u_char *kbuf, *hash; 68 u_char *kbuf;
68 DH *dh; 69 DH *dh;
69 int min = -1, max = -1, nbits = -1; 70 int min = -1, max = -1, nbits = -1;
70 BIGNUM *shared_secret = NULL; 71 BIGNUM *shared_secret = NULL;
@@ -72,6 +73,8 @@ kexgss_server(Kex *kex)
72 int type = 0; 73 int type = 0;
73 gss_OID oid; 74 gss_OID oid;
74 char *mechs; 75 char *mechs;
76 u_char hash[SSH_DIGEST_MAX_LENGTH];
77 size_t hashlen;
75 78
76 /* Initialise GSSAPI */ 79 /* Initialise GSSAPI */
77 80
@@ -84,8 +87,8 @@ kexgss_server(Kex *kex)
84 free(mechs); 87 free(mechs);
85 } 88 }
86 89
87 debug2("%s: Identifying %s", __func__, kex->name); 90 debug2("%s: Identifying %s", __func__, ssh->kex->name);
88 oid = ssh_gssapi_id_kex(NULL, kex->name, kex->kex_type); 91 oid = ssh_gssapi_id_kex(NULL, ssh->kex->name, ssh->kex->kex_type);
89 if (oid == GSS_C_NO_OID) 92 if (oid == GSS_C_NO_OID)
90 fatal("Unknown gssapi mechanism"); 93 fatal("Unknown gssapi mechanism");
91 94
@@ -94,7 +97,7 @@ kexgss_server(Kex *kex)
94 if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, oid)))) 97 if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, oid))))
95 fatal("Unable to acquire credentials for the server"); 98 fatal("Unable to acquire credentials for the server");
96 99
97 switch (kex->kex_type) { 100 switch (ssh->kex->kex_type) {
98 case KEX_GSS_GRP1_SHA1: 101 case KEX_GSS_GRP1_SHA1:
99 dh = dh_new_group1(); 102 dh = dh_new_group1();
100 break; 103 break;
@@ -125,10 +128,10 @@ kexgss_server(Kex *kex)
125 packet_write_wait(); 128 packet_write_wait();
126 break; 129 break;
127 default: 130 default:
128 fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); 131 fatal("%s: Unexpected KEX type %d", __func__, ssh->kex->kex_type);
129 } 132 }
130 133
131 dh_gen_key(dh, kex->we_need * 8); 134 dh_gen_key(dh, ssh->kex->we_need * 8);
132 135
133 do { 136 do {
134 debug("Wait SSH2_MSG_GSSAPI_INIT"); 137 debug("Wait SSH2_MSG_GSSAPI_INIT");
@@ -211,43 +214,44 @@ kexgss_server(Kex *kex)
211 memset(kbuf, 0, klen); 214 memset(kbuf, 0, klen);
212 free(kbuf); 215 free(kbuf);
213 216
214 switch (kex->kex_type) { 217 hashlen = sizeof(hash);
218 switch (ssh->kex->kex_type) {
215 case KEX_GSS_GRP1_SHA1: 219 case KEX_GSS_GRP1_SHA1:
216 case KEX_GSS_GRP14_SHA1: 220 case KEX_GSS_GRP14_SHA1:
217 kex_dh_hash( 221 kex_dh_hash(
218 kex->client_version_string, kex->server_version_string, 222 ssh->kex->client_version_string, ssh->kex->server_version_string,
219 buffer_ptr(&kex->peer), buffer_len(&kex->peer), 223 buffer_ptr(ssh->kex->peer), buffer_len(ssh->kex->peer),
220 buffer_ptr(&kex->my), buffer_len(&kex->my), 224 buffer_ptr(ssh->kex->my), buffer_len(ssh->kex->my),
221 NULL, 0, /* Change this if we start sending host keys */ 225 NULL, 0, /* Change this if we start sending host keys */
222 dh_client_pub, dh->pub_key, shared_secret, 226 dh_client_pub, dh->pub_key, shared_secret,
223 &hash, &hashlen 227 hash, &hashlen
224 ); 228 );
225 break; 229 break;
226 case KEX_GSS_GEX_SHA1: 230 case KEX_GSS_GEX_SHA1:
227 kexgex_hash( 231 kexgex_hash(
228 kex->hash_alg, 232 ssh->kex->hash_alg,
229 kex->client_version_string, kex->server_version_string, 233 ssh->kex->client_version_string, ssh->kex->server_version_string,
230 buffer_ptr(&kex->peer), buffer_len(&kex->peer), 234 buffer_ptr(ssh->kex->peer), buffer_len(ssh->kex->peer),
231 buffer_ptr(&kex->my), buffer_len(&kex->my), 235 buffer_ptr(ssh->kex->my), buffer_len(ssh->kex->my),
232 NULL, 0, 236 NULL, 0,
233 min, nbits, max, 237 min, nbits, max,
234 dh->p, dh->g, 238 dh->p, dh->g,
235 dh_client_pub, 239 dh_client_pub,
236 dh->pub_key, 240 dh->pub_key,
237 shared_secret, 241 shared_secret,
238 &hash, &hashlen 242 hash, &hashlen
239 ); 243 );
240 break; 244 break;
241 default: 245 default:
242 fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); 246 fatal("%s: Unexpected KEX type %d", __func__, ssh->kex->kex_type);
243 } 247 }
244 248
245 BN_clear_free(dh_client_pub); 249 BN_clear_free(dh_client_pub);
246 250
247 if (kex->session_id == NULL) { 251 if (ssh->kex->session_id == NULL) {
248 kex->session_id_len = hashlen; 252 ssh->kex->session_id_len = hashlen;
249 kex->session_id = xmalloc(kex->session_id_len); 253 ssh->kex->session_id = xmalloc(ssh->kex->session_id_len);
250 memcpy(kex->session_id, hash, kex->session_id_len); 254 memcpy(ssh->kex->session_id, hash, ssh->kex->session_id_len);
251 } 255 }
252 256
253 gssbuf.value = hash; 257 gssbuf.value = hash;
@@ -278,13 +282,14 @@ kexgss_server(Kex *kex)
278 282
279 DH_free(dh); 283 DH_free(dh);
280 284
281 kex_derive_keys_bn(kex, hash, hashlen, shared_secret); 285 kex_derive_keys_bn(ssh, hash, hashlen, shared_secret);
282 BN_clear_free(shared_secret); 286 BN_clear_free(shared_secret);
283 kex_finish(kex); 287 kex_send_newkeys(ssh);
284 288
285 /* If this was a rekey, then save out any delegated credentials we 289 /* If this was a rekey, then save out any delegated credentials we
286 * just exchanged. */ 290 * just exchanged. */
287 if (options.gss_store_rekey) 291 if (options.gss_store_rekey)
288 ssh_gssapi_rekey_creds(); 292 ssh_gssapi_rekey_creds();
293 return 0;
289} 294}
290#endif /* GSSAPI */ 295#endif /* GSSAPI */
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 c25ccd80e..d7454808e 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>
@@ -553,7 +553,7 @@ tilde_expand_filename(const char *filename, uid_t uid)
553 if (path != NULL) 553 if (path != NULL)
554 filename = path + 1; 554 filename = path + 1;
555 555
556 if (xasprintf(&ret, "%s%s%s", pw->pw_dir, sep, filename) >= MAXPATHLEN) 556 if (xasprintf(&ret, "%s%s%s", pw->pw_dir, sep, filename) >= PATH_MAX)
557 fatal("tilde_expand_filename: Path too long"); 557 fatal("tilde_expand_filename: Path too long");
558 558
559 return (ret); 559 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 cc15ce486..ce7ba079c 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#ifdef USE_CONSOLEKIT 107#ifdef USE_CONSOLEKIT
104#include "consolekit.h" 108#include "consolekit.h"
105#endif 109#endif
@@ -111,38 +115,13 @@ static Gssctxt *gsscontext = NULL;
111/* Imports */ 115/* Imports */
112extern ServerOptions options; 116extern ServerOptions options;
113extern u_int utmp_len; 117extern u_int utmp_len;
114extern Newkeys *current_keys[];
115extern z_stream incoming_stream;
116extern z_stream outgoing_stream;
117extern u_char session_id[]; 118extern u_char session_id[];
118extern Buffer auth_debug; 119extern Buffer auth_debug;
119extern int auth_debug_init; 120extern int auth_debug_init;
120extern Buffer loginmsg; 121extern Buffer loginmsg;
121 122
122/* State exported from the child */ 123/* State exported from the child */
123 124static struct sshbuf *child_state;
124struct {
125 z_stream incoming;
126 z_stream outgoing;
127 u_char *keyin;
128 u_int keyinlen;
129 u_char *keyout;
130 u_int keyoutlen;
131 u_char *ivin;
132 u_int ivinlen;
133 u_char *ivout;
134 u_int ivoutlen;
135 u_char *ssh1key;
136 u_int ssh1keylen;
137 int ssh1cipher;
138 int ssh1protoflags;
139 u_char *input;
140 u_int ilen;
141 u_char *output;
142 u_int olen;
143 u_int64_t sent_bytes;
144 u_int64_t recv_bytes;
145} child_state;
146 125
147/* Functions on the monitor that answer unprivileged requests */ 126/* Functions on the monitor that answer unprivileged requests */
148 127
@@ -539,6 +518,27 @@ monitor_sync(struct monitor *pmonitor)
539 } 518 }
540} 519}
541 520
521/* Allocation functions for zlib */
522static void *
523mm_zalloc(struct mm_master *mm, u_int ncount, u_int size)
524{
525 size_t len = (size_t) size * ncount;
526 void *address;
527
528 if (len == 0 || ncount > SIZE_MAX / size)
529 fatal("%s: mm_zalloc(%u, %u)", __func__, ncount, size);
530
531 address = mm_malloc(mm, len);
532
533 return (address);
534}
535
536static void
537mm_zfree(struct mm_master *mm, void *address)
538{
539 mm_free(mm, address);
540}
541
542static int 542static int
543monitor_read_log(struct monitor *pmonitor) 543monitor_read_log(struct monitor *pmonitor)
544{ 544{
@@ -719,28 +719,60 @@ mm_answer_moduli(int sock, Buffer *m)
719} 719}
720#endif 720#endif
721 721
722extern AuthenticationConnection *auth_conn;
723
724int 722int
725mm_answer_sign(int sock, Buffer *m) 723mm_answer_sign(int sock, Buffer *m)
726{ 724{
727 Key *key; 725 struct ssh *ssh = active_state; /* XXX */
726 extern int auth_sock; /* XXX move to state struct? */
727 struct sshkey *key;
728 struct sshbuf *sigbuf;
728 u_char *p; 729 u_char *p;
729 u_char *signature; 730 u_char *signature;
730 u_int siglen, datlen; 731 size_t datlen, siglen;
731 int keyid; 732 int r, keyid, is_proof = 0;
733 const char proof_req[] = "hostkeys-prove-00@openssh.com";
732 734
733 debug3("%s", __func__); 735 debug3("%s", __func__);
734 736
735 keyid = buffer_get_int(m); 737 if ((r = sshbuf_get_u32(m, &keyid)) != 0 ||
736 p = buffer_get_string(m, &datlen); 738 (r = sshbuf_get_string(m, &p, &datlen)) != 0)
739 fatal("%s: buffer error: %s", __func__, ssh_err(r));
737 740
738 /* 741 /*
739 * Supported KEX types use SHA1 (20 bytes), SHA256 (32 bytes), 742 * Supported KEX types use SHA1 (20 bytes), SHA256 (32 bytes),
740 * SHA384 (48 bytes) and SHA512 (64 bytes). 743 * SHA384 (48 bytes) and SHA512 (64 bytes).
744 *
745 * Otherwise, verify the signature request is for a hostkey
746 * proof.
747 *
748 * XXX perform similar check for KEX signature requests too?
749 * it's not trivial, since what is signed is the hash, rather
750 * than the full kex structure...
741 */ 751 */
742 if (datlen != 20 && datlen != 32 && datlen != 48 && datlen != 64) 752 if (datlen != 20 && datlen != 32 && datlen != 48 && datlen != 64) {
743 fatal("%s: data length incorrect: %u", __func__, datlen); 753 /*
754 * Construct expected hostkey proof and compare it to what
755 * the client sent us.
756 */
757 if (session_id2_len == 0) /* hostkeys is never first */
758 fatal("%s: bad data length: %zu", __func__, datlen);
759 if ((key = get_hostkey_public_by_index(keyid, ssh)) == NULL)
760 fatal("%s: no hostkey for index %d", __func__, keyid);
761 if ((sigbuf = sshbuf_new()) == NULL)
762 fatal("%s: sshbuf_new", __func__);
763 if ((r = sshbuf_put_cstring(sigbuf, proof_req)) != 0 ||
764 (r = sshbuf_put_string(sigbuf, session_id2,
765 session_id2_len) != 0) ||
766 (r = sshkey_puts(key, sigbuf)) != 0)
767 fatal("%s: couldn't prepare private key "
768 "proof buffer: %s", __func__, ssh_err(r));
769 if (datlen != sshbuf_len(sigbuf) ||
770 memcmp(p, sshbuf_ptr(sigbuf), sshbuf_len(sigbuf)) != 0)
771 fatal("%s: bad data length: %zu, hostkey proof len %zu",
772 __func__, datlen, sshbuf_len(sigbuf));
773 sshbuf_free(sigbuf);
774 is_proof = 1;
775 }
744 776
745 /* save session id, it will be passed on the first call */ 777 /* save session id, it will be passed on the first call */
746 if (session_id2_len == 0) { 778 if (session_id2_len == 0) {
@@ -750,20 +782,26 @@ mm_answer_sign(int sock, Buffer *m)
750 } 782 }
751 783
752 if ((key = get_hostkey_by_index(keyid)) != NULL) { 784 if ((key = get_hostkey_by_index(keyid)) != NULL) {
753 if (key_sign(key, &signature, &siglen, p, datlen) < 0) 785 if ((r = sshkey_sign(key, &signature, &siglen, p, datlen,
754 fatal("%s: key_sign failed", __func__); 786 datafellows)) != 0)
755 } else if ((key = get_hostkey_public_by_index(keyid)) != NULL && 787 fatal("%s: sshkey_sign failed: %s",
756 auth_conn != NULL) { 788 __func__, ssh_err(r));
757 if (ssh_agent_sign(auth_conn, key, &signature, &siglen, p, 789 } else if ((key = get_hostkey_public_by_index(keyid, ssh)) != NULL &&
758 datlen) < 0) 790 auth_sock > 0) {
759 fatal("%s: ssh_agent_sign failed", __func__); 791 if ((r = ssh_agent_sign(auth_sock, key, &signature, &siglen,
792 p, datlen, datafellows)) != 0) {
793 fatal("%s: ssh_agent_sign failed: %s",
794 __func__, ssh_err(r));
795 }
760 } else 796 } else
761 fatal("%s: no hostkey from index %d", __func__, keyid); 797 fatal("%s: no hostkey from index %d", __func__, keyid);
762 798
763 debug3("%s: signature %p(%u)", __func__, signature, siglen); 799 debug3("%s: %s signature %p(%zu)", __func__,
800 is_proof ? "KEX" : "hostkey proof", signature, siglen);
764 801
765 buffer_clear(m); 802 sshbuf_reset(m);
766 buffer_put_string(m, signature, siglen); 803 if ((r = sshbuf_put_string(m, signature, siglen)) != 0)
804 fatal("%s: buffer error: %s", __func__, ssh_err(r));
767 805
768 free(p); 806 free(p);
769 free(signature); 807 free(signature);
@@ -1226,9 +1264,18 @@ mm_answer_keyallowed(int sock, Buffer *m)
1226 debug3("%s: key_from_blob: %p", __func__, key); 1264 debug3("%s: key_from_blob: %p", __func__, key);
1227 1265
1228 if (key != NULL && authctxt->valid) { 1266 if (key != NULL && authctxt->valid) {
1267 /* These should not make it past the privsep child */
1268 if (key_type_plain(key->type) == KEY_RSA &&
1269 (datafellows & SSH_BUG_RSASIGMD5) != 0)
1270 fatal("%s: passed a SSH_BUG_RSASIGMD5 key", __func__);
1271
1229 switch (type) { 1272 switch (type) {
1230 case MM_USERKEY: 1273 case MM_USERKEY:
1231 allowed = options.pubkey_authentication && 1274 allowed = options.pubkey_authentication &&
1275 !auth2_userkey_already_used(authctxt, key) &&
1276 match_pattern_list(sshkey_ssh_name(key),
1277 options.pubkey_key_types,
1278 strlen(options.pubkey_key_types), 0) == 1 &&
1232 user_key_allowed(authctxt->pw, key); 1279 user_key_allowed(authctxt->pw, key);
1233 pubkey_auth_info(authctxt, key, NULL); 1280 pubkey_auth_info(authctxt, key, NULL);
1234 auth_method = "publickey"; 1281 auth_method = "publickey";
@@ -1237,6 +1284,9 @@ mm_answer_keyallowed(int sock, Buffer *m)
1237 break; 1284 break;
1238 case MM_HOSTKEY: 1285 case MM_HOSTKEY:
1239 allowed = options.hostbased_authentication && 1286 allowed = options.hostbased_authentication &&
1287 match_pattern_list(sshkey_ssh_name(key),
1288 options.hostbased_key_types,
1289 strlen(options.hostbased_key_types), 0) == 1 &&
1240 hostbased_key_allowed(authctxt->pw, 1290 hostbased_key_allowed(authctxt->pw,
1241 cuser, chost, key); 1291 cuser, chost, key);
1242 pubkey_auth_info(authctxt, key, 1292 pubkey_auth_info(authctxt, key,
@@ -1456,7 +1506,12 @@ mm_answer_keyverify(int sock, Buffer *m)
1456 debug3("%s: key %p signature %s", 1506 debug3("%s: key %p signature %s",
1457 __func__, key, (verified == 1) ? "verified" : "unverified"); 1507 __func__, key, (verified == 1) ? "verified" : "unverified");
1458 1508
1459 key_free(key); 1509 /* If auth was successful then record key to ensure it isn't reused */
1510 if (verified == 1)
1511 auth2_record_userkey(authctxt, key);
1512 else
1513 key_free(key);
1514
1460 free(blob); 1515 free(blob);
1461 free(signature); 1516 free(signature);
1462 free(data); 1517 free(data);
@@ -1842,112 +1897,47 @@ mm_answer_audit_command(int socket, Buffer *m)
1842void 1897void
1843monitor_apply_keystate(struct monitor *pmonitor) 1898monitor_apply_keystate(struct monitor *pmonitor)
1844{ 1899{
1845 if (compat20) { 1900 struct ssh *ssh = active_state; /* XXX */
1846 set_newkeys(MODE_IN); 1901 struct kex *kex;
1847 set_newkeys(MODE_OUT); 1902 int r;
1848 } else { 1903
1849 packet_set_protocol_flags(child_state.ssh1protoflags); 1904 debug3("%s: packet_set_state", __func__);
1850 packet_set_encryption_key(child_state.ssh1key, 1905 if ((r = ssh_packet_set_state(ssh, child_state)) != 0)
1851 child_state.ssh1keylen, child_state.ssh1cipher); 1906 fatal("%s: packet_set_state: %s", __func__, ssh_err(r));
1852 free(child_state.ssh1key); 1907 sshbuf_free(child_state);
1853 } 1908 child_state = NULL;
1854 1909
1855 /* for rc4 and other stateful ciphers */ 1910 if ((kex = ssh->kex) != 0) {
1856 packet_set_keycontext(MODE_OUT, child_state.keyout); 1911 /* XXX set callbacks */
1857 free(child_state.keyout); 1912#ifdef WITH_OPENSSL
1858 packet_set_keycontext(MODE_IN, child_state.keyin); 1913 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server;
1859 free(child_state.keyin); 1914 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server;
1860 1915 kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
1861 if (!compat20) { 1916 kex->kex[KEX_DH_GEX_SHA256] = kexgex_server;
1862 packet_set_iv(MODE_OUT, child_state.ivout); 1917# ifdef OPENSSL_HAS_ECC
1863 free(child_state.ivout); 1918 kex->kex[KEX_ECDH_SHA2] = kexecdh_server;
1864 packet_set_iv(MODE_IN, child_state.ivin); 1919# endif
1865 free(child_state.ivin); 1920#endif /* WITH_OPENSSL */
1921 kex->kex[KEX_C25519_SHA256] = kexc25519_server;
1922#ifdef GSSAPI
1923 if (options.gss_keyex) {
1924 kex->kex[KEX_GSS_GRP1_SHA1] = kexgss_server;
1925 kex->kex[KEX_GSS_GRP14_SHA1] = kexgss_server;
1926 kex->kex[KEX_GSS_GEX_SHA1] = kexgss_server;
1927 }
1928#endif
1929 kex->load_host_public_key=&get_hostkey_public_by_type;
1930 kex->load_host_private_key=&get_hostkey_private_by_type;
1931 kex->host_key_index=&get_hostkey_index;
1932 kex->sign = sshd_hostkey_sign;
1866 } 1933 }
1867 1934
1868 memcpy(&incoming_stream, &child_state.incoming,
1869 sizeof(incoming_stream));
1870 memcpy(&outgoing_stream, &child_state.outgoing,
1871 sizeof(outgoing_stream));
1872
1873 /* Update with new address */ 1935 /* Update with new address */
1874 if (options.compression) 1936 if (options.compression) {
1875 mm_init_compression(pmonitor->m_zlib); 1937 ssh_packet_set_compress_hooks(ssh, pmonitor->m_zlib,
1876 1938 (ssh_packet_comp_alloc_func *)mm_zalloc,
1877 packet_set_postauth(); 1939 (ssh_packet_comp_free_func *)mm_zfree);
1878
1879 if (options.rekey_limit || options.rekey_interval)
1880 packet_set_rekey_limits((u_int32_t)options.rekey_limit,
1881 (time_t)options.rekey_interval);
1882
1883 /* Network I/O buffers */
1884 /* XXX inefficient for large buffers, need: buffer_init_from_string */
1885 buffer_clear(packet_get_input());
1886 buffer_append(packet_get_input(), child_state.input, child_state.ilen);
1887 explicit_bzero(child_state.input, child_state.ilen);
1888 free(child_state.input);
1889
1890 buffer_clear(packet_get_output());
1891 buffer_append(packet_get_output(), child_state.output,
1892 child_state.olen);
1893 explicit_bzero(child_state.output, child_state.olen);
1894 free(child_state.output);
1895
1896 /* Roaming */
1897 if (compat20)
1898 roam_set_bytes(child_state.sent_bytes, child_state.recv_bytes);
1899}
1900
1901static Kex *
1902mm_get_kex(Buffer *m)
1903{
1904 Kex *kex;
1905 void *blob;
1906 u_int bloblen;
1907
1908 kex = xcalloc(1, sizeof(*kex));
1909 kex->session_id = buffer_get_string(m, &kex->session_id_len);
1910 if (session_id2 == NULL ||
1911 kex->session_id_len != session_id2_len ||
1912 timingsafe_bcmp(kex->session_id, session_id2, session_id2_len) != 0)
1913 fatal("mm_get_get: internal error: bad session id");
1914 kex->we_need = buffer_get_int(m);
1915#ifdef WITH_OPENSSL
1916 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server;
1917 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server;
1918 kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
1919 kex->kex[KEX_DH_GEX_SHA256] = kexgex_server;
1920 kex->kex[KEX_ECDH_SHA2] = kexecdh_server;
1921#endif
1922 kex->kex[KEX_C25519_SHA256] = kexc25519_server;
1923#ifdef GSSAPI
1924 if (options.gss_keyex) {
1925 kex->kex[KEX_GSS_GRP1_SHA1] = kexgss_server;
1926 kex->kex[KEX_GSS_GRP14_SHA1] = kexgss_server;
1927 kex->kex[KEX_GSS_GEX_SHA1] = kexgss_server;
1928 } 1940 }
1929#endif
1930 kex->server = 1;
1931 kex->hostkey_type = buffer_get_int(m);
1932 kex->kex_type = buffer_get_int(m);
1933 blob = buffer_get_string(m, &bloblen);
1934 buffer_init(&kex->my);
1935 buffer_append(&kex->my, blob, bloblen);
1936 free(blob);
1937 blob = buffer_get_string(m, &bloblen);
1938 buffer_init(&kex->peer);
1939 buffer_append(&kex->peer, blob, bloblen);
1940 free(blob);
1941 kex->done = 1;
1942 kex->flags = buffer_get_int(m);
1943 kex->client_version_string = buffer_get_string(m, NULL);
1944 kex->server_version_string = buffer_get_string(m, NULL);
1945 kex->load_host_public_key=&get_hostkey_public_by_type;
1946 kex->load_host_private_key=&get_hostkey_private_by_type;
1947 kex->host_key_index=&get_hostkey_index;
1948 kex->sign = sshd_hostkey_sign;
1949
1950 return (kex);
1951} 1941}
1952 1942
1953/* This function requries careful sanity checking */ 1943/* This function requries careful sanity checking */
@@ -1955,118 +1945,16 @@ mm_get_kex(Buffer *m)
1955void 1945void
1956mm_get_keystate(struct monitor *pmonitor) 1946mm_get_keystate(struct monitor *pmonitor)
1957{ 1947{
1958 Buffer m;
1959 u_char *blob, *p;
1960 u_int bloblen, plen;
1961 u_int32_t seqnr, packets;
1962 u_int64_t blocks, bytes;
1963
1964 debug3("%s: Waiting for new keys", __func__); 1948 debug3("%s: Waiting for new keys", __func__);
1965 1949
1966 buffer_init(&m); 1950 if ((child_state = sshbuf_new()) == NULL)
1967 mm_request_receive_expect(pmonitor->m_sendfd, MONITOR_REQ_KEYEXPORT, &m); 1951 fatal("%s: sshbuf_new failed", __func__);
1968 if (!compat20) { 1952 mm_request_receive_expect(pmonitor->m_sendfd, MONITOR_REQ_KEYEXPORT,
1969 child_state.ssh1protoflags = buffer_get_int(&m); 1953 child_state);
1970 child_state.ssh1cipher = buffer_get_int(&m); 1954 debug3("%s: GOT new keys", __func__);
1971 child_state.ssh1key = buffer_get_string(&m,
1972 &child_state.ssh1keylen);
1973 child_state.ivout = buffer_get_string(&m,
1974 &child_state.ivoutlen);
1975 child_state.ivin = buffer_get_string(&m, &child_state.ivinlen);
1976 goto skip;
1977 } else {
1978 /* Get the Kex for rekeying */
1979 *pmonitor->m_pkex = mm_get_kex(&m);
1980 }
1981
1982 blob = buffer_get_string(&m, &bloblen);
1983 current_keys[MODE_OUT] = mm_newkeys_from_blob(blob, bloblen);
1984 free(blob);
1985
1986 debug3("%s: Waiting for second key", __func__);
1987 blob = buffer_get_string(&m, &bloblen);
1988 current_keys[MODE_IN] = mm_newkeys_from_blob(blob, bloblen);
1989 free(blob);
1990
1991 /* Now get sequence numbers for the packets */
1992 seqnr = buffer_get_int(&m);
1993 blocks = buffer_get_int64(&m);
1994 packets = buffer_get_int(&m);
1995 bytes = buffer_get_int64(&m);
1996 packet_set_state(MODE_OUT, seqnr, blocks, packets, bytes);
1997 seqnr = buffer_get_int(&m);
1998 blocks = buffer_get_int64(&m);
1999 packets = buffer_get_int(&m);
2000 bytes = buffer_get_int64(&m);
2001 packet_set_state(MODE_IN, seqnr, blocks, packets, bytes);
2002
2003 skip:
2004 /* Get the key context */
2005 child_state.keyout = buffer_get_string(&m, &child_state.keyoutlen);
2006 child_state.keyin = buffer_get_string(&m, &child_state.keyinlen);
2007
2008 debug3("%s: Getting compression state", __func__);
2009 /* Get compression state */
2010 p = buffer_get_string(&m, &plen);
2011 if (plen != sizeof(child_state.outgoing))
2012 fatal("%s: bad request size", __func__);
2013 memcpy(&child_state.outgoing, p, sizeof(child_state.outgoing));
2014 free(p);
2015
2016 p = buffer_get_string(&m, &plen);
2017 if (plen != sizeof(child_state.incoming))
2018 fatal("%s: bad request size", __func__);
2019 memcpy(&child_state.incoming, p, sizeof(child_state.incoming));
2020 free(p);
2021
2022 /* Network I/O buffers */
2023 debug3("%s: Getting Network I/O buffers", __func__);
2024 child_state.input = buffer_get_string(&m, &child_state.ilen);
2025 child_state.output = buffer_get_string(&m, &child_state.olen);
2026
2027 /* Roaming */
2028 if (compat20) {
2029 child_state.sent_bytes = buffer_get_int64(&m);
2030 child_state.recv_bytes = buffer_get_int64(&m);
2031 }
2032
2033 buffer_free(&m);
2034} 1955}
2035 1956
2036 1957
2037/* Allocation functions for zlib */
2038void *
2039mm_zalloc(struct mm_master *mm, u_int ncount, u_int size)
2040{
2041 size_t len = (size_t) size * ncount;
2042 void *address;
2043
2044 if (len == 0 || ncount > SIZE_T_MAX / size)
2045 fatal("%s: mm_zalloc(%u, %u)", __func__, ncount, size);
2046
2047 address = mm_malloc(mm, len);
2048
2049 return (address);
2050}
2051
2052void
2053mm_zfree(struct mm_master *mm, void *address)
2054{
2055 mm_free(mm, address);
2056}
2057
2058void
2059mm_init_compression(struct mm_master *mm)
2060{
2061 outgoing_stream.zalloc = (alloc_func)mm_zalloc;
2062 outgoing_stream.zfree = (free_func)mm_zfree;
2063 outgoing_stream.opaque = mm;
2064
2065 incoming_stream.zalloc = (alloc_func)mm_zalloc;
2066 incoming_stream.zfree = (free_func)mm_zfree;
2067 incoming_stream.opaque = mm;
2068}
2069
2070/* XXX */ 1958/* XXX */
2071 1959
2072#define FD_CLOSEONEXEC(x) do { \ 1960#define FD_CLOSEONEXEC(x) do { \
@@ -2102,6 +1990,7 @@ monitor_openfds(struct monitor *mon, int do_logfds)
2102struct monitor * 1990struct monitor *
2103monitor_init(void) 1991monitor_init(void)
2104{ 1992{
1993 struct ssh *ssh = active_state; /* XXX */
2105 struct monitor *mon; 1994 struct monitor *mon;
2106 1995
2107 mon = xcalloc(1, sizeof(*mon)); 1996 mon = xcalloc(1, sizeof(*mon));
@@ -2114,7 +2003,9 @@ monitor_init(void)
2114 mon->m_zlib = mm_create(mon->m_zback, 20 * MM_MEMSIZE); 2003 mon->m_zlib = mm_create(mon->m_zback, 20 * MM_MEMSIZE);
2115 2004
2116 /* Compression needs to share state across borders */ 2005 /* Compression needs to share state across borders */
2117 mm_init_compression(mon->m_zlib); 2006 ssh_packet_set_compress_hooks(ssh, mon->m_zlib,
2007 (ssh_packet_comp_alloc_func *)mm_zalloc,
2008 (ssh_packet_comp_free_func *)mm_zfree);
2118 } 2009 }
2119 2010
2120 return mon; 2011 return mon;
diff --git a/monitor.h b/monitor.h
index 10ba59ea9..fd8d92cd0 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>
@@ -82,7 +82,7 @@ struct monitor {
82 int m_log_sendfd; 82 int m_log_sendfd;
83 struct mm_master *m_zback; 83 struct mm_master *m_zback;
84 struct mm_master *m_zlib; 84 struct mm_master *m_zlib;
85 struct Kex **m_pkex; 85 struct kex **m_pkex;
86 pid_t m_pid; 86 pid_t m_pid;
87}; 87};
88 88
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 4c57d4df3..a5f4e9d3c 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);
@@ -486,239 +491,21 @@ mm_key_verify(Key *key, u_char *sig, u_int siglen, u_char *data, u_int datalen)
486 return (verified); 491 return (verified);
487} 492}
488 493
489/* Export key state after authentication */
490Newkeys *
491mm_newkeys_from_blob(u_char *blob, int blen)
492{
493 Buffer b;
494 u_int len;
495 Newkeys *newkey = NULL;
496 Enc *enc;
497 Mac *mac;
498 Comp *comp;
499
500 debug3("%s: %p(%d)", __func__, blob, blen);
501#ifdef DEBUG_PK
502 dump_base64(stderr, blob, blen);
503#endif
504 buffer_init(&b);
505 buffer_append(&b, blob, blen);
506
507 newkey = xcalloc(1, sizeof(*newkey));
508 enc = &newkey->enc;
509 mac = &newkey->mac;
510 comp = &newkey->comp;
511
512 /* Enc structure */
513 enc->name = buffer_get_string(&b, NULL);
514 buffer_get(&b, &enc->cipher, sizeof(enc->cipher));
515 enc->enabled = buffer_get_int(&b);
516 enc->block_size = buffer_get_int(&b);
517 enc->key = buffer_get_string(&b, &enc->key_len);
518 enc->iv = buffer_get_string(&b, &enc->iv_len);
519
520 if (enc->name == NULL || cipher_by_name(enc->name) != enc->cipher)
521 fatal("%s: bad cipher name %s or pointer %p", __func__,
522 enc->name, enc->cipher);
523
524 /* Mac structure */
525 if (cipher_authlen(enc->cipher) == 0) {
526 mac->name = buffer_get_string(&b, NULL);
527 if (mac->name == NULL || mac_setup(mac, mac->name) == -1)
528 fatal("%s: can not setup mac %s", __func__, mac->name);
529 mac->enabled = buffer_get_int(&b);
530 mac->key = buffer_get_string(&b, &len);
531 if (len > mac->key_len)
532 fatal("%s: bad mac key length: %u > %d", __func__, len,
533 mac->key_len);
534 mac->key_len = len;
535 }
536
537 /* Comp structure */
538 comp->type = buffer_get_int(&b);
539 comp->enabled = buffer_get_int(&b);
540 comp->name = buffer_get_string(&b, NULL);
541
542 len = buffer_len(&b);
543 if (len != 0)
544 error("newkeys_from_blob: remaining bytes in blob %u", len);
545 buffer_free(&b);
546 return (newkey);
547}
548
549int
550mm_newkeys_to_blob(int mode, u_char **blobp, u_int *lenp)
551{
552 Buffer b;
553 int len;
554 Enc *enc;
555 Mac *mac;
556 Comp *comp;
557 Newkeys *newkey = (Newkeys *)packet_get_newkeys(mode);
558
559 debug3("%s: converting %p", __func__, newkey);
560
561 if (newkey == NULL) {
562 error("%s: newkey == NULL", __func__);
563 return 0;
564 }
565 enc = &newkey->enc;
566 mac = &newkey->mac;
567 comp = &newkey->comp;
568
569 buffer_init(&b);
570 /* Enc structure */
571 buffer_put_cstring(&b, enc->name);
572 /* The cipher struct is constant and shared, you export pointer */
573 buffer_append(&b, &enc->cipher, sizeof(enc->cipher));
574 buffer_put_int(&b, enc->enabled);
575 buffer_put_int(&b, enc->block_size);
576 buffer_put_string(&b, enc->key, enc->key_len);
577 packet_get_keyiv(mode, enc->iv, enc->iv_len);
578 buffer_put_string(&b, enc->iv, enc->iv_len);
579
580 /* Mac structure */
581 if (cipher_authlen(enc->cipher) == 0) {
582 buffer_put_cstring(&b, mac->name);
583 buffer_put_int(&b, mac->enabled);
584 buffer_put_string(&b, mac->key, mac->key_len);
585 }
586
587 /* Comp structure */
588 buffer_put_int(&b, comp->type);
589 buffer_put_int(&b, comp->enabled);
590 buffer_put_cstring(&b, comp->name);
591
592 len = buffer_len(&b);
593 if (lenp != NULL)
594 *lenp = len;
595 if (blobp != NULL) {
596 *blobp = xmalloc(len);
597 memcpy(*blobp, buffer_ptr(&b), len);
598 }
599 explicit_bzero(buffer_ptr(&b), len);
600 buffer_free(&b);
601 return len;
602}
603
604static void
605mm_send_kex(Buffer *m, Kex *kex)
606{
607 buffer_put_string(m, kex->session_id, kex->session_id_len);
608 buffer_put_int(m, kex->we_need);
609 buffer_put_int(m, kex->hostkey_type);
610 buffer_put_int(m, kex->kex_type);
611 buffer_put_string(m, buffer_ptr(&kex->my), buffer_len(&kex->my));
612 buffer_put_string(m, buffer_ptr(&kex->peer), buffer_len(&kex->peer));
613 buffer_put_int(m, kex->flags);
614 buffer_put_cstring(m, kex->client_version_string);
615 buffer_put_cstring(m, kex->server_version_string);
616}
617
618void 494void
619mm_send_keystate(struct monitor *monitor) 495mm_send_keystate(struct monitor *monitor)
620{ 496{
621 Buffer m, *input, *output; 497 struct ssh *ssh = active_state; /* XXX */
622 u_char *blob, *p; 498 struct sshbuf *m;
623 u_int bloblen, plen; 499 int r;
624 u_int32_t seqnr, packets; 500
625 u_int64_t blocks, bytes; 501 if ((m = sshbuf_new()) == NULL)
626 502 fatal("%s: sshbuf_new failed", __func__);
627 buffer_init(&m); 503 if ((r = ssh_packet_get_state(ssh, m)) != 0)
628 504 fatal("%s: get_state failed: %s",
629 if (!compat20) { 505 __func__, ssh_err(r));
630 u_char iv[24]; 506 mm_request_send(monitor->m_recvfd, MONITOR_REQ_KEYEXPORT, m);
631 u_char *key;
632 u_int ivlen, keylen;
633
634 buffer_put_int(&m, packet_get_protocol_flags());
635
636 buffer_put_int(&m, packet_get_ssh1_cipher());
637
638 debug3("%s: Sending ssh1 KEY+IV", __func__);
639 keylen = packet_get_encryption_key(NULL);
640 key = xmalloc(keylen+1); /* add 1 if keylen == 0 */
641 keylen = packet_get_encryption_key(key);
642 buffer_put_string(&m, key, keylen);
643 explicit_bzero(key, keylen);
644 free(key);
645
646 ivlen = packet_get_keyiv_len(MODE_OUT);
647 packet_get_keyiv(MODE_OUT, iv, ivlen);
648 buffer_put_string(&m, iv, ivlen);
649 ivlen = packet_get_keyiv_len(MODE_IN);
650 packet_get_keyiv(MODE_IN, iv, ivlen);
651 buffer_put_string(&m, iv, ivlen);
652 goto skip;
653 } else {
654 /* Kex for rekeying */
655 mm_send_kex(&m, *monitor->m_pkex);
656 }
657
658 debug3("%s: Sending new keys: %p %p",
659 __func__, packet_get_newkeys(MODE_OUT),
660 packet_get_newkeys(MODE_IN));
661
662 /* Keys from Kex */
663 if (!mm_newkeys_to_blob(MODE_OUT, &blob, &bloblen))
664 fatal("%s: conversion of newkeys failed", __func__);
665
666 buffer_put_string(&m, blob, bloblen);
667 free(blob);
668
669 if (!mm_newkeys_to_blob(MODE_IN, &blob, &bloblen))
670 fatal("%s: conversion of newkeys failed", __func__);
671
672 buffer_put_string(&m, blob, bloblen);
673 free(blob);
674
675 packet_get_state(MODE_OUT, &seqnr, &blocks, &packets, &bytes);
676 buffer_put_int(&m, seqnr);
677 buffer_put_int64(&m, blocks);
678 buffer_put_int(&m, packets);
679 buffer_put_int64(&m, bytes);
680 packet_get_state(MODE_IN, &seqnr, &blocks, &packets, &bytes);
681 buffer_put_int(&m, seqnr);
682 buffer_put_int64(&m, blocks);
683 buffer_put_int(&m, packets);
684 buffer_put_int64(&m, bytes);
685
686 debug3("%s: New keys have been sent", __func__);
687 skip:
688 /* More key context */
689 plen = packet_get_keycontext(MODE_OUT, NULL);
690 p = xmalloc(plen+1);
691 packet_get_keycontext(MODE_OUT, p);
692 buffer_put_string(&m, p, plen);
693 free(p);
694
695 plen = packet_get_keycontext(MODE_IN, NULL);
696 p = xmalloc(plen+1);
697 packet_get_keycontext(MODE_IN, p);
698 buffer_put_string(&m, p, plen);
699 free(p);
700
701 /* Compression state */
702 debug3("%s: Sending compression state", __func__);
703 buffer_put_string(&m, &outgoing_stream, sizeof(outgoing_stream));
704 buffer_put_string(&m, &incoming_stream, sizeof(incoming_stream));
705
706 /* Network I/O buffers */
707 input = (Buffer *)packet_get_input();
708 output = (Buffer *)packet_get_output();
709 buffer_put_string(&m, buffer_ptr(input), buffer_len(input));
710 buffer_put_string(&m, buffer_ptr(output), buffer_len(output));
711
712 /* Roaming */
713 if (compat20) {
714 buffer_put_int64(&m, get_sent_bytes());
715 buffer_put_int64(&m, get_recv_bytes());
716 }
717
718 mm_request_send(monitor->m_recvfd, MONITOR_REQ_KEYEXPORT, &m);
719 debug3("%s: Finished sending state", __func__); 507 debug3("%s: Finished sending state", __func__);
720 508 sshbuf_free(m);
721 buffer_free(&m);
722} 509}
723 510
724int 511int
diff --git a/monitor_wrap.h b/monitor_wrap.h
index 00e93fe9c..f99c31c43 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 *, char *); 44void mm_inform_authserv(char *, char *, char *);
45void mm_inform_authrole(char *); 45void mm_inform_authrole(char *);
46struct passwd *mm_getpwnamallow(const char *); 46struct passwd *mm_getpwnamallow(const char *);
@@ -90,7 +90,7 @@ void mm_ssh1_session_id(u_char *);
90int mm_ssh1_session_key(BIGNUM *); 90int mm_ssh1_session_key(BIGNUM *);
91 91
92/* Key export functions */ 92/* Key export functions */
93struct Newkeys *mm_newkeys_from_blob(u_char *, int); 93struct newkeys *mm_newkeys_from_blob(u_char *, int);
94int mm_newkeys_to_blob(int, u_char **, u_int *); 94int mm_newkeys_to_blob(int, u_char **, u_int *);
95 95
96void monitor_apply_keystate(struct monitor *); 96void monitor_apply_keystate(struct monitor *);
@@ -106,9 +106,6 @@ int mm_skey_query(void *, char **, char **, u_int *, char ***, u_int **);
106int mm_skey_respond(void *, u_int, char **); 106int mm_skey_respond(void *, u_int, char **);
107 107
108/* zlib allocation hooks */ 108/* zlib allocation hooks */
109
110void *mm_zalloc(struct mm_master *, u_int, u_int);
111void mm_zfree(struct mm_master *, void *);
112void mm_init_compression(struct mm_master *); 109void mm_init_compression(struct mm_master *);
113 110
114#ifdef USE_CONSOLEKIT 111#ifdef USE_CONSOLEKIT
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 defd5fb61..3f62403ce 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 29338b619..66a62f269 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>
@@ -43,6 +44,9 @@
43#ifdef HAVE_UTIL_H 44#ifdef HAVE_UTIL_H
44#include <util.h> 45#include <util.h>
45#endif 46#endif
47#if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) && !defined(BROKEN_STRNVIS)
48# include <vis.h>
49#endif
46 50
47#include "xmalloc.h" 51#include "xmalloc.h"
48#include "ssh.h" 52#include "ssh.h"
@@ -50,14 +54,15 @@
50#include "cipher.h" 54#include "cipher.h"
51#include "pathnames.h" 55#include "pathnames.h"
52#include "log.h" 56#include "log.h"
53#include "key.h" 57#include "sshkey.h"
54#include "misc.h" 58#include "misc.h"
55#include "readconf.h" 59#include "readconf.h"
56#include "match.h" 60#include "match.h"
57#include "buffer.h"
58#include "kex.h" 61#include "kex.h"
59#include "mac.h" 62#include "mac.h"
60#include "uidswap.h" 63#include "uidswap.h"
64#include "myproposal.h"
65#include "digest.h"
61 66
62/* Format of the configuration file: 67/* Format of the configuration file:
63 68
@@ -137,7 +142,7 @@ typedef enum {
137 oBatchMode, oCheckHostIP, oStrictHostKeyChecking, oCompression, 142 oBatchMode, oCheckHostIP, oStrictHostKeyChecking, oCompression,
138 oCompressionLevel, oTCPKeepAlive, oNumberOfPasswordPrompts, 143 oCompressionLevel, oTCPKeepAlive, oNumberOfPasswordPrompts,
139 oUsePrivilegedPort, oLogLevel, oCiphers, oProtocol, oMacs, 144 oUsePrivilegedPort, oLogLevel, oCiphers, oProtocol, oMacs,
140 oGlobalKnownHostsFile2, oUserKnownHostsFile2, oPubkeyAuthentication, 145 oPubkeyAuthentication,
141 oKbdInteractiveAuthentication, oKbdInteractiveDevices, oHostKeyAlias, 146 oKbdInteractiveAuthentication, oKbdInteractiveDevices, oHostKeyAlias,
142 oDynamicForward, oPreferredAuthentications, oHostbasedAuthentication, 147 oDynamicForward, oPreferredAuthentications, oHostbasedAuthentication,
143 oHostKeyAlgorithms, oBindAddress, oPKCS11Provider, 148 oHostKeyAlgorithms, oBindAddress, oPKCS11Provider,
@@ -154,7 +159,8 @@ typedef enum {
154 oKexAlgorithms, oIPQoS, oRequestTTY, oIgnoreUnknown, oProxyUseFdpass, 159 oKexAlgorithms, oIPQoS, oRequestTTY, oIgnoreUnknown, oProxyUseFdpass,
155 oCanonicalDomains, oCanonicalizeHostname, oCanonicalizeMaxDots, 160 oCanonicalDomains, oCanonicalizeHostname, oCanonicalizeMaxDots,
156 oCanonicalizeFallbackLocal, oCanonicalizePermittedCNAMEs, 161 oCanonicalizeFallbackLocal, oCanonicalizePermittedCNAMEs,
157 oStreamLocalBindMask, oStreamLocalBindUnlink, 162 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys,
163 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes,
158 oProtocolKeepAlives, oSetupTimeOut, 164 oProtocolKeepAlives, oSetupTimeOut,
159 oIgnoredUnknownOption, oDeprecated, oUnsupported 165 oIgnoredUnknownOption, oDeprecated, oUnsupported
160} OpCodes; 166} OpCodes;
@@ -227,7 +233,7 @@ static struct {
227 { "globalknownhostsfile", oGlobalKnownHostsFile }, 233 { "globalknownhostsfile", oGlobalKnownHostsFile },
228 { "globalknownhostsfile2", oDeprecated }, 234 { "globalknownhostsfile2", oDeprecated },
229 { "userknownhostsfile", oUserKnownHostsFile }, 235 { "userknownhostsfile", oUserKnownHostsFile },
230 { "userknownhostsfile2", oDeprecated }, 236 { "userknownhostsfile2", oDeprecated },
231 { "connectionattempts", oConnectionAttempts }, 237 { "connectionattempts", oConnectionAttempts },
232 { "batchmode", oBatchMode }, 238 { "batchmode", oBatchMode },
233 { "checkhostip", oCheckHostIP }, 239 { "checkhostip", oCheckHostIP },
@@ -280,6 +286,10 @@ static struct {
280 { "canonicalizepermittedcnames", oCanonicalizePermittedCNAMEs }, 286 { "canonicalizepermittedcnames", oCanonicalizePermittedCNAMEs },
281 { "streamlocalbindmask", oStreamLocalBindMask }, 287 { "streamlocalbindmask", oStreamLocalBindMask },
282 { "streamlocalbindunlink", oStreamLocalBindUnlink }, 288 { "streamlocalbindunlink", oStreamLocalBindUnlink },
289 { "revokedhostkeys", oRevokedHostKeys },
290 { "fingerprinthash", oFingerprintHash },
291 { "updatehostkeys", oUpdateHostkeys },
292 { "hostbasedkeytypes", oHostbasedKeyTypes },
283 { "ignoreunknown", oIgnoreUnknown }, 293 { "ignoreunknown", oIgnoreUnknown },
284 { "protocolkeepalives", oProtocolKeepAlives }, 294 { "protocolkeepalives", oProtocolKeepAlives },
285 { "setuptimeout", oSetupTimeOut }, 295 { "setuptimeout", oSetupTimeOut },
@@ -483,7 +493,7 @@ execute_in_shell(const char *cmd)
483 if (!WIFEXITED(status)) { 493 if (!WIFEXITED(status)) {
484 error("command '%.100s' exited abnormally", cmd); 494 error("command '%.100s' exited abnormally", cmd);
485 return -1; 495 return -1;
486 } 496 }
487 debug3("command returned status %d", WEXITSTATUS(status)); 497 debug3("command returned status %d", WEXITSTATUS(status));
488 return WEXITSTATUS(status); 498 return WEXITSTATUS(status);
489} 499}
@@ -493,11 +503,12 @@ execute_in_shell(const char *cmd)
493 */ 503 */
494static int 504static int
495match_cfg_line(Options *options, char **condition, struct passwd *pw, 505match_cfg_line(Options *options, char **condition, struct passwd *pw,
496 const char *host_arg, const char *filename, int linenum) 506 const char *host_arg, const char *original_host, int post_canon,
507 const char *filename, int linenum)
497{ 508{
498 char *arg, *attrib, *cmd, *cp = *condition, *host; 509 char *arg, *oattrib, *attrib, *cmd, *cp = *condition, *host, *criteria;
499 const char *ruser; 510 const char *ruser;
500 int r, port, result = 1, attributes = 0; 511 int r, port, this_result, result = 1, attributes = 0, negate;
501 size_t len; 512 size_t len;
502 char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV]; 513 char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV];
503 514
@@ -514,21 +525,38 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw,
514 } else 525 } else
515 host = xstrdup(host_arg); 526 host = xstrdup(host_arg);
516 527
517 debug3("checking match for '%s' host %s", cp, host); 528 debug2("checking match for '%s' host %s originally %s",
518 while ((attrib = strdelim(&cp)) && *attrib != '\0') { 529 cp, host, original_host);
519 attributes++; 530 while ((oattrib = attrib = strdelim(&cp)) && *attrib != '\0') {
531 criteria = NULL;
532 this_result = 1;
533 if ((negate = attrib[0] == '!'))
534 attrib++;
535 /* criteria "all" and "canonical" have no argument */
520 if (strcasecmp(attrib, "all") == 0) { 536 if (strcasecmp(attrib, "all") == 0) {
521 if (attributes != 1 || 537 if (attributes > 1 ||
522 ((arg = strdelim(&cp)) != NULL && *arg != '\0')) { 538 ((arg = strdelim(&cp)) != NULL && *arg != '\0')) {
523 error("'all' cannot be combined with other " 539 error("%.200s line %d: '%s' cannot be combined "
524 "Match attributes"); 540 "with other Match attributes",
541 filename, linenum, oattrib);
525 result = -1; 542 result = -1;
526 goto out; 543 goto out;
527 } 544 }
528 *condition = cp; 545 if (result)
529 result = 1; 546 result = negate ? 0 : 1;
530 goto out; 547 goto out;
531 } 548 }
549 attributes++;
550 if (strcasecmp(attrib, "canonical") == 0) {
551 r = !!post_canon; /* force bitmask member to boolean */
552 if (r == (negate ? 1 : 0))
553 this_result = result = 0;
554 debug3("%.200s line %d: %smatched '%s'",
555 filename, linenum,
556 this_result ? "" : "not ", oattrib);
557 continue;
558 }
559 /* All other criteria require an argument */
532 if ((arg = strdelim(&cp)) == NULL || *arg == '\0') { 560 if ((arg = strdelim(&cp)) == NULL || *arg == '\0') {
533 error("Missing Match criteria for %s", attrib); 561 error("Missing Match criteria for %s", attrib);
534 result = -1; 562 result = -1;
@@ -536,31 +564,25 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw,
536 } 564 }
537 len = strlen(arg); 565 len = strlen(arg);
538 if (strcasecmp(attrib, "host") == 0) { 566 if (strcasecmp(attrib, "host") == 0) {
539 if (match_hostname(host, arg, len) != 1) 567 criteria = xstrdup(host);
540 result = 0; 568 r = match_hostname(host, arg, len) == 1;
541 else 569 if (r == (negate ? 1 : 0))
542 debug("%.200s line %d: matched 'Host %.100s' ", 570 this_result = result = 0;
543 filename, linenum, host);
544 } else if (strcasecmp(attrib, "originalhost") == 0) { 571 } else if (strcasecmp(attrib, "originalhost") == 0) {
545 if (match_hostname(host_arg, arg, len) != 1) 572 criteria = xstrdup(original_host);
546 result = 0; 573 r = match_hostname(original_host, arg, len) == 1;
547 else 574 if (r == (negate ? 1 : 0))
548 debug("%.200s line %d: matched " 575 this_result = result = 0;
549 "'OriginalHost %.100s' ",
550 filename, linenum, host_arg);
551 } else if (strcasecmp(attrib, "user") == 0) { 576 } else if (strcasecmp(attrib, "user") == 0) {
552 if (match_pattern_list(ruser, arg, len, 0) != 1) 577 criteria = xstrdup(ruser);
553 result = 0; 578 r = match_pattern_list(ruser, arg, len, 0) == 1;
554 else 579 if (r == (negate ? 1 : 0))
555 debug("%.200s line %d: matched 'User %.100s' ", 580 this_result = result = 0;
556 filename, linenum, ruser);
557 } else if (strcasecmp(attrib, "localuser") == 0) { 581 } else if (strcasecmp(attrib, "localuser") == 0) {
558 if (match_pattern_list(pw->pw_name, arg, len, 0) != 1) 582 criteria = xstrdup(pw->pw_name);
559 result = 0; 583 r = match_pattern_list(pw->pw_name, arg, len, 0) == 1;
560 else 584 if (r == (negate ? 1 : 0))
561 debug("%.200s line %d: matched " 585 this_result = result = 0;
562 "'LocalUser %.100s' ",
563 filename, linenum, pw->pw_name);
564 } else if (strcasecmp(attrib, "exec") == 0) { 586 } else if (strcasecmp(attrib, "exec") == 0) {
565 if (gethostname(thishost, sizeof(thishost)) == -1) 587 if (gethostname(thishost, sizeof(thishost)) == -1)
566 fatal("gethostname: %s", strerror(errno)); 588 fatal("gethostname: %s", strerror(errno));
@@ -573,47 +595,49 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw,
573 "d", pw->pw_dir, 595 "d", pw->pw_dir,
574 "h", host, 596 "h", host,
575 "l", thishost, 597 "l", thishost,
576 "n", host_arg, 598 "n", original_host,
577 "p", portstr, 599 "p", portstr,
578 "r", ruser, 600 "r", ruser,
579 "u", pw->pw_name, 601 "u", pw->pw_name,
580 (char *)NULL); 602 (char *)NULL);
581 if (result != 1) { 603 if (result != 1) {
582 /* skip execution if prior predicate failed */ 604 /* skip execution if prior predicate failed */
583 debug("%.200s line %d: skipped exec \"%.100s\"", 605 debug3("%.200s line %d: skipped exec "
584 filename, linenum, cmd); 606 "\"%.100s\"", filename, linenum, cmd);
585 } else { 607 free(cmd);
586 r = execute_in_shell(cmd); 608 continue;
587 if (r == -1) {
588 fatal("%.200s line %d: match exec "
589 "'%.100s' error", filename,
590 linenum, cmd);
591 } else if (r == 0) {
592 debug("%.200s line %d: matched "
593 "'exec \"%.100s\"'", filename,
594 linenum, cmd);
595 } else {
596 debug("%.200s line %d: no match "
597 "'exec \"%.100s\"'", filename,
598 linenum, cmd);
599 result = 0;
600 }
601 } 609 }
610 r = execute_in_shell(cmd);
611 if (r == -1) {
612 fatal("%.200s line %d: match exec "
613 "'%.100s' error", filename,
614 linenum, cmd);
615 }
616 criteria = xstrdup(cmd);
602 free(cmd); 617 free(cmd);
618 /* Force exit status to boolean */
619 r = r == 0;
620 if (r == (negate ? 1 : 0))
621 this_result = result = 0;
603 } else { 622 } else {
604 error("Unsupported Match attribute %s", attrib); 623 error("Unsupported Match attribute %s", attrib);
605 result = -1; 624 result = -1;
606 goto out; 625 goto out;
607 } 626 }
627 debug3("%.200s line %d: %smatched '%s \"%.100s\"' ",
628 filename, linenum, this_result ? "": "not ",
629 oattrib, criteria);
630 free(criteria);
608 } 631 }
609 if (attributes == 0) { 632 if (attributes == 0) {
610 error("One or more attributes required for Match"); 633 error("One or more attributes required for Match");
611 result = -1; 634 result = -1;
612 goto out; 635 goto out;
613 } 636 }
614 debug3("match %sfound", result ? "" : "not ");
615 *condition = cp;
616 out: 637 out:
638 if (result != -1)
639 debug2("match %sfound", result ? "" : "not ");
640 *condition = cp;
617 free(host); 641 free(host);
618 return result; 642 return result;
619} 643}
@@ -736,7 +760,8 @@ static const struct multistate multistate_canonicalizehostname[] = {
736#define WHITESPACE " \t\r\n" 760#define WHITESPACE " \t\r\n"
737int 761int
738process_config_line(Options *options, struct passwd *pw, const char *host, 762process_config_line(Options *options, struct passwd *pw, const char *host,
739 char *line, const char *filename, int linenum, int *activep, int userconfig) 763 const char *original_host, char *line, const char *filename,
764 int linenum, int *activep, int flags)
740{ 765{
741 char *s, **charptr, *endofnumber, *keyword, *arg, *arg2; 766 char *s, **charptr, *endofnumber, *keyword, *arg, *arg2;
742 char **cpptr, fwdarg[256]; 767 char **cpptr, fwdarg[256];
@@ -792,7 +817,9 @@ parse_time:
792 if (!arg || *arg == '\0') 817 if (!arg || *arg == '\0')
793 fatal("%s line %d: missing time value.", 818 fatal("%s line %d: missing time value.",
794 filename, linenum); 819 filename, linenum);
795 if ((value = convtime(arg)) == -1) 820 if (strcmp(arg, "none") == 0)
821 value = -1;
822 else if ((value = convtime(arg)) == -1)
796 fatal("%s line %d: invalid time value.", 823 fatal("%s line %d: invalid time value.",
797 filename, linenum); 824 filename, linenum);
798 if (*activep && *intptr == -1) 825 if (*activep && *intptr == -1)
@@ -829,7 +856,7 @@ parse_time:
829 case oForwardX11Trusted: 856 case oForwardX11Trusted:
830 intptr = &options->forward_x11_trusted; 857 intptr = &options->forward_x11_trusted;
831 goto parse_flag; 858 goto parse_flag;
832 859
833 case oForwardX11Timeout: 860 case oForwardX11Timeout:
834 intptr = &options->forward_x11_timeout; 861 intptr = &options->forward_x11_timeout;
835 goto parse_time; 862 goto parse_time;
@@ -984,7 +1011,8 @@ parse_time:
984 if (*intptr >= SSH_MAX_IDENTITY_FILES) 1011 if (*intptr >= SSH_MAX_IDENTITY_FILES)
985 fatal("%.200s line %d: Too many identity files specified (max %d).", 1012 fatal("%.200s line %d: Too many identity files specified (max %d).",
986 filename, linenum, SSH_MAX_IDENTITY_FILES); 1013 filename, linenum, SSH_MAX_IDENTITY_FILES);
987 add_identity_file(options, NULL, arg, userconfig); 1014 add_identity_file(options, NULL,
1015 arg, flags & SSHCONF_USERCONF);
988 } 1016 }
989 break; 1017 break;
990 1018
@@ -1127,7 +1155,7 @@ parse_int:
1127 arg = strdelim(&s); 1155 arg = strdelim(&s);
1128 if (!arg || *arg == '\0') 1156 if (!arg || *arg == '\0')
1129 fatal("%.200s line %d: Missing argument.", filename, linenum); 1157 fatal("%.200s line %d: Missing argument.", filename, linenum);
1130 if (!key_names_valid2(arg)) 1158 if (!sshkey_names_valid2(arg, 1))
1131 fatal("%.200s line %d: Bad protocol 2 host key algorithms '%s'.", 1159 fatal("%.200s line %d: Bad protocol 2 host key algorithms '%s'.",
1132 filename, linenum, arg ? arg : "<NONE>"); 1160 filename, linenum, arg ? arg : "<NONE>");
1133 if (*activep && options->hostkeyalgorithms == NULL) 1161 if (*activep && options->hostkeyalgorithms == NULL)
@@ -1232,8 +1260,8 @@ parse_int:
1232 if (cmdline) 1260 if (cmdline)
1233 fatal("Host directive not supported as a command-line " 1261 fatal("Host directive not supported as a command-line "
1234 "option"); 1262 "option");
1235 value = match_cfg_line(options, &s, pw, host, 1263 value = match_cfg_line(options, &s, pw, host, original_host,
1236 filename, linenum); 1264 flags & SSHCONF_POSTCANON, filename, linenum);
1237 if (value < 0) 1265 if (value < 0)
1238 fatal("%.200s line %d: Bad Match condition", filename, 1266 fatal("%.200s line %d: Bad Match condition", filename,
1239 linenum); 1267 linenum);
@@ -1472,6 +1500,41 @@ parse_int:
1472 intptr = &options->fwd_opts.streamlocal_bind_unlink; 1500 intptr = &options->fwd_opts.streamlocal_bind_unlink;
1473 goto parse_flag; 1501 goto parse_flag;
1474 1502
1503 case oRevokedHostKeys:
1504 charptr = &options->revoked_host_keys;
1505 goto parse_string;
1506
1507 case oFingerprintHash:
1508 intptr = &options->fingerprint_hash;
1509 arg = strdelim(&s);
1510 if (!arg || *arg == '\0')
1511 fatal("%.200s line %d: Missing argument.",
1512 filename, linenum);
1513 if ((value = ssh_digest_alg_by_name(arg)) == -1)
1514 fatal("%.200s line %d: Invalid hash algorithm \"%s\".",
1515 filename, linenum, arg);
1516 if (*activep && *intptr == -1)
1517 *intptr = value;
1518 break;
1519
1520 case oUpdateHostkeys:
1521 intptr = &options->update_hostkeys;
1522 multistate_ptr = multistate_yesnoask;
1523 goto parse_multistate;
1524
1525 case oHostbasedKeyTypes:
1526 charptr = &options->hostbased_key_types;
1527 arg = strdelim(&s);
1528 if (!arg || *arg == '\0')
1529 fatal("%.200s line %d: Missing argument.",
1530 filename, linenum);
1531 if (!sshkey_names_valid2(arg, 1))
1532 fatal("%s line %d: Bad key types '%s'.",
1533 filename, linenum, arg ? arg : "<NONE>");
1534 if (*activep && *charptr == NULL)
1535 *charptr = xstrdup(arg);
1536 break;
1537
1475 case oDeprecated: 1538 case oDeprecated:
1476 debug("%s line %d: Deprecated option \"%s\"", 1539 debug("%s line %d: Deprecated option \"%s\"",
1477 filename, linenum, keyword); 1540 filename, linenum, keyword);
@@ -1483,7 +1546,7 @@ parse_int:
1483 return 0; 1546 return 0;
1484 1547
1485 default: 1548 default:
1486 fatal("process_config_line: Unimplemented opcode %d", opcode); 1549 fatal("%s: Unimplemented opcode %d", __func__, opcode);
1487 } 1550 }
1488 1551
1489 /* Check that there is no garbage at end of line. */ 1552 /* Check that there is no garbage at end of line. */
@@ -1503,7 +1566,7 @@ parse_int:
1503 1566
1504int 1567int
1505read_config_file(const char *filename, struct passwd *pw, const char *host, 1568read_config_file(const char *filename, struct passwd *pw, const char *host,
1506 Options *options, int flags) 1569 const char *original_host, Options *options, int flags)
1507{ 1570{
1508 FILE *f; 1571 FILE *f;
1509 char line[1024]; 1572 char line[1024];
@@ -1533,8 +1596,8 @@ read_config_file(const char *filename, struct passwd *pw, const char *host,
1533 while (fgets(line, sizeof(line), f)) { 1596 while (fgets(line, sizeof(line), f)) {
1534 /* Update line number counter. */ 1597 /* Update line number counter. */
1535 linenum++; 1598 linenum++;
1536 if (process_config_line(options, pw, host, line, filename, 1599 if (process_config_line(options, pw, host, original_host,
1537 linenum, &active, flags & SSHCONF_USERCONF) != 0) 1600 line, filename, linenum, &active, flags) != 0)
1538 bad_options++; 1601 bad_options++;
1539 } 1602 }
1540 fclose(f); 1603 fclose(f);
@@ -1652,6 +1715,10 @@ initialize_options(Options * options)
1652 options->canonicalize_max_dots = -1; 1715 options->canonicalize_max_dots = -1;
1653 options->canonicalize_fallback_local = -1; 1716 options->canonicalize_fallback_local = -1;
1654 options->canonicalize_hostname = -1; 1717 options->canonicalize_hostname = -1;
1718 options->revoked_host_keys = NULL;
1719 options->fingerprint_hash = -1;
1720 options->update_hostkeys = -1;
1721 options->hostbased_key_types = NULL;
1655} 1722}
1656 1723
1657/* 1724/*
@@ -1840,6 +1907,13 @@ fill_default_options(Options * options)
1840 options->canonicalize_fallback_local = 1; 1907 options->canonicalize_fallback_local = 1;
1841 if (options->canonicalize_hostname == -1) 1908 if (options->canonicalize_hostname == -1)
1842 options->canonicalize_hostname = SSH_CANONICALISE_NO; 1909 options->canonicalize_hostname = SSH_CANONICALISE_NO;
1910 if (options->fingerprint_hash == -1)
1911 options->fingerprint_hash = SSH_FP_HASH_DEFAULT;
1912 if (options->update_hostkeys == -1)
1913 options->update_hostkeys = 0;
1914 if (options->hostbased_key_types == NULL)
1915 options->hostbased_key_types = xstrdup("*");
1916
1843#define CLEAR_ON_NONE(v) \ 1917#define CLEAR_ON_NONE(v) \
1844 do { \ 1918 do { \
1845 if (option_clear_or_none(v)) { \ 1919 if (option_clear_or_none(v)) { \
@@ -1850,6 +1924,7 @@ fill_default_options(Options * options)
1850 CLEAR_ON_NONE(options->local_command); 1924 CLEAR_ON_NONE(options->local_command);
1851 CLEAR_ON_NONE(options->proxy_command); 1925 CLEAR_ON_NONE(options->proxy_command);
1852 CLEAR_ON_NONE(options->control_path); 1926 CLEAR_ON_NONE(options->control_path);
1927 CLEAR_ON_NONE(options->revoked_host_keys);
1853 /* options->user will be set in the main program if appropriate */ 1928 /* options->user will be set in the main program if appropriate */
1854 /* options->hostname will be set in the main program if appropriate */ 1929 /* options->hostname will be set in the main program if appropriate */
1855 /* options->host_key_alias should not be set by default */ 1930 /* options->host_key_alias should not be set by default */
@@ -2063,3 +2138,303 @@ parse_forward(struct Forward *fwd, const char *fwdspec, int dynamicfwd, int remo
2063 fwd->listen_path = NULL; 2138 fwd->listen_path = NULL;
2064 return (0); 2139 return (0);
2065} 2140}
2141
2142/* XXX the following is a near-vebatim copy from servconf.c; refactor */
2143static const char *
2144fmt_multistate_int(int val, const struct multistate *m)
2145{
2146 u_int i;
2147
2148 for (i = 0; m[i].key != NULL; i++) {
2149 if (m[i].value == val)
2150 return m[i].key;
2151 }
2152 return "UNKNOWN";
2153}
2154
2155static const char *
2156fmt_intarg(OpCodes code, int val)
2157{
2158 if (val == -1)
2159 return "unset";
2160 switch (code) {
2161 case oAddressFamily:
2162 return fmt_multistate_int(val, multistate_addressfamily);
2163 case oVerifyHostKeyDNS:
2164 case oStrictHostKeyChecking:
2165 case oUpdateHostkeys:
2166 return fmt_multistate_int(val, multistate_yesnoask);
2167 case oControlMaster:
2168 return fmt_multistate_int(val, multistate_controlmaster);
2169 case oTunnel:
2170 return fmt_multistate_int(val, multistate_tunnel);
2171 case oRequestTTY:
2172 return fmt_multistate_int(val, multistate_requesttty);
2173 case oCanonicalizeHostname:
2174 return fmt_multistate_int(val, multistate_canonicalizehostname);
2175 case oFingerprintHash:
2176 return ssh_digest_alg_name(val);
2177 case oProtocol:
2178 switch (val) {
2179 case SSH_PROTO_1:
2180 return "1";
2181 case SSH_PROTO_2:
2182 return "2";
2183 case (SSH_PROTO_1|SSH_PROTO_2):
2184 return "2,1";
2185 default:
2186 return "UNKNOWN";
2187 }
2188 default:
2189 switch (val) {
2190 case 0:
2191 return "no";
2192 case 1:
2193 return "yes";
2194 default:
2195 return "UNKNOWN";
2196 }
2197 }
2198}
2199
2200static const char *
2201lookup_opcode_name(OpCodes code)
2202{
2203 u_int i;
2204
2205 for (i = 0; keywords[i].name != NULL; i++)
2206 if (keywords[i].opcode == code)
2207 return(keywords[i].name);
2208 return "UNKNOWN";
2209}
2210
2211static void
2212dump_cfg_int(OpCodes code, int val)
2213{
2214 printf("%s %d\n", lookup_opcode_name(code), val);
2215}
2216
2217static void
2218dump_cfg_fmtint(OpCodes code, int val)
2219{
2220 printf("%s %s\n", lookup_opcode_name(code), fmt_intarg(code, val));
2221}
2222
2223static void
2224dump_cfg_string(OpCodes code, const char *val)
2225{
2226 if (val == NULL)
2227 return;
2228 printf("%s %s\n", lookup_opcode_name(code), val);
2229}
2230
2231static void
2232dump_cfg_strarray(OpCodes code, u_int count, char **vals)
2233{
2234 u_int i;
2235
2236 for (i = 0; i < count; i++)
2237 printf("%s %s\n", lookup_opcode_name(code), vals[i]);
2238}
2239
2240static void
2241dump_cfg_strarray_oneline(OpCodes code, u_int count, char **vals)
2242{
2243 u_int i;
2244
2245 printf("%s", lookup_opcode_name(code));
2246 for (i = 0; i < count; i++)
2247 printf(" %s", vals[i]);
2248 printf("\n");
2249}
2250
2251static void
2252dump_cfg_forwards(OpCodes code, u_int count, const struct Forward *fwds)
2253{
2254 const struct Forward *fwd;
2255 u_int i;
2256
2257 /* oDynamicForward */
2258 for (i = 0; i < count; i++) {
2259 fwd = &fwds[i];
2260 if (code == oDynamicForward &&
2261 strcmp(fwd->connect_host, "socks") != 0)
2262 continue;
2263 if (code == oLocalForward &&
2264 strcmp(fwd->connect_host, "socks") == 0)
2265 continue;
2266 printf("%s", lookup_opcode_name(code));
2267 if (fwd->listen_port == PORT_STREAMLOCAL)
2268 printf(" %s", fwd->listen_path);
2269 else if (fwd->listen_host == NULL)
2270 printf(" %d", fwd->listen_port);
2271 else {
2272 printf(" [%s]:%d",
2273 fwd->listen_host, fwd->listen_port);
2274 }
2275 if (code != oDynamicForward) {
2276 if (fwd->connect_port == PORT_STREAMLOCAL)
2277 printf(" %s", fwd->connect_path);
2278 else if (fwd->connect_host == NULL)
2279 printf(" %d", fwd->connect_port);
2280 else {
2281 printf(" [%s]:%d",
2282 fwd->connect_host, fwd->connect_port);
2283 }
2284 }
2285 printf("\n");
2286 }
2287}
2288
2289void
2290dump_client_config(Options *o, const char *host)
2291{
2292 int i;
2293 char vbuf[5];
2294
2295 /* Most interesting options first: user, host, port */
2296 dump_cfg_string(oUser, o->user);
2297 dump_cfg_string(oHostName, host);
2298 dump_cfg_int(oPort, o->port);
2299
2300 /* Flag options */
2301 dump_cfg_fmtint(oAddressFamily, o->address_family);
2302 dump_cfg_fmtint(oBatchMode, o->batch_mode);
2303 dump_cfg_fmtint(oCanonicalizeFallbackLocal, o->canonicalize_fallback_local);
2304 dump_cfg_fmtint(oCanonicalizeHostname, o->canonicalize_hostname);
2305 dump_cfg_fmtint(oChallengeResponseAuthentication, o->challenge_response_authentication);
2306 dump_cfg_fmtint(oCheckHostIP, o->check_host_ip);
2307 dump_cfg_fmtint(oCompression, o->compression);
2308 dump_cfg_fmtint(oControlMaster, o->control_master);
2309 dump_cfg_fmtint(oEnableSSHKeysign, o->enable_ssh_keysign);
2310 dump_cfg_fmtint(oExitOnForwardFailure, o->exit_on_forward_failure);
2311 dump_cfg_fmtint(oFingerprintHash, o->fingerprint_hash);
2312 dump_cfg_fmtint(oForwardAgent, o->forward_agent);
2313 dump_cfg_fmtint(oForwardX11, o->forward_x11);
2314 dump_cfg_fmtint(oForwardX11Trusted, o->forward_x11_trusted);
2315 dump_cfg_fmtint(oGatewayPorts, o->fwd_opts.gateway_ports);
2316#ifdef GSSAPI
2317 dump_cfg_fmtint(oGssAuthentication, o->gss_authentication);
2318 dump_cfg_fmtint(oGssDelegateCreds, o->gss_deleg_creds);
2319#endif /* GSSAPI */
2320 dump_cfg_fmtint(oHashKnownHosts, o->hash_known_hosts);
2321 dump_cfg_fmtint(oHostbasedAuthentication, o->hostbased_authentication);
2322 dump_cfg_fmtint(oIdentitiesOnly, o->identities_only);
2323 dump_cfg_fmtint(oKbdInteractiveAuthentication, o->kbd_interactive_authentication);
2324 dump_cfg_fmtint(oNoHostAuthenticationForLocalhost, o->no_host_authentication_for_localhost);
2325 dump_cfg_fmtint(oPasswordAuthentication, o->password_authentication);
2326 dump_cfg_fmtint(oPermitLocalCommand, o->permit_local_command);
2327 dump_cfg_fmtint(oProtocol, o->protocol);
2328 dump_cfg_fmtint(oProxyUseFdpass, o->proxy_use_fdpass);
2329 dump_cfg_fmtint(oPubkeyAuthentication, o->pubkey_authentication);
2330 dump_cfg_fmtint(oRequestTTY, o->request_tty);
2331 dump_cfg_fmtint(oRhostsRSAAuthentication, o->rhosts_rsa_authentication);
2332 dump_cfg_fmtint(oRSAAuthentication, o->rsa_authentication);
2333 dump_cfg_fmtint(oStreamLocalBindUnlink, o->fwd_opts.streamlocal_bind_unlink);
2334 dump_cfg_fmtint(oStrictHostKeyChecking, o->strict_host_key_checking);
2335 dump_cfg_fmtint(oTCPKeepAlive, o->tcp_keep_alive);
2336 dump_cfg_fmtint(oTunnel, o->tun_open);
2337 dump_cfg_fmtint(oUsePrivilegedPort, o->use_privileged_port);
2338 dump_cfg_fmtint(oVerifyHostKeyDNS, o->verify_host_key_dns);
2339 dump_cfg_fmtint(oVisualHostKey, o->visual_host_key);
2340 dump_cfg_fmtint(oUpdateHostkeys, o->update_hostkeys);
2341
2342 /* Integer options */
2343 dump_cfg_int(oCanonicalizeMaxDots, o->canonicalize_max_dots);
2344 dump_cfg_int(oCompressionLevel, o->compression_level);
2345 dump_cfg_int(oConnectionAttempts, o->connection_attempts);
2346 dump_cfg_int(oForwardX11Timeout, o->forward_x11_timeout);
2347 dump_cfg_int(oNumberOfPasswordPrompts, o->number_of_password_prompts);
2348 dump_cfg_int(oServerAliveCountMax, o->server_alive_count_max);
2349 dump_cfg_int(oServerAliveInterval, o->server_alive_interval);
2350
2351 /* String options */
2352 dump_cfg_string(oBindAddress, o->bind_address);
2353 dump_cfg_string(oCiphers, o->ciphers ? o->ciphers : KEX_CLIENT_ENCRYPT);
2354 dump_cfg_string(oControlPath, o->control_path);
2355 dump_cfg_string(oHostKeyAlgorithms, o->hostkeyalgorithms ? o->hostkeyalgorithms : KEX_DEFAULT_PK_ALG);
2356 dump_cfg_string(oHostKeyAlias, o->host_key_alias);
2357 dump_cfg_string(oHostbasedKeyTypes, o->hostbased_key_types);
2358 dump_cfg_string(oKbdInteractiveDevices, o->kbd_interactive_devices);
2359 dump_cfg_string(oKexAlgorithms, o->kex_algorithms ? o->kex_algorithms : KEX_CLIENT_KEX);
2360 dump_cfg_string(oLocalCommand, o->local_command);
2361 dump_cfg_string(oLogLevel, log_level_name(o->log_level));
2362 dump_cfg_string(oMacs, o->macs ? o->macs : KEX_CLIENT_MAC);
2363 dump_cfg_string(oPKCS11Provider, o->pkcs11_provider);
2364 dump_cfg_string(oPreferredAuthentications, o->preferred_authentications);
2365 dump_cfg_string(oProxyCommand, o->proxy_command);
2366 dump_cfg_string(oRevokedHostKeys, o->revoked_host_keys);
2367 dump_cfg_string(oXAuthLocation, o->xauth_location);
2368
2369 /* Forwards */
2370 dump_cfg_forwards(oDynamicForward, o->num_local_forwards, o->local_forwards);
2371 dump_cfg_forwards(oLocalForward, o->num_local_forwards, o->local_forwards);
2372 dump_cfg_forwards(oRemoteForward, o->num_remote_forwards, o->remote_forwards);
2373
2374 /* String array options */
2375 dump_cfg_strarray(oIdentityFile, o->num_identity_files, o->identity_files);
2376 dump_cfg_strarray_oneline(oCanonicalDomains, o->num_canonical_domains, o->canonical_domains);
2377 dump_cfg_strarray_oneline(oGlobalKnownHostsFile, o->num_system_hostfiles, o->system_hostfiles);
2378 dump_cfg_strarray_oneline(oUserKnownHostsFile, o->num_user_hostfiles, o->user_hostfiles);
2379 dump_cfg_strarray(oSendEnv, o->num_send_env, o->send_env);
2380
2381 /* Special cases */
2382
2383 /* oConnectTimeout */
2384 if (o->connection_timeout == -1)
2385 printf("connecttimeout none\n");
2386 else
2387 dump_cfg_int(oConnectTimeout, o->connection_timeout);
2388
2389 /* oTunnelDevice */
2390 printf("tunneldevice");
2391 if (o->tun_local == SSH_TUNID_ANY)
2392 printf(" any");
2393 else
2394 printf(" %d", o->tun_local);
2395 if (o->tun_remote == SSH_TUNID_ANY)
2396 printf(":any");
2397 else
2398 printf(":%d", o->tun_remote);
2399 printf("\n");
2400
2401 /* oCanonicalizePermittedCNAMEs */
2402 if ( o->num_permitted_cnames > 0) {
2403 printf("canonicalizePermittedcnames");
2404 for (i = 0; i < o->num_permitted_cnames; i++) {
2405 printf(" %s:%s", o->permitted_cnames[i].source_list,
2406 o->permitted_cnames[i].target_list);
2407 }
2408 printf("\n");
2409 }
2410
2411 /* oCipher */
2412 if (o->cipher != SSH_CIPHER_NOT_SET)
2413 printf("Cipher %s\n", cipher_name(o->cipher));
2414
2415 /* oControlPersist */
2416 if (o->control_persist == 0 || o->control_persist_timeout == 0)
2417 dump_cfg_fmtint(oControlPersist, o->control_persist);
2418 else
2419 dump_cfg_int(oControlPersist, o->control_persist_timeout);
2420
2421 /* oEscapeChar */
2422 if (o->escape_char == SSH_ESCAPECHAR_NONE)
2423 printf("escapechar none\n");
2424 else {
2425 vis(vbuf, o->escape_char, VIS_WHITE, 0);
2426 printf("escapechar %s\n", vbuf);
2427 }
2428
2429 /* oIPQoS */
2430 printf("ipqos %s ", iptos2str(o->ip_qos_interactive));
2431 printf("%s\n", iptos2str(o->ip_qos_bulk));
2432
2433 /* oRekeyLimit */
2434 printf("rekeylimit %lld %d\n",
2435 (long long)o->rekey_limit, o->rekey_interval);
2436
2437 /* oStreamLocalBindMask */
2438 printf("streamlocalbindmask 0%o\n",
2439 o->fwd_opts.streamlocal_bind_mask);
2440}
diff --git a/readconf.h b/readconf.h
index 0e298898a..ef39c4ca4 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>
@@ -98,7 +98,7 @@ typedef struct {
98 int num_identity_files; /* Number of files for RSA/DSA identities. */ 98 int num_identity_files; /* Number of files for RSA/DSA identities. */
99 char *identity_files[SSH_MAX_IDENTITY_FILES]; 99 char *identity_files[SSH_MAX_IDENTITY_FILES];
100 int identity_file_userprovided[SSH_MAX_IDENTITY_FILES]; 100 int identity_file_userprovided[SSH_MAX_IDENTITY_FILES];
101 Key *identity_keys[SSH_MAX_IDENTITY_FILES]; 101 struct sshkey *identity_keys[SSH_MAX_IDENTITY_FILES];
102 102
103 /* Local TCP/IP forward requests. */ 103 /* Local TCP/IP forward requests. */
104 int num_local_forwards; 104 int num_local_forwards;
@@ -149,6 +149,14 @@ typedef struct {
149 int num_permitted_cnames; 149 int num_permitted_cnames;
150 struct allowed_cname permitted_cnames[MAX_CANON_DOMAINS]; 150 struct allowed_cname permitted_cnames[MAX_CANON_DOMAINS];
151 151
152 char *revoked_host_keys;
153
154 int fingerprint_hash;
155
156 int update_hostkeys; /* one of SSH_UPDATE_HOSTKEYS_* */
157
158 char *hostbased_key_types;
159
152 char *ignored_unknown; /* Pattern list of unknown tokens to ignore */ 160 char *ignored_unknown; /* Pattern list of unknown tokens to ignore */
153} Options; 161} Options;
154 162
@@ -169,17 +177,23 @@ typedef struct {
169 177
170#define SSHCONF_CHECKPERM 1 /* check permissions on config file */ 178#define SSHCONF_CHECKPERM 1 /* check permissions on config file */
171#define SSHCONF_USERCONF 2 /* user provided config file not system */ 179#define SSHCONF_USERCONF 2 /* user provided config file not system */
180#define SSHCONF_POSTCANON 4 /* After hostname canonicalisation */
181
182#define SSH_UPDATE_HOSTKEYS_NO 0
183#define SSH_UPDATE_HOSTKEYS_YES 1
184#define SSH_UPDATE_HOSTKEYS_ASK 2
172 185
173void initialize_options(Options *); 186void initialize_options(Options *);
174void fill_default_options(Options *); 187void fill_default_options(Options *);
175void fill_default_options_for_canonicalization(Options *); 188void fill_default_options_for_canonicalization(Options *);
176int process_config_line(Options *, struct passwd *, const char *, char *, 189int process_config_line(Options *, struct passwd *, const char *,
177 const char *, int, int *, int); 190 const char *, char *, const char *, int, int *, int);
178int read_config_file(const char *, struct passwd *, const char *, 191int read_config_file(const char *, struct passwd *, const char *,
179 Options *, int); 192 const char *, Options *, int);
180int parse_forward(struct Forward *, const char *, int, int); 193int parse_forward(struct Forward *, const char *, int, int);
181int default_ssh_port(void); 194int default_ssh_port(void);
182int option_clear_or_none(const char *); 195int option_clear_or_none(const char *);
196void dump_client_config(Options *o, const char *host);
183 197
184void add_local_forward(Options *, const struct Forward *); 198void add_local_forward(Options *, const struct Forward *);
185void add_remote_forward(Options *, const struct Forward *); 199void 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 a1b318b9f..afa4a2fb0 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>
@@ -757,7 +758,7 @@ source(int argc, char **argv)
757 off_t i, statbytes; 758 off_t i, statbytes;
758 size_t amt, nr; 759 size_t amt, nr;
759 int fd = -1, haderr, indx; 760 int fd = -1, haderr, indx;
760 char *last, *name, buf[2048], encname[MAXPATHLEN]; 761 char *last, *name, buf[2048], encname[PATH_MAX];
761 int len; 762 int len;
762 763
763 for (indx = 0; indx < argc; ++indx) { 764 for (indx = 0; indx < argc; ++indx) {
@@ -866,7 +867,7 @@ rsource(char *name, struct stat *statp)
866{ 867{
867 DIR *dirp; 868 DIR *dirp;
868 struct dirent *dp; 869 struct dirent *dp;
869 char *last, *vect[1], path[MAXPATHLEN]; 870 char *last, *vect[1], path[PATH_MAX];
870 871
871 if (!(dirp = opendir(name))) { 872 if (!(dirp = opendir(name))) {
872 run_err("%s: %s", name, strerror(errno)); 873 run_err("%s: %s", name, strerror(errno));
diff --git a/servconf.c b/servconf.c
index 6c7741ab2..bec53e00e 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;
@@ -160,12 +165,22 @@ initialize_server_options(ServerOptions *options)
160 options->ip_qos_interactive = -1; 165 options->ip_qos_interactive = -1;
161 options->ip_qos_bulk = -1; 166 options->ip_qos_bulk = -1;
162 options->version_addendum = NULL; 167 options->version_addendum = NULL;
168 options->fingerprint_hash = -1;
163 options->debian_banner = -1; 169 options->debian_banner = -1;
164} 170}
165 171
172/* Returns 1 if a string option is unset or set to "none" or 0 otherwise. */
173static int
174option_clear_or_none(const char *o)
175{
176 return o == NULL || strcasecmp(o, "none") == 0;
177}
178
166void 179void
167fill_default_server_options(ServerOptions *options) 180fill_default_server_options(ServerOptions *options)
168{ 181{
182 int i;
183
169 /* Portable-specific options */ 184 /* Portable-specific options */
170 if (options->use_pam == -1) 185 if (options->use_pam == -1)
171 options->use_pam = 0; 186 options->use_pam = 0;
@@ -197,7 +212,7 @@ fill_default_server_options(ServerOptions *options)
197 if (options->listen_addrs == NULL) 212 if (options->listen_addrs == NULL)
198 add_listen_addr(options, NULL, 0); 213 add_listen_addr(options, NULL, 0);
199 if (options->pid_file == NULL) 214 if (options->pid_file == NULL)
200 options->pid_file = _PATH_SSH_DAEMON_PID_FILE; 215 options->pid_file = xstrdup(_PATH_SSH_DAEMON_PID_FILE);
201 if (options->server_key_bits == -1) 216 if (options->server_key_bits == -1)
202 options->server_key_bits = 1024; 217 options->server_key_bits = 1024;
203 if (options->login_grace_time == -1) 218 if (options->login_grace_time == -1)
@@ -221,7 +236,7 @@ fill_default_server_options(ServerOptions *options)
221 if (options->x11_use_localhost == -1) 236 if (options->x11_use_localhost == -1)
222 options->x11_use_localhost = 1; 237 options->x11_use_localhost = 1;
223 if (options->xauth_location == NULL) 238 if (options->xauth_location == NULL)
224 options->xauth_location = _PATH_XAUTH; 239 options->xauth_location = xstrdup(_PATH_XAUTH);
225 if (options->permit_tty == -1) 240 if (options->permit_tty == -1)
226 options->permit_tty = 1; 241 options->permit_tty = 1;
227 if (options->permit_user_rc == -1) 242 if (options->permit_user_rc == -1)
@@ -240,10 +255,14 @@ fill_default_server_options(ServerOptions *options)
240 options->hostbased_authentication = 0; 255 options->hostbased_authentication = 0;
241 if (options->hostbased_uses_name_from_packet_only == -1) 256 if (options->hostbased_uses_name_from_packet_only == -1)
242 options->hostbased_uses_name_from_packet_only = 0; 257 options->hostbased_uses_name_from_packet_only = 0;
258 if (options->hostbased_key_types == NULL)
259 options->hostbased_key_types = xstrdup("*");
243 if (options->rsa_authentication == -1) 260 if (options->rsa_authentication == -1)
244 options->rsa_authentication = 1; 261 options->rsa_authentication = 1;
245 if (options->pubkey_authentication == -1) 262 if (options->pubkey_authentication == -1)
246 options->pubkey_authentication = 1; 263 options->pubkey_authentication = 1;
264 if (options->pubkey_key_types == NULL)
265 options->pubkey_key_types = xstrdup("*");
247 if (options->kerberos_authentication == -1) 266 if (options->kerberos_authentication == -1)
248 options->kerberos_authentication = 0; 267 options->kerberos_authentication = 0;
249 if (options->kerberos_or_local_passwd == -1) 268 if (options->kerberos_or_local_passwd == -1)
@@ -299,7 +318,7 @@ fill_default_server_options(ServerOptions *options)
299 if (options->max_sessions == -1) 318 if (options->max_sessions == -1)
300 options->max_sessions = DEFAULT_SESSIONS_MAX; 319 options->max_sessions = DEFAULT_SESSIONS_MAX;
301 if (options->use_dns == -1) 320 if (options->use_dns == -1)
302 options->use_dns = 1; 321 options->use_dns = 0;
303 if (options->client_alive_interval == -1) 322 if (options->client_alive_interval == -1)
304 options->client_alive_interval = 0; 323 options->client_alive_interval = 0;
305 if (options->client_alive_count_max == -1) 324 if (options->client_alive_count_max == -1)
@@ -322,12 +341,32 @@ fill_default_server_options(ServerOptions *options)
322 options->fwd_opts.streamlocal_bind_mask = 0177; 341 options->fwd_opts.streamlocal_bind_mask = 0177;
323 if (options->fwd_opts.streamlocal_bind_unlink == -1) 342 if (options->fwd_opts.streamlocal_bind_unlink == -1)
324 options->fwd_opts.streamlocal_bind_unlink = 0; 343 options->fwd_opts.streamlocal_bind_unlink = 0;
344 if (options->fingerprint_hash == -1)
345 options->fingerprint_hash = SSH_FP_HASH_DEFAULT;
325 if (options->debian_banner == -1) 346 if (options->debian_banner == -1)
326 options->debian_banner = 1; 347 options->debian_banner = 1;
327 /* Turn privilege separation on by default */ 348 /* Turn privilege separation on by default */
328 if (use_privsep == -1) 349 if (use_privsep == -1)
329 use_privsep = PRIVSEP_NOSANDBOX; 350 use_privsep = PRIVSEP_NOSANDBOX;
330 351
352#define CLEAR_ON_NONE(v) \
353 do { \
354 if (option_clear_or_none(v)) { \
355 free(v); \
356 v = NULL; \
357 } \
358 } while(0)
359 CLEAR_ON_NONE(options->pid_file);
360 CLEAR_ON_NONE(options->xauth_location);
361 CLEAR_ON_NONE(options->banner);
362 CLEAR_ON_NONE(options->trusted_user_ca_keys);
363 CLEAR_ON_NONE(options->revoked_keys_file);
364 for (i = 0; i < options->num_host_key_files; i++)
365 CLEAR_ON_NONE(options->host_key_files[i]);
366 for (i = 0; i < options->num_host_cert_files; i++)
367 CLEAR_ON_NONE(options->host_cert_files[i]);
368#undef CLEAR_ON_NONE
369
331#ifndef HAVE_MMAP 370#ifndef HAVE_MMAP
332 if (use_privsep && options->compression == 1) { 371 if (use_privsep && options->compression == 1) {
333 error("This platform does not support both privilege " 372 error("This platform does not support both privilege "
@@ -345,8 +384,8 @@ typedef enum {
345 /* Portable-specific options */ 384 /* Portable-specific options */
346 sUsePAM, 385 sUsePAM,
347 /* Standard Options */ 386 /* Standard Options */
348 sPort, sHostKeyFile, sServerKeyBits, sLoginGraceTime, sKeyRegenerationTime, 387 sPort, sHostKeyFile, sServerKeyBits, sLoginGraceTime,
349 sPermitRootLogin, sLogFacility, sLogLevel, 388 sKeyRegenerationTime, sPermitRootLogin, sLogFacility, sLogLevel,
350 sRhostsRSAAuthentication, sRSAAuthentication, 389 sRhostsRSAAuthentication, sRSAAuthentication,
351 sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup, 390 sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup,
352 sKerberosGetAFSToken, 391 sKerberosGetAFSToken,
@@ -359,11 +398,11 @@ typedef enum {
359 sPermitUserEnvironment, sUseLogin, sAllowTcpForwarding, sCompression, 398 sPermitUserEnvironment, sUseLogin, sAllowTcpForwarding, sCompression,
360 sRekeyLimit, sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups, 399 sRekeyLimit, sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups,
361 sIgnoreUserKnownHosts, sCiphers, sMacs, sProtocol, sPidFile, 400 sIgnoreUserKnownHosts, sCiphers, sMacs, sProtocol, sPidFile,
362 sGatewayPorts, sPubkeyAuthentication, sXAuthLocation, sSubsystem, 401 sGatewayPorts, sPubkeyAuthentication, sPubkeyAcceptedKeyTypes,
363 sMaxStartups, sMaxAuthTries, sMaxSessions, 402 sXAuthLocation, sSubsystem, sMaxStartups, sMaxAuthTries, sMaxSessions,
364 sBanner, sUseDNS, sHostbasedAuthentication, 403 sBanner, sUseDNS, sHostbasedAuthentication,
365 sHostbasedUsesNameFromPacketOnly, sClientAliveInterval, 404 sHostbasedUsesNameFromPacketOnly, sHostbasedAcceptedKeyTypes,
366 sClientAliveCountMax, sAuthorizedKeysFile, 405 sClientAliveInterval, sClientAliveCountMax, sAuthorizedKeysFile,
367 sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor, 406 sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor,
368 sGssKeyEx, sGssStoreRekey, 407 sGssKeyEx, sGssStoreRekey,
369 sAcceptEnv, sPermitTunnel, 408 sAcceptEnv, sPermitTunnel,
@@ -375,7 +414,7 @@ typedef enum {
375 sAuthorizedKeysCommand, sAuthorizedKeysCommandUser, 414 sAuthorizedKeysCommand, sAuthorizedKeysCommandUser,
376 sAuthenticationMethods, sHostKeyAgent, sPermitUserRC, 415 sAuthenticationMethods, sHostKeyAgent, sPermitUserRC,
377 sStreamLocalBindMask, sStreamLocalBindUnlink, 416 sStreamLocalBindMask, sStreamLocalBindUnlink,
378 sAllowStreamLocalForwarding, 417 sAllowStreamLocalForwarding, sFingerprintHash,
379 sDebianBanner, 418 sDebianBanner,
380 sDeprecated, sUnsupported 419 sDeprecated, sUnsupported
381} ServerOpCodes; 420} ServerOpCodes;
@@ -413,8 +452,10 @@ static struct {
413 { "rhostsrsaauthentication", sRhostsRSAAuthentication, SSHCFG_ALL }, 452 { "rhostsrsaauthentication", sRhostsRSAAuthentication, SSHCFG_ALL },
414 { "hostbasedauthentication", sHostbasedAuthentication, SSHCFG_ALL }, 453 { "hostbasedauthentication", sHostbasedAuthentication, SSHCFG_ALL },
415 { "hostbasedusesnamefrompacketonly", sHostbasedUsesNameFromPacketOnly, SSHCFG_ALL }, 454 { "hostbasedusesnamefrompacketonly", sHostbasedUsesNameFromPacketOnly, SSHCFG_ALL },
455 { "hostbasedacceptedkeytypes", sHostbasedAcceptedKeyTypes, SSHCFG_ALL },
416 { "rsaauthentication", sRSAAuthentication, SSHCFG_ALL }, 456 { "rsaauthentication", sRSAAuthentication, SSHCFG_ALL },
417 { "pubkeyauthentication", sPubkeyAuthentication, SSHCFG_ALL }, 457 { "pubkeyauthentication", sPubkeyAuthentication, SSHCFG_ALL },
458 { "pubkeyacceptedkeytypes", sPubkeyAcceptedKeyTypes, SSHCFG_ALL },
418 { "dsaauthentication", sPubkeyAuthentication, SSHCFG_GLOBAL }, /* alias */ 459 { "dsaauthentication", sPubkeyAuthentication, SSHCFG_GLOBAL }, /* alias */
419#ifdef KRB5 460#ifdef KRB5
420 { "kerberosauthentication", sKerberosAuthentication, SSHCFG_ALL }, 461 { "kerberosauthentication", sKerberosAuthentication, SSHCFG_ALL },
@@ -518,6 +559,7 @@ static struct {
518 { "streamlocalbindmask", sStreamLocalBindMask, SSHCFG_ALL }, 559 { "streamlocalbindmask", sStreamLocalBindMask, SSHCFG_ALL },
519 { "streamlocalbindunlink", sStreamLocalBindUnlink, SSHCFG_ALL }, 560 { "streamlocalbindunlink", sStreamLocalBindUnlink, SSHCFG_ALL },
520 { "allowstreamlocalforwarding", sAllowStreamLocalForwarding, SSHCFG_ALL }, 561 { "allowstreamlocalforwarding", sAllowStreamLocalForwarding, SSHCFG_ALL },
562 { "fingerprinthash", sFingerprintHash, SSHCFG_GLOBAL },
521 { "debianbanner", sDebianBanner, SSHCFG_GLOBAL }, 563 { "debianbanner", sDebianBanner, SSHCFG_GLOBAL },
522 { NULL, sBadOption, 0 } 564 { NULL, sBadOption, 0 }
523}; 565};
@@ -557,8 +599,10 @@ parse_token(const char *cp, const char *filename,
557char * 599char *
558derelativise_path(const char *path) 600derelativise_path(const char *path)
559{ 601{
560 char *expanded, *ret, cwd[MAXPATHLEN]; 602 char *expanded, *ret, cwd[PATH_MAX];
561 603
604 if (strcasecmp(path, "none") == 0)
605 return xstrdup("none");
562 expanded = tilde_expand_filename(path, getuid()); 606 expanded = tilde_expand_filename(path, getuid());
563 if (*expanded == '/') 607 if (*expanded == '/')
564 return expanded; 608 return expanded;
@@ -1103,6 +1147,20 @@ process_server_config_line(ServerOptions *options, char *line,
1103 intptr = &options->hostbased_uses_name_from_packet_only; 1147 intptr = &options->hostbased_uses_name_from_packet_only;
1104 goto parse_flag; 1148 goto parse_flag;
1105 1149
1150 case sHostbasedAcceptedKeyTypes:
1151 charptr = &options->hostbased_key_types;
1152 parse_keytypes:
1153 arg = strdelim(&cp);
1154 if (!arg || *arg == '\0')
1155 fatal("%s line %d: Missing argument.",
1156 filename, linenum);
1157 if (!sshkey_names_valid2(arg, 1))
1158 fatal("%s line %d: Bad key types '%s'.",
1159 filename, linenum, arg ? arg : "<NONE>");
1160 if (*activep && *charptr == NULL)
1161 *charptr = xstrdup(arg);
1162 break;
1163
1106 case sRSAAuthentication: 1164 case sRSAAuthentication:
1107 intptr = &options->rsa_authentication; 1165 intptr = &options->rsa_authentication;
1108 goto parse_flag; 1166 goto parse_flag;
@@ -1111,6 +1169,10 @@ process_server_config_line(ServerOptions *options, char *line,
1111 intptr = &options->pubkey_authentication; 1169 intptr = &options->pubkey_authentication;
1112 goto parse_flag; 1170 goto parse_flag;
1113 1171
1172 case sPubkeyAcceptedKeyTypes:
1173 charptr = &options->pubkey_key_types;
1174 goto parse_keytypes;
1175
1114 case sKerberosAuthentication: 1176 case sKerberosAuthentication:
1115 intptr = &options->kerberos_authentication; 1177 intptr = &options->kerberos_authentication;
1116 goto parse_flag; 1178 goto parse_flag;
@@ -1650,6 +1712,9 @@ process_server_config_line(ServerOptions *options, char *line,
1650 return 0; 1712 return 0;
1651 1713
1652 case sAuthorizedKeysCommand: 1714 case sAuthorizedKeysCommand:
1715 if (cp == NULL)
1716 fatal("%.200s line %d: Missing argument.", filename,
1717 linenum);
1653 len = strspn(cp, WHITESPACE); 1718 len = strspn(cp, WHITESPACE);
1654 if (*activep && options->authorized_keys_command == NULL) { 1719 if (*activep && options->authorized_keys_command == NULL) {
1655 if (cp[len] != '/' && strcasecmp(cp + len, "none") != 0) 1720 if (cp[len] != '/' && strcasecmp(cp + len, "none") != 0)
@@ -1664,6 +1729,9 @@ process_server_config_line(ServerOptions *options, char *line,
1664 charptr = &options->authorized_keys_command_user; 1729 charptr = &options->authorized_keys_command_user;
1665 1730
1666 arg = strdelim(&cp); 1731 arg = strdelim(&cp);
1732 if (!arg || *arg == '\0')
1733 fatal("%s line %d: missing AuthorizedKeysCommandUser "
1734 "argument.", filename, linenum);
1667 if (*activep && *charptr == NULL) 1735 if (*activep && *charptr == NULL)
1668 *charptr = xstrdup(arg); 1736 *charptr = xstrdup(arg);
1669 break; 1737 break;
@@ -1702,6 +1770,18 @@ process_server_config_line(ServerOptions *options, char *line,
1702 intptr = &options->fwd_opts.streamlocal_bind_unlink; 1770 intptr = &options->fwd_opts.streamlocal_bind_unlink;
1703 goto parse_flag; 1771 goto parse_flag;
1704 1772
1773 case sFingerprintHash:
1774 arg = strdelim(&cp);
1775 if (!arg || *arg == '\0')
1776 fatal("%.200s line %d: Missing argument.",
1777 filename, linenum);
1778 if ((value = ssh_digest_alg_by_name(arg)) == -1)
1779 fatal("%.200s line %d: Invalid hash algorithm \"%s\".",
1780 filename, linenum, arg);
1781 if (*activep)
1782 options->fingerprint_hash = value;
1783 break;
1784
1705 case sDebianBanner: 1785 case sDebianBanner:
1706 intptr = &options->debian_banner; 1786 intptr = &options->debian_banner;
1707 goto parse_int; 1787 goto parse_int;
@@ -1948,6 +2028,8 @@ fmt_intarg(ServerOpCodes code, int val)
1948 return fmt_multistate_int(val, multistate_tcpfwd); 2028 return fmt_multistate_int(val, multistate_tcpfwd);
1949 case sAllowStreamLocalForwarding: 2029 case sAllowStreamLocalForwarding:
1950 return fmt_multistate_int(val, multistate_tcpfwd); 2030 return fmt_multistate_int(val, multistate_tcpfwd);
2031 case sFingerprintHash:
2032 return ssh_digest_alg_name(val);
1951 case sProtocol: 2033 case sProtocol:
1952 switch (val) { 2034 switch (val) {
1953 case SSH_PROTO_1: 2035 case SSH_PROTO_1:
@@ -1999,7 +2081,8 @@ dump_cfg_string(ServerOpCodes code, const char *val)
1999{ 2081{
2000 if (val == NULL) 2082 if (val == NULL)
2001 return; 2083 return;
2002 printf("%s %s\n", lookup_opcode_name(code), val); 2084 printf("%s %s\n", lookup_opcode_name(code),
2085 val == NULL ? "none" : val);
2003} 2086}
2004 2087
2005static void 2088static void
@@ -2112,13 +2195,13 @@ dump_config(ServerOptions *o)
2112 dump_cfg_fmtint(sAllowTcpForwarding, o->allow_tcp_forwarding); 2195 dump_cfg_fmtint(sAllowTcpForwarding, o->allow_tcp_forwarding);
2113 dump_cfg_fmtint(sAllowStreamLocalForwarding, o->allow_streamlocal_forwarding); 2196 dump_cfg_fmtint(sAllowStreamLocalForwarding, o->allow_streamlocal_forwarding);
2114 dump_cfg_fmtint(sUsePrivilegeSeparation, use_privsep); 2197 dump_cfg_fmtint(sUsePrivilegeSeparation, use_privsep);
2198 dump_cfg_fmtint(sFingerprintHash, o->fingerprint_hash);
2115 2199
2116 /* string arguments */ 2200 /* string arguments */
2117 dump_cfg_string(sPidFile, o->pid_file); 2201 dump_cfg_string(sPidFile, o->pid_file);
2118 dump_cfg_string(sXAuthLocation, o->xauth_location); 2202 dump_cfg_string(sXAuthLocation, o->xauth_location);
2119 dump_cfg_string(sCiphers, o->ciphers ? o->ciphers : 2203 dump_cfg_string(sCiphers, o->ciphers ? o->ciphers : KEX_SERVER_ENCRYPT);
2120 cipher_alg_list(',', 0)); 2204 dump_cfg_string(sMacs, o->macs ? o->macs : KEX_SERVER_MAC);
2121 dump_cfg_string(sMacs, o->macs ? o->macs : mac_alg_list(','));
2122 dump_cfg_string(sBanner, o->banner); 2205 dump_cfg_string(sBanner, o->banner);
2123 dump_cfg_string(sForceCommand, o->adm_forced_command); 2206 dump_cfg_string(sForceCommand, o->adm_forced_command);
2124 dump_cfg_string(sChrootDirectory, o->chroot_directory); 2207 dump_cfg_string(sChrootDirectory, o->chroot_directory);
@@ -2130,8 +2213,12 @@ dump_config(ServerOptions *o)
2130 dump_cfg_string(sAuthorizedKeysCommand, o->authorized_keys_command); 2213 dump_cfg_string(sAuthorizedKeysCommand, o->authorized_keys_command);
2131 dump_cfg_string(sAuthorizedKeysCommandUser, o->authorized_keys_command_user); 2214 dump_cfg_string(sAuthorizedKeysCommandUser, o->authorized_keys_command_user);
2132 dump_cfg_string(sHostKeyAgent, o->host_key_agent); 2215 dump_cfg_string(sHostKeyAgent, o->host_key_agent);
2133 dump_cfg_string(sKexAlgorithms, o->kex_algorithms ? o->kex_algorithms : 2216 dump_cfg_string(sKexAlgorithms,
2134 kex_alg_list(',')); 2217 o->kex_algorithms ? o->kex_algorithms : KEX_SERVER_KEX);
2218 dump_cfg_string(sHostbasedAcceptedKeyTypes, o->hostbased_key_types ?
2219 o->hostbased_key_types : KEX_DEFAULT_PK_ALG);
2220 dump_cfg_string(sPubkeyAcceptedKeyTypes, o->pubkey_key_types ?
2221 o->pubkey_key_types : KEX_DEFAULT_PK_ALG);
2135 2222
2136 /* string arguments requiring a lookup */ 2223 /* string arguments requiring a lookup */
2137 dump_cfg_string(sLogLevel, log_level_name(o->log_level)); 2224 dump_cfg_string(sLogLevel, log_level_name(o->log_level));
diff --git a/servconf.h b/servconf.h
index fa48804ec..ed0f17167 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
@@ -189,6 +191,8 @@ typedef struct {
189 u_int num_auth_methods; 191 u_int num_auth_methods;
190 char *auth_methods[MAX_AUTH_METHODS]; 192 char *auth_methods[MAX_AUTH_METHODS];
191 193
194 int fingerprint_hash;
195
192 int debian_banner; 196 int debian_banner;
193} ServerOptions; 197} ServerOptions;
194 198
@@ -218,6 +222,8 @@ struct connection_info {
218 M_CP_STROPT(authorized_principals_file); \ 222 M_CP_STROPT(authorized_principals_file); \
219 M_CP_STROPT(authorized_keys_command); \ 223 M_CP_STROPT(authorized_keys_command); \
220 M_CP_STROPT(authorized_keys_command_user); \ 224 M_CP_STROPT(authorized_keys_command_user); \
225 M_CP_STROPT(hostbased_key_types); \
226 M_CP_STROPT(pubkey_key_types); \
221 M_CP_STRARRAYOPT(authorized_keys_files, num_authkeys_files); \ 227 M_CP_STRARRAYOPT(authorized_keys_files, num_authkeys_files); \
222 M_CP_STRARRAYOPT(allow_users, num_allow_users); \ 228 M_CP_STRARRAYOPT(allow_users, num_allow_users); \
223 M_CP_STRARRAYOPT(deny_users, num_deny_users); \ 229 M_CP_STRARRAYOPT(deny_users, num_deny_users); \
diff --git a/serverloop.c b/serverloop.c
index 813e5bf38..68f0251a1 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 6250c2031..785833f09 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"
@@ -1446,7 +1447,7 @@ static void
1446safely_chroot(const char *path, uid_t uid) 1447safely_chroot(const char *path, uid_t uid)
1447{ 1448{
1448 const char *cp; 1449 const char *cp;
1449 char component[MAXPATHLEN]; 1450 char component[PATH_MAX];
1450 struct stat st; 1451 struct stat st;
1451 1452
1452 if (*path != '/') 1453 if (*path != '/')
@@ -1629,11 +1630,11 @@ launch_login(struct passwd *pw, const char *hostname)
1629static void 1630static void
1630child_close_fds(void) 1631child_close_fds(void)
1631{ 1632{
1632 extern AuthenticationConnection *auth_conn; 1633 extern int auth_sock;
1633 1634
1634 if (auth_conn) { 1635 if (auth_sock != -1) {
1635 ssh_close_authentication_connection(auth_conn); 1636 close(auth_sock);
1636 auth_conn = NULL; 1637 auth_sock = -1;
1637 } 1638 }
1638 1639
1639 if (packet_get_connection_in() == packet_get_connection_out()) 1640 if (packet_get_connection_in() == packet_get_connection_out())
@@ -2661,7 +2662,7 @@ session_setup_x11fwd(Session *s)
2661 debug("X11 forwarding disabled in server configuration file."); 2662 debug("X11 forwarding disabled in server configuration file.");
2662 return 0; 2663 return 0;
2663 } 2664 }
2664 if (!options.xauth_location || 2665 if (options.xauth_location == NULL ||
2665 (stat(options.xauth_location, &st) == -1)) { 2666 (stat(options.xauth_location, &st) == -1)) {
2666 packet_send_debug("No xauth program; cannot forward with spoofing."); 2667 packet_send_debug("No xauth program; cannot forward with spoofing.");
2667 return 0; 2668 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 f2c408070..25de326b4 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 79b948c8b..19bed1e34 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.
@@ -247,7 +249,7 @@ flag determines the key length by selecting from one of three elliptic
247curve sizes: 256, 384 or 521 bits. 249curve sizes: 256, 384 or 521 bits.
248Attempting to use bit lengths other than these three values for ECDSA keys 250Attempting to use bit lengths other than these three values for ECDSA keys
249will fail. 251will fail.
250ED25519 keys have a fixed length and the 252Ed25519 keys have a fixed length and the
251.Fl b 253.Fl b
252flag will be ignored. 254flag will be ignored.
253.It Fl C Ar comment 255.It Fl C Ar comment
@@ -265,6 +267,14 @@ When used in combination with
265this option indicates that a CA key resides in a PKCS#11 token (see the 267this option indicates that a CA key resides in a PKCS#11 token (see the
266.Sx CERTIFICATES 268.Sx CERTIFICATES
267section for details). 269section for details).
270.It Fl E Ar fingerprint_hash
271Specifies the hash algorithm used when displaying key fingerprints.
272Valid options are:
273.Dq md5
274and
275.Dq sha256 .
276The default is
277.Dq sha256 .
268.It Fl e 278.It Fl e
269This option will read a private or public OpenSSH key file and 279This option will read a private or public OpenSSH key file and
270print to stdout the key in one of the formats specified by the 280print to stdout the key in one of the formats specified by the
@@ -799,7 +809,7 @@ There is no need to keep the contents of this file secret.
799.It Pa ~/.ssh/id_ecdsa 809.It Pa ~/.ssh/id_ecdsa
800.It Pa ~/.ssh/id_ed25519 810.It Pa ~/.ssh/id_ed25519
801.It Pa ~/.ssh/id_rsa 811.It Pa ~/.ssh/id_rsa
802Contains the protocol version 2 DSA, ECDSA, ED25519 or RSA 812Contains the protocol version 2 DSA, ECDSA, Ed25519 or RSA
803authentication identity of the user. 813authentication identity of the user.
804This file should not be readable by anyone but the user. 814This file should not be readable by anyone but the user.
805It is possible to 815It is possible to
@@ -815,7 +825,7 @@ will read this file when a login attempt is made.
815.It Pa ~/.ssh/id_ecdsa.pub 825.It Pa ~/.ssh/id_ecdsa.pub
816.It Pa ~/.ssh/id_ed25519.pub 826.It Pa ~/.ssh/id_ed25519.pub
817.It Pa ~/.ssh/id_rsa.pub 827.It Pa ~/.ssh/id_rsa.pub
818Contains the protocol version 2 DSA, ECDSA, ED25519 or RSA 828Contains the protocol version 2 DSA, ECDSA, Ed25519 or RSA
819public key for authentication. 829public key for authentication.
820The contents of this file should be added to 830The contents of this file should be added to
821.Pa ~/.ssh/authorized_keys 831.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 2606b15b1..c8892fed4 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
@@ -780,7 +793,7 @@ This stores the private key in
780.Pa ~/.ssh/id_ecdsa 793.Pa ~/.ssh/id_ecdsa
781(protocol 2 ECDSA), 794(protocol 2 ECDSA),
782.Pa ~/.ssh/id_ed25519 795.Pa ~/.ssh/id_ed25519
783(protocol 2 ED25519), 796(protocol 2 Ed25519),
784or 797or
785.Pa ~/.ssh/id_rsa 798.Pa ~/.ssh/id_rsa
786(protocol 2 RSA) 799(protocol 2 RSA)
@@ -792,7 +805,7 @@ and stores the public key in
792.Pa ~/.ssh/id_ecdsa.pub 805.Pa ~/.ssh/id_ecdsa.pub
793(protocol 2 ECDSA), 806(protocol 2 ECDSA),
794.Pa ~/.ssh/id_ed25519.pub 807.Pa ~/.ssh/id_ed25519.pub
795(protocol 2 ED25519), 808(protocol 2 Ed25519),
796or 809or
797.Pa ~/.ssh/id_rsa.pub 810.Pa ~/.ssh/id_rsa.pub
798(protocol 2 RSA) 811(protocol 2 RSA)
@@ -1087,7 +1100,7 @@ Fingerprints can be determined using
1087If the fingerprint is already known, it can be matched 1100If the fingerprint is already known, it can be matched
1088and the key can be accepted or rejected. 1101and the key can be accepted or rejected.
1089Because of the difficulty of comparing host keys 1102Because of the difficulty of comparing host keys
1090just by looking at hex strings, 1103just by looking at fingerprint strings,
1091there is also support to compare host keys visually, 1104there is also support to compare host keys visually,
1092using 1105using
1093.Em random art . 1106.Em random art .
@@ -1332,7 +1345,7 @@ secret, but the recommended permissions are read/write/execute for the user,
1332and not accessible by others. 1345and not accessible by others.
1333.Pp 1346.Pp
1334.It Pa ~/.ssh/authorized_keys 1347.It Pa ~/.ssh/authorized_keys
1335Lists the public keys (DSA, ECDSA, ED25519, RSA) 1348Lists the public keys (DSA, ECDSA, Ed25519, RSA)
1336that can be used for logging in as this user. 1349that can be used for logging in as this user.
1337The format of this file is described in the 1350The format of this file is described in the
1338.Xr sshd 8 1351.Xr sshd 8
diff --git a/ssh.c b/ssh.c
index 5bce695d9..e8be6fe47 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 da3c1771a..da8e54428 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
@@ -125,10 +128,12 @@ A single
125.Ql * 128.Ql *
126as a pattern can be used to provide global 129as a pattern can be used to provide global
127defaults for all hosts. 130defaults for all hosts.
128The host is the 131The host is usually the
129.Ar hostname 132.Ar hostname
130argument given on the command line (i.e. the name is not converted to 133argument given on the command line
131a canonicalized host name before matching). 134(see the
135.Cm CanonicalizeHostname
136option for exceptions.)
132.Pp 137.Pp
133A pattern entry may be negated by prefixing it with an exclamation mark 138A pattern entry may be negated by prefixing it with an exclamation mark
134.Pq Sq !\& . 139.Pq Sq !\& .
@@ -150,19 +155,40 @@ or
150keyword) to be used only when the conditions following the 155keyword) to be used only when the conditions following the
151.Cm Match 156.Cm Match
152keyword are satisfied. 157keyword are satisfied.
153Match conditions are specified using one or more keyword/criteria pairs 158Match conditions are specified using one or more critera
154or the single token 159or the single token
155.Cm all 160.Cm all
156which matches all criteria. 161which always matches.
157The available keywords are: 162The available criteria keywords are:
163.Cm canonical ,
158.Cm exec , 164.Cm exec ,
159.Cm host , 165.Cm host ,
160.Cm originalhost , 166.Cm originalhost ,
161.Cm user , 167.Cm user ,
162and 168and
163.Cm localuser . 169.Cm localuser .
170The
171.Cm all
172criteria must appear alone or immediately after
173.Cm canonical .
174Other criteria may be combined arbitrarily.
175All criteria but
176.Cm all
177and
178.Cm canonical
179require an argument.
180Criteria may be negated by prepending an exclamation mark
181.Pq Sq !\& .
164.Pp 182.Pp
165The 183The
184.Cm canonical
185keywork matches only when the configuration file is being re-parsed
186after hostname canonicalization (see the
187.Cm CanonicalizeHostname
188option.)
189This may be useful to specify conditions that work with canonical host
190names only.
191The
166.Cm exec 192.Cm exec
167keyword executes the specified command under the user's shell. 193keyword executes the specified command under the user's shell.
168If the command returns a zero exit status then the condition is considered true. 194If the command returns a zero exit status then the condition is considered true.
@@ -195,7 +221,9 @@ The criteria for the
195keyword are matched against the target hostname, after any substitution 221keyword are matched against the target hostname, after any substitution
196by the 222by the
197.Cm Hostname 223.Cm Hostname
198option. 224or
225.Cm CanonicalizeHostname
226options.
199The 227The
200.Cm originalhost 228.Cm originalhost
201keyword matches against the hostname as it was specified on the command-line. 229keyword matches against the hostname as it was specified on the command-line.
@@ -284,10 +312,11 @@ is set to
284.Dq always , 312.Dq always ,
285then canonicalization is applied to proxied connections too. 313then canonicalization is applied to proxied connections too.
286.Pp 314.Pp
287If this option is enabled and canonicalisation results in the target hostname 315If this option is enabled, then the configuration files are processed
288changing, then the configuration files are processed again using the new 316again using the new target name to pick up any new configuration in matching
289target name to pick up any new configuration in matching
290.Cm Host 317.Cm Host
318and
319.Cm Match
291stanzas. 320stanzas.
292.It Cm CanonicalizeMaxDots 321.It Cm CanonicalizeMaxDots
293Specifies the maximum number of dot characters in a hostname before 322Specifies the maximum number of dot characters in a hostname before
@@ -408,7 +437,9 @@ aes192-cbc,aes256-cbc,arcfour
408The list of available ciphers may also be obtained using the 437The list of available ciphers may also be obtained using the
409.Fl Q 438.Fl Q
410option of 439option of
411.Xr ssh 1 . 440.Xr ssh 1
441with an argument of
442.Dq cipher .
412.It Cm ClearAllForwardings 443.It Cm ClearAllForwardings
413Specifies that all local, remote, and dynamic port forwardings 444Specifies that all local, remote, and dynamic port forwardings
414specified in the configuration files or on the command line be 445specified in the configuration files or on the command line be
@@ -528,7 +559,8 @@ by a hash of the concatenation: %l%h%p%r.
528It is recommended that any 559It is recommended that any
529.Cm ControlPath 560.Cm ControlPath
530used for opportunistic connection sharing include 561used for opportunistic connection sharing include
531at least %h, %p, and %r (or alternatively %C). 562at least %h, %p, and %r (or alternatively %C) and be placed in a directory
563that is not writable by other users.
532This ensures that shared connections are uniquely identified. 564This ensures that shared connections are uniquely identified.
533.It Cm ControlPersist 565.It Cm ControlPersist
534When used in conjunction with 566When used in conjunction with
@@ -541,7 +573,9 @@ If set to
541then the master connection will not be placed into the background, 573then the master connection will not be placed into the background,
542and will close as soon as the initial client connection is closed. 574and will close as soon as the initial client connection is closed.
543If set to 575If set to
544.Dq yes , 576.Dq yes
577or
578.Dq 0 ,
545then the master connection will remain in the background indefinitely 579then the master connection will remain in the background indefinitely
546(until killed or closed via a mechanism such as the 580(until killed or closed via a mechanism such as the
547.Xr ssh 1 581.Xr ssh 1
@@ -626,6 +660,14 @@ or
626.Dq no . 660.Dq no .
627The default is 661The default is
628.Dq no . 662.Dq no .
663.It Cm FingerprintHash
664Specifies the hash algorithm used when displaying key fingerprints.
665Valid options are:
666.Dq md5
667and
668.Dq sha256 .
669The default is
670.Dq sha256 .
629.It Cm ForwardAgent 671.It Cm ForwardAgent
630Specifies whether the connection to the authentication agent (if any) 672Specifies whether the connection to the authentication agent (if any)
631will be forwarded to the remote machine. 673will be forwarded to the remote machine.
@@ -791,6 +833,17 @@ The default is
791This option applies to protocol version 2 only and 833This option applies to protocol version 2 only and
792is similar to 834is similar to
793.Cm RhostsRSAAuthentication . 835.Cm RhostsRSAAuthentication .
836.It Cm HostbasedKeyTypes
837Specifies the key types that will be used for hostbased authentication
838as a comma-separated pattern list.
839The default
840.Dq *
841will allow all key types.
842The
843.Fl Q
844option of
845.Xr ssh 1
846may be used to list supported key types.
794.It Cm HostKeyAlgorithms 847.It Cm HostKeyAlgorithms
795Specifies the protocol version 2 host key algorithms 848Specifies the protocol version 2 host key algorithms
796that the client wants to use in order of preference. 849that the client wants to use in order of preference.
@@ -808,6 +861,13 @@ ssh-ed25519,ssh-rsa,ssh-dss
808.Pp 861.Pp
809If hostkeys are known for the destination host then this default is modified 862If hostkeys are known for the destination host then this default is modified
810to prefer their algorithms. 863to prefer their algorithms.
864.Pp
865The list of available key types may also be obtained using the
866.Fl Q
867option of
868.Xr ssh 1
869with an argument of
870.Dq key .
811.It Cm HostKeyAlias 871.It Cm HostKeyAlias
812Specifies an alias that should be used instead of the 872Specifies an alias that should be used instead of the
813real host name when looking up or saving the host key 873real host name when looking up or saving the host key
@@ -851,7 +911,7 @@ offers many different identities.
851The default is 911The default is
852.Dq no . 912.Dq no .
853.It Cm IdentityFile 913.It Cm IdentityFile
854Specifies a file from which the user's DSA, ECDSA, ED25519 or RSA authentication 914Specifies a file from which the user's DSA, ECDSA, Ed25519 or RSA authentication
855identity is read. 915identity is read.
856The default is 916The default is
857.Pa ~/.ssh/identity 917.Pa ~/.ssh/identity
@@ -978,6 +1038,13 @@ diffie-hellman-group14-sha1,
978diffie-hellman-group-exchange-sha1, 1038diffie-hellman-group-exchange-sha1,
979diffie-hellman-group1-sha1 1039diffie-hellman-group1-sha1
980.Ed 1040.Ed
1041.Pp
1042The list of available key exchange algorithms may also be obtained using the
1043.Fl Q
1044option of
1045.Xr ssh 1
1046with an argument of
1047.Dq kex .
981.It Cm LocalCommand 1048.It Cm LocalCommand
982Specifies a command to execute on the local machine after successfully 1049Specifies a command to execute on the local machine after successfully
983connecting to the server. 1050connecting to the server.
@@ -1067,6 +1134,13 @@ hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,
1067hmac-md5,hmac-sha1,hmac-ripemd160, 1134hmac-md5,hmac-sha1,hmac-ripemd160,
1068hmac-sha1-96,hmac-md5-96 1135hmac-sha1-96,hmac-md5-96
1069.Ed 1136.Ed
1137.Pp
1138The list of available MAC algorithms may also be obtained using the
1139.Fl Q
1140option of
1141.Xr ssh 1
1142with an argument of
1143.Dq mac .
1070.It Cm NoHostAuthenticationForLocalhost 1144.It Cm NoHostAuthenticationForLocalhost
1071This option can be used if the home directory is shared across machines. 1145This option can be used if the home directory is shared across machines.
1072In this case localhost will refer to a different machine on each of 1146In this case localhost will refer to a different machine on each of
@@ -1277,6 +1351,16 @@ and
1277.Fl T 1351.Fl T
1278flags for 1352flags for
1279.Xr ssh 1 . 1353.Xr ssh 1 .
1354.It Cm RevokedHostKeys
1355Specifies revoked host public keys.
1356Keys listed in this file will be refused for host authentication.
1357Note that if this file does not exist or is not readable,
1358then host authentication will be refused for all hosts.
1359Keys may be specified as a text file, listing one public key per line, or as
1360an OpenSSH Key Revocation List (KRL) as generated by
1361.Xr ssh-keygen 1 .
1362For more information on KRLs, see the KEY REVOCATION LISTS section in
1363.Xr ssh-keygen 1 .
1280.It Cm RhostsRSAAuthentication 1364.It Cm RhostsRSAAuthentication
1281Specifies whether to try rhosts based authentication with RSA host 1365Specifies whether to try rhosts based authentication with RSA host
1282authentication. 1366authentication.
@@ -1491,6 +1575,36 @@ is not specified, it defaults to
1491.Dq any . 1575.Dq any .
1492The default is 1576The default is
1493.Dq any:any . 1577.Dq any:any .
1578.It Cm UpdateHostKeys
1579Specifies whether
1580.Xr ssh 1
1581should accept notifications of additional hostkeys from the server sent
1582after authentication has completed and add them to
1583.Cm UserKnownHostsFile .
1584The argument must be
1585.Dq yes ,
1586.Dq no
1587(the default) or
1588.Dq ask .
1589Enabling this option allows learning alternate hostkeys for a server
1590and supports graceful key rotation by allowing a server to send replacement
1591public keys before old ones are removed.
1592Additional hostkeys are only accepted if the key used to authenticate the
1593host was already trusted or explicity accepted by the user.
1594If
1595.Cm UpdateHostKeys
1596is set to
1597.Dq ask ,
1598then the user is asked to confirm the modifications to the known_hosts file.
1599Confirmation is currently incompatible with
1600.Cm ControlPersist ,
1601and will be disabled if it is enabled.
1602.Pp
1603Presently, only
1604.Xr sshd 8
1605from OpenSSH 6.8 and greater support the
1606.Dq hostkeys@openssh.com
1607protocol extension used to inform the client of all the server's hostkeys.
1494.It Cm UsePrivilegedPort 1608.It Cm UsePrivilegedPort
1495Specifies whether to use a privileged port for outgoing connections. 1609Specifies whether to use a privileged port for outgoing connections.
1496The argument must be 1610The argument must be
@@ -1549,12 +1663,12 @@ See also VERIFYING HOST KEYS in
1549If this flag is set to 1663If this flag is set to
1550.Dq yes , 1664.Dq yes ,
1551an ASCII art representation of the remote host key fingerprint is 1665an ASCII art representation of the remote host key fingerprint is
1552printed in addition to the hex fingerprint string at login and 1666printed in addition to the fingerprint string at login and
1553for unknown host keys. 1667for unknown host keys.
1554If this flag is set to 1668If this flag is set to
1555.Dq no , 1669.Dq no ,
1556no fingerprint strings are printed at login and 1670no fingerprint strings are printed at login and
1557only the hex fingerprint string will be printed for unknown host keys. 1671only the fingerprint string will be printed for unknown host keys.
1558The default is 1672The default is
1559.Dq no . 1673.Dq no .
1560.It Cm XAuthLocation 1674.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 563405ecb..a6c9e20ed 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
@@ -1187,6 +1199,12 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
1187 } 1199 }
1188 } 1200 }
1189 1201
1202 if (!hostkey_trusted && options.update_hostkeys) {
1203 debug("%s: hostkey not known or explicitly trusted: "
1204 "disabling UpdateHostkeys", __func__);
1205 options.update_hostkeys = 0;
1206 }
1207
1190 free(ip); 1208 free(ip);
1191 free(host); 1209 free(host);
1192 if (host_hostkeys != NULL) 1210 if (host_hostkeys != NULL)
@@ -1224,16 +1242,45 @@ int
1224verify_host_key(char *host, struct sockaddr *hostaddr, Key *host_key) 1242verify_host_key(char *host, struct sockaddr *hostaddr, Key *host_key)
1225{ 1243{
1226 int r = -1, flags = 0; 1244 int r = -1, flags = 0;
1227 char *fp; 1245 char *fp = NULL;
1228 Key *plain = NULL; 1246 struct sshkey *plain = NULL;
1247
1248 if ((fp = sshkey_fingerprint(host_key,
1249 options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL) {
1250 error("%s: fingerprint host key: %s", __func__, ssh_err(r));
1251 r = -1;
1252 goto out;
1253 }
1229 1254
1230 fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); 1255 debug("Server host key: %s %s",
1231 debug("Server host key: %s %s", key_type(host_key), fp); 1256 compat20 ? sshkey_ssh_name(host_key) : sshkey_type(host_key), fp);
1232 free(fp);
1233 1257
1234 if (key_equal(previous_host_key, host_key)) { 1258 if (sshkey_equal(previous_host_key, host_key)) {
1235 debug("%s: server host key matches cached key", __func__); 1259 debug2("%s: server host key %s %s matches cached key",
1236 return 0; 1260 __func__, sshkey_type(host_key), fp);
1261 r = 0;
1262 goto out;
1263 }
1264
1265 /* Check in RevokedHostKeys file if specified */
1266 if (options.revoked_host_keys != NULL) {
1267 r = sshkey_check_revoked(host_key, options.revoked_host_keys);
1268 switch (r) {
1269 case 0:
1270 break; /* not revoked */
1271 case SSH_ERR_KEY_REVOKED:
1272 error("Host key %s %s revoked by file %s",
1273 sshkey_type(host_key), fp,
1274 options.revoked_host_keys);
1275 r = -1;
1276 goto out;
1277 default:
1278 error("Error checking host key %s %s in "
1279 "revoked keys file %s: %s", sshkey_type(host_key),
1280 fp, options.revoked_host_keys, ssh_err(r));
1281 r = -1;
1282 goto out;
1283 }
1237 } 1284 }
1238 1285
1239 if (options.verify_host_key_dns) { 1286 if (options.verify_host_key_dns) {
@@ -1241,17 +1288,17 @@ verify_host_key(char *host, struct sockaddr *hostaddr, Key *host_key)
1241 * XXX certs are not yet supported for DNS, so downgrade 1288 * XXX certs are not yet supported for DNS, so downgrade
1242 * them and try the plain key. 1289 * them and try the plain key.
1243 */ 1290 */
1244 plain = key_from_private(host_key); 1291 if ((r = sshkey_from_private(host_key, &plain)) != 0)
1245 if (key_is_cert(plain)) 1292 goto out;
1246 key_drop_cert(plain); 1293 if (sshkey_is_cert(plain))
1294 sshkey_drop_cert(plain);
1247 if (verify_host_key_dns(host, hostaddr, plain, &flags) == 0) { 1295 if (verify_host_key_dns(host, hostaddr, plain, &flags) == 0) {
1248 if (flags & DNS_VERIFY_FOUND) { 1296 if (flags & DNS_VERIFY_FOUND) {
1249 if (options.verify_host_key_dns == 1 && 1297 if (options.verify_host_key_dns == 1 &&
1250 flags & DNS_VERIFY_MATCH && 1298 flags & DNS_VERIFY_MATCH &&
1251 flags & DNS_VERIFY_SECURE) { 1299 flags & DNS_VERIFY_SECURE) {
1252 key_free(plain);
1253 r = 0; 1300 r = 0;
1254 goto done; 1301 goto out;
1255 } 1302 }
1256 if (flags & DNS_VERIFY_MATCH) { 1303 if (flags & DNS_VERIFY_MATCH) {
1257 matching_host_key_dns = 1; 1304 matching_host_key_dns = 1;
@@ -1263,14 +1310,14 @@ verify_host_key(char *host, struct sockaddr *hostaddr, Key *host_key)
1263 } 1310 }
1264 } 1311 }
1265 } 1312 }
1266 key_free(plain);
1267 } 1313 }
1268
1269 r = check_host_key(host, hostaddr, options.port, host_key, RDRW, 1314 r = check_host_key(host, hostaddr, options.port, host_key, RDRW,
1270 options.user_hostfiles, options.num_user_hostfiles, 1315 options.user_hostfiles, options.num_user_hostfiles,
1271 options.system_hostfiles, options.num_system_hostfiles); 1316 options.system_hostfiles, options.num_system_hostfiles);
1272 1317
1273done: 1318out:
1319 sshkey_free(plain);
1320 free(fp);
1274 if (r == 0 && host_key != NULL) { 1321 if (r == 0 && host_key != NULL) {
1275 key_free(previous_host_key); 1322 key_free(previous_host_key);
1276 previous_host_key = key_from_private(host_key); 1323 previous_host_key = key_from_private(host_key);
@@ -1361,8 +1408,12 @@ show_other_keys(struct hostkeys *hostkeys, Key *key)
1361 continue; 1408 continue;
1362 if (!lookup_key_in_hostkeys_by_type(hostkeys, type[i], &found)) 1409 if (!lookup_key_in_hostkeys_by_type(hostkeys, type[i], &found))
1363 continue; 1410 continue;
1364 fp = key_fingerprint(found->key, SSH_FP_MD5, SSH_FP_HEX); 1411 fp = sshkey_fingerprint(found->key,
1365 ra = key_fingerprint(found->key, SSH_FP_MD5, SSH_FP_RANDOMART); 1412 options.fingerprint_hash, SSH_FP_DEFAULT);
1413 ra = sshkey_fingerprint(found->key,
1414 options.fingerprint_hash, SSH_FP_RANDOMART);
1415 if (fp == NULL || ra == NULL)
1416 fatal("%s: sshkey_fingerprint fail", __func__);
1366 logit("WARNING: %s key found for host %s\n" 1417 logit("WARNING: %s key found for host %s\n"
1367 "in %s:%lu\n" 1418 "in %s:%lu\n"
1368 "%s key fingerprint %s.", 1419 "%s key fingerprint %s.",
@@ -1383,7 +1434,10 @@ warn_changed_key(Key *host_key)
1383{ 1434{
1384 char *fp; 1435 char *fp;
1385 1436
1386 fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); 1437 fp = sshkey_fingerprint(host_key, options.fingerprint_hash,
1438 SSH_FP_DEFAULT);
1439 if (fp == NULL)
1440 fatal("%s: sshkey_fingerprint fail", __func__);
1387 1441
1388 error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); 1442 error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
1389 error("@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @"); 1443 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 7b478f16d..faa8ec589 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#ifdef GSSAPI 163#ifdef GSSAPI
163 char *orig = NULL, *gss = NULL; 164 char *orig = NULL, *gss = NULL;
@@ -240,13 +241,17 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port)
240 (time_t)options.rekey_interval); 241 (time_t)options.rekey_interval);
241 242
242 /* start key exchange */ 243 /* start key exchange */
243 kex = kex_setup(myproposal); 244 if ((r = kex_setup(active_state, myproposal)) != 0)
245 fatal("kex_setup: %s", ssh_err(r));
246 kex = active_state->kex;
244#ifdef WITH_OPENSSL 247#ifdef WITH_OPENSSL
245 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client; 248 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client;
246 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client; 249 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client;
247 kex->kex[KEX_DH_GEX_SHA1] = kexgex_client; 250 kex->kex[KEX_DH_GEX_SHA1] = kexgex_client;
248 kex->kex[KEX_DH_GEX_SHA256] = kexgex_client; 251 kex->kex[KEX_DH_GEX_SHA256] = kexgex_client;
252# ifdef OPENSSL_HAS_ECC
249 kex->kex[KEX_ECDH_SHA2] = kexecdh_client; 253 kex->kex[KEX_ECDH_SHA2] = kexecdh_client;
254# endif
250#endif 255#endif
251 kex->kex[KEX_C25519_SHA256] = kexc25519_client; 256 kex->kex[KEX_C25519_SHA256] = kexc25519_client;
252#ifdef GSSAPI 257#ifdef GSSAPI
@@ -273,9 +278,7 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port)
273 } 278 }
274#endif 279#endif
275 280
276 xxx_kex = kex; 281 dispatch_run(DISPATCH_BLOCK, &kex->done, active_state);
277
278 dispatch_run(DISPATCH_BLOCK, &kex->done, kex);
279 282
280 if (options.use_roaming && !kex->roaming) { 283 if (options.use_roaming && !kex->roaming) {
281 debug("Roaming not allowed by server"); 284 debug("Roaming not allowed by server");
@@ -298,15 +301,15 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port)
298 * Authenticate user 301 * Authenticate user
299 */ 302 */
300 303
301typedef struct Authctxt Authctxt; 304typedef struct cauthctxt Authctxt;
302typedef struct Authmethod Authmethod; 305typedef struct cauthmethod Authmethod;
303typedef struct identity Identity; 306typedef struct identity Identity;
304typedef struct idlist Idlist; 307typedef struct idlist Idlist;
305 308
306struct identity { 309struct identity {
307 TAILQ_ENTRY(identity) next; 310 TAILQ_ENTRY(identity) next;
308 AuthenticationConnection *ac; /* set if agent supports key */ 311 int agent_fd; /* >=0 if agent supports key */
309 Key *key; /* public/private key */ 312 struct sshkey *key; /* public/private key */
310 char *filename; /* comment for agent-only keys */ 313 char *filename; /* comment for agent-only keys */
311 int tried; 314 int tried;
312 int isprivate; /* key points to the private key */ 315 int isprivate; /* key points to the private key */
@@ -314,25 +317,29 @@ struct identity {
314}; 317};
315TAILQ_HEAD(idlist, identity); 318TAILQ_HEAD(idlist, identity);
316 319
317struct Authctxt { 320struct cauthctxt {
318 const char *server_user; 321 const char *server_user;
319 const char *local_user; 322 const char *local_user;
320 const char *host; 323 const char *host;
321 const char *service; 324 const char *service;
322 Authmethod *method; 325 struct cauthmethod *method;
323 sig_atomic_t success; 326 sig_atomic_t success;
324 char *authlist; 327 char *authlist;
328 int attempt;
325 /* pubkey */ 329 /* pubkey */
326 Idlist keys; 330 struct idlist keys;
327 AuthenticationConnection *agent; 331 int agent_fd;
328 /* hostbased */ 332 /* hostbased */
329 Sensitive *sensitive; 333 Sensitive *sensitive;
334 char *oktypes, *ktypes;
335 const char *active_ktype;
330 /* kbd-interactive */ 336 /* kbd-interactive */
331 int info_req_seen; 337 int info_req_seen;
332 /* generic */ 338 /* generic */
333 void *methoddata; 339 void *methoddata;
334}; 340};
335struct Authmethod { 341
342struct cauthmethod {
336 char *name; /* string to compare against server's list */ 343 char *name; /* string to compare against server's list */
337 int (*userauth)(Authctxt *authctxt); 344 int (*userauth)(Authctxt *authctxt);
338 void (*cleanup)(Authctxt *authctxt); 345 void (*cleanup)(Authctxt *authctxt);
@@ -340,14 +347,14 @@ struct Authmethod {
340 int *batch_flag; /* flag in option struct that disables method */ 347 int *batch_flag; /* flag in option struct that disables method */
341}; 348};
342 349
343void input_userauth_success(int, u_int32_t, void *); 350int input_userauth_success(int, u_int32_t, void *);
344void input_userauth_success_unexpected(int, u_int32_t, void *); 351int input_userauth_success_unexpected(int, u_int32_t, void *);
345void input_userauth_failure(int, u_int32_t, void *); 352int input_userauth_failure(int, u_int32_t, void *);
346void input_userauth_banner(int, u_int32_t, void *); 353int input_userauth_banner(int, u_int32_t, void *);
347void input_userauth_error(int, u_int32_t, void *); 354int input_userauth_error(int, u_int32_t, void *);
348void input_userauth_info_req(int, u_int32_t, void *); 355int input_userauth_info_req(int, u_int32_t, void *);
349void input_userauth_pk_ok(int, u_int32_t, void *); 356int input_userauth_pk_ok(int, u_int32_t, void *);
350void input_userauth_passwd_changereq(int, u_int32_t, void *); 357int input_userauth_passwd_changereq(int, u_int32_t, void *);
351 358
352int userauth_none(Authctxt *); 359int userauth_none(Authctxt *);
353int userauth_pubkey(Authctxt *); 360int userauth_pubkey(Authctxt *);
@@ -357,11 +364,11 @@ int userauth_hostbased(Authctxt *);
357 364
358#ifdef GSSAPI 365#ifdef GSSAPI
359int userauth_gssapi(Authctxt *authctxt); 366int userauth_gssapi(Authctxt *authctxt);
360void input_gssapi_response(int type, u_int32_t, void *); 367int input_gssapi_response(int type, u_int32_t, void *);
361void input_gssapi_token(int type, u_int32_t, void *); 368int input_gssapi_token(int type, u_int32_t, void *);
362void input_gssapi_hash(int type, u_int32_t, void *); 369int input_gssapi_hash(int type, u_int32_t, void *);
363void input_gssapi_error(int, u_int32_t, void *); 370int input_gssapi_error(int, u_int32_t, void *);
364void input_gssapi_errtok(int, u_int32_t, void *); 371int input_gssapi_errtok(int, u_int32_t, void *);
365int userauth_gsskeyex(Authctxt *authctxt); 372int userauth_gsskeyex(Authctxt *authctxt);
366#endif 373#endif
367 374
@@ -460,7 +467,9 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host,
460 authctxt.authlist = NULL; 467 authctxt.authlist = NULL;
461 authctxt.methoddata = NULL; 468 authctxt.methoddata = NULL;
462 authctxt.sensitive = sensitive; 469 authctxt.sensitive = sensitive;
470 authctxt.active_ktype = authctxt.oktypes = authctxt.ktypes = NULL;
463 authctxt.info_req_seen = 0; 471 authctxt.info_req_seen = 0;
472 authctxt.agent_fd = -1;
464 if (authctxt.method == NULL) 473 if (authctxt.method == NULL)
465 fatal("ssh_userauth2: internal error: cannot send userauth none request"); 474 fatal("ssh_userauth2: internal error: cannot send userauth none request");
466 475
@@ -515,15 +524,16 @@ userauth(Authctxt *authctxt, char *authlist)
515} 524}
516 525
517/* ARGSUSED */ 526/* ARGSUSED */
518void 527int
519input_userauth_error(int type, u_int32_t seq, void *ctxt) 528input_userauth_error(int type, u_int32_t seq, void *ctxt)
520{ 529{
521 fatal("input_userauth_error: bad message during authentication: " 530 fatal("input_userauth_error: bad message during authentication: "
522 "type %d", type); 531 "type %d", type);
532 return 0;
523} 533}
524 534
525/* ARGSUSED */ 535/* ARGSUSED */
526void 536int
527input_userauth_banner(int type, u_int32_t seq, void *ctxt) 537input_userauth_banner(int type, u_int32_t seq, void *ctxt)
528{ 538{
529 char *msg, *raw, *lang; 539 char *msg, *raw, *lang;
@@ -542,10 +552,11 @@ input_userauth_banner(int type, u_int32_t seq, void *ctxt)
542 } 552 }
543 free(raw); 553 free(raw);
544 free(lang); 554 free(lang);
555 return 0;
545} 556}
546 557
547/* ARGSUSED */ 558/* ARGSUSED */
548void 559int
549input_userauth_success(int type, u_int32_t seq, void *ctxt) 560input_userauth_success(int type, u_int32_t seq, void *ctxt)
550{ 561{
551 Authctxt *authctxt = ctxt; 562 Authctxt *authctxt = ctxt;
@@ -559,9 +570,10 @@ input_userauth_success(int type, u_int32_t seq, void *ctxt)
559 free(authctxt->methoddata); 570 free(authctxt->methoddata);
560 authctxt->methoddata = NULL; 571 authctxt->methoddata = NULL;
561 authctxt->success = 1; /* break out */ 572 authctxt->success = 1; /* break out */
573 return 0;
562} 574}
563 575
564void 576int
565input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt) 577input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt)
566{ 578{
567 Authctxt *authctxt = ctxt; 579 Authctxt *authctxt = ctxt;
@@ -571,10 +583,11 @@ input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt)
571 583
572 fatal("Unexpected authentication success during %s.", 584 fatal("Unexpected authentication success during %s.",
573 authctxt->method->name); 585 authctxt->method->name);
586 return 0;
574} 587}
575 588
576/* ARGSUSED */ 589/* ARGSUSED */
577void 590int
578input_userauth_failure(int type, u_int32_t seq, void *ctxt) 591input_userauth_failure(int type, u_int32_t seq, void *ctxt)
579{ 592{
580 Authctxt *authctxt = ctxt; 593 Authctxt *authctxt = ctxt;
@@ -597,10 +610,11 @@ input_userauth_failure(int type, u_int32_t seq, void *ctxt)
597 debug("Authentications that can continue: %s", authlist); 610 debug("Authentications that can continue: %s", authlist);
598 611
599 userauth(authctxt, authlist); 612 userauth(authctxt, authlist);
613 return 0;
600} 614}
601 615
602/* ARGSUSED */ 616/* ARGSUSED */
603void 617int
604input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt) 618input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt)
605{ 619{
606 Authctxt *authctxt = ctxt; 620 Authctxt *authctxt = ctxt;
@@ -644,7 +658,9 @@ input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt)
644 key->type, pktype); 658 key->type, pktype);
645 goto done; 659 goto done;
646 } 660 }
647 fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); 661 if ((fp = sshkey_fingerprint(key, options.fingerprint_hash,
662 SSH_FP_DEFAULT)) == NULL)
663 goto done;
648 debug2("input_userauth_pk_ok: fp %s", fp); 664 debug2("input_userauth_pk_ok: fp %s", fp);
649 free(fp); 665 free(fp);
650 666
@@ -668,6 +684,7 @@ done:
668 /* try another method if we did not send a packet */ 684 /* try another method if we did not send a packet */
669 if (sent == 0) 685 if (sent == 0)
670 userauth(authctxt, NULL); 686 userauth(authctxt, NULL);
687 return 0;
671} 688}
672 689
673#ifdef GSSAPI 690#ifdef GSSAPI
@@ -795,7 +812,7 @@ process_gssapi_token(void *ctxt, gss_buffer_t recv_tok)
795} 812}
796 813
797/* ARGSUSED */ 814/* ARGSUSED */
798void 815int
799input_gssapi_response(int type, u_int32_t plen, void *ctxt) 816input_gssapi_response(int type, u_int32_t plen, void *ctxt)
800{ 817{
801 Authctxt *authctxt = ctxt; 818 Authctxt *authctxt = ctxt;
@@ -816,7 +833,7 @@ input_gssapi_response(int type, u_int32_t plen, void *ctxt)
816 free(oidv); 833 free(oidv);
817 debug("Badly encoded mechanism OID received"); 834 debug("Badly encoded mechanism OID received");
818 userauth(authctxt, NULL); 835 userauth(authctxt, NULL);
819 return; 836 return 0;
820 } 837 }
821 838
822 if (!ssh_gssapi_check_oid(gssctxt, oidv + 2, oidlen - 2)) 839 if (!ssh_gssapi_check_oid(gssctxt, oidv + 2, oidlen - 2))
@@ -830,12 +847,13 @@ input_gssapi_response(int type, u_int32_t plen, void *ctxt)
830 /* Start again with next method on list */ 847 /* Start again with next method on list */
831 debug("Trying to start again"); 848 debug("Trying to start again");
832 userauth(authctxt, NULL); 849 userauth(authctxt, NULL);
833 return; 850 return 0;
834 } 851 }
852 return 0;
835} 853}
836 854
837/* ARGSUSED */ 855/* ARGSUSED */
838void 856int
839input_gssapi_token(int type, u_int32_t plen, void *ctxt) 857input_gssapi_token(int type, u_int32_t plen, void *ctxt)
840{ 858{
841 Authctxt *authctxt = ctxt; 859 Authctxt *authctxt = ctxt;
@@ -858,12 +876,13 @@ input_gssapi_token(int type, u_int32_t plen, void *ctxt)
858 if (GSS_ERROR(status)) { 876 if (GSS_ERROR(status)) {
859 /* Start again with the next method in the list */ 877 /* Start again with the next method in the list */
860 userauth(authctxt, NULL); 878 userauth(authctxt, NULL);
861 return; 879 return 0;
862 } 880 }
881 return 0;
863} 882}
864 883
865/* ARGSUSED */ 884/* ARGSUSED */
866void 885int
867input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) 886input_gssapi_errtok(int type, u_int32_t plen, void *ctxt)
868{ 887{
869 Authctxt *authctxt = ctxt; 888 Authctxt *authctxt = ctxt;
@@ -890,10 +909,11 @@ input_gssapi_errtok(int type, u_int32_t plen, void *ctxt)
890 gss_release_buffer(&ms, &send_tok); 909 gss_release_buffer(&ms, &send_tok);
891 910
892 /* Server will be returning a failed packet after this one */ 911 /* Server will be returning a failed packet after this one */
912 return 0;
893} 913}
894 914
895/* ARGSUSED */ 915/* ARGSUSED */
896void 916int
897input_gssapi_error(int type, u_int32_t plen, void *ctxt) 917input_gssapi_error(int type, u_int32_t plen, void *ctxt)
898{ 918{
899 char *msg; 919 char *msg;
@@ -909,6 +929,7 @@ input_gssapi_error(int type, u_int32_t plen, void *ctxt)
909 debug("Server GSSAPI Error:\n%s", msg); 929 debug("Server GSSAPI Error:\n%s", msg);
910 free(msg); 930 free(msg);
911 free(lang); 931 free(lang);
932 return 0;
912} 933}
913 934
914int 935int
@@ -1005,7 +1026,7 @@ userauth_passwd(Authctxt *authctxt)
1005 * parse PASSWD_CHANGEREQ, prompt user and send SSH2_MSG_USERAUTH_REQUEST 1026 * parse PASSWD_CHANGEREQ, prompt user and send SSH2_MSG_USERAUTH_REQUEST
1006 */ 1027 */
1007/* ARGSUSED */ 1028/* ARGSUSED */
1008void 1029int
1009input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) 1030input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt)
1010{ 1031{
1011 Authctxt *authctxt = ctxt; 1032 Authctxt *authctxt = ctxt;
@@ -1046,7 +1067,7 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt)
1046 password = read_passphrase(prompt, RP_ALLOW_EOF); 1067 password = read_passphrase(prompt, RP_ALLOW_EOF);
1047 if (password == NULL) { 1068 if (password == NULL) {
1048 /* bail out */ 1069 /* bail out */
1049 return; 1070 return 0;
1050 } 1071 }
1051 snprintf(prompt, sizeof(prompt), 1072 snprintf(prompt, sizeof(prompt),
1052 "Retype %.30s@%.128s's new password: ", 1073 "Retype %.30s@%.128s's new password: ",
@@ -1069,30 +1090,33 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt)
1069 1090
1070 dispatch_set(SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ, 1091 dispatch_set(SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ,
1071 &input_userauth_passwd_changereq); 1092 &input_userauth_passwd_changereq);
1093 return 0;
1072} 1094}
1073 1095
1074static int 1096static int
1075identity_sign(Identity *id, u_char **sigp, u_int *lenp, 1097identity_sign(struct identity *id, u_char **sigp, size_t *lenp,
1076 u_char *data, u_int datalen) 1098 const u_char *data, size_t datalen, u_int compat)
1077{ 1099{
1078 Key *prv; 1100 Key *prv;
1079 int ret; 1101 int ret;
1080 1102
1081 /* the agent supports this key */ 1103 /* the agent supports this key */
1082 if (id->ac) 1104 if (id->agent_fd)
1083 return (ssh_agent_sign(id->ac, id->key, sigp, lenp, 1105 return ssh_agent_sign(id->agent_fd, id->key, sigp, lenp,
1084 data, datalen)); 1106 data, datalen, compat);
1107
1085 /* 1108 /*
1086 * we have already loaded the private key or 1109 * we have already loaded the private key or
1087 * the private key is stored in external hardware 1110 * the private key is stored in external hardware
1088 */ 1111 */
1089 if (id->isprivate || (id->key->flags & SSHKEY_FLAG_EXT)) 1112 if (id->isprivate || (id->key->flags & SSHKEY_FLAG_EXT))
1090 return (key_sign(id->key, sigp, lenp, data, datalen)); 1113 return (sshkey_sign(id->key, sigp, lenp, data, datalen,
1114 compat));
1091 /* load the private key from the file */ 1115 /* load the private key from the file */
1092 if ((prv = load_identity_file(id->filename, id->userprovided)) == NULL) 1116 if ((prv = load_identity_file(id->filename, id->userprovided)) == NULL)
1093 return (-1); 1117 return (-1); /* XXX return decent error code */
1094 ret = key_sign(prv, sigp, lenp, data, datalen); 1118 ret = sshkey_sign(prv, sigp, lenp, data, datalen, compat);
1095 key_free(prv); 1119 sshkey_free(prv);
1096 return (ret); 1120 return (ret);
1097} 1121}
1098 1122
@@ -1101,13 +1125,16 @@ sign_and_send_pubkey(Authctxt *authctxt, Identity *id)
1101{ 1125{
1102 Buffer b; 1126 Buffer b;
1103 u_char *blob, *signature; 1127 u_char *blob, *signature;
1104 u_int bloblen, slen; 1128 u_int bloblen;
1129 size_t slen;
1105 u_int skip = 0; 1130 u_int skip = 0;
1106 int ret = -1; 1131 int ret = -1;
1107 int have_sig = 1; 1132 int have_sig = 1;
1108 char *fp; 1133 char *fp;
1109 1134
1110 fp = key_fingerprint(id->key, SSH_FP_MD5, SSH_FP_HEX); 1135 if ((fp = sshkey_fingerprint(id->key, options.fingerprint_hash,
1136 SSH_FP_DEFAULT)) == NULL)
1137 return 0;
1111 debug3("sign_and_send_pubkey: %s %s", key_type(id->key), fp); 1138 debug3("sign_and_send_pubkey: %s %s", key_type(id->key), fp);
1112 free(fp); 1139 free(fp);
1113 1140
@@ -1142,8 +1169,8 @@ sign_and_send_pubkey(Authctxt *authctxt, Identity *id)
1142 1169
1143 /* generate signature */ 1170 /* generate signature */
1144 ret = identity_sign(id, &signature, &slen, 1171 ret = identity_sign(id, &signature, &slen,
1145 buffer_ptr(&b), buffer_len(&b)); 1172 buffer_ptr(&b), buffer_len(&b), datafellows);
1146 if (ret == -1) { 1173 if (ret != 0) {
1147 free(blob); 1174 free(blob);
1148 buffer_free(&b); 1175 buffer_free(&b);
1149 return 0; 1176 return 0;
@@ -1218,7 +1245,7 @@ load_identity_file(char *filename, int userprovided)
1218{ 1245{
1219 Key *private; 1246 Key *private;
1220 char prompt[300], *passphrase; 1247 char prompt[300], *passphrase;
1221 int perm_ok = 0, quit, i; 1248 int r, perm_ok = 0, quit = 0, i;
1222 struct stat st; 1249 struct stat st;
1223 1250
1224 if (stat(filename, &st) < 0) { 1251 if (stat(filename, &st) < 0) {
@@ -1226,33 +1253,50 @@ load_identity_file(char *filename, int userprovided)
1226 filename, strerror(errno)); 1253 filename, strerror(errno));
1227 return NULL; 1254 return NULL;
1228 } 1255 }
1229 private = key_load_private_type(KEY_UNSPEC, filename, "", NULL, &perm_ok); 1256 snprintf(prompt, sizeof prompt,
1230 if (!perm_ok) { 1257 "Enter passphrase for key '%.100s': ", filename);
1231 if (private != NULL) 1258 for (i = 0; i <= options.number_of_password_prompts; i++) {
1232 key_free(private); 1259 if (i == 0)
1233 return NULL; 1260 passphrase = "";
1234 } 1261 else {
1235 if (private == NULL) {
1236 if (options.batch_mode)
1237 return NULL;
1238 snprintf(prompt, sizeof prompt,
1239 "Enter passphrase for key '%.100s': ", filename);
1240 for (i = 0; i < options.number_of_password_prompts; i++) {
1241 passphrase = read_passphrase(prompt, 0); 1262 passphrase = read_passphrase(prompt, 0);
1242 if (strcmp(passphrase, "") != 0) { 1263 if (*passphrase == '\0') {
1243 private = key_load_private_type(KEY_UNSPEC,
1244 filename, passphrase, NULL, NULL);
1245 quit = 0;
1246 } else {
1247 debug2("no passphrase given, try next key"); 1264 debug2("no passphrase given, try next key");
1265 free(passphrase);
1266 break;
1267 }
1268 }
1269 switch ((r = sshkey_load_private_type(KEY_UNSPEC, filename,
1270 passphrase, &private, NULL, &perm_ok))) {
1271 case 0:
1272 break;
1273 case SSH_ERR_KEY_WRONG_PASSPHRASE:
1274 if (options.batch_mode) {
1275 quit = 1;
1276 break;
1277 }
1278 if (i != 0)
1279 debug2("bad passphrase given, try again...");
1280 break;
1281 case SSH_ERR_SYSTEM_ERROR:
1282 if (errno == ENOENT) {
1283 debug2("Load key \"%s\": %s",
1284 filename, ssh_err(r));
1248 quit = 1; 1285 quit = 1;
1286 break;
1249 } 1287 }
1288 /* FALLTHROUGH */
1289 default:
1290 error("Load key \"%s\": %s", filename, ssh_err(r));
1291 quit = 1;
1292 break;
1293 }
1294 if (i > 0) {
1250 explicit_bzero(passphrase, strlen(passphrase)); 1295 explicit_bzero(passphrase, strlen(passphrase));
1251 free(passphrase); 1296 free(passphrase);
1252 if (private != NULL || quit)
1253 break;
1254 debug2("bad passphrase given, try again...");
1255 } 1297 }
1298 if (private != NULL || quit)
1299 break;
1256 } 1300 }
1257 return private; 1301 return private;
1258} 1302}
@@ -1266,12 +1310,12 @@ load_identity_file(char *filename, int userprovided)
1266static void 1310static void
1267pubkey_prepare(Authctxt *authctxt) 1311pubkey_prepare(Authctxt *authctxt)
1268{ 1312{
1269 Identity *id, *id2, *tmp; 1313 struct identity *id, *id2, *tmp;
1270 Idlist agent, files, *preferred; 1314 struct idlist agent, files, *preferred;
1271 Key *key; 1315 struct sshkey *key;
1272 AuthenticationConnection *ac; 1316 int agent_fd, i, r, found;
1273 char *comment; 1317 size_t j;
1274 int i, found; 1318 struct ssh_identitylist *idlist;
1275 1319
1276 TAILQ_INIT(&agent); /* keys from the agent */ 1320 TAILQ_INIT(&agent); /* keys from the agent */
1277 TAILQ_INIT(&files); /* keys from the config file */ 1321 TAILQ_INIT(&files); /* keys from the config file */
@@ -1301,7 +1345,7 @@ pubkey_prepare(Authctxt *authctxt)
1301 if (id2->key == NULL || 1345 if (id2->key == NULL ||
1302 (id2->key->flags & SSHKEY_FLAG_EXT) == 0) 1346 (id2->key->flags & SSHKEY_FLAG_EXT) == 0)
1303 continue; 1347 continue;
1304 if (key_equal(id->key, id2->key)) { 1348 if (sshkey_equal(id->key, id2->key)) {
1305 TAILQ_REMOVE(&files, id, next); 1349 TAILQ_REMOVE(&files, id, next);
1306 TAILQ_INSERT_TAIL(preferred, id, next); 1350 TAILQ_INSERT_TAIL(preferred, id, next);
1307 found = 1; 1351 found = 1;
@@ -1316,37 +1360,48 @@ pubkey_prepare(Authctxt *authctxt)
1316 } 1360 }
1317 } 1361 }
1318 /* list of keys supported by the agent */ 1362 /* list of keys supported by the agent */
1319 if ((ac = ssh_get_authentication_connection())) { 1363 if ((r = ssh_get_authentication_socket(&agent_fd)) != 0) {
1320 for (key = ssh_get_first_identity(ac, &comment, 2); 1364 if (r != SSH_ERR_AGENT_NOT_PRESENT)
1321 key != NULL; 1365 debug("%s: ssh_get_authentication_socket: %s",
1322 key = ssh_get_next_identity(ac, &comment, 2)) { 1366 __func__, ssh_err(r));
1367 } else if ((r = ssh_fetch_identitylist(agent_fd, 2, &idlist)) != 0) {
1368 if (r != SSH_ERR_AGENT_NO_IDENTITIES)
1369 debug("%s: ssh_fetch_identitylist: %s",
1370 __func__, ssh_err(r));
1371 } else {
1372 for (j = 0; j < idlist->nkeys; j++) {
1323 found = 0; 1373 found = 0;
1324 TAILQ_FOREACH(id, &files, next) { 1374 TAILQ_FOREACH(id, &files, next) {
1325 /* agent keys from the config file are preferred */ 1375 /*
1326 if (key_equal(key, id->key)) { 1376 * agent keys from the config file are
1327 key_free(key); 1377 * preferred
1328 free(comment); 1378 */
1379 if (sshkey_equal(idlist->keys[j], id->key)) {
1329 TAILQ_REMOVE(&files, id, next); 1380 TAILQ_REMOVE(&files, id, next);
1330 TAILQ_INSERT_TAIL(preferred, id, next); 1381 TAILQ_INSERT_TAIL(preferred, id, next);
1331 id->ac = ac; 1382 id->agent_fd = agent_fd;
1332 found = 1; 1383 found = 1;
1333 break; 1384 break;
1334 } 1385 }
1335 } 1386 }
1336 if (!found && !options.identities_only) { 1387 if (!found && !options.identities_only) {
1337 id = xcalloc(1, sizeof(*id)); 1388 id = xcalloc(1, sizeof(*id));
1338 id->key = key; 1389 /* XXX "steals" key/comment from idlist */
1339 id->filename = comment; 1390 id->key = idlist->keys[j];
1340 id->ac = ac; 1391 id->filename = idlist->comments[j];
1392 idlist->keys[j] = NULL;
1393 idlist->comments[j] = NULL;
1394 id->agent_fd = agent_fd;
1341 TAILQ_INSERT_TAIL(&agent, id, next); 1395 TAILQ_INSERT_TAIL(&agent, id, next);
1342 } 1396 }
1343 } 1397 }
1398 ssh_free_identitylist(idlist);
1344 /* append remaining agent keys */ 1399 /* append remaining agent keys */
1345 for (id = TAILQ_FIRST(&agent); id; id = TAILQ_FIRST(&agent)) { 1400 for (id = TAILQ_FIRST(&agent); id; id = TAILQ_FIRST(&agent)) {
1346 TAILQ_REMOVE(&agent, id, next); 1401 TAILQ_REMOVE(&agent, id, next);
1347 TAILQ_INSERT_TAIL(preferred, id, next); 1402 TAILQ_INSERT_TAIL(preferred, id, next);
1348 } 1403 }
1349 authctxt->agent = ac; 1404 authctxt->agent_fd = agent_fd;
1350 } 1405 }
1351 /* append remaining keys from the config file */ 1406 /* append remaining keys from the config file */
1352 for (id = TAILQ_FIRST(&files); id; id = TAILQ_FIRST(&files)) { 1407 for (id = TAILQ_FIRST(&files); id; id = TAILQ_FIRST(&files)) {
@@ -1364,13 +1419,13 @@ pubkey_cleanup(Authctxt *authctxt)
1364{ 1419{
1365 Identity *id; 1420 Identity *id;
1366 1421
1367 if (authctxt->agent != NULL) 1422 if (authctxt->agent_fd != -1)
1368 ssh_close_authentication_connection(authctxt->agent); 1423 ssh_close_authentication_socket(authctxt->agent_fd);
1369 for (id = TAILQ_FIRST(&authctxt->keys); id; 1424 for (id = TAILQ_FIRST(&authctxt->keys); id;
1370 id = TAILQ_FIRST(&authctxt->keys)) { 1425 id = TAILQ_FIRST(&authctxt->keys)) {
1371 TAILQ_REMOVE(&authctxt->keys, id, next); 1426 TAILQ_REMOVE(&authctxt->keys, id, next);
1372 if (id->key) 1427 if (id->key)
1373 key_free(id->key); 1428 sshkey_free(id->key);
1374 free(id->filename); 1429 free(id->filename);
1375 free(id); 1430 free(id);
1376 } 1431 }
@@ -1462,7 +1517,7 @@ userauth_kbdint(Authctxt *authctxt)
1462/* 1517/*
1463 * parse INFO_REQUEST, prompt user and send INFO_RESPONSE 1518 * parse INFO_REQUEST, prompt user and send INFO_RESPONSE
1464 */ 1519 */
1465void 1520int
1466input_userauth_info_req(int type, u_int32_t seq, void *ctxt) 1521input_userauth_info_req(int type, u_int32_t seq, void *ctxt)
1467{ 1522{
1468 Authctxt *authctxt = ctxt; 1523 Authctxt *authctxt = ctxt;
@@ -1514,81 +1569,120 @@ input_userauth_info_req(int type, u_int32_t seq, void *ctxt)
1514 1569
1515 packet_add_padding(64); 1570 packet_add_padding(64);
1516 packet_send(); 1571 packet_send();
1572 return 0;
1517} 1573}
1518 1574
1519static int 1575static int
1520ssh_keysign(Key *key, u_char **sigp, u_int *lenp, 1576ssh_keysign(struct sshkey *key, u_char **sigp, size_t *lenp,
1521 u_char *data, u_int datalen) 1577 const u_char *data, size_t datalen)
1522{ 1578{
1523 Buffer b; 1579 struct sshbuf *b;
1524 struct stat st; 1580 struct stat st;
1525 pid_t pid; 1581 pid_t pid;
1526 int to[2], from[2], status, version = 2; 1582 int i, r, to[2], from[2], status, sock = packet_get_connection_in();
1583 u_char rversion = 0, version = 2;
1584 void (*osigchld)(int);
1527 1585
1528 debug2("ssh_keysign called"); 1586 *sigp = NULL;
1587 *lenp = 0;
1529 1588
1530 if (stat(_PATH_SSH_KEY_SIGN, &st) < 0) { 1589 if (stat(_PATH_SSH_KEY_SIGN, &st) < 0) {
1531 error("ssh_keysign: not installed: %s", strerror(errno)); 1590 error("%s: not installed: %s", __func__, strerror(errno));
1591 return -1;
1592 }
1593 if (fflush(stdout) != 0) {
1594 error("%s: fflush: %s", __func__, strerror(errno));
1532 return -1; 1595 return -1;
1533 } 1596 }
1534 if (fflush(stdout) != 0)
1535 error("ssh_keysign: fflush: %s", strerror(errno));
1536 if (pipe(to) < 0) { 1597 if (pipe(to) < 0) {
1537 error("ssh_keysign: pipe: %s", strerror(errno)); 1598 error("%s: pipe: %s", __func__, strerror(errno));
1538 return -1; 1599 return -1;
1539 } 1600 }
1540 if (pipe(from) < 0) { 1601 if (pipe(from) < 0) {
1541 error("ssh_keysign: pipe: %s", strerror(errno)); 1602 error("%s: pipe: %s", __func__, strerror(errno));
1542 return -1; 1603 return -1;
1543 } 1604 }
1544 if ((pid = fork()) < 0) { 1605 if ((pid = fork()) < 0) {
1545 error("ssh_keysign: fork: %s", strerror(errno)); 1606 error("%s: fork: %s", __func__, strerror(errno));
1546 return -1; 1607 return -1;
1547 } 1608 }
1609 osigchld = signal(SIGCHLD, SIG_DFL);
1548 if (pid == 0) { 1610 if (pid == 0) {
1549 /* keep the socket on exec */ 1611 /* keep the socket on exec */
1550 fcntl(packet_get_connection_in(), F_SETFD, 0); 1612 fcntl(sock, F_SETFD, 0);
1551 permanently_drop_suid(getuid()); 1613 permanently_drop_suid(getuid());
1552 close(from[0]); 1614 close(from[0]);
1553 if (dup2(from[1], STDOUT_FILENO) < 0) 1615 if (dup2(from[1], STDOUT_FILENO) < 0)
1554 fatal("ssh_keysign: dup2: %s", strerror(errno)); 1616 fatal("%s: dup2: %s", __func__, strerror(errno));
1555 close(to[1]); 1617 close(to[1]);
1556 if (dup2(to[0], STDIN_FILENO) < 0) 1618 if (dup2(to[0], STDIN_FILENO) < 0)
1557 fatal("ssh_keysign: dup2: %s", strerror(errno)); 1619 fatal("%s: dup2: %s", __func__, strerror(errno));
1558 close(from[1]); 1620 close(from[1]);
1559 close(to[0]); 1621 close(to[0]);
1622 /* Close everything but stdio and the socket */
1623 for (i = STDERR_FILENO + 1; i < sock; i++)
1624 close(i);
1625 closefrom(sock + 1);
1626 debug3("%s: [child] pid=%ld, exec %s",
1627 __func__, (long)getpid(), _PATH_SSH_KEY_SIGN);
1560 execl(_PATH_SSH_KEY_SIGN, _PATH_SSH_KEY_SIGN, (char *) 0); 1628 execl(_PATH_SSH_KEY_SIGN, _PATH_SSH_KEY_SIGN, (char *) 0);
1561 fatal("ssh_keysign: exec(%s): %s", _PATH_SSH_KEY_SIGN, 1629 fatal("%s: exec(%s): %s", __func__, _PATH_SSH_KEY_SIGN,
1562 strerror(errno)); 1630 strerror(errno));
1563 } 1631 }
1564 close(from[1]); 1632 close(from[1]);
1565 close(to[0]); 1633 close(to[0]);
1566 1634
1567 buffer_init(&b); 1635 if ((b = sshbuf_new()) == NULL)
1568 buffer_put_int(&b, packet_get_connection_in()); /* send # of socket */ 1636 fatal("%s: sshbuf_new failed", __func__);
1569 buffer_put_string(&b, data, datalen); 1637 /* send # of sock, data to be signed */
1570 if (ssh_msg_send(to[1], version, &b) == -1) 1638 if ((r = sshbuf_put_u32(b, sock) != 0) ||
1571 fatal("ssh_keysign: couldn't send request"); 1639 (r = sshbuf_put_string(b, data, datalen)) != 0)
1572 1640 fatal("%s: buffer error: %s", __func__, ssh_err(r));
1573 if (ssh_msg_recv(from[0], &b) < 0) { 1641 if (ssh_msg_send(to[1], version, b) == -1)
1574 error("ssh_keysign: no reply"); 1642 fatal("%s: couldn't send request", __func__);
1575 buffer_free(&b); 1643 sshbuf_reset(b);
1576 return -1; 1644 r = ssh_msg_recv(from[0], b);
1577 }
1578 close(from[0]); 1645 close(from[0]);
1579 close(to[1]); 1646 close(to[1]);
1647 if (r < 0) {
1648 error("%s: no reply", __func__);
1649 goto fail;
1650 }
1580 1651
1581 while (waitpid(pid, &status, 0) < 0) 1652 errno = 0;
1582 if (errno != EINTR) 1653 while (waitpid(pid, &status, 0) < 0) {
1583 break; 1654 if (errno != EINTR) {
1584 1655 error("%s: waitpid %ld: %s",
1585 if (buffer_get_char(&b) != version) { 1656 __func__, (long)pid, strerror(errno));
1586 error("ssh_keysign: bad version"); 1657 goto fail;
1587 buffer_free(&b); 1658 }
1659 }
1660 if (!WIFEXITED(status)) {
1661 error("%s: exited abnormally", __func__);
1662 goto fail;
1663 }
1664 if (WEXITSTATUS(status) != 0) {
1665 error("%s: exited with status %d",
1666 __func__, WEXITSTATUS(status));
1667 goto fail;
1668 }
1669 if ((r = sshbuf_get_u8(b, &rversion)) != 0) {
1670 error("%s: buffer error: %s", __func__, ssh_err(r));
1671 goto fail;
1672 }
1673 if (rversion != version) {
1674 error("%s: bad version", __func__);
1675 goto fail;
1676 }
1677 if ((r = sshbuf_get_string(b, sigp, lenp)) != 0) {
1678 error("%s: buffer error: %s", __func__, ssh_err(r));
1679 fail:
1680 signal(SIGCHLD, osigchld);
1681 sshbuf_free(b);
1588 return -1; 1682 return -1;
1589 } 1683 }
1590 *sigp = buffer_get_string(&b, lenp); 1684 signal(SIGCHLD, osigchld);
1591 buffer_free(&b); 1685 sshbuf_free(b);
1592 1686
1593 return 0; 1687 return 0;
1594} 1688}
@@ -1596,94 +1690,149 @@ ssh_keysign(Key *key, u_char **sigp, u_int *lenp,
1596int 1690int
1597userauth_hostbased(Authctxt *authctxt) 1691userauth_hostbased(Authctxt *authctxt)
1598{ 1692{
1599 Key *private = NULL; 1693 struct ssh *ssh = active_state;
1600 Sensitive *sensitive = authctxt->sensitive; 1694 struct sshkey *private = NULL;
1601 Buffer b; 1695 struct sshbuf *b = NULL;
1602 u_char *signature, *blob;
1603 char *chost, *pkalg, *p;
1604 const char *service; 1696 const char *service;
1605 u_int blen, slen; 1697 u_char *sig = NULL, *keyblob = NULL;
1606 int ok, i, found = 0; 1698 char *fp = NULL, *chost = NULL, *lname = NULL;
1607 1699 size_t siglen = 0, keylen = 0;
1608 /* check for a useful key */ 1700 int i, r, success = 0;
1609 for (i = 0; i < sensitive->nkeys; i++) { 1701
1610 private = sensitive->keys[i]; 1702 if (authctxt->ktypes == NULL) {
1611 if (private && private->type != KEY_RSA1) { 1703 authctxt->oktypes = xstrdup(options.hostbased_key_types);
1612 found = 1; 1704 authctxt->ktypes = authctxt->oktypes;
1705 }
1706
1707 /*
1708 * Work through each listed type pattern in HostbasedKeyTypes,
1709 * trying each hostkey that matches the type in turn.
1710 */
1711 for (;;) {
1712 if (authctxt->active_ktype == NULL)
1713 authctxt->active_ktype = strsep(&authctxt->ktypes, ",");
1714 if (authctxt->active_ktype == NULL ||
1715 *authctxt->active_ktype == '\0')
1716 break;
1717 debug3("%s: trying key type %s", __func__,
1718 authctxt->active_ktype);
1719
1720 /* check for a useful key */
1721 private = NULL;
1722 for (i = 0; i < authctxt->sensitive->nkeys; i++) {
1723 if (authctxt->sensitive->keys[i] == NULL ||
1724 authctxt->sensitive->keys[i]->type == KEY_RSA1 ||
1725 authctxt->sensitive->keys[i]->type == KEY_UNSPEC)
1726 continue;
1727 if (match_pattern_list(
1728 sshkey_ssh_name(authctxt->sensitive->keys[i]),
1729 authctxt->active_ktype,
1730 strlen(authctxt->active_ktype), 0) != 1)
1731 continue;
1613 /* we take and free the key */ 1732 /* we take and free the key */
1614 sensitive->keys[i] = NULL; 1733 private = authctxt->sensitive->keys[i];
1734 authctxt->sensitive->keys[i] = NULL;
1615 break; 1735 break;
1616 } 1736 }
1737 /* Found one */
1738 if (private != NULL)
1739 break;
1740 /* No more keys of this type; advance */
1741 authctxt->active_ktype = NULL;
1617 } 1742 }
1618 if (!found) { 1743 if (private == NULL) {
1744 free(authctxt->oktypes);
1745 authctxt->oktypes = authctxt->ktypes = NULL;
1746 authctxt->active_ktype = NULL;
1619 debug("No more client hostkeys for hostbased authentication."); 1747 debug("No more client hostkeys for hostbased authentication.");
1620 return 0; 1748 goto out;
1621 } 1749 }
1622 if (key_to_blob(private, &blob, &blen) == 0) { 1750
1623 key_free(private); 1751 if ((fp = sshkey_fingerprint(private, options.fingerprint_hash,
1624 return 0; 1752 SSH_FP_DEFAULT)) == NULL) {
1753 error("%s: sshkey_fingerprint failed", __func__);
1754 goto out;
1625 } 1755 }
1756 debug("%s: trying hostkey %s %s",
1757 __func__, sshkey_ssh_name(private), fp);
1758
1626 /* figure out a name for the client host */ 1759 /* figure out a name for the client host */
1627 p = get_local_name(packet_get_connection_in()); 1760 if ((lname = get_local_name(packet_get_connection_in())) == NULL) {
1628 if (p == NULL) { 1761 error("%s: cannot get local ipaddr/name", __func__);
1629 error("userauth_hostbased: cannot get local ipaddr/name"); 1762 goto out;
1630 key_free(private);
1631 free(blob);
1632 return 0;
1633 } 1763 }
1634 xasprintf(&chost, "%s.", p); 1764
1635 debug2("userauth_hostbased: chost %s", chost); 1765 /* XXX sshbuf_put_stringf? */
1636 free(p); 1766 xasprintf(&chost, "%s.", lname);
1767 debug2("%s: chost %s", __func__, chost);
1637 1768
1638 service = datafellows & SSH_BUG_HBSERVICE ? "ssh-userauth" : 1769 service = datafellows & SSH_BUG_HBSERVICE ? "ssh-userauth" :
1639 authctxt->service; 1770 authctxt->service;
1640 pkalg = xstrdup(key_ssh_name(private)); 1771
1641 buffer_init(&b);
1642 /* construct data */ 1772 /* construct data */
1643 buffer_put_string(&b, session_id2, session_id2_len); 1773 if ((b = sshbuf_new()) == NULL) {
1644 buffer_put_char(&b, SSH2_MSG_USERAUTH_REQUEST); 1774 error("%s: sshbuf_new failed", __func__);
1645 buffer_put_cstring(&b, authctxt->server_user); 1775 goto out;
1646 buffer_put_cstring(&b, service); 1776 }
1647 buffer_put_cstring(&b, authctxt->method->name); 1777 if ((r = sshkey_to_blob(private, &keyblob, &keylen)) != 0) {
1648 buffer_put_cstring(&b, pkalg); 1778 error("%s: sshkey_to_blob: %s", __func__, ssh_err(r));
1649 buffer_put_string(&b, blob, blen); 1779 goto out;
1650 buffer_put_cstring(&b, chost); 1780 }
1651 buffer_put_cstring(&b, authctxt->local_user); 1781 if ((r = sshbuf_put_string(b, session_id2, session_id2_len)) != 0 ||
1782 (r = sshbuf_put_u8(b, SSH2_MSG_USERAUTH_REQUEST)) != 0 ||
1783 (r = sshbuf_put_cstring(b, authctxt->server_user)) != 0 ||
1784 (r = sshbuf_put_cstring(b, service)) != 0 ||
1785 (r = sshbuf_put_cstring(b, authctxt->method->name)) != 0 ||
1786 (r = sshbuf_put_cstring(b, key_ssh_name(private))) != 0 ||
1787 (r = sshbuf_put_string(b, keyblob, keylen)) != 0 ||
1788 (r = sshbuf_put_cstring(b, chost)) != 0 ||
1789 (r = sshbuf_put_cstring(b, authctxt->local_user)) != 0) {
1790 error("%s: buffer error: %s", __func__, ssh_err(r));
1791 goto out;
1792 }
1793
1652#ifdef DEBUG_PK 1794#ifdef DEBUG_PK
1653 buffer_dump(&b); 1795 sshbuf_dump(b, stderr);
1654#endif 1796#endif
1655 if (sensitive->external_keysign) 1797 if (authctxt->sensitive->external_keysign)
1656 ok = ssh_keysign(private, &signature, &slen, 1798 r = ssh_keysign(private, &sig, &siglen,
1657 buffer_ptr(&b), buffer_len(&b)); 1799 sshbuf_ptr(b), sshbuf_len(b));
1658 else 1800 else if ((r = sshkey_sign(private, &sig, &siglen,
1659 ok = key_sign(private, &signature, &slen, 1801 sshbuf_ptr(b), sshbuf_len(b), datafellows)) != 0)
1660 buffer_ptr(&b), buffer_len(&b)); 1802 debug("%s: sshkey_sign: %s", __func__, ssh_err(r));
1661 key_free(private); 1803 if (r != 0) {
1662 buffer_free(&b); 1804 error("sign using hostkey %s %s failed",
1663 if (ok != 0) { 1805 sshkey_ssh_name(private), fp);
1664 error("key_sign failed"); 1806 goto out;
1665 free(chost);
1666 free(pkalg);
1667 free(blob);
1668 return 0;
1669 } 1807 }
1670 packet_start(SSH2_MSG_USERAUTH_REQUEST); 1808 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_REQUEST)) != 0 ||
1671 packet_put_cstring(authctxt->server_user); 1809 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 ||
1672 packet_put_cstring(authctxt->service); 1810 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 ||
1673 packet_put_cstring(authctxt->method->name); 1811 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 ||
1674 packet_put_cstring(pkalg); 1812 (r = sshpkt_put_cstring(ssh, key_ssh_name(private))) != 0 ||
1675 packet_put_string(blob, blen); 1813 (r = sshpkt_put_string(ssh, keyblob, keylen)) != 0 ||
1676 packet_put_cstring(chost); 1814 (r = sshpkt_put_cstring(ssh, chost)) != 0 ||
1677 packet_put_cstring(authctxt->local_user); 1815 (r = sshpkt_put_cstring(ssh, authctxt->local_user)) != 0 ||
1678 packet_put_string(signature, slen); 1816 (r = sshpkt_put_string(ssh, sig, siglen)) != 0 ||
1679 explicit_bzero(signature, slen); 1817 (r = sshpkt_send(ssh)) != 0) {
1680 free(signature); 1818 error("%s: packet error: %s", __func__, ssh_err(r));
1819 goto out;
1820 }
1821 success = 1;
1822
1823 out:
1824 if (sig != NULL) {
1825 explicit_bzero(sig, siglen);
1826 free(sig);
1827 }
1828 free(keyblob);
1829 free(lname);
1830 free(fp);
1681 free(chost); 1831 free(chost);
1682 free(pkalg); 1832 sshkey_free(private);
1683 free(blob); 1833 sshbuf_free(b);
1684 1834
1685 packet_send(); 1835 return success;
1686 return 1;
1687} 1836}
1688 1837
1689/* find auth method */ 1838/* 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 f8f9eac37..e1980174d 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
@@ -281,7 +281,7 @@ though this can be changed via the
281.Cm Protocol 281.Cm Protocol
282option in 282option in
283.Xr sshd_config 5 . 283.Xr sshd_config 5 .
284Protocol 2 supports DSA, ECDSA, ED25519 and RSA keys; 284Protocol 2 supports DSA, ECDSA, Ed25519 and RSA keys;
285protocol 1 only supports RSA keys. 285protocol 1 only supports RSA keys.
286For both protocols, 286For both protocols,
287each host has a host-specific key, 287each host has a host-specific key,
@@ -607,10 +607,10 @@ Disables execution of
607Forbids X11 forwarding when this key is used for authentication. 607Forbids X11 forwarding when this key is used for authentication.
608Any X11 forward requests by the client will return an error. 608Any X11 forward requests by the client will return an error.
609.It Cm permitopen="host:port" 609.It Cm permitopen="host:port"
610Limit local 610Limit local port forwarding with
611.Li ``ssh -L'' 611.Xr ssh 1
612port forwarding such that it may only connect to the specified host and 612.Fl L
613port. 613such that it may only connect to the specified host and port.
614IPv6 addresses can be specified by enclosing the address in square brackets. 614IPv6 addresses can be specified by enclosing the address in square brackets.
615Multiple 615Multiple
616.Cm permitopen 616.Cm permitopen
@@ -811,7 +811,7 @@ secret, but the recommended permissions are read/write/execute for the user,
811and not accessible by others. 811and not accessible by others.
812.Pp 812.Pp
813.It Pa ~/.ssh/authorized_keys 813.It Pa ~/.ssh/authorized_keys
814Lists the public keys (DSA, ECDSA, ED25519, RSA) 814Lists the public keys (DSA, ECDSA, Ed25519, RSA)
815that can be used for logging in as this user. 815that can be used for logging in as this user.
816The format of this file is described above. 816The format of this file is described above.
817The content of the file is not highly sensitive, but the recommended 817The content of the file is not highly sensitive, but the recommended
diff --git a/sshd.c b/sshd.c
index 23d5a64f0..f8db3ae60 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#ifdef USE_SECURITY_SESSION_API 128#ifdef USE_SECURITY_SESSION_API
127#include <Security/AuthSession.h> 129#include <Security/AuthSession.h>
@@ -197,11 +199,8 @@ int num_listen_socks = 0;
197char *client_version_string = NULL; 199char *client_version_string = NULL;
198char *server_version_string = NULL; 200char *server_version_string = NULL;
199 201
200/* for rekeying XXX fixme */
201Kex *xxx_kex;
202
203/* Daemon's agent connection */ 202/* Daemon's agent connection */
204AuthenticationConnection *auth_conn = NULL; 203int auth_sock = -1;
205int have_agent = 0; 204int have_agent = 0;
206 205
207/* 206/*
@@ -241,7 +240,7 @@ u_char *session_id2 = NULL;
241u_int session_id2_len = 0; 240u_int session_id2_len = 0;
242 241
243/* record remote hostname or ip */ 242/* record remote hostname or ip */
244u_int utmp_len = MAXHOSTNAMELEN; 243u_int utmp_len = HOST_NAME_MAX+1;
245 244
246/* options.max_startup sized array of fd ints */ 245/* options.max_startup sized array of fd ints */
247int *startup_pipes = NULL; 246int *startup_pipes = NULL;
@@ -498,7 +497,7 @@ sshd_exchange_identification(int sock_in, int sock_out)
498 debug("Client protocol version %d.%d; client software version %.100s", 497 debug("Client protocol version %d.%d; client software version %.100s",
499 remote_major, remote_minor, remote_version); 498 remote_major, remote_minor, remote_version);
500 499
501 compat_datafellows(remote_version); 500 active_state->compat = compat_datafellows(remote_version);
502 501
503 if ((datafellows & SSH_BUG_PROBE) != 0) { 502 if ((datafellows & SSH_BUG_PROBE) != 0) {
504 logit("probed from %s with %s. Don't panic.", 503 logit("probed from %s with %s. Don't panic.",
@@ -634,7 +633,9 @@ privsep_preauth_child(void)
634 633
635 arc4random_stir(); 634 arc4random_stir();
636 arc4random_buf(rnd, sizeof(rnd)); 635 arc4random_buf(rnd, sizeof(rnd));
636#ifdef WITH_OPENSSL
637 RAND_seed(rnd, sizeof(rnd)); 637 RAND_seed(rnd, sizeof(rnd));
638#endif
638 explicit_bzero(rnd, sizeof(rnd)); 639 explicit_bzero(rnd, sizeof(rnd));
639 640
640 /* Demote the private keys to public keys. */ 641 /* Demote the private keys to public keys. */
@@ -664,14 +665,14 @@ privsep_preauth_child(void)
664static int 665static int
665privsep_preauth(Authctxt *authctxt) 666privsep_preauth(Authctxt *authctxt)
666{ 667{
667 int status; 668 int status, r;
668 pid_t pid; 669 pid_t pid;
669 struct ssh_sandbox *box = NULL; 670 struct ssh_sandbox *box = NULL;
670 671
671 /* Set up unprivileged child process to deal with network data */ 672 /* Set up unprivileged child process to deal with network data */
672 pmonitor = monitor_init(); 673 pmonitor = monitor_init();
673 /* Store a pointer to the kex for later rekeying */ 674 /* Store a pointer to the kex for later rekeying */
674 pmonitor->m_pkex = &xxx_kex; 675 pmonitor->m_pkex = &active_state->kex;
675 676
676 if (use_privsep == PRIVSEP_ON) 677 if (use_privsep == PRIVSEP_ON)
677 box = ssh_sandbox_init(pmonitor); 678 box = ssh_sandbox_init(pmonitor);
@@ -682,8 +683,14 @@ privsep_preauth(Authctxt *authctxt)
682 debug2("Network child is on pid %ld", (long)pid); 683 debug2("Network child is on pid %ld", (long)pid);
683 684
684 pmonitor->m_pid = pid; 685 pmonitor->m_pid = pid;
685 if (have_agent) 686 if (have_agent) {
686 auth_conn = ssh_get_authentication_connection(); 687 r = ssh_get_authentication_socket(&auth_sock);
688 if (r != 0) {
689 error("Could not get agent socket: %s",
690 ssh_err(r));
691 have_agent = 0;
692 }
693 }
687 if (box != NULL) 694 if (box != NULL)
688 ssh_sandbox_parent_preauth(box, pid); 695 ssh_sandbox_parent_preauth(box, pid);
689 monitor_child_preauth(authctxt, pmonitor); 696 monitor_child_preauth(authctxt, pmonitor);
@@ -769,7 +776,9 @@ privsep_postauth(Authctxt *authctxt)
769 776
770 arc4random_stir(); 777 arc4random_stir();
771 arc4random_buf(rnd, sizeof(rnd)); 778 arc4random_buf(rnd, sizeof(rnd));
779#ifdef WITH_OPENSSL
772 RAND_seed(rnd, sizeof(rnd)); 780 RAND_seed(rnd, sizeof(rnd));
781#endif
773 explicit_bzero(rnd, sizeof(rnd)); 782 explicit_bzero(rnd, sizeof(rnd));
774 783
775 /* Drop privileges */ 784 /* Drop privileges */
@@ -839,7 +848,7 @@ list_hostkey_types(void)
839} 848}
840 849
841static Key * 850static Key *
842get_hostkey_by_type(int type, int need_private) 851get_hostkey_by_type(int type, int nid, int need_private, struct ssh *ssh)
843{ 852{
844 int i; 853 int i;
845 Key *key; 854 Key *key;
@@ -860,7 +869,8 @@ get_hostkey_by_type(int type, int need_private)
860 key = sensitive_data.host_pubkeys[i]; 869 key = sensitive_data.host_pubkeys[i];
861 break; 870 break;
862 } 871 }
863 if (key != NULL && key->type == type) 872 if (key != NULL && key->type == type &&
873 (key->type != KEY_ECDSA || key->ecdsa_nid == nid))
864 return need_private ? 874 return need_private ?
865 sensitive_data.host_keys[i] : key; 875 sensitive_data.host_keys[i] : key;
866 } 876 }
@@ -868,15 +878,15 @@ get_hostkey_by_type(int type, int need_private)
868} 878}
869 879
870Key * 880Key *
871get_hostkey_public_by_type(int type) 881get_hostkey_public_by_type(int type, int nid, struct ssh *ssh)
872{ 882{
873 return get_hostkey_by_type(type, 0); 883 return get_hostkey_by_type(type, nid, 0, ssh);
874} 884}
875 885
876Key * 886Key *
877get_hostkey_private_by_type(int type) 887get_hostkey_private_by_type(int type, int nid, struct ssh *ssh)
878{ 888{
879 return get_hostkey_by_type(type, 1); 889 return get_hostkey_by_type(type, nid, 1, ssh);
880} 890}
881 891
882Key * 892Key *
@@ -888,7 +898,7 @@ get_hostkey_by_index(int ind)
888} 898}
889 899
890Key * 900Key *
891get_hostkey_public_by_index(int ind) 901get_hostkey_public_by_index(int ind, struct ssh *ssh)
892{ 902{
893 if (ind < 0 || ind >= options.num_host_key_files) 903 if (ind < 0 || ind >= options.num_host_key_files)
894 return (NULL); 904 return (NULL);
@@ -896,24 +906,71 @@ get_hostkey_public_by_index(int ind)
896} 906}
897 907
898int 908int
899get_hostkey_index(Key *key) 909get_hostkey_index(Key *key, int compare, struct ssh *ssh)
900{ 910{
901 int i; 911 int i;
902 912
903 for (i = 0; i < options.num_host_key_files; i++) { 913 for (i = 0; i < options.num_host_key_files; i++) {
904 if (key_is_cert(key)) { 914 if (key_is_cert(key)) {
905 if (key == sensitive_data.host_certificates[i]) 915 if (key == sensitive_data.host_certificates[i] ||
916 (compare && sensitive_data.host_certificates[i] &&
917 sshkey_equal(key,
918 sensitive_data.host_certificates[i])))
906 return (i); 919 return (i);
907 } else { 920 } else {
908 if (key == sensitive_data.host_keys[i]) 921 if (key == sensitive_data.host_keys[i] ||
922 (compare && sensitive_data.host_keys[i] &&
923 sshkey_equal(key, sensitive_data.host_keys[i])))
909 return (i); 924 return (i);
910 if (key == sensitive_data.host_pubkeys[i]) 925 if (key == sensitive_data.host_pubkeys[i] ||
926 (compare && sensitive_data.host_pubkeys[i] &&
927 sshkey_equal(key, sensitive_data.host_pubkeys[i])))
911 return (i); 928 return (i);
912 } 929 }
913 } 930 }
914 return (-1); 931 return (-1);
915} 932}
916 933
934/* Inform the client of all hostkeys */
935static void
936notify_hostkeys(struct ssh *ssh)
937{
938 struct sshbuf *buf;
939 struct sshkey *key;
940 int i, nkeys, r;
941 char *fp;
942
943 if ((buf = sshbuf_new()) == NULL)
944 fatal("%s: sshbuf_new", __func__);
945 for (i = nkeys = 0; i < options.num_host_key_files; i++) {
946 key = get_hostkey_public_by_index(i, ssh);
947 if (key == NULL || key->type == KEY_UNSPEC ||
948 key->type == KEY_RSA1 || sshkey_is_cert(key))
949 continue;
950 fp = sshkey_fingerprint(key, options.fingerprint_hash,
951 SSH_FP_DEFAULT);
952 debug3("%s: key %d: %s %s", __func__, i,
953 sshkey_ssh_name(key), fp);
954 free(fp);
955 if (nkeys == 0) {
956 packet_start(SSH2_MSG_GLOBAL_REQUEST);
957 packet_put_cstring("hostkeys-00@openssh.com");
958 packet_put_char(0); /* want-reply */
959 }
960 sshbuf_reset(buf);
961 if ((r = sshkey_putb(key, buf)) != 0)
962 fatal("%s: couldn't put hostkey %d: %s",
963 __func__, i, ssh_err(r));
964 packet_put_string(sshbuf_ptr(buf), sshbuf_len(buf));
965 nkeys++;
966 }
967 debug3("%s: sent %d hostkeys", __func__, nkeys);
968 if (nkeys == 0)
969 fatal("%s: no hostkeys", __func__);
970 packet_send();
971 sshbuf_free(buf);
972}
973
917/* 974/*
918 * returns 1 if connection should be dropped, 0 otherwise. 975 * returns 1 if connection should be dropped, 0 otherwise.
919 * dropping starts at connection #max_startups_begin with a probability 976 * dropping starts at connection #max_startups_begin with a probability
@@ -999,7 +1056,7 @@ send_rexec_state(int fd, Buffer *conf)
999#endif 1056#endif
1000 buffer_put_int(&m, 0); 1057 buffer_put_int(&m, 0);
1001 1058
1002#ifndef OPENSSL_PRNG_ONLY 1059#if defined(WITH_OPENSSL) && !defined(OPENSSL_PRNG_ONLY)
1003 rexec_send_rng_seed(&m); 1060 rexec_send_rng_seed(&m);
1004#endif 1061#endif
1005 1062
@@ -1052,7 +1109,7 @@ recv_rexec_state(int fd, Buffer *conf)
1052#endif 1109#endif
1053 } 1110 }
1054 1111
1055#ifndef OPENSSL_PRNG_ONLY 1112#if defined(WITH_OPENSSL) && !defined(OPENSSL_PRNG_ONLY)
1056 rexec_recv_rng_seed(&m); 1113 rexec_recv_rng_seed(&m);
1057#endif 1114#endif
1058 1115
@@ -1219,7 +1276,8 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s)
1219 logit("Received signal %d; terminating.", 1276 logit("Received signal %d; terminating.",
1220 (int) received_sigterm); 1277 (int) received_sigterm);
1221 close_listen_socks(); 1278 close_listen_socks();
1222 unlink(options.pid_file); 1279 if (options.pid_file != NULL)
1280 unlink(options.pid_file);
1223 exit(received_sigterm == SIGTERM ? 0 : 255); 1281 exit(received_sigterm == SIGTERM ? 0 : 255);
1224 } 1282 }
1225 if (key_used && key_do_regen) { 1283 if (key_used && key_do_regen) {
@@ -1382,7 +1440,9 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s)
1382 */ 1440 */
1383 arc4random_stir(); 1441 arc4random_stir();
1384 arc4random_buf(rnd, sizeof(rnd)); 1442 arc4random_buf(rnd, sizeof(rnd));
1443#ifdef WITH_OPENSSL
1385 RAND_seed(rnd, sizeof(rnd)); 1444 RAND_seed(rnd, sizeof(rnd));
1445#endif
1386 explicit_bzero(rnd, sizeof(rnd)); 1446 explicit_bzero(rnd, sizeof(rnd));
1387 } 1447 }
1388 1448
@@ -1401,11 +1461,11 @@ main(int ac, char **av)
1401{ 1461{
1402 extern char *optarg; 1462 extern char *optarg;
1403 extern int optind; 1463 extern int optind;
1404 int opt, i, j, on = 1; 1464 int r, opt, i, j, on = 1;
1405 int sock_in = -1, sock_out = -1, newsock = -1; 1465 int sock_in = -1, sock_out = -1, newsock = -1;
1406 const char *remote_ip; 1466 const char *remote_ip;
1407 int remote_port; 1467 int remote_port;
1408 char *line, *logfile = NULL; 1468 char *fp, *line, *logfile = NULL;
1409 int config_s[2] = { -1 , -1 }; 1469 int config_s[2] = { -1 , -1 };
1410 u_int n; 1470 u_int n;
1411 u_int64_t ibytes, obytes; 1471 u_int64_t ibytes, obytes;
@@ -1544,8 +1604,8 @@ main(int ac, char **av)
1544 exit(1); 1604 exit(1);
1545 break; 1605 break;
1546 case 'u': 1606 case 'u':
1547 utmp_len = (u_int)strtonum(optarg, 0, MAXHOSTNAMELEN+1, NULL); 1607 utmp_len = (u_int)strtonum(optarg, 0, HOST_NAME_MAX+1+1, NULL);
1548 if (utmp_len > MAXHOSTNAMELEN) { 1608 if (utmp_len > HOST_NAME_MAX+1) {
1549 fprintf(stderr, "Invalid utmp length.\n"); 1609 fprintf(stderr, "Invalid utmp length.\n");
1550 exit(1); 1610 exit(1);
1551 } 1611 }
@@ -1705,21 +1765,25 @@ main(int ac, char **av)
1705 sizeof(Key *)); 1765 sizeof(Key *));
1706 sensitive_data.host_pubkeys = xcalloc(options.num_host_key_files, 1766 sensitive_data.host_pubkeys = xcalloc(options.num_host_key_files,
1707 sizeof(Key *)); 1767 sizeof(Key *));
1708 for (i = 0; i < options.num_host_key_files; i++) {
1709 sensitive_data.host_keys[i] = NULL;
1710 sensitive_data.host_pubkeys[i] = NULL;
1711 }
1712 1768
1713 if (options.host_key_agent) { 1769 if (options.host_key_agent) {
1714 if (strcmp(options.host_key_agent, SSH_AUTHSOCKET_ENV_NAME)) 1770 if (strcmp(options.host_key_agent, SSH_AUTHSOCKET_ENV_NAME))
1715 setenv(SSH_AUTHSOCKET_ENV_NAME, 1771 setenv(SSH_AUTHSOCKET_ENV_NAME,
1716 options.host_key_agent, 1); 1772 options.host_key_agent, 1);
1717 have_agent = ssh_agent_present(); 1773 if ((r = ssh_get_authentication_socket(NULL)) == 0)
1774 have_agent = 1;
1775 else
1776 error("Could not connect to agent \"%s\": %s",
1777 options.host_key_agent, ssh_err(r));
1718 } 1778 }
1719 1779
1720 for (i = 0; i < options.num_host_key_files; i++) { 1780 for (i = 0; i < options.num_host_key_files; i++) {
1781 if (options.host_key_files[i] == NULL)
1782 continue;
1721 key = key_load_private(options.host_key_files[i], "", NULL); 1783 key = key_load_private(options.host_key_files[i], "", NULL);
1722 pubkey = key_load_public(options.host_key_files[i], NULL); 1784 pubkey = key_load_public(options.host_key_files[i], NULL);
1785 if (pubkey == NULL && key != NULL)
1786 pubkey = key_demote(key);
1723 sensitive_data.host_keys[i] = key; 1787 sensitive_data.host_keys[i] = key;
1724 sensitive_data.host_pubkeys[i] = pubkey; 1788 sensitive_data.host_pubkeys[i] = pubkey;
1725 1789
@@ -1747,11 +1811,17 @@ main(int ac, char **av)
1747 case KEY_DSA: 1811 case KEY_DSA:
1748 case KEY_ECDSA: 1812 case KEY_ECDSA:
1749 case KEY_ED25519: 1813 case KEY_ED25519:
1750 sensitive_data.have_ssh2_key = 1; 1814 if (have_agent || key != NULL)
1815 sensitive_data.have_ssh2_key = 1;
1751 break; 1816 break;
1752 } 1817 }
1753 debug("private host key: #%d type %d %s", i, keytype, 1818 if ((fp = sshkey_fingerprint(pubkey, options.fingerprint_hash,
1754 key_type(key ? key : pubkey)); 1819 SSH_FP_DEFAULT)) == NULL)
1820 fatal("sshkey_fingerprint failed");
1821 debug("%s host key #%d: %s %s",
1822 key ? "private" : "agent", i, keytype == KEY_RSA1 ?
1823 sshkey_type(pubkey) : sshkey_ssh_name(pubkey), fp);
1824 free(fp);
1755 } 1825 }
1756 if ((options.protocol & SSH_PROTO_1) && !sensitive_data.have_ssh1_key) { 1826 if ((options.protocol & SSH_PROTO_1) && !sensitive_data.have_ssh1_key) {
1757 logit("Disabling protocol version 1. Could not load host key"); 1827 logit("Disabling protocol version 1. Could not load host key");
@@ -1779,6 +1849,8 @@ main(int ac, char **av)
1779 sensitive_data.host_certificates[i] = NULL; 1849 sensitive_data.host_certificates[i] = NULL;
1780 1850
1781 for (i = 0; i < options.num_host_cert_files; i++) { 1851 for (i = 0; i < options.num_host_cert_files; i++) {
1852 if (options.host_cert_files[i] == NULL)
1853 continue;
1782 key = key_load_public(options.host_cert_files[i], NULL); 1854 key = key_load_public(options.host_cert_files[i], NULL);
1783 if (key == NULL) { 1855 if (key == NULL) {
1784 error("Could not load host certificate: %s", 1856 error("Could not load host certificate: %s",
@@ -1946,7 +2018,7 @@ main(int ac, char **av)
1946 * Write out the pid file after the sigterm handler 2018 * Write out the pid file after the sigterm handler
1947 * is setup and the listen sockets are bound 2019 * is setup and the listen sockets are bound
1948 */ 2020 */
1949 if (!debug_flag) { 2021 if (options.pid_file != NULL && !debug_flag) {
1950 FILE *f = fopen(options.pid_file, "w"); 2022 FILE *f = fopen(options.pid_file, "w");
1951 2023
1952 if (f == NULL) { 2024 if (f == NULL) {
@@ -2192,8 +2264,12 @@ main(int ac, char **av)
2192 if (use_privsep) { 2264 if (use_privsep) {
2193 if (privsep_preauth(authctxt) == 1) 2265 if (privsep_preauth(authctxt) == 1)
2194 goto authenticated; 2266 goto authenticated;
2195 } else if (compat20 && have_agent) 2267 } else if (compat20 && have_agent) {
2196 auth_conn = ssh_get_authentication_connection(); 2268 if ((r = ssh_get_authentication_socket(&auth_sock)) != 0) {
2269 error("Unable to get agent socket: %s", ssh_err(r));
2270 have_agent = 0;
2271 }
2272 }
2197 2273
2198 /* perform the key exchange */ 2274 /* perform the key exchange */
2199 /* authenticate user and start session */ 2275 /* authenticate user and start session */
@@ -2262,12 +2338,15 @@ main(int ac, char **av)
2262 packet_set_timeout(options.client_alive_interval, 2338 packet_set_timeout(options.client_alive_interval,
2263 options.client_alive_count_max); 2339 options.client_alive_count_max);
2264 2340
2341 /* Try to send all our hostkeys to the client */
2342 if (compat20)
2343 notify_hostkeys(active_state);
2344
2265 /* Start session. */ 2345 /* Start session. */
2266 do_authenticated(authctxt); 2346 do_authenticated(authctxt);
2267 2347
2268 /* The connection has been terminated. */ 2348 /* The connection has been terminated. */
2269 packet_get_state(MODE_IN, NULL, NULL, NULL, &ibytes); 2349 packet_get_bytes(&ibytes, &obytes);
2270 packet_get_state(MODE_OUT, NULL, NULL, NULL, &obytes);
2271 verbose("Transferred: sent %llu, received %llu bytes", 2350 verbose("Transferred: sent %llu, received %llu bytes",
2272 (unsigned long long)obytes, (unsigned long long)ibytes); 2351 (unsigned long long)obytes, (unsigned long long)ibytes);
2273 2352
@@ -2349,8 +2428,10 @@ do_ssh1_kex(void)
2349{ 2428{
2350 int i, len; 2429 int i, len;
2351 int rsafail = 0; 2430 int rsafail = 0;
2352 BIGNUM *session_key_int; 2431 BIGNUM *session_key_int, *fake_key_int, *real_key_int;
2353 u_char session_key[SSH_SESSION_KEY_LENGTH]; 2432 u_char session_key[SSH_SESSION_KEY_LENGTH];
2433 u_char fake_key_bytes[4096 / 8];
2434 size_t fake_key_len;
2354 u_char cookie[8]; 2435 u_char cookie[8];
2355 u_int cipher_type, auth_mask, protocol_flags; 2436 u_int cipher_type, auth_mask, protocol_flags;
2356 2437
@@ -2428,74 +2509,61 @@ do_ssh1_kex(void)
2428 debug("Encryption type: %.200s", cipher_name(cipher_type)); 2509 debug("Encryption type: %.200s", cipher_name(cipher_type));
2429 2510
2430 /* Get the encrypted integer. */ 2511 /* Get the encrypted integer. */
2431 if ((session_key_int = BN_new()) == NULL) 2512 if ((real_key_int = BN_new()) == NULL)
2432 fatal("do_ssh1_kex: BN_new failed"); 2513 fatal("do_ssh1_kex: BN_new failed");
2433 packet_get_bignum(session_key_int); 2514 packet_get_bignum(real_key_int);
2434 2515
2435 protocol_flags = packet_get_int(); 2516 protocol_flags = packet_get_int();
2436 packet_set_protocol_flags(protocol_flags); 2517 packet_set_protocol_flags(protocol_flags);
2437 packet_check_eom(); 2518 packet_check_eom();
2438 2519
2439 /* Decrypt session_key_int using host/server keys */ 2520 /* Setup a fake key in case RSA decryption fails */
2440 rsafail = PRIVSEP(ssh1_session_key(session_key_int)); 2521 if ((fake_key_int = BN_new()) == NULL)
2522 fatal("do_ssh1_kex: BN_new failed");
2523 fake_key_len = BN_num_bytes(real_key_int);
2524 if (fake_key_len > sizeof(fake_key_bytes))
2525 fake_key_len = sizeof(fake_key_bytes);
2526 arc4random_buf(fake_key_bytes, fake_key_len);
2527 if (BN_bin2bn(fake_key_bytes, fake_key_len, fake_key_int) == NULL)
2528 fatal("do_ssh1_kex: BN_bin2bn failed");
2529
2530 /* Decrypt real_key_int using host/server keys */
2531 rsafail = PRIVSEP(ssh1_session_key(real_key_int));
2532 /* If decryption failed, use the fake key. Else, the real key. */
2533 if (rsafail)
2534 session_key_int = fake_key_int;
2535 else
2536 session_key_int = real_key_int;
2441 2537
2442 /* 2538 /*
2443 * Extract session key from the decrypted integer. The key is in the 2539 * Extract session key from the decrypted integer. The key is in the
2444 * least significant 256 bits of the integer; the first byte of the 2540 * least significant 256 bits of the integer; the first byte of the
2445 * key is in the highest bits. 2541 * key is in the highest bits.
2446 */ 2542 */
2447 if (!rsafail) { 2543 (void) BN_mask_bits(session_key_int, sizeof(session_key) * 8);
2448 (void) BN_mask_bits(session_key_int, sizeof(session_key) * 8); 2544 len = BN_num_bytes(session_key_int);
2449 len = BN_num_bytes(session_key_int); 2545 if (len < 0 || (u_int)len > sizeof(session_key)) {
2450 if (len < 0 || (u_int)len > sizeof(session_key)) { 2546 error("do_ssh1_kex: bad session key len from %s: "
2451 error("do_ssh1_kex: bad session key len from %s: " 2547 "session_key_int %d > sizeof(session_key) %lu",
2452 "session_key_int %d > sizeof(session_key) %lu", 2548 get_remote_ipaddr(), len, (u_long)sizeof(session_key));
2453 get_remote_ipaddr(), len, (u_long)sizeof(session_key)); 2549 rsafail++;
2454 rsafail++; 2550 } else {
2455 } else { 2551 explicit_bzero(session_key, sizeof(session_key));
2456 explicit_bzero(session_key, sizeof(session_key)); 2552 BN_bn2bin(session_key_int,
2457 BN_bn2bin(session_key_int, 2553 session_key + sizeof(session_key) - len);
2458 session_key + sizeof(session_key) - len); 2554
2459 2555 derive_ssh1_session_id(
2460 derive_ssh1_session_id( 2556 sensitive_data.ssh1_host_key->rsa->n,
2461 sensitive_data.ssh1_host_key->rsa->n, 2557 sensitive_data.server_key->rsa->n,
2462 sensitive_data.server_key->rsa->n, 2558 cookie, session_id);
2463 cookie, session_id); 2559 /*
2464 /* 2560 * Xor the first 16 bytes of the session key with the
2465 * Xor the first 16 bytes of the session key with the 2561 * session id.
2466 * session id. 2562 */
2467 */
2468 for (i = 0; i < 16; i++)
2469 session_key[i] ^= session_id[i];
2470 }
2471 }
2472 if (rsafail) {
2473 int bytes = BN_num_bytes(session_key_int);
2474 u_char *buf = xmalloc(bytes);
2475 struct ssh_digest_ctx *md;
2476
2477 logit("do_connection: generating a fake encryption key");
2478 BN_bn2bin(session_key_int, buf);
2479 if ((md = ssh_digest_start(SSH_DIGEST_MD5)) == NULL ||
2480 ssh_digest_update(md, buf, bytes) < 0 ||
2481 ssh_digest_update(md, sensitive_data.ssh1_cookie,
2482 SSH_SESSION_KEY_LENGTH) < 0 ||
2483 ssh_digest_final(md, session_key, sizeof(session_key)) < 0)
2484 fatal("%s: md5 failed", __func__);
2485 ssh_digest_free(md);
2486 if ((md = ssh_digest_start(SSH_DIGEST_MD5)) == NULL ||
2487 ssh_digest_update(md, session_key, 16) < 0 ||
2488 ssh_digest_update(md, sensitive_data.ssh1_cookie,
2489 SSH_SESSION_KEY_LENGTH) < 0 ||
2490 ssh_digest_final(md, session_key + 16,
2491 sizeof(session_key) - 16) < 0)
2492 fatal("%s: md5 failed", __func__);
2493 ssh_digest_free(md);
2494 explicit_bzero(buf, bytes);
2495 free(buf);
2496 for (i = 0; i < 16; i++) 2563 for (i = 0; i < 16; i++)
2497 session_id[i] = session_key[i] ^ session_key[i + 16]; 2564 session_key[i] ^= session_id[i];
2498 } 2565 }
2566
2499 /* Destroy the private and public keys. No longer. */ 2567 /* Destroy the private and public keys. No longer. */
2500 destroy_sensitive_data(); 2568 destroy_sensitive_data();
2501 2569
@@ -2503,7 +2571,8 @@ do_ssh1_kex(void)
2503 mm_ssh1_session_id(session_id); 2571 mm_ssh1_session_id(session_id);
2504 2572
2505 /* Destroy the decrypted integer. It is no longer needed. */ 2573 /* Destroy the decrypted integer. It is no longer needed. */
2506 BN_clear_free(session_key_int); 2574 BN_clear_free(real_key_int);
2575 BN_clear_free(fake_key_int);
2507 2576
2508 /* Set the session key. From this on all communications will be encrypted. */ 2577 /* Set the session key. From this on all communications will be encrypted. */
2509 packet_set_encryption_key(session_key, SSH_SESSION_KEY_LENGTH, cipher_type); 2578 packet_set_encryption_key(session_key, SSH_SESSION_KEY_LENGTH, cipher_type);
@@ -2520,21 +2589,30 @@ do_ssh1_kex(void)
2520} 2589}
2521#endif 2590#endif
2522 2591
2523void 2592int
2524sshd_hostkey_sign(Key *privkey, Key *pubkey, u_char **signature, u_int *slen, 2593sshd_hostkey_sign(Key *privkey, Key *pubkey, u_char **signature, size_t *slen,
2525 u_char *data, u_int dlen) 2594 const u_char *data, size_t dlen, u_int flag)
2526{ 2595{
2596 int r;
2597 u_int xxx_slen, xxx_dlen = dlen;
2598
2527 if (privkey) { 2599 if (privkey) {
2528 if (PRIVSEP(key_sign(privkey, signature, slen, data, dlen) < 0)) 2600 if (PRIVSEP(key_sign(privkey, signature, &xxx_slen, data, xxx_dlen) < 0))
2529 fatal("%s: key_sign failed", __func__); 2601 fatal("%s: key_sign failed", __func__);
2602 if (slen)
2603 *slen = xxx_slen;
2530 } else if (use_privsep) { 2604 } else if (use_privsep) {
2531 if (mm_key_sign(pubkey, signature, slen, data, dlen) < 0) 2605 if (mm_key_sign(pubkey, signature, &xxx_slen, data, xxx_dlen) < 0)
2532 fatal("%s: pubkey_sign failed", __func__); 2606 fatal("%s: pubkey_sign failed", __func__);
2607 if (slen)
2608 *slen = xxx_slen;
2533 } else { 2609 } else {
2534 if (ssh_agent_sign(auth_conn, pubkey, signature, slen, data, 2610 if ((r = ssh_agent_sign(auth_sock, pubkey, signature, slen,
2535 dlen)) 2611 data, dlen, datafellows)) != 0)
2536 fatal("%s: ssh_agent_sign failed", __func__); 2612 fatal("%s: ssh_agent_sign failed: %s",
2613 __func__, ssh_err(r));
2537 } 2614 }
2615 return 0;
2538} 2616}
2539 2617
2540/* 2618/*
@@ -2544,7 +2622,8 @@ static void
2544do_ssh2_kex(void) 2622do_ssh2_kex(void)
2545{ 2623{
2546 char *myproposal[PROPOSAL_MAX] = { KEX_SERVER }; 2624 char *myproposal[PROPOSAL_MAX] = { KEX_SERVER };
2547 Kex *kex; 2625 struct kex *kex;
2626 int r;
2548 2627
2549 if (options.ciphers != NULL) { 2628 if (options.ciphers != NULL) {
2550 myproposal[PROPOSAL_ENC_ALGS_CTOS] = 2629 myproposal[PROPOSAL_ENC_ALGS_CTOS] =
@@ -2622,13 +2701,17 @@ do_ssh2_kex(void)
2622#endif 2701#endif
2623 2702
2624 /* start key exchange */ 2703 /* start key exchange */
2625 kex = kex_setup(myproposal); 2704 if ((r = kex_setup(active_state, myproposal)) != 0)
2705 fatal("kex_setup: %s", ssh_err(r));
2706 kex = active_state->kex;
2626#ifdef WITH_OPENSSL 2707#ifdef WITH_OPENSSL
2627 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server; 2708 kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server;
2628 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server; 2709 kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server;
2629 kex->kex[KEX_DH_GEX_SHA1] = kexgex_server; 2710 kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
2630 kex->kex[KEX_DH_GEX_SHA256] = kexgex_server; 2711 kex->kex[KEX_DH_GEX_SHA256] = kexgex_server;
2712# ifdef OPENSSL_HAS_ECC
2631 kex->kex[KEX_ECDH_SHA2] = kexecdh_server; 2713 kex->kex[KEX_ECDH_SHA2] = kexecdh_server;
2714# endif
2632#endif 2715#endif
2633 kex->kex[KEX_C25519_SHA256] = kexc25519_server; 2716 kex->kex[KEX_C25519_SHA256] = kexc25519_server;
2634#ifdef GSSAPI 2717#ifdef GSSAPI
@@ -2646,9 +2729,7 @@ do_ssh2_kex(void)
2646 kex->host_key_index=&get_hostkey_index; 2729 kex->host_key_index=&get_hostkey_index;
2647 kex->sign = sshd_hostkey_sign; 2730 kex->sign = sshd_hostkey_sign;
2648 2731
2649 xxx_kex = kex; 2732 dispatch_run(DISPATCH_BLOCK, &kex->done, active_state);
2650
2651 dispatch_run(DISPATCH_BLOCK, &kex->done, kex);
2652 2733
2653 session_id2 = kex->session_id; 2734 session_id2 = kex->session_id;
2654 session_id2_len = kex->session_id_len; 2735 session_id2_len = kex->session_id_len;
diff --git a/sshd_config b/sshd_config
index 4db32f509..339123329 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.
@@ -115,7 +115,7 @@ UsePrivilegeSeparation sandbox # Default for new installations.
115#Compression delayed 115#Compression delayed
116#ClientAliveInterval 0 116#ClientAliveInterval 0
117#ClientAliveCountMax 3 117#ClientAliveCountMax 3
118#UseDNS yes 118#UseDNS no
119#PidFile /var/run/sshd.pid 119#PidFile /var/run/sshd.pid
120#MaxStartups 10:30:100 120#MaxStartups 10:30:100
121#PermitTunnel no 121#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 7aa7b4733..db1f2fd69 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
@@ -235,6 +235,18 @@ would restrict keyboard interactive authentication to the
235.Dq bsdauth 235.Dq bsdauth
236device. 236device.
237.Pp 237.Pp
238If the
239.Dq publickey
240method is listed more than once,
241.Xr sshd 8
242verifies that keys that have been used successfully are not reused for
243subsequent authentications.
244For example, an
245.Cm AuthenticationMethods
246of
247.Dq publickey,publickey
248will require successful authentication using two different public keys.
249.Pp
238This option is only available for SSH protocol 2 and will yield a fatal 250This option is only available for SSH protocol 2 and will yield a fatal
239error if enabled if protocol 1 is also enabled. 251error if enabled if protocol 1 is also enabled.
240Note that each authentication method listed should also be explicitly enabled 252Note that each authentication method listed should also be explicitly enabled
@@ -257,6 +269,13 @@ By default, no AuthorizedKeysCommand is run.
257Specifies the user under whose account the AuthorizedKeysCommand is run. 269Specifies the user under whose account the AuthorizedKeysCommand is run.
258It is recommended to use a dedicated user that has no other role on the host 270It is recommended to use a dedicated user that has no other role on the host
259than running authorized keys commands. 271than running authorized keys commands.
272If
273.Cm AuthorizedKeysCommand
274is specified but
275.Cm AuthorizedKeysCommandUser
276is not, then
277.Xr sshd 8
278will refuse to start.
260.It Cm AuthorizedKeysFile 279.It Cm AuthorizedKeysFile
261Specifies the file that contains the public keys that can be used 280Specifies the file that contains the public keys that can be used
262for user authentication. 281for user authentication.
@@ -335,8 +354,10 @@ The default is
335Specifies the pathname of a directory to 354Specifies the pathname of a directory to
336.Xr chroot 2 355.Xr chroot 2
337to after authentication. 356to after authentication.
338All components of the pathname must be root-owned directories that are 357At session startup
339not writable by any other user or group. 358.Xr sshd 8
359checks that all components of the pathname are root-owned directories
360which are not writable by any other user or group.
340After the chroot, 361After the chroot,
341.Xr sshd 8 362.Xr sshd 8
342changes the working directory to the user's home directory. 363changes the working directory to the user's home directory.
@@ -360,7 +381,6 @@ nodes such as
360.Xr stdin 4 , 381.Xr stdin 4 ,
361.Xr stdout 4 , 382.Xr stdout 4 ,
362.Xr stderr 4 , 383.Xr stderr 4 ,
363.Xr arandom 4
364and 384and
365.Xr tty 4 385.Xr tty 4
366devices. 386devices.
@@ -374,6 +394,13 @@ inside the chroot directory on some operating systems (see
374.Xr sftp-server 8 394.Xr sftp-server 8
375for details). 395for details).
376.Pp 396.Pp
397For safety, it is very important that the directory hierarchy be
398prevented from modification by other processes on the system (especially
399those outside the jail).
400Misconfiguration can lead to unsafe environments which
401.Xr sshd 8
402cannot detect.
403.Pp
377The default is not to 404The default is not to
378.Xr chroot 2 . 405.Xr chroot 2 .
379.It Cm Ciphers 406.It Cm Ciphers
@@ -424,7 +451,9 @@ chacha20-poly1305@openssh.com
424The list of available ciphers may also be obtained using the 451The list of available ciphers may also be obtained using the
425.Fl Q 452.Fl Q
426option of 453option of
427.Xr ssh 1 . 454.Xr ssh 1
455with an argument of
456.Dq cipher .
428.It Cm ClientAliveCountMax 457.It Cm ClientAliveCountMax
429Sets the number of client alive messages (see below) which may be 458Sets the number of client alive messages (see below) which may be
430sent without 459sent without
@@ -512,6 +541,14 @@ and finally
512See PATTERNS in 541See PATTERNS in
513.Xr ssh_config 5 542.Xr ssh_config 5
514for more information on patterns. 543for more information on patterns.
544.It Cm FingerprintHash
545Specifies the hash algorithm used when logging key fingerprints.
546Valid options are:
547.Dq md5
548and
549.Dq sha256 .
550The default is
551.Dq sha256 .
515.It Cm ForceCommand 552.It Cm ForceCommand
516Forces the execution of the command specified by 553Forces the execution of the command specified by
517.Cm ForceCommand , 554.Cm ForceCommand ,
@@ -590,6 +627,17 @@ Controls whether the user's GSSAPI credentials should be updated following a
590successful connection rekeying. This option can be used to accepted renewed 627successful connection rekeying. This option can be used to accepted renewed
591or updated credentials from a compatible client. The default is 628or updated credentials from a compatible client. The default is
592.Dq no . 629.Dq no .
630.It Cm HostbasedAcceptedKeyTypes
631Specifies the key types that will be accepted for hostbased authentication
632as a comma-separated pattern list.
633The default
634.Dq *
635will allow all key types.
636The
637.Fl Q
638option of
639.Xr ssh 1
640may be used to list supported key types.
593.It Cm HostbasedAuthentication 641.It Cm HostbasedAuthentication
594Specifies whether rhosts or /etc/hosts.equiv authentication together 642Specifies whether rhosts or /etc/hosts.equiv authentication together
595with successful public key client host authentication is allowed 643with successful public key client host authentication is allowed
@@ -791,6 +839,13 @@ ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,
791diffie-hellman-group-exchange-sha256, 839diffie-hellman-group-exchange-sha256,
792diffie-hellman-group14-sha1 840diffie-hellman-group14-sha1
793.Ed 841.Ed
842.Pp
843The list of available key exchange algorithms may also be obtained using the
844.Fl Q
845option of
846.Xr ssh 1
847with an argument of
848.Dq kex .
794.It Cm KeyRegenerationInterval 849.It Cm KeyRegenerationInterval
795In protocol version 1, the ephemeral server key is automatically regenerated 850In protocol version 1, the ephemeral server key is automatically regenerated
796after this many seconds (if it has been used). 851after this many seconds (if it has been used).
@@ -810,18 +865,18 @@ The following forms may be used:
810.It 865.It
811.Cm ListenAddress 866.Cm ListenAddress
812.Sm off 867.Sm off
813.Ar host No | Ar IPv4_addr No | Ar IPv6_addr 868.Ar host | Ar IPv4_addr | Ar IPv6_addr
814.Sm on 869.Sm on
815.It 870.It
816.Cm ListenAddress 871.Cm ListenAddress
817.Sm off 872.Sm off
818.Ar host No | Ar IPv4_addr No : Ar port 873.Ar host | Ar IPv4_addr : Ar port
819.Sm on 874.Sm on
820.It 875.It
821.Cm ListenAddress 876.Cm ListenAddress
822.Sm off 877.Sm off
823.Oo 878.Oo
824.Ar host No | Ar IPv6_addr Oc : Ar port 879.Ar host | Ar IPv6_addr Oc : Ar port
825.Sm on 880.Sm on
826.El 881.El
827.Pp 882.Pp
@@ -909,6 +964,13 @@ hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
909umac-64@openssh.com,umac-128@openssh.com, 964umac-64@openssh.com,umac-128@openssh.com,
910hmac-sha2-256,hmac-sha2-512 965hmac-sha2-256,hmac-sha2-512
911.Ed 966.Ed
967.Pp
968The list of available MAC algorithms may also be obtained using the
969.Fl Q
970option of
971.Xr ssh 1
972with an argument of
973.Dq mac .
912.It Cm Match 974.It Cm Match
913Introduces a conditional block. 975Introduces a conditional block.
914If all of the criteria on the 976If all of the criteria on the
@@ -919,7 +981,7 @@ set in the global section of the config file, until either another
919line or the end of the file. 981line or the end of the file.
920If a keyword appears in multiple 982If a keyword appears in multiple
921.Cm Match 983.Cm Match
922blocks that are satisified, only the first instance of the keyword is 984blocks that are satisfied, only the first instance of the keyword is
923applied. 985applied.
924.Pp 986.Pp
925The arguments to 987The arguments to
@@ -963,6 +1025,7 @@ Available keywords are
963.Cm AcceptEnv , 1025.Cm AcceptEnv ,
964.Cm AllowAgentForwarding , 1026.Cm AllowAgentForwarding ,
965.Cm AllowGroups , 1027.Cm AllowGroups ,
1028.Cm AllowStreamLocalForwarding ,
966.Cm AllowTcpForwarding , 1029.Cm AllowTcpForwarding ,
967.Cm AllowUsers , 1030.Cm AllowUsers ,
968.Cm AuthenticationMethods , 1031.Cm AuthenticationMethods ,
@@ -977,8 +1040,10 @@ Available keywords are
977.Cm ForceCommand , 1040.Cm ForceCommand ,
978.Cm GatewayPorts , 1041.Cm GatewayPorts ,
979.Cm GSSAPIAuthentication , 1042.Cm GSSAPIAuthentication ,
1043.Cm HostbasedAcceptedKeyTypes ,
980.Cm HostbasedAuthentication , 1044.Cm HostbasedAuthentication ,
981.Cm HostbasedUsesNameFromPacketOnly , 1045.Cm HostbasedUsesNameFromPacketOnly ,
1046.Cm IPQoS ,
982.Cm KbdInteractiveAuthentication , 1047.Cm KbdInteractiveAuthentication ,
983.Cm KerberosAuthentication , 1048.Cm KerberosAuthentication ,
984.Cm MaxAuthTries , 1049.Cm MaxAuthTries ,
@@ -990,10 +1055,15 @@ Available keywords are
990.Cm PermitTTY , 1055.Cm PermitTTY ,
991.Cm PermitTunnel , 1056.Cm PermitTunnel ,
992.Cm PermitUserRC , 1057.Cm PermitUserRC ,
1058.Cm PubkeyAcceptedKeyTypes ,
993.Cm PubkeyAuthentication , 1059.Cm PubkeyAuthentication ,
994.Cm RekeyLimit , 1060.Cm RekeyLimit ,
1061.Cm RevokedKeys ,
995.Cm RhostsRSAAuthentication , 1062.Cm RhostsRSAAuthentication ,
996.Cm RSAAuthentication , 1063.Cm RSAAuthentication ,
1064.Cm StreamLocalBindMask ,
1065.Cm StreamLocalBindUnlink ,
1066.Cm TrustedUserCAKeys ,
997.Cm X11DisplayOffset , 1067.Cm X11DisplayOffset ,
998.Cm X11Forwarding 1068.Cm X11Forwarding
999and 1069and
@@ -1118,6 +1188,10 @@ and
1118.Dq ethernet . 1188.Dq ethernet .
1119The default is 1189The default is
1120.Dq no . 1190.Dq no .
1191.Pp
1192Independent of this setting, the permissions of the selected
1193.Xr tun 4
1194device must allow access to the user.
1121.It Cm PermitTTY 1195.It Cm PermitTTY
1122Specifies whether 1196Specifies whether
1123.Xr pty 4 1197.Xr pty 4
@@ -1193,6 +1267,17 @@ Specifying
1193.Dq 2,1 1267.Dq 2,1
1194is identical to 1268is identical to
1195.Dq 1,2 . 1269.Dq 1,2 .
1270.It Cm PubkeyAcceptedKeyTypes
1271Specifies the key types that will be accepted for public key authentication
1272as a comma-separated pattern list.
1273The default
1274.Dq *
1275will allow all key types.
1276The
1277.Fl Q
1278option of
1279.Xr ssh 1
1280may be used to list supported key types.
1196.It Cm PubkeyAuthentication 1281.It Cm PubkeyAuthentication
1197Specifies whether public key authentication is allowed. 1282Specifies whether public key authentication is allowed.
1198The default is 1283The default is
@@ -1360,7 +1445,7 @@ should look up the remote host name and check that
1360the resolved host name for the remote IP address maps back to the 1445the resolved host name for the remote IP address maps back to the
1361very same IP address. 1446very same IP address.
1362The default is 1447The default is
1363.Dq yes . 1448.Dq no .
1364.It Cm UseLogin 1449.It Cm UseLogin
1365Specifies whether 1450Specifies whether
1366.Xr login 1 1451.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 1a96eae19..cd5992ecb 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 */
@@ -182,12 +188,12 @@ sshkey_ecdsa_nid_from_name(const char *name)
182{ 188{
183 const struct keytype *kt; 189 const struct keytype *kt;
184 190
185 for (kt = keytypes; kt->type != -1; kt++) { 191 for (kt = keytypes; kt->type != -1; kt++) {
186 if (kt->type != KEY_ECDSA && kt->type != KEY_ECDSA_CERT) 192 if (kt->type != KEY_ECDSA && kt->type != KEY_ECDSA_CERT)
187 continue; 193 continue;
188 if (kt->name != NULL && strcmp(name, kt->name) == 0) 194 if (kt->name != NULL && strcmp(name, kt->name) == 0)
189 return kt->nid; 195 return kt->nid;
190 } 196 }
191 return -1; 197 return -1;
192} 198}
193 199
@@ -218,9 +224,11 @@ key_alg_list(int certs_only, int plain_only)
218} 224}
219 225
220int 226int
221sshkey_names_valid2(const char *names) 227sshkey_names_valid2(const char *names, int allow_wildcard)
222{ 228{
223 char *s, *cp, *p; 229 char *s, *cp, *p;
230 const struct keytype *kt;
231 int type;
224 232
225 if (names == NULL || strcmp(names, "") == 0) 233 if (names == NULL || strcmp(names, "") == 0)
226 return 0; 234 return 0;
@@ -228,9 +236,28 @@ sshkey_names_valid2(const char *names)
228 return 0; 236 return 0;
229 for ((p = strsep(&cp, ",")); p && *p != '\0'; 237 for ((p = strsep(&cp, ",")); p && *p != '\0';
230 (p = strsep(&cp, ","))) { 238 (p = strsep(&cp, ","))) {
231 switch (sshkey_type_from_name(p)) { 239 type = sshkey_type_from_name(p);
232 case KEY_RSA1: 240 if (type == KEY_RSA1) {
233 case KEY_UNSPEC: 241 free(s);
242 return 0;
243 }
244 if (type == KEY_UNSPEC) {
245 if (allow_wildcard) {
246 /*
247 * Try matching key types against the string.
248 * If any has a positive or negative match then
249 * the component is accepted.
250 */
251 for (kt = keytypes; kt->type != -1; kt++) {
252 if (kt->type == KEY_RSA1)
253 continue;
254 if (match_pattern_list(kt->name,
255 p, strlen(p), 0) != 0)
256 break;
257 }
258 if (kt->type != -1)
259 continue;
260 }
234 free(s); 261 free(s);
235 return 0; 262 return 0;
236 } 263 }
@@ -798,13 +825,28 @@ to_blob_buf(const struct sshkey *key, struct sshbuf *b, int force_plain)
798} 825}
799 826
800int 827int
801sshkey_to_blob_buf(const struct sshkey *key, struct sshbuf *b) 828sshkey_putb(const struct sshkey *key, struct sshbuf *b)
802{ 829{
803 return to_blob_buf(key, b, 0); 830 return to_blob_buf(key, b, 0);
804} 831}
805 832
806int 833int
807sshkey_plain_to_blob_buf(const struct sshkey *key, struct sshbuf *b) 834sshkey_puts(const struct sshkey *key, struct sshbuf *b)
835{
836 struct sshbuf *tmp;
837 int r;
838
839 if ((tmp = sshbuf_new()) == NULL)
840 return SSH_ERR_ALLOC_FAIL;
841 r = to_blob_buf(key, tmp, 0);
842 if (r == 0)
843 r = sshbuf_put_stringb(b, tmp);
844 sshbuf_free(tmp);
845 return r;
846}
847
848int
849sshkey_putb_plain(const struct sshkey *key, struct sshbuf *b)
808{ 850{
809 return to_blob_buf(key, b, 1); 851 return to_blob_buf(key, b, 1);
810} 852}
@@ -853,29 +895,18 @@ sshkey_plain_to_blob(const struct sshkey *key, u_char **blobp, size_t *lenp)
853} 895}
854 896
855int 897int
856sshkey_fingerprint_raw(const struct sshkey *k, enum sshkey_fp_type dgst_type, 898sshkey_fingerprint_raw(const struct sshkey *k, int dgst_alg,
857 u_char **retp, size_t *lenp) 899 u_char **retp, size_t *lenp)
858{ 900{
859 u_char *blob = NULL, *ret = NULL; 901 u_char *blob = NULL, *ret = NULL;
860 size_t blob_len = 0; 902 size_t blob_len = 0;
861 int hash_alg = -1, r = SSH_ERR_INTERNAL_ERROR; 903 int r = SSH_ERR_INTERNAL_ERROR;
862 904
863 if (retp != NULL) 905 if (retp != NULL)
864 *retp = NULL; 906 *retp = NULL;
865 if (lenp != NULL) 907 if (lenp != NULL)
866 *lenp = 0; 908 *lenp = 0;
867 909 if (ssh_digest_bytes(dgst_alg) == 0) {
868 switch (dgst_type) {
869 case SSH_FP_MD5:
870 hash_alg = SSH_DIGEST_MD5;
871 break;
872 case SSH_FP_SHA1:
873 hash_alg = SSH_DIGEST_SHA1;
874 break;
875 case SSH_FP_SHA256:
876 hash_alg = SSH_DIGEST_SHA256;
877 break;
878 default:
879 r = SSH_ERR_INVALID_ARGUMENT; 910 r = SSH_ERR_INVALID_ARGUMENT;
880 goto out; 911 goto out;
881 } 912 }
@@ -900,7 +931,7 @@ sshkey_fingerprint_raw(const struct sshkey *k, enum sshkey_fp_type dgst_type,
900 r = SSH_ERR_ALLOC_FAIL; 931 r = SSH_ERR_ALLOC_FAIL;
901 goto out; 932 goto out;
902 } 933 }
903 if ((r = ssh_digest_memory(hash_alg, blob, blob_len, 934 if ((r = ssh_digest_memory(dgst_alg, blob, blob_len,
904 ret, SSH_DIGEST_MAX_LENGTH)) != 0) 935 ret, SSH_DIGEST_MAX_LENGTH)) != 0)
905 goto out; 936 goto out;
906 /* success */ 937 /* success */
@@ -909,7 +940,7 @@ sshkey_fingerprint_raw(const struct sshkey *k, enum sshkey_fp_type dgst_type,
909 ret = NULL; 940 ret = NULL;
910 } 941 }
911 if (lenp != NULL) 942 if (lenp != NULL)
912 *lenp = ssh_digest_bytes(hash_alg); 943 *lenp = ssh_digest_bytes(dgst_alg);
913 r = 0; 944 r = 0;
914 out: 945 out:
915 free(ret); 946 free(ret);
@@ -921,21 +952,45 @@ sshkey_fingerprint_raw(const struct sshkey *k, enum sshkey_fp_type dgst_type,
921} 952}
922 953
923static char * 954static char *
924fingerprint_hex(u_char *dgst_raw, size_t dgst_raw_len) 955fingerprint_b64(const char *alg, u_char *dgst_raw, size_t dgst_raw_len)
925{ 956{
926 char *retval; 957 char *ret;
927 size_t i; 958 size_t plen = strlen(alg) + 1;
959 size_t rlen = ((dgst_raw_len + 2) / 3) * 4 + plen + 1;
960 int r;
928 961
929 if ((retval = calloc(1, dgst_raw_len * 3 + 1)) == NULL) 962 if (dgst_raw_len > 65536 || (ret = calloc(1, rlen)) == NULL)
963 return NULL;
964 strlcpy(ret, alg, rlen);
965 strlcat(ret, ":", rlen);
966 if (dgst_raw_len == 0)
967 return ret;
968 if ((r = b64_ntop(dgst_raw, dgst_raw_len,
969 ret + plen, rlen - plen)) == -1) {
970 explicit_bzero(ret, rlen);
971 free(ret);
930 return NULL; 972 return NULL;
931 for (i = 0; i < dgst_raw_len; i++) {
932 char hex[4];
933 snprintf(hex, sizeof(hex), "%02x:", dgst_raw[i]);
934 strlcat(retval, hex, dgst_raw_len * 3 + 1);
935 } 973 }
974 /* Trim padding characters from end */
975 ret[strcspn(ret, "=")] = '\0';
976 return ret;
977}
978
979static char *
980fingerprint_hex(const char *alg, u_char *dgst_raw, size_t dgst_raw_len)
981{
982 char *retval, hex[5];
983 size_t i, rlen = dgst_raw_len * 3 + strlen(alg) + 2;
936 984
937 /* Remove the trailing ':' character */ 985 if (dgst_raw_len > 65536 || (retval = calloc(1, rlen)) == NULL)
938 retval[(dgst_raw_len * 3) - 1] = '\0'; 986 return NULL;
987 strlcpy(retval, alg, rlen);
988 strlcat(retval, ":", rlen);
989 for (i = 0; i < dgst_raw_len; i++) {
990 snprintf(hex, sizeof(hex), "%s%02x",
991 i > 0 ? ":" : "", dgst_raw[i]);
992 strlcat(retval, hex, rlen);
993 }
939 return retval; 994 return retval;
940} 995}
941 996
@@ -1021,7 +1076,7 @@ fingerprint_bubblebabble(u_char *dgst_raw, size_t dgst_raw_len)
1021#define FLDSIZE_Y (FLDBASE + 1) 1076#define FLDSIZE_Y (FLDBASE + 1)
1022#define FLDSIZE_X (FLDBASE * 2 + 1) 1077#define FLDSIZE_X (FLDBASE * 2 + 1)
1023static char * 1078static char *
1024fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len, 1079fingerprint_randomart(const char *alg, u_char *dgst_raw, size_t dgst_raw_len,
1025 const struct sshkey *k) 1080 const struct sshkey *k)
1026{ 1081{
1027 /* 1082 /*
@@ -1029,9 +1084,9 @@ fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len,
1029 * intersects with itself. Matter of taste. 1084 * intersects with itself. Matter of taste.
1030 */ 1085 */
1031 char *augmentation_string = " .o+=*BOX@%&#/^SE"; 1086 char *augmentation_string = " .o+=*BOX@%&#/^SE";
1032 char *retval, *p, title[FLDSIZE_X]; 1087 char *retval, *p, title[FLDSIZE_X], hash[FLDSIZE_X];
1033 u_char field[FLDSIZE_X][FLDSIZE_Y]; 1088 u_char field[FLDSIZE_X][FLDSIZE_Y];
1034 size_t i, tlen; 1089 size_t i, tlen, hlen;
1035 u_int b; 1090 u_int b;
1036 int x, y, r; 1091 int x, y, r;
1037 size_t len = strlen(augmentation_string) - 1; 1092 size_t len = strlen(augmentation_string) - 1;
@@ -1076,8 +1131,12 @@ fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len,
1076 sshkey_type(k), sshkey_size(k)); 1131 sshkey_type(k), sshkey_size(k));
1077 /* If [type size] won't fit, then try [type]; fits "[ED25519-CERT]" */ 1132 /* If [type size] won't fit, then try [type]; fits "[ED25519-CERT]" */
1078 if (r < 0 || r > (int)sizeof(title)) 1133 if (r < 0 || r > (int)sizeof(title))
1079 snprintf(title, sizeof(title), "[%s]", sshkey_type(k)); 1134 r = snprintf(title, sizeof(title), "[%s]", sshkey_type(k));
1080 tlen = strlen(title); 1135 tlen = (r <= 0) ? 0 : strlen(title);
1136
1137 /* assemble hash ID. */
1138 r = snprintf(hash, sizeof(hash), "[%s]", alg);
1139 hlen = (r <= 0) ? 0 : strlen(hash);
1081 1140
1082 /* output upper border */ 1141 /* output upper border */
1083 p = retval; 1142 p = retval;
@@ -1086,7 +1145,7 @@ fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len,
1086 *p++ = '-'; 1145 *p++ = '-';
1087 memcpy(p, title, tlen); 1146 memcpy(p, title, tlen);
1088 p += tlen; 1147 p += tlen;
1089 for (i = p - retval - 1; i < FLDSIZE_X; i++) 1148 for (i += tlen; i < FLDSIZE_X; i++)
1090 *p++ = '-'; 1149 *p++ = '-';
1091 *p++ = '+'; 1150 *p++ = '+';
1092 *p++ = '\n'; 1151 *p++ = '\n';
@@ -1102,7 +1161,11 @@ fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len,
1102 1161
1103 /* output lower border */ 1162 /* output lower border */
1104 *p++ = '+'; 1163 *p++ = '+';
1105 for (i = 0; i < FLDSIZE_X; i++) 1164 for (i = 0; i < (FLDSIZE_X - hlen) / 2; i++)
1165 *p++ = '-';
1166 memcpy(p, hash, hlen);
1167 p += hlen;
1168 for (i += hlen; i < FLDSIZE_X; i++)
1106 *p++ = '-'; 1169 *p++ = '-';
1107 *p++ = '+'; 1170 *p++ = '+';
1108 1171
@@ -1110,24 +1173,39 @@ fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len,
1110} 1173}
1111 1174
1112char * 1175char *
1113sshkey_fingerprint(const struct sshkey *k, enum sshkey_fp_type dgst_type, 1176sshkey_fingerprint(const struct sshkey *k, int dgst_alg,
1114 enum sshkey_fp_rep dgst_rep) 1177 enum sshkey_fp_rep dgst_rep)
1115{ 1178{
1116 char *retval = NULL; 1179 char *retval = NULL;
1117 u_char *dgst_raw; 1180 u_char *dgst_raw;
1118 size_t dgst_raw_len; 1181 size_t dgst_raw_len;
1119 1182
1120 if (sshkey_fingerprint_raw(k, dgst_type, &dgst_raw, &dgst_raw_len) != 0) 1183 if (sshkey_fingerprint_raw(k, dgst_alg, &dgst_raw, &dgst_raw_len) != 0)
1121 return NULL; 1184 return NULL;
1122 switch (dgst_rep) { 1185 switch (dgst_rep) {
1186 case SSH_FP_DEFAULT:
1187 if (dgst_alg == SSH_DIGEST_MD5) {
1188 retval = fingerprint_hex(ssh_digest_alg_name(dgst_alg),
1189 dgst_raw, dgst_raw_len);
1190 } else {
1191 retval = fingerprint_b64(ssh_digest_alg_name(dgst_alg),
1192 dgst_raw, dgst_raw_len);
1193 }
1194 break;
1123 case SSH_FP_HEX: 1195 case SSH_FP_HEX:
1124 retval = fingerprint_hex(dgst_raw, dgst_raw_len); 1196 retval = fingerprint_hex(ssh_digest_alg_name(dgst_alg),
1197 dgst_raw, dgst_raw_len);
1198 break;
1199 case SSH_FP_BASE64:
1200 retval = fingerprint_b64(ssh_digest_alg_name(dgst_alg),
1201 dgst_raw, dgst_raw_len);
1125 break; 1202 break;
1126 case SSH_FP_BUBBLEBABBLE: 1203 case SSH_FP_BUBBLEBABBLE:
1127 retval = fingerprint_bubblebabble(dgst_raw, dgst_raw_len); 1204 retval = fingerprint_bubblebabble(dgst_raw, dgst_raw_len);
1128 break; 1205 break;
1129 case SSH_FP_RANDOMART: 1206 case SSH_FP_RANDOMART:
1130 retval = fingerprint_randomart(dgst_raw, dgst_raw_len, k); 1207 retval = fingerprint_randomart(ssh_digest_alg_name(dgst_alg),
1208 dgst_raw, dgst_raw_len, k);
1131 break; 1209 break;
1132 default: 1210 default:
1133 explicit_bzero(dgst_raw, dgst_raw_len); 1211 explicit_bzero(dgst_raw, dgst_raw_len);
@@ -1234,16 +1312,20 @@ sshkey_read(struct sshkey *ret, char **cpp)
1234 cp = space+1; 1312 cp = space+1;
1235 if (*cp == '\0') 1313 if (*cp == '\0')
1236 return SSH_ERR_INVALID_FORMAT; 1314 return SSH_ERR_INVALID_FORMAT;
1237 if (ret->type == KEY_UNSPEC) { 1315 if (ret->type != KEY_UNSPEC && ret->type != type)
1238 ret->type = type;
1239 } else if (ret->type != type)
1240 return SSH_ERR_KEY_TYPE_MISMATCH; 1316 return SSH_ERR_KEY_TYPE_MISMATCH;
1241 if ((blob = sshbuf_new()) == NULL) 1317 if ((blob = sshbuf_new()) == NULL)
1242 return SSH_ERR_ALLOC_FAIL; 1318 return SSH_ERR_ALLOC_FAIL;
1243 /* trim comment */ 1319 /* trim comment */
1244 space = strchr(cp, ' '); 1320 space = strchr(cp, ' ');
1245 if (space) 1321 if (space) {
1246 *space = '\0'; 1322 /* advance 'space': skip whitespace */
1323 *space++ = '\0';
1324 while (*space == ' ' || *space == '\t')
1325 space++;
1326 *cpp = space;
1327 } else
1328 *cpp = cp + strlen(cp);
1247 if ((r = sshbuf_b64tod(blob, cp)) != 0) { 1329 if ((r = sshbuf_b64tod(blob, cp)) != 0) {
1248 sshbuf_free(blob); 1330 sshbuf_free(blob);
1249 return r; 1331 return r;
@@ -1263,7 +1345,7 @@ sshkey_read(struct sshkey *ret, char **cpp)
1263 sshkey_free(k); 1345 sshkey_free(k);
1264 return SSH_ERR_EC_CURVE_MISMATCH; 1346 return SSH_ERR_EC_CURVE_MISMATCH;
1265 } 1347 }
1266/*XXXX*/ 1348 ret->type = type;
1267 if (sshkey_is_cert(ret)) { 1349 if (sshkey_is_cert(ret)) {
1268 if (!sshkey_is_cert(k)) { 1350 if (!sshkey_is_cert(k)) {
1269 sshkey_free(k); 1351 sshkey_free(k);
@@ -1320,12 +1402,6 @@ sshkey_read(struct sshkey *ret, char **cpp)
1320 sshkey_free(k); 1402 sshkey_free(k);
1321 if (retval != 0) 1403 if (retval != 0)
1322 break; 1404 break;
1323 /* advance cp: skip whitespace and data */
1324 while (*cp == ' ' || *cp == '\t')
1325 cp++;
1326 while (*cp != '\0' && *cp != ' ' && *cp != '\t')
1327 cp++;
1328 *cpp = cp;
1329 break; 1405 break;
1330 default: 1406 default:
1331 return SSH_ERR_INVALID_ARGUMENT; 1407 return SSH_ERR_INVALID_ARGUMENT;
@@ -1390,7 +1466,7 @@ sshkey_write(const struct sshkey *key, FILE *f)
1390 ret = SSH_ERR_ALLOC_FAIL; 1466 ret = SSH_ERR_ALLOC_FAIL;
1391 goto out; 1467 goto out;
1392 } 1468 }
1393 if ((ret = sshkey_to_blob_buf(key, bb)) != 0) 1469 if ((ret = sshkey_putb(key, bb)) != 0)
1394 goto out; 1470 goto out;
1395 if ((uu = sshbuf_dtob64(bb)) == NULL) { 1471 if ((uu = sshbuf_dtob64(bb)) == NULL) {
1396 ret = SSH_ERR_ALLOC_FAIL; 1472 ret = SSH_ERR_ALLOC_FAIL;
@@ -1767,38 +1843,30 @@ sshkey_from_private(const struct sshkey *k, struct sshkey **pkp)
1767} 1843}
1768 1844
1769static int 1845static int
1770cert_parse(struct sshbuf *b, struct sshkey *key, const u_char *blob, 1846cert_parse(struct sshbuf *b, struct sshkey *key, struct sshbuf *certbuf)
1771 size_t blen)
1772{ 1847{
1773 u_char *principals = NULL, *critical = NULL, *exts = NULL; 1848 struct sshbuf *principals = NULL, *crit = NULL;
1774 u_char *sig_key = NULL, *sig = NULL; 1849 struct sshbuf *exts = NULL, *ca = NULL;
1775 size_t signed_len, plen, clen, sklen, slen, kidlen, elen; 1850 u_char *sig = NULL;
1776 struct sshbuf *tmp; 1851 size_t signed_len = 0, slen = 0, kidlen = 0;
1777 char *principal;
1778 int ret = SSH_ERR_INTERNAL_ERROR; 1852 int ret = SSH_ERR_INTERNAL_ERROR;
1779 int v00 = sshkey_cert_is_legacy(key); 1853 int v00 = sshkey_cert_is_legacy(key);
1780 char **oprincipals;
1781
1782 if ((tmp = sshbuf_new()) == NULL)
1783 return SSH_ERR_ALLOC_FAIL;
1784 1854
1785 /* Copy the entire key blob for verification and later serialisation */ 1855 /* Copy the entire key blob for verification and later serialisation */
1786 if ((ret = sshbuf_put(key->cert->certblob, blob, blen)) != 0) 1856 if ((ret = sshbuf_putb(key->cert->certblob, certbuf)) != 0)
1787 return ret; 1857 return ret;
1788 1858
1789 elen = 0; /* Not touched for v00 certs */
1790 principals = exts = critical = sig_key = sig = NULL;
1791 if ((!v00 && (ret = sshbuf_get_u64(b, &key->cert->serial)) != 0) || 1859 if ((!v00 && (ret = sshbuf_get_u64(b, &key->cert->serial)) != 0) ||
1792 (ret = sshbuf_get_u32(b, &key->cert->type)) != 0 || 1860 (ret = sshbuf_get_u32(b, &key->cert->type)) != 0 ||
1793 (ret = sshbuf_get_cstring(b, &key->cert->key_id, &kidlen)) != 0 || 1861 (ret = sshbuf_get_cstring(b, &key->cert->key_id, &kidlen)) != 0 ||
1794 (ret = sshbuf_get_string(b, &principals, &plen)) != 0 || 1862 (ret = sshbuf_froms(b, &principals)) != 0 ||
1795 (ret = sshbuf_get_u64(b, &key->cert->valid_after)) != 0 || 1863 (ret = sshbuf_get_u64(b, &key->cert->valid_after)) != 0 ||
1796 (ret = sshbuf_get_u64(b, &key->cert->valid_before)) != 0 || 1864 (ret = sshbuf_get_u64(b, &key->cert->valid_before)) != 0 ||
1797 (ret = sshbuf_get_string(b, &critical, &clen)) != 0 || 1865 (ret = sshbuf_froms(b, &crit)) != 0 ||
1798 (!v00 && (ret = sshbuf_get_string(b, &exts, &elen)) != 0) || 1866 (!v00 && (ret = sshbuf_froms(b, &exts)) != 0) ||
1799 (v00 && (ret = sshbuf_get_string_direct(b, NULL, NULL)) != 0) || 1867 (v00 && (ret = sshbuf_get_string_direct(b, NULL, NULL)) != 0) ||
1800 (ret = sshbuf_get_string_direct(b, NULL, NULL)) != 0 || 1868 (ret = sshbuf_get_string_direct(b, NULL, NULL)) != 0 ||
1801 (ret = sshbuf_get_string(b, &sig_key, &sklen)) != 0) { 1869 (ret = sshbuf_froms(b, &ca)) != 0) {
1802 /* XXX debug print error for ret */ 1870 /* XXX debug print error for ret */
1803 ret = SSH_ERR_INVALID_FORMAT; 1871 ret = SSH_ERR_INVALID_FORMAT;
1804 goto out; 1872 goto out;
@@ -1818,14 +1886,17 @@ cert_parse(struct sshbuf *b, struct sshkey *key, const u_char *blob,
1818 goto out; 1886 goto out;
1819 } 1887 }
1820 1888
1821 if ((ret = sshbuf_put(tmp, principals, plen)) != 0) 1889 /* Parse principals section */
1822 goto out; 1890 while (sshbuf_len(principals) > 0) {
1823 while (sshbuf_len(tmp) > 0) { 1891 char *principal = NULL;
1892 char **oprincipals = NULL;
1893
1824 if (key->cert->nprincipals >= SSHKEY_CERT_MAX_PRINCIPALS) { 1894 if (key->cert->nprincipals >= SSHKEY_CERT_MAX_PRINCIPALS) {
1825 ret = SSH_ERR_INVALID_FORMAT; 1895 ret = SSH_ERR_INVALID_FORMAT;
1826 goto out; 1896 goto out;
1827 } 1897 }
1828 if ((ret = sshbuf_get_cstring(tmp, &principal, &plen)) != 0) { 1898 if ((ret = sshbuf_get_cstring(principals, &principal,
1899 NULL)) != 0) {
1829 ret = SSH_ERR_INVALID_FORMAT; 1900 ret = SSH_ERR_INVALID_FORMAT;
1830 goto out; 1901 goto out;
1831 } 1902 }
@@ -1842,38 +1913,38 @@ cert_parse(struct sshbuf *b, struct sshkey *key, const u_char *blob,
1842 key->cert->principals[key->cert->nprincipals++] = principal; 1913 key->cert->principals[key->cert->nprincipals++] = principal;
1843 } 1914 }
1844 1915
1845 sshbuf_reset(tmp); 1916 /*
1846 1917 * Stash a copies of the critical options and extensions sections
1847 if ((ret = sshbuf_put(key->cert->critical, critical, clen)) != 0 || 1918 * for later use.
1848 (ret = sshbuf_put(tmp, critical, clen)) != 0) 1919 */
1920 if ((ret = sshbuf_putb(key->cert->critical, crit)) != 0 ||
1921 (exts != NULL &&
1922 (ret = sshbuf_putb(key->cert->extensions, exts)) != 0))
1849 goto out; 1923 goto out;
1850 1924
1851 /* validate structure */ 1925 /*
1852 while (sshbuf_len(tmp) != 0) { 1926 * Validate critical options and extensions sections format.
1853 if ((ret = sshbuf_get_string_direct(tmp, NULL, NULL)) != 0 || 1927 * NB. extensions are not present in v00 certs.
1854 (ret = sshbuf_get_string_direct(tmp, NULL, NULL)) != 0) { 1928 */
1929 while (sshbuf_len(crit) != 0) {
1930 if ((ret = sshbuf_get_string_direct(crit, NULL, NULL)) != 0 ||
1931 (ret = sshbuf_get_string_direct(crit, NULL, NULL)) != 0) {
1932 sshbuf_reset(key->cert->critical);
1855 ret = SSH_ERR_INVALID_FORMAT; 1933 ret = SSH_ERR_INVALID_FORMAT;
1856 goto out; 1934 goto out;
1857 } 1935 }
1858 } 1936 }
1859 sshbuf_reset(tmp); 1937 while (exts != NULL && sshbuf_len(exts) != 0) {
1860 1938 if ((ret = sshbuf_get_string_direct(exts, NULL, NULL)) != 0 ||
1861 if ((ret = sshbuf_put(key->cert->extensions, exts, elen)) != 0 || 1939 (ret = sshbuf_get_string_direct(exts, NULL, NULL)) != 0) {
1862 (ret = sshbuf_put(tmp, exts, elen)) != 0) 1940 sshbuf_reset(key->cert->extensions);
1863 goto out;
1864
1865 /* validate structure */
1866 while (sshbuf_len(tmp) != 0) {
1867 if ((ret = sshbuf_get_string_direct(tmp, NULL, NULL)) != 0 ||
1868 (ret = sshbuf_get_string_direct(tmp, NULL, NULL)) != 0) {
1869 ret = SSH_ERR_INVALID_FORMAT; 1941 ret = SSH_ERR_INVALID_FORMAT;
1870 goto out; 1942 goto out;
1871 } 1943 }
1872 } 1944 }
1873 sshbuf_reset(tmp);
1874 1945
1875 if (sshkey_from_blob_internal(sig_key, sklen, 1946 /* Parse CA key and check signature */
1876 &key->cert->signature_key, 0) != 0) { 1947 if (sshkey_from_blob_internal(ca, &key->cert->signature_key, 0) != 0) {
1877 ret = SSH_ERR_KEY_CERT_INVALID_SIGN_KEY; 1948 ret = SSH_ERR_KEY_CERT_INVALID_SIGN_KEY;
1878 goto out; 1949 goto out;
1879 } 1950 }
@@ -1881,50 +1952,49 @@ cert_parse(struct sshbuf *b, struct sshkey *key, const u_char *blob,
1881 ret = SSH_ERR_KEY_CERT_INVALID_SIGN_KEY; 1952 ret = SSH_ERR_KEY_CERT_INVALID_SIGN_KEY;
1882 goto out; 1953 goto out;
1883 } 1954 }
1884
1885 if ((ret = sshkey_verify(key->cert->signature_key, sig, slen, 1955 if ((ret = sshkey_verify(key->cert->signature_key, sig, slen,
1886 sshbuf_ptr(key->cert->certblob), signed_len, 0)) != 0) 1956 sshbuf_ptr(key->cert->certblob), signed_len, 0)) != 0)
1887 goto out; 1957 goto out;
1888 ret = 0;
1889 1958
1959 /* Success */
1960 ret = 0;
1890 out: 1961 out:
1891 sshbuf_free(tmp); 1962 sshbuf_free(ca);
1892 free(principals); 1963 sshbuf_free(crit);
1893 free(critical); 1964 sshbuf_free(exts);
1894 free(exts); 1965 sshbuf_free(principals);
1895 free(sig_key);
1896 free(sig); 1966 free(sig);
1897 return ret; 1967 return ret;
1898} 1968}
1899 1969
1900static int 1970static int
1901sshkey_from_blob_internal(const u_char *blob, size_t blen, 1971sshkey_from_blob_internal(struct sshbuf *b, struct sshkey **keyp,
1902 struct sshkey **keyp, int allow_cert) 1972 int allow_cert)
1903{ 1973{
1904 struct sshbuf *b = NULL; 1974 int type, ret = SSH_ERR_INTERNAL_ERROR;
1905 int type, nid = -1, ret = SSH_ERR_INTERNAL_ERROR;
1906 char *ktype = NULL, *curve = NULL; 1975 char *ktype = NULL, *curve = NULL;
1907 struct sshkey *key = NULL; 1976 struct sshkey *key = NULL;
1908 size_t len; 1977 size_t len;
1909 u_char *pk = NULL; 1978 u_char *pk = NULL;
1979 struct sshbuf *copy;
1910#if defined(WITH_OPENSSL) && defined(OPENSSL_HAS_ECC) 1980#if defined(WITH_OPENSSL) && defined(OPENSSL_HAS_ECC)
1911 EC_POINT *q = NULL; 1981 EC_POINT *q = NULL;
1912#endif /* WITH_OPENSSL && OPENSSL_HAS_ECC */ 1982#endif /* WITH_OPENSSL && OPENSSL_HAS_ECC */
1913 1983
1914#ifdef DEBUG_PK /* XXX */ 1984#ifdef DEBUG_PK /* XXX */
1915 dump_base64(stderr, blob, blen); 1985 sshbuf_dump(b, stderr);
1916#endif 1986#endif
1917 *keyp = NULL; 1987 *keyp = NULL;
1918 if ((b = sshbuf_from(blob, blen)) == NULL) 1988 if ((copy = sshbuf_fromb(b)) == NULL) {
1919 return SSH_ERR_ALLOC_FAIL; 1989 ret = SSH_ERR_ALLOC_FAIL;
1990 goto out;
1991 }
1920 if (sshbuf_get_cstring(b, &ktype, NULL) != 0) { 1992 if (sshbuf_get_cstring(b, &ktype, NULL) != 0) {
1921 ret = SSH_ERR_INVALID_FORMAT; 1993 ret = SSH_ERR_INVALID_FORMAT;
1922 goto out; 1994 goto out;
1923 } 1995 }
1924 1996
1925 type = sshkey_type_from_name(ktype); 1997 type = sshkey_type_from_name(ktype);
1926 if (sshkey_type_plain(type) == KEY_ECDSA)
1927 nid = sshkey_ecdsa_nid_from_name(ktype);
1928 if (!allow_cert && sshkey_type_is_cert(type)) { 1998 if (!allow_cert && sshkey_type_is_cert(type)) {
1929 ret = SSH_ERR_KEY_CERT_INVALID_SIGN_KEY; 1999 ret = SSH_ERR_KEY_CERT_INVALID_SIGN_KEY;
1930 goto out; 2000 goto out;
@@ -1932,6 +2002,7 @@ sshkey_from_blob_internal(const u_char *blob, size_t blen,
1932 switch (type) { 2002 switch (type) {
1933#ifdef WITH_OPENSSL 2003#ifdef WITH_OPENSSL
1934 case KEY_RSA_CERT: 2004 case KEY_RSA_CERT:
2005 /* Skip nonce */
1935 if (sshbuf_get_string_direct(b, NULL, NULL) != 0) { 2006 if (sshbuf_get_string_direct(b, NULL, NULL) != 0) {
1936 ret = SSH_ERR_INVALID_FORMAT; 2007 ret = SSH_ERR_INVALID_FORMAT;
1937 goto out; 2008 goto out;
@@ -1953,6 +2024,7 @@ sshkey_from_blob_internal(const u_char *blob, size_t blen,
1953#endif 2024#endif
1954 break; 2025 break;
1955 case KEY_DSA_CERT: 2026 case KEY_DSA_CERT:
2027 /* Skip nonce */
1956 if (sshbuf_get_string_direct(b, NULL, NULL) != 0) { 2028 if (sshbuf_get_string_direct(b, NULL, NULL) != 0) {
1957 ret = SSH_ERR_INVALID_FORMAT; 2029 ret = SSH_ERR_INVALID_FORMAT;
1958 goto out; 2030 goto out;
@@ -1976,6 +2048,7 @@ sshkey_from_blob_internal(const u_char *blob, size_t blen,
1976#endif 2048#endif
1977 break; 2049 break;
1978 case KEY_ECDSA_CERT: 2050 case KEY_ECDSA_CERT:
2051 /* Skip nonce */
1979 if (sshbuf_get_string_direct(b, NULL, NULL) != 0) { 2052 if (sshbuf_get_string_direct(b, NULL, NULL) != 0) {
1980 ret = SSH_ERR_INVALID_FORMAT; 2053 ret = SSH_ERR_INVALID_FORMAT;
1981 goto out; 2054 goto out;
@@ -1987,7 +2060,7 @@ sshkey_from_blob_internal(const u_char *blob, size_t blen,
1987 ret = SSH_ERR_ALLOC_FAIL; 2060 ret = SSH_ERR_ALLOC_FAIL;
1988 goto out; 2061 goto out;
1989 } 2062 }
1990 key->ecdsa_nid = nid; 2063 key->ecdsa_nid = sshkey_ecdsa_nid_from_name(ktype);
1991 if (sshbuf_get_cstring(b, &curve, NULL) != 0) { 2064 if (sshbuf_get_cstring(b, &curve, NULL) != 0) {
1992 ret = SSH_ERR_INVALID_FORMAT; 2065 ret = SSH_ERR_INVALID_FORMAT;
1993 goto out; 2066 goto out;
@@ -2028,6 +2101,7 @@ sshkey_from_blob_internal(const u_char *blob, size_t blen,
2028# endif /* OPENSSL_HAS_ECC */ 2101# endif /* OPENSSL_HAS_ECC */
2029#endif /* WITH_OPENSSL */ 2102#endif /* WITH_OPENSSL */
2030 case KEY_ED25519_CERT: 2103 case KEY_ED25519_CERT:
2104 /* Skip nonce */
2031 if (sshbuf_get_string_direct(b, NULL, NULL) != 0) { 2105 if (sshbuf_get_string_direct(b, NULL, NULL) != 0) {
2032 ret = SSH_ERR_INVALID_FORMAT; 2106 ret = SSH_ERR_INVALID_FORMAT;
2033 goto out; 2107 goto out;
@@ -2059,8 +2133,7 @@ sshkey_from_blob_internal(const u_char *blob, size_t blen,
2059 } 2133 }
2060 2134
2061 /* Parse certificate potion */ 2135 /* Parse certificate potion */
2062 if (sshkey_is_cert(key) && 2136 if (sshkey_is_cert(key) && (ret = cert_parse(b, key, copy)) != 0)
2063 (ret = cert_parse(b, key, blob, blen)) != 0)
2064 goto out; 2137 goto out;
2065 2138
2066 if (key != NULL && sshbuf_len(b) != 0) { 2139 if (key != NULL && sshbuf_len(b) != 0) {
@@ -2071,7 +2144,7 @@ sshkey_from_blob_internal(const u_char *blob, size_t blen,
2071 *keyp = key; 2144 *keyp = key;
2072 key = NULL; 2145 key = NULL;
2073 out: 2146 out:
2074 sshbuf_free(b); 2147 sshbuf_free(copy);
2075 sshkey_free(key); 2148 sshkey_free(key);
2076 free(ktype); 2149 free(ktype);
2077 free(curve); 2150 free(curve);
@@ -2086,7 +2159,33 @@ sshkey_from_blob_internal(const u_char *blob, size_t blen,
2086int 2159int
2087sshkey_from_blob(const u_char *blob, size_t blen, struct sshkey **keyp) 2160sshkey_from_blob(const u_char *blob, size_t blen, struct sshkey **keyp)
2088{ 2161{
2089 return sshkey_from_blob_internal(blob, blen, keyp, 1); 2162 struct sshbuf *b;
2163 int r;
2164
2165 if ((b = sshbuf_from(blob, blen)) == NULL)
2166 return SSH_ERR_ALLOC_FAIL;
2167 r = sshkey_from_blob_internal(b, keyp, 1);
2168 sshbuf_free(b);
2169 return r;
2170}
2171
2172int
2173sshkey_fromb(struct sshbuf *b, struct sshkey **keyp)
2174{
2175 return sshkey_from_blob_internal(b, keyp, 1);
2176}
2177
2178int
2179sshkey_froms(struct sshbuf *buf, struct sshkey **keyp)
2180{
2181 struct sshbuf *b;
2182 int r;
2183
2184 if ((r = sshbuf_froms(buf, &b)) != 0)
2185 return r;
2186 r = sshkey_from_blob_internal(b, keyp, 1);
2187 sshbuf_free(b);
2188 return r;
2090} 2189}
2091 2190
2092int 2191int
@@ -2132,10 +2231,7 @@ sshkey_verify(const struct sshkey *key,
2132 const u_char *sig, size_t siglen, 2231 const u_char *sig, size_t siglen,
2133 const u_char *data, size_t dlen, u_int compat) 2232 const u_char *data, size_t dlen, u_int compat)
2134{ 2233{
2135 if (siglen == 0) 2234 if (siglen == 0 || dlen > SSH_KEY_MAX_SIGN_DATA_SIZE)
2136 return -1;
2137
2138 if (dlen > SSH_KEY_MAX_SIGN_DATA_SIZE)
2139 return SSH_ERR_INVALID_ARGUMENT; 2235 return SSH_ERR_INVALID_ARGUMENT;
2140 switch (key->type) { 2236 switch (key->type) {
2141#ifdef WITH_OPENSSL 2237#ifdef WITH_OPENSSL
@@ -2369,6 +2465,7 @@ sshkey_certify(struct sshkey *k, struct sshkey *ca)
2369 break; 2465 break;
2370 default: 2466 default:
2371 ret = SSH_ERR_INVALID_ARGUMENT; 2467 ret = SSH_ERR_INVALID_ARGUMENT;
2468 goto out;
2372 } 2469 }
2373 2470
2374 /* -v01 certs have a serial number next */ 2471 /* -v01 certs have a serial number next */
@@ -2594,8 +2691,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp)
2594{ 2691{
2595 char *tname = NULL, *curve = NULL; 2692 char *tname = NULL, *curve = NULL;
2596 struct sshkey *k = NULL; 2693 struct sshkey *k = NULL;
2597 const u_char *cert; 2694 size_t pklen = 0, sklen = 0;
2598 size_t len, pklen = 0, sklen = 0;
2599 int type, r = SSH_ERR_INTERNAL_ERROR; 2695 int type, r = SSH_ERR_INTERNAL_ERROR;
2600 u_char *ed25519_pk = NULL, *ed25519_sk = NULL; 2696 u_char *ed25519_pk = NULL, *ed25519_sk = NULL;
2601#ifdef WITH_OPENSSL 2697#ifdef WITH_OPENSSL
@@ -2623,8 +2719,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp)
2623 break; 2719 break;
2624 case KEY_DSA_CERT_V00: 2720 case KEY_DSA_CERT_V00:
2625 case KEY_DSA_CERT: 2721 case KEY_DSA_CERT:
2626 if ((r = sshbuf_get_string_direct(buf, &cert, &len)) != 0 || 2722 if ((r = sshkey_froms(buf, &k)) != 0 ||
2627 (r = sshkey_from_blob(cert, len, &k)) != 0 ||
2628 (r = sshkey_add_private(k)) != 0 || 2723 (r = sshkey_add_private(k)) != 0 ||
2629 (r = sshbuf_get_bignum2(buf, k->dsa->priv_key)) != 0) 2724 (r = sshbuf_get_bignum2(buf, k->dsa->priv_key)) != 0)
2630 goto out; 2725 goto out;
@@ -2667,8 +2762,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp)
2667 r = SSH_ERR_LIBCRYPTO_ERROR; 2762 r = SSH_ERR_LIBCRYPTO_ERROR;
2668 goto out; 2763 goto out;
2669 } 2764 }
2670 if ((r = sshbuf_get_string_direct(buf, &cert, &len)) != 0 || 2765 if ((r = sshkey_froms(buf, &k)) != 0 ||
2671 (r = sshkey_from_blob(cert, len, &k)) != 0 ||
2672 (r = sshkey_add_private(k)) != 0 || 2766 (r = sshkey_add_private(k)) != 0 ||
2673 (r = sshbuf_get_bignum2(buf, exponent)) != 0) 2767 (r = sshbuf_get_bignum2(buf, exponent)) != 0)
2674 goto out; 2768 goto out;
@@ -2698,8 +2792,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp)
2698 break; 2792 break;
2699 case KEY_RSA_CERT_V00: 2793 case KEY_RSA_CERT_V00:
2700 case KEY_RSA_CERT: 2794 case KEY_RSA_CERT:
2701 if ((r = sshbuf_get_string_direct(buf, &cert, &len)) != 0 || 2795 if ((r = sshkey_froms(buf, &k)) != 0 ||
2702 (r = sshkey_from_blob(cert, len, &k)) != 0 ||
2703 (r = sshkey_add_private(k)) != 0 || 2796 (r = sshkey_add_private(k)) != 0 ||
2704 (r = sshbuf_get_bignum2(buf, k->rsa->d) != 0) || 2797 (r = sshbuf_get_bignum2(buf, k->rsa->d) != 0) ||
2705 (r = sshbuf_get_bignum2(buf, k->rsa->iqmp) != 0) || 2798 (r = sshbuf_get_bignum2(buf, k->rsa->iqmp) != 0) ||
@@ -2726,8 +2819,7 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp)
2726 ed25519_pk = ed25519_sk = NULL; 2819 ed25519_pk = ed25519_sk = NULL;
2727 break; 2820 break;
2728 case KEY_ED25519_CERT: 2821 case KEY_ED25519_CERT:
2729 if ((r = sshbuf_get_string_direct(buf, &cert, &len)) != 0 || 2822 if ((r = sshkey_froms(buf, &k)) != 0 ||
2730 (r = sshkey_from_blob(cert, len, &k)) != 0 ||
2731 (r = sshkey_add_private(k)) != 0 || 2823 (r = sshkey_add_private(k)) != 0 ||
2732 (r = sshbuf_get_string(buf, &ed25519_pk, &pklen)) != 0 || 2824 (r = sshbuf_get_string(buf, &ed25519_pk, &pklen)) != 0 ||
2733 (r = sshbuf_get_string(buf, &ed25519_sk, &sklen)) != 0) 2825 (r = sshbuf_get_string(buf, &ed25519_sk, &sklen)) != 0)
@@ -2953,8 +3045,9 @@ sshkey_private_to_blob2(const struct sshkey *prv, struct sshbuf *blob,
2953 const char *passphrase, const char *comment, const char *ciphername, 3045 const char *passphrase, const char *comment, const char *ciphername,
2954 int rounds) 3046 int rounds)
2955{ 3047{
2956 u_char *cp, *b64 = NULL, *key = NULL, *pubkeyblob = NULL; 3048 u_char *cp, *key = NULL, *pubkeyblob = NULL;
2957 u_char salt[SALT_LEN]; 3049 u_char salt[SALT_LEN];
3050 char *b64 = NULL;
2958 size_t i, pubkeylen, keylen, ivlen, blocksize, authlen; 3051 size_t i, pubkeylen, keylen, ivlen, blocksize, authlen;
2959 u_int check; 3052 u_int check;
2960 int r = SSH_ERR_INTERNAL_ERROR; 3053 int r = SSH_ERR_INTERNAL_ERROR;
@@ -3166,7 +3259,7 @@ sshkey_parse_private2(struct sshbuf *blob, int type, const char *passphrase,
3166 } 3259 }
3167 3260
3168 /* decode base64 */ 3261 /* decode base64 */
3169 if ((r = sshbuf_b64tod(decoded, sshbuf_ptr(encoded))) != 0) 3262 if ((r = sshbuf_b64tod(decoded, (char *)sshbuf_ptr(encoded))) != 0)
3170 goto out; 3263 goto out;
3171 3264
3172 /* check magic */ 3265 /* check magic */
@@ -3482,10 +3575,12 @@ sshkey_private_to_fileblob(struct sshkey *key, struct sshbuf *blob,
3482 int force_new_format, const char *new_format_cipher, int new_format_rounds) 3575 int force_new_format, const char *new_format_cipher, int new_format_rounds)
3483{ 3576{
3484 switch (key->type) { 3577 switch (key->type) {
3485#ifdef WITH_OPENSSL 3578#ifdef WITH_SSH1
3486 case KEY_RSA1: 3579 case KEY_RSA1:
3487 return sshkey_private_rsa1_to_blob(key, blob, 3580 return sshkey_private_rsa1_to_blob(key, blob,
3488 passphrase, comment); 3581 passphrase, comment);
3582#endif /* WITH_SSH1 */
3583#ifdef WITH_OPENSSL
3489 case KEY_DSA: 3584 case KEY_DSA:
3490 case KEY_ECDSA: 3585 case KEY_ECDSA:
3491 case KEY_RSA: 3586 case KEY_RSA:
@@ -3691,20 +3786,16 @@ sshkey_parse_private_rsa1(struct sshbuf *blob, const char *passphrase,
3691#endif /* WITH_SSH1 */ 3786#endif /* WITH_SSH1 */
3692 3787
3693#ifdef WITH_OPENSSL 3788#ifdef WITH_OPENSSL
3694/* XXX make private once ssh-keysign.c fixed */ 3789static int
3695int
3696sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type, 3790sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
3697 const char *passphrase, struct sshkey **keyp, char **commentp) 3791 const char *passphrase, struct sshkey **keyp)
3698{ 3792{
3699 EVP_PKEY *pk = NULL; 3793 EVP_PKEY *pk = NULL;
3700 struct sshkey *prv = NULL; 3794 struct sshkey *prv = NULL;
3701 char *name = "<no key>";
3702 BIO *bio = NULL; 3795 BIO *bio = NULL;
3703 int r; 3796 int r;
3704 3797
3705 *keyp = NULL; 3798 *keyp = NULL;
3706 if (commentp != NULL)
3707 *commentp = NULL;
3708 3799
3709 if ((bio = BIO_new(BIO_s_mem())) == NULL || sshbuf_len(blob) > INT_MAX) 3800 if ((bio = BIO_new(BIO_s_mem())) == NULL || sshbuf_len(blob) > INT_MAX)
3710 return SSH_ERR_ALLOC_FAIL; 3801 return SSH_ERR_ALLOC_FAIL;
@@ -3727,7 +3818,6 @@ sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
3727 } 3818 }
3728 prv->rsa = EVP_PKEY_get1_RSA(pk); 3819 prv->rsa = EVP_PKEY_get1_RSA(pk);
3729 prv->type = KEY_RSA; 3820 prv->type = KEY_RSA;
3730 name = "rsa w/o comment";
3731#ifdef DEBUG_PK 3821#ifdef DEBUG_PK
3732 RSA_print_fp(stderr, prv->rsa, 8); 3822 RSA_print_fp(stderr, prv->rsa, 8);
3733#endif 3823#endif
@@ -3743,7 +3833,6 @@ sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
3743 } 3833 }
3744 prv->dsa = EVP_PKEY_get1_DSA(pk); 3834 prv->dsa = EVP_PKEY_get1_DSA(pk);
3745 prv->type = KEY_DSA; 3835 prv->type = KEY_DSA;
3746 name = "dsa w/o comment";
3747#ifdef DEBUG_PK 3836#ifdef DEBUG_PK
3748 DSA_print_fp(stderr, prv->dsa, 8); 3837 DSA_print_fp(stderr, prv->dsa, 8);
3749#endif 3838#endif
@@ -3765,7 +3854,6 @@ sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
3765 r = SSH_ERR_INVALID_FORMAT; 3854 r = SSH_ERR_INVALID_FORMAT;
3766 goto out; 3855 goto out;
3767 } 3856 }
3768 name = "ecdsa w/o comment";
3769# ifdef DEBUG_PK 3857# ifdef DEBUG_PK
3770 if (prv != NULL && prv->ecdsa != NULL) 3858 if (prv != NULL && prv->ecdsa != NULL)
3771 sshkey_dump_ec_key(prv->ecdsa); 3859 sshkey_dump_ec_key(prv->ecdsa);
@@ -3775,11 +3863,6 @@ sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
3775 r = SSH_ERR_INVALID_FORMAT; 3863 r = SSH_ERR_INVALID_FORMAT;
3776 goto out; 3864 goto out;
3777 } 3865 }
3778 if (commentp != NULL &&
3779 (*commentp = strdup(name)) == NULL) {
3780 r = SSH_ERR_ALLOC_FAIL;
3781 goto out;
3782 }
3783 r = 0; 3866 r = 0;
3784 *keyp = prv; 3867 *keyp = prv;
3785 prv = NULL; 3868 prv = NULL;
@@ -3804,15 +3887,17 @@ sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
3804 *commentp = NULL; 3887 *commentp = NULL;
3805 3888
3806 switch (type) { 3889 switch (type) {
3807#ifdef WITH_OPENSSL 3890#ifdef WITH_SSH1
3808 case KEY_RSA1: 3891 case KEY_RSA1:
3809 return sshkey_parse_private_rsa1(blob, passphrase, 3892 return sshkey_parse_private_rsa1(blob, passphrase,
3810 keyp, commentp); 3893 keyp, commentp);
3894#endif /* WITH_SSH1 */
3895#ifdef WITH_OPENSSL
3811 case KEY_DSA: 3896 case KEY_DSA:
3812 case KEY_ECDSA: 3897 case KEY_ECDSA:
3813 case KEY_RSA: 3898 case KEY_RSA:
3814 return sshkey_parse_private_pem_fileblob(blob, type, passphrase, 3899 return sshkey_parse_private_pem_fileblob(blob, type,
3815 keyp, commentp); 3900 passphrase, keyp);
3816#endif /* WITH_OPENSSL */ 3901#endif /* WITH_OPENSSL */
3817 case KEY_ED25519: 3902 case KEY_ED25519:
3818 return sshkey_parse_private2(blob, type, passphrase, 3903 return sshkey_parse_private2(blob, type, passphrase,
@@ -3822,8 +3907,8 @@ sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
3822 commentp)) == 0) 3907 commentp)) == 0)
3823 return 0; 3908 return 0;
3824#ifdef WITH_OPENSSL 3909#ifdef WITH_OPENSSL
3825 return sshkey_parse_private_pem_fileblob(blob, type, passphrase, 3910 return sshkey_parse_private_pem_fileblob(blob, type,
3826 keyp, commentp); 3911 passphrase, keyp);
3827#else 3912#else
3828 return SSH_ERR_INVALID_FORMAT; 3913 return SSH_ERR_INVALID_FORMAT;
3829#endif /* WITH_OPENSSL */ 3914#endif /* WITH_OPENSSL */
diff --git a/sshkey.h b/sshkey.h
index b573e7f33..9314e8513 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.
@@ -68,16 +68,14 @@ enum sshkey_types {
68 KEY_UNSPEC 68 KEY_UNSPEC
69}; 69};
70 70
71/* Fingerprint hash algorithms */ 71/* Default fingerprint hash */
72enum sshkey_fp_type { 72#define SSH_FP_HASH_DEFAULT SSH_DIGEST_SHA256
73 SSH_FP_SHA1,
74 SSH_FP_MD5,
75 SSH_FP_SHA256
76};
77 73
78/* Fingerprint representation formats */ 74/* Fingerprint representation formats */
79enum sshkey_fp_rep { 75enum sshkey_fp_rep {
76 SSH_FP_DEFAULT = 0,
80 SSH_FP_HEX, 77 SSH_FP_HEX,
78 SSH_FP_BASE64,
81 SSH_FP_BUBBLEBABBLE, 79 SSH_FP_BUBBLEBABBLE,
82 SSH_FP_RANDOMART 80 SSH_FP_RANDOMART
83}; 81};
@@ -125,9 +123,9 @@ int sshkey_equal_public(const struct sshkey *,
125 const struct sshkey *); 123 const struct sshkey *);
126int sshkey_equal(const struct sshkey *, const struct sshkey *); 124int sshkey_equal(const struct sshkey *, const struct sshkey *);
127char *sshkey_fingerprint(const struct sshkey *, 125char *sshkey_fingerprint(const struct sshkey *,
128 enum sshkey_fp_type, enum sshkey_fp_rep); 126 int, enum sshkey_fp_rep);
129int sshkey_fingerprint_raw(const struct sshkey *k, 127int sshkey_fingerprint_raw(const struct sshkey *k,
130 enum sshkey_fp_type dgst_type, u_char **retp, size_t *lenp); 128 int, u_char **retp, size_t *lenp);
131const char *sshkey_type(const struct sshkey *); 129const char *sshkey_type(const struct sshkey *);
132const char *sshkey_cert_type(const struct sshkey *); 130const char *sshkey_cert_type(const struct sshkey *);
133int sshkey_write(const struct sshkey *, FILE *); 131int sshkey_write(const struct sshkey *, FILE *);
@@ -159,14 +157,17 @@ int sshkey_ec_validate_public(const EC_GROUP *, const EC_POINT *);
159int sshkey_ec_validate_private(const EC_KEY *); 157int sshkey_ec_validate_private(const EC_KEY *);
160const char *sshkey_ssh_name(const struct sshkey *); 158const char *sshkey_ssh_name(const struct sshkey *);
161const char *sshkey_ssh_name_plain(const struct sshkey *); 159const char *sshkey_ssh_name_plain(const struct sshkey *);
162int sshkey_names_valid2(const char *); 160int sshkey_names_valid2(const char *, int);
163char *key_alg_list(int, int); 161char *key_alg_list(int, int);
164 162
165int sshkey_from_blob(const u_char *, size_t, struct sshkey **); 163int sshkey_from_blob(const u_char *, size_t, struct sshkey **);
166int sshkey_to_blob_buf(const struct sshkey *, struct sshbuf *); 164int sshkey_fromb(struct sshbuf *, struct sshkey **);
165int sshkey_froms(struct sshbuf *, struct sshkey **);
167int sshkey_to_blob(const struct sshkey *, u_char **, size_t *); 166int sshkey_to_blob(const struct sshkey *, u_char **, size_t *);
168int sshkey_plain_to_blob_buf(const struct sshkey *, struct sshbuf *); 167int sshkey_putb(const struct sshkey *, struct sshbuf *);
168int sshkey_puts(const struct sshkey *, struct sshbuf *);
169int sshkey_plain_to_blob(const struct sshkey *, u_char **, size_t *); 169int sshkey_plain_to_blob(const struct sshkey *, u_char **, size_t *);
170int sshkey_putb_plain(const struct sshkey *, struct sshbuf *);
170 171
171int sshkey_sign(const struct sshkey *, u_char **, size_t *, 172int sshkey_sign(const struct sshkey *, u_char **, size_t *,
172 const u_char *, size_t, u_int); 173 const u_char *, size_t, u_int);
@@ -187,8 +188,6 @@ int sshkey_private_to_fileblob(struct sshkey *key, struct sshbuf *blob,
187 int force_new_format, const char *new_format_cipher, int new_format_rounds); 188 int force_new_format, const char *new_format_cipher, int new_format_rounds);
188int sshkey_parse_public_rsa1_fileblob(struct sshbuf *blob, 189int sshkey_parse_public_rsa1_fileblob(struct sshbuf *blob,
189 struct sshkey **keyp, char **commentp); 190 struct sshkey **keyp, char **commentp);
190int sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
191 const char *passphrase, struct sshkey **keyp, char **commentp);
192int sshkey_parse_private_fileblob(struct sshbuf *buffer, 191int sshkey_parse_private_fileblob(struct sshbuf *buffer,
193 const char *passphrase, const char *filename, struct sshkey **keyp, 192 const char *passphrase, const char *filename, struct sshkey **keyp,
194 char **commentp); 193 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 3512ec801..f7b1f6d64 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, const char *role)
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 0fee7c3c2..94569acde 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_MINIMUM SSH_VERSION SSH_PORTABLE 6#define SSH_RELEASE_MINIMUM 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