From 1ac6c57f6a4682895ea21607bc6d8f1079efd6b4 Mon Sep 17 00:00:00 2001 From: Frank Scheiner Date: Fri, 5 Aug 2022 16:13:15 +0200 Subject: [PATCH] Remove obsolete GSI-OpenSSH 7.5p1 for Debian Fixes #170 --- packaging/debian/gsi-openssh/debian/README | 21 - .../debian/gsi-openssh/debian/README.patches | 43 - .../debian/gsi-openssh/debian/changelog.in | 174 - packaging/debian/gsi-openssh/debian/compat | 1 - packaging/debian/gsi-openssh/debian/control | 66 - packaging/debian/gsi-openssh/debian/copyright | 348 - .../debian/gsi-openssh-clients.install | 16 - .../debian/gsi-openssh-server.init | 274 - .../debian/gsi-openssh-server.install | 10 - .../debian/gsi-openssh-server.postinst | 15 - .../gsi-openssh/debian/gsi-openssh.install | 5 - .../patches/hpn-14.13-isshd.v3.19.1.patch | 3085 --- .../debian/patches/hpn_isshd-gsi.7.5p1c.patch | 16737 ---------------- .../patches/hpn_isshd-gsi_ossl.7.5p1c.patch | 3791 ---- .../patches/openssh-7_5_P1-hpn-14.13.diff | 2342 --- .../debian/gsi-openssh/debian/patches/series | 4 - packaging/debian/gsi-openssh/debian/rules | 121 - .../debian/gsi-openssh/debian/source/format | 1 - 18 files changed, 27054 deletions(-) delete mode 100644 packaging/debian/gsi-openssh/debian/README delete mode 100644 packaging/debian/gsi-openssh/debian/README.patches delete mode 100644 packaging/debian/gsi-openssh/debian/changelog.in delete mode 100644 packaging/debian/gsi-openssh/debian/compat delete mode 100644 packaging/debian/gsi-openssh/debian/control delete mode 100644 packaging/debian/gsi-openssh/debian/copyright delete mode 100644 packaging/debian/gsi-openssh/debian/gsi-openssh-clients.install delete mode 100755 packaging/debian/gsi-openssh/debian/gsi-openssh-server.init delete mode 100644 packaging/debian/gsi-openssh/debian/gsi-openssh-server.install delete mode 100644 packaging/debian/gsi-openssh/debian/gsi-openssh-server.postinst delete mode 100644 packaging/debian/gsi-openssh/debian/gsi-openssh.install delete mode 100644 packaging/debian/gsi-openssh/debian/patches/hpn-14.13-isshd.v3.19.1.patch delete mode 100644 packaging/debian/gsi-openssh/debian/patches/hpn_isshd-gsi.7.5p1c.patch delete mode 100644 packaging/debian/gsi-openssh/debian/patches/hpn_isshd-gsi_ossl.7.5p1c.patch delete mode 100644 packaging/debian/gsi-openssh/debian/patches/openssh-7_5_P1-hpn-14.13.diff delete mode 100644 packaging/debian/gsi-openssh/debian/patches/series delete mode 100755 packaging/debian/gsi-openssh/debian/rules delete mode 100644 packaging/debian/gsi-openssh/debian/source/format diff --git a/packaging/debian/gsi-openssh/debian/README b/packaging/debian/gsi-openssh/debian/README deleted file mode 100644 index e7ccf28d8e..0000000000 --- a/packaging/debian/gsi-openssh/debian/README +++ /dev/null @@ -1,21 +0,0 @@ -This package is part of the Grid Community Toolkit. For more information visit: - -https://gridcf.org/gct-docs/latest/gsiopenssh/ - -Admin Guide: -https://gridcf.org/gct-docs/latest/gsiopenssh/admin/ - -Developer's Guide: -https://gridcf.org/gct-docs/latest/gsiopenssh/developer/ - -Release Notes: -https://gridcf.org/gct-docs/latest/gsiopenssh/rn/ - -Public Interface Guide: -https://gridcf.org/gct-docs/latest/gsiopenssh/pi/ - -Quality Profile: -https://gridcf.org/gct-docs/latest/gsiopenssh/qp/ - -Migrating Guide: -https://gridcf.org/gct-docs/latest/gsiopenssh/mig/ diff --git a/packaging/debian/gsi-openssh/debian/README.patches b/packaging/debian/gsi-openssh/debian/README.patches deleted file mode 100644 index e4c10ede0d..0000000000 --- a/packaging/debian/gsi-openssh/debian/README.patches +++ /dev/null @@ -1,43 +0,0 @@ -The following patches are for OpenSSH 7.3p1 (ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.3p1.tar.gz) and need to be applied in the order they are described below: - -1. HPN patch (openssh-7_3_P1-hpn-14.12.patch): - -Expected source of patch: http://sourceforge.net/projects/hpnssh/files/ - -The HPN-SSH patch to Portable OpenSSH was constructed as follows as the patch wasn't readily available at the above link at this time. -## git clone git@github.com:rapier1/openssh-portable.git -## cd openssh-portable -## git remote add portable https://github.com/openssh/openssh-portable.git -## git fetch portable -## git merge-base hpn-7_3_P1 V_7_3_P1 > common_ancestor -## git diff `cat common_ancestor` hpn-7_3_P1 > ../openssh-7_3_P1-hpn-14.12.patch - - -2. ISSHD patch to HPN (hpn-14.12-isshd.v3.19.1.patch): - -The iSSHD patch to HPN-SSH is constructed as follows: -## git clone git@github.com:set-element/openssh-hpn-isshd.git -## cd openssh-hpn-isshd -## git remote add hpn https://github.com/rapier1/openssh-portable.git -## git fetch hpn -## git merge-base 45285b04324c35bf4ba3e1ea400866627bd64527 hpn-7_3_P1 > common_ancestor -## git diff `cat common_ancestor` 45285b04324c35bf4ba3e1ea400866627bd64527 > ../hpn-14.12-isshd.v3.19.1.patch - - -3. GSI patch to ISSHD (hpn_isshd-gsi.7.3p1c.patch): - -The GSI patch to be applied on top of the iSSHD patch is constructed as follows: -## tar xvf openssh-7.3p1.tar.gz -## cd openssh-7.3p1 -## patch -p1 --no-backup-if-mismatch < ../openssh-7_3_P1-hpn-14.12.patch -## patch -p1 --no-backup-if-mismatch < ../hpn-14.12-isshd.v3.19.1.patch -## grep "^commit " ChangeLog | tail -1 | cut -d' ' -f2 > ../changelog_last_commit -## cd .. -## git clone https://github.com/globus/gsi-openssh.git -## cd gsi-openssh -## git checkout tags/7.3p1c -## git log `cat ../changelog_last_commit`^... > ChangeLog -## make -f Makefile.in MANFMT="/usr/bin/nroff -mandoc" SHELL=$SHELL distprep -## rm -fr .git -## cd .. -## diff -Naur openssh-7.3p1 gsi-openssh > hpn_isshd-gsi.7.3p1c.patch diff --git a/packaging/debian/gsi-openssh/debian/changelog.in b/packaging/debian/gsi-openssh/debian/changelog.in deleted file mode 100644 index 47fd6d5d8a..0000000000 --- a/packaging/debian/gsi-openssh/debian/changelog.in +++ /dev/null @@ -1,174 +0,0 @@ -gsi-openssh (7.5p1c-1+gct.@distro@) @distro@; urgency=medium - - * Bump gsi-openssh source version - - -- Mattias Ellert Thu, 18 Apr 2019 08:38:03 +0200 - -gsi-openssh (7.5p1b-3+gct.@distro@) @distro@; urgency=medium - - * Remove usage statistics collection support - - -- Mattias Ellert Thu, 20 Dec 2018 16:59:54 +0100 - -gsi-openssh (7.5p1b-2+gt6.@distro@) @distro@; urgency=low - - * Debian packaging for gsi-openssh-server no longer creates sshd user (#119) - - -- Globus Toolkit Tue, 27 Jun 2017 13:07:14 -0400 - -gsi-openssh (7.5p1b-1+gt6.@distro@) @distro@; urgency=low - - * Update to GSI-OpenSSH 7.5p1b - - -- Globus Toolkit Tue, 27 Jun 2017 13:07:14 -0400 - -gsi-openssh (7.3p1c-1+gt6.@distro@) @distro@; urgency=low - - * Update to GSI-OpenSSH 7.3p1c - - -- Globus Toolkit Tue, 18 Apr 2017 10:22:36 -0400 - -gsi-openssh (7.3p1b-1+gt6.@distro@) @distro@; urgency=low - - * Update to GSI-OpenSSH 7.3p1b - - -- Globus Toolkit Mon, 03 Apr 2017 13:42:17 -0400 - -gsi-openssh (7.3p1a-1+gt6.@distro@) @distro@; urgency=low - - * Update to GSI-OpenSSH 7.3p1a - - -- Globus Toolkit Fri, 24 Mar 2017 14:33:26 -0400 - -gsi-openssh (7.1p2i-1+gt6.@distro@) @distro@; urgency=low - - * Setting GSS_C_CONF_FLAG to get around the issue of - * SSL_export_keying_material interop error with CentOS 6 - - -- Globus Toolkit Mon, 20 Mar 2017 12:28:18 -0400 - -gsi-openssh (7.1p2h-1+gt6.@distro@) @distro@; urgency=low - - * New 7.1p2h release that fixes negotiation problem from previous - - -- Globus Toolkit Mon, 06 Mar 2017 15:21:06 -0500 - -gsi-openssh (7.1p2g-1+gt6.@distro@) @distro@; urgency=low - - * New 7.1p2g release that introduces negotiation of new mechanism OID - - -- Globus Toolkit Thu, 08 Dec 2016 09:09:29 -0500 - -gsi-openssh (7.1p2f-4+gt6.@distro@) @distro@; urgency=low - - * Fix for https://github.com/globus/globus-toolkit/issues/61: - Debian 7 package fails to detect status of gsisshd - * Fix for https://github.com/globus/globus-toolkit/issues/62: - gsisshd prints message about /etc/gsi-openssh to stderr - - -- Globus Toolkit Thu, 18 Aug 2016 10:55:01 -0400 - -gsi-openssh (7.1p2f-2+gt6.@distro@) @distro@; urgency=low - - * Fix for https://github.com/globus/globus-toolkit/issues/49 - - -- Globus Toolkit Fri, 17 Jun 2016 12:45:10 -0400 - -gsi-openssh (7.1p2f-1+gt6.@distro@) @distro@; urgency=low - - * Fix to use sshd_config from installed location for installations from the - source and binary tarballs. - * DisableUsageStats now defaults to Yes in code (already defaults to Yes in - the supplied sshd_config). Also moved the DisableUsageStats directive to be - ahead of the Match directives in sshd_config. - - -- Globus Toolkit Tue, 07 Jun 2016 07:53:45 -0400 - -gsi-openssh (7.1p2e-1+gt6.@distro@) @distro@; urgency=low - - * default iSSHD auditing to disabled - - -- Globus Toolkit Thu, 12 May 2016 14:18:13 -0400 - -gsi-openssh (7.1p2d-1+gt6.@distro@) @distro@; urgency=low - - * Fix configuration problem missing gss_assist functions - - -- Globus Toolkit Thu, 12 May 2016 10:57:24 -0400 - -gsi-openssh (7.1p2c-2+gt6.@distro@) @distro@; urgency=low - - * Change source url - - -- Globus Toolkit Mon, 25 Apr 2016 09:38:04 -0400 - -gsi-openssh (7.1p2c-1+gt6.@distro@) @distro@; urgency=low - - * Fixes for Globus Toolkit builds: Skip probing for specific globus funcs - * Fixes for building kerberos/mechglue without GSI. - * Disable iSSHD auditing by default in the source code itself. - * Fix missing call to dh_shlibdeps - * Fix init script problems - - -- Globus Toolkit Fri, 11 Mar 2016 13:35:19 -0500 - -gsi-openssh (7.1p2b-1+gt6.@distro@) @distro@; urgency=low - - * Update to gsi-openssh 7.1p2b - - -- Globus Toolkit Fri, 04 Mar 2016 11:56:56 -0500 - -gsi-openssh (5.7-3+gt6.@distro@) @distro@; urgency=low - - * CVE-2016-0777 - - -- Globus Toolkit Thu, 14 Jan 2016 14:26:45 -0500 - -gsi-openssh (5.7-2+gt6.@distro@) @distro@; urgency=low - - * https://globus.atlassian.net/browse/GT-492 - - -- Globus Toolkit Mon, 30 Jun 2014 13:34:35 -0400 - -gsi-openssh (5.7-1+gt6.@distro@) @distro@; urgency=low - - * Fixes for GT6 - - -- Globus Toolkit Wed, 23 Apr 2014 13:43:00 -0400 - -gsi-openssh (5.7-1+gt6.@distro@) @distro@; urgency=low - - * update to 5.7 - - -- Globus Toolkit Fri, 24 Jan 2014 10:51:35 -0500 - -gsi-openssh (5.6-1) unstable; urgency=low - - * update to 5.6 - - -- Globus Toolkit Tue, 02 Apr 2013 10:06:33 -0400 - -gsi-openssh (5.5-2) unstable; urgency=low - - * run autoconf before configuring to get updated configure macros, etc - * add dependency on pkg-config so that -ledit detection works - - -- Globus Toolkit Thu, 14 Mar 2013 11:19:39 -0400 - -gsi-openssh (5.5-1) unstable; urgency=low - - * Update to 5.5 - - -- Globus Toolkit Tue, 26 Jun 2012 18:41:36 -0400 - -gsi-openssh (5.4-1) unstable; urgency=low - - * Update to 5.4 - - -- Globus Toolkit Wed, 01 Jun 2011 20:42:22 -0400 - -gsi-openssh (5.3-0GT5.1.1a) unstable; urgency=low - - * Non-Maintainer Upload -- Update to Globus Toolkit 5.1.1 - - -- Globus Toolkit Wed, 01 Jun 2011 20:42:22 -0400 diff --git a/packaging/debian/gsi-openssh/debian/compat b/packaging/debian/gsi-openssh/debian/compat deleted file mode 100644 index ec635144f6..0000000000 --- a/packaging/debian/gsi-openssh/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/packaging/debian/gsi-openssh/debian/control b/packaging/debian/gsi-openssh/debian/control deleted file mode 100644 index 18b0656b08..0000000000 --- a/packaging/debian/gsi-openssh/debian/control +++ /dev/null @@ -1,66 +0,0 @@ -Source: gsi-openssh -Priority: optional -Maintainer: Mattias Ellert -Build-Depends: debhelper (>= 9), dh-autoreconf, libldap2-dev, zlib1g-dev, libaudit-dev, libpam-dev, libwrap0-dev, libssl-dev, libglobus-gss-assist-dev, globus-common-progs, libedit-dev, pkg-config, libglobus-gssapi-gsi-dev (>= 12.12) -Standards-Version: 3.9.2 -Section: net -Homepage: https://github.com/gridcf/gct/ - -Package: gsi-openssh -Section: net -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: GSI OpenSSH - OpenSSH is a free version of SSH (Secure SHell), a program for logging - into and executing commands on a remote machine. This package includes - the clients necessary to make encrypted connections to SSH servers. - . - This version of OpenSSH has been modified to support GSI authentication. - . - The gsi-openssh package contains: - GSI OpenSSH Common files - -Package: gsi-openssh-clients -Section: net -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: GSI OpenSSH Clients - OpenSSH is a free version of SSH (Secure SHell), a program for logging - into and executing commands on a remote machine. This package includes - the clients necessary to make encrypted connections to SSH servers. - . - This version of OpenSSH has been modified to support GSI authentication. - . - The gsi-openssh-clients package contains: - GSI OpenSSH Clients - -Package: gsi-openssh-server -Section: net -Architecture: any -Depends: gsi-openssh (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}, lsb-base (>= 3.0-6), adduser -Description: GSI OpenSSH Server - OpenSSH is a free version of SSH (Secure SHell), a program for logging - into and executing commands on a remote machine. This package contains - the secure shell daemon (sshd). The sshd daemon allows SSH clients to - securely connect to your SSH server. - . - This version of OpenSSH has been modified to support GSI authentication. - . - The gsi-openssh-server package contains: - GSI OpenSSH Server - -Package: gsi-openssh-dbg -Section: debug -Priority: optional -Architecture: any -Depends: gsi-openssh (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} -Description: GSI OpenSSH Debug Symbols - OpenSSH is a free version of SSH (Secure SHell), a program for logging - into and executing commands on a remote machine. This package contains - the secure shell daemon (sshd). The sshd daemon allows SSH clients to - securely connect to your SSH server. - . - This version of OpenSSH has been modified to support GSI authentication. - . - The gsi-openssh-dbg package contains: - GSI OpenSSH Debug Symbols diff --git a/packaging/debian/gsi-openssh/debian/copyright b/packaging/debian/gsi-openssh/debian/copyright deleted file mode 100644 index cf2b969277..0000000000 --- a/packaging/debian/gsi-openssh/debian/copyright +++ /dev/null @@ -1,348 +0,0 @@ -Name: gsi-openssh -Maintainer: Mattias Ellert -Source: http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.5p1.tar.gz - -Files: * -Copyright: Copyright (c) 1995 Tatu Ylonen , Espoo, Finland - -This file is part of the OpenSSH software. - -The licences which components of this software fall under are as -follows. First, we will summarize and say that all components -are under a BSD licence, or a licence more free than that. - -OpenSSH contains no GPL code. - -1) - * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland - * All rights reserved - * - * As far as I am concerned, the code I have written for this software - * can be used freely for any purpose. Any derived versions of this - * software must be clearly marked as such, and if the derived work is - * incompatible with the protocol description in the RFC file, it must be - * called by a name other than "ssh" or "Secure Shell". - - [Tatu continues] - * However, I am not implying to give any licenses to any patents or - * copyrights held by third parties, and the software includes parts that - * are not under my direct control. As far as I know, all included - * source code is used in accordance with the relevant license agreements - * and can be used freely for any purpose (the GNU license being the most - * restrictive); see below for details. - - [However, none of that term is relevant at this point in time. All of - these restrictively licenced software components which he talks about - have been removed from OpenSSH, i.e., - - - RSA is no longer included, found in the OpenSSL library - - IDEA is no longer included, its use is deprecated - - DES is now external, in the OpenSSL library - - GMP is no longer used, and instead we call BN code from OpenSSL - - Zlib is now external, in a library - - The make-ssh-known-hosts script is no longer included - - TSS has been removed - - MD5 is now external, in the OpenSSL library - - RC4 support has been replaced with ARC4 support from OpenSSL - - Blowfish is now external, in the OpenSSL library - - [The licence continues] - - Note that any information and cryptographic algorithms used in this - software are publicly available on the Internet and at any major - bookstore, scientific library, and patent office worldwide. More - information can be found e.g. at "http://www.cs.hut.fi/crypto". - - The legal status of this program is some combination of all these - permissions and restrictions. Use only at your own responsibility. - You will be responsible for any legal consequences yourself; I am not - making any claims whether possessing or using this is legal or not in - your country, and I am not taking any responsibility on your behalf. - - - NO WARRANTY - - BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY - FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN - OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES - PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED - OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS - TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE - PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, - REPAIR OR CORRECTION. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING - WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR - REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, - INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING - OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED - TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY - YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - POSSIBILITY OF SUCH DAMAGES. - -2) - The 32-bit CRC compensation attack detector in deattack.c was - contributed by CORE SDI S.A. under a BSD-style license. - - * Cryptographic attack detector for ssh - source code - * - * Copyright (c) 1998 CORE SDI S.A., Buenos Aires, Argentina. - * - * All rights reserved. Redistribution and use in source and binary - * forms, with or without modification, are permitted provided that - * this copyright notice is retained. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES ARE DISCLAIMED. IN NO EVENT SHALL CORE SDI S.A. BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY OR - * CONSEQUENTIAL DAMAGES RESULTING FROM THE USE OR MISUSE OF THIS - * SOFTWARE. - * - * Ariel Futoransky - * - -3) - ssh-keyscan was contributed by David Mazieres under a BSD-style - license. - - * Copyright 1995, 1996 by David Mazieres . - * - * Modification and redistribution in source and binary forms is - * permitted provided that due credit is given to the author and the - * OpenBSD project by leaving this copyright notice intact. - -4) - The Rijndael implementation by Vincent Rijmen, Antoon Bosselaers - and Paulo Barreto is in the public domain and distributed - with the following license: - - * @version 3.0 (December 2000) - * - * Optimised ANSI C code for the Rijndael cipher (now AES) - * - * @author Vincent Rijmen - * @author Antoon Bosselaers - * @author Paulo Barreto - * - * This code is hereby placed in the public domain. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -5) - One component of the ssh source code is under a 3-clause BSD license, - held by the University of California, since we pulled these parts from - original Berkeley code. - - * Copyright (c) 1983, 1990, 1992, 1993, 1995 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - -6) - Remaining components of the software are provided under a standard - 2-term BSD licence with the following names as copyright holders: - - Markus Friedl - Theo de Raadt - Niels Provos - Dug Song - Aaron Campbell - Damien Miller - Kevin Steves - Daniel Kouril - Wesley Griffin - Per Allansson - Nils Nordman - Simon Wilkinson - - Portable OpenSSH additionally includes code from the following copyright - holders, also under the 2-term BSD license: - - Ben Lindstrom - Tim Rice - Andre Lucas - Chris Adams - Corinna Vinschen - Cray Inc. - Denis Parker - Gert Doering - Jakob Schlyter - Jason Downs - Juha Yrjˆl‰ - Michael Stone - Networks Associates Technology, Inc. - Solar Designer - Todd C. Miller - Wayne Schroeder - William Jones - Darren Tucker - Sun Microsystems - The SCO Group - Daniel Walsh - Red Hat, Inc - Simon Vallet / Genoscope - - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -8) Portable OpenSSH contains the following additional licenses: - - a) md5crypt.c, md5crypt.h - - * "THE BEER-WARE LICENSE" (Revision 42): - * wrote this file. As long as you retain this - * notice you can do whatever you want with this stuff. If we meet - * some day, and you think this stuff is worth it, you can buy me a - * beer in return. Poul-Henning Kamp - - b) snprintf replacement - - * Copyright Patrick Powell 1995 - * This code is based on code written by Patrick Powell - * (papowell@astart.com) It may be used for any purpose as long as this - * notice remains intact on all source code distributions - - c) Compatibility code (openbsd-compat) - - Apart from the previously mentioned licenses, various pieces of code - in the openbsd-compat/ subdirectory are licensed as follows: - - Some code is licensed under a 3-term BSD license, to the following - copyright holders: - - Todd C. Miller - Theo de Raadt - Damien Miller - Eric P. Allman - The Regents of the University of California - Constantin S. Svintsoff - - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - - Some code is licensed under an ISC-style license, to the following - copyright holders: - - Internet Software Consortium. - Todd C. Miller - Reyk Floeter - Chad Mynhier - - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE - * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - Some code is licensed under a MIT-style license to the following - copyright holders: - - Free Software Foundation, Inc. - - * Permission is hereby granted, free of charge, to any person obtaining a * - * copy of this software and associated documentation files (the * - * "Software"), to deal in the Software without restriction, including * - * without limitation the rights to use, copy, modify, merge, publish, * - * distribute, distribute with modifications, sublicense, and/or sell * - * copies of the Software, and to permit persons to whom the Software is * - * furnished to do so, subject to the following conditions: * - * * - * The above copyright notice and this permission notice shall be included * - * in all copies or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * - * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * - * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * * - * Except as contained in this notice, the name(s) of the above copyright * - * holders shall not be used in advertising or otherwise to promote the * - * sale, use or other dealings in this Software without prior written * - * authorization. * - ****************************************************************************/ - - ------- -$OpenBSD: LICENCE,v 1.19 2004/08/30 09:18:08 markus Exp $ - diff --git a/packaging/debian/gsi-openssh/debian/gsi-openssh-clients.install b/packaging/debian/gsi-openssh/debian/gsi-openssh-clients.install deleted file mode 100644 index 9979a9fe94..0000000000 --- a/packaging/debian/gsi-openssh/debian/gsi-openssh-clients.install +++ /dev/null @@ -1,16 +0,0 @@ -debian/tmp/etc/gsissh/ssh_config -debian/tmp/usr/bin/gsiscp -debian/tmp/usr/bin/gsisftp -debian/tmp/usr/bin/gsissh -debian/tmp/usr/bin/gsissh-add -debian/tmp/usr/bin/gsissh-agent -debian/tmp/usr/bin/gsissh-keyscan -debian/tmp/usr/lib/gsissh/ssh-pkcs11-helper -debian/tmp/usr/share/man/man1/gsiscp.1 -debian/tmp/usr/share/man/man1/gsisftp.1 -debian/tmp/usr/share/man/man1/gsissh.1 -debian/tmp/usr/share/man/man1/gsissh-add.1 -debian/tmp/usr/share/man/man1/gsissh-agent.1 -debian/tmp/usr/share/man/man1/gsissh-keyscan.1 -debian/tmp/usr/share/man/man5/gsissh_config.5 -debian/tmp/usr/share/man/man8/gsissh-pkcs11-helper.8 diff --git a/packaging/debian/gsi-openssh/debian/gsi-openssh-server.init b/packaging/debian/gsi-openssh/debian/gsi-openssh-server.init deleted file mode 100755 index 17b0fa6f98..0000000000 --- a/packaging/debian/gsi-openssh/debian/gsi-openssh-server.init +++ /dev/null @@ -1,274 +0,0 @@ -#!/bin/bash -# -# gsisshd Start up the GSI OpenSSH server daemon -# -# chkconfig: - 55 25 -# description: SSH is a protocol for secure remote shell access. \ -# This service starts up the OpenSSH server daemon. -# -# processname: gsisshd -# config: /etc/gsissh/ssh_host_key -# config: /etc/gsissh/ssh_host_key.pub -# config: /etc/gsissh/ssh_random_seed -# config: /etc/gsissh/sshd_config -# pidfile: /var/run/gsisshd.pid - -### BEGIN INIT INFO -# Provides: gsisshd -# Required-Start: $local_fs $network $syslog -# Required-Stop: $local_fs $syslog -# Should-Start: $syslog -# Should-Stop: $network $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start up the GSI OpenSSH server daemon -# Description: SSH is a protocol for secure remote shell access. -# This service starts up the GSI OpenSSH server daemon. -### END INIT INFO - -# source function library -. /lib/lsb/init-functions - -RETVAL=0 -prog="gsisshd" -lockfile=/var/lock/subsys/$prog - -KEYGEN=/usr/bin/gsissh-keygen -SSHD=/usr/sbin/gsisshd -RSA1_KEY=/etc/gsissh/ssh_host_key -RSA_KEY=/etc/gsissh/ssh_host_rsa_key -DSA_KEY=/etc/gsissh/ssh_host_dsa_key -ECDSA_KEY=/etc/gsissh/ssh_host_ecdsa_key -ED25519_KEY=/etc/gsissh/ssh_host_ed25519_key -PID_FILE=/var/run/gsisshd.pid - -# pull in default settings -[ -f /etc/default/gsi-openssh-server ] && . /etc/default/gsi-openssh-server - -runlevel=$(set -- $(runlevel); eval "echo \$$#" ) - -do_rsa1_keygen() { - if [ ! -s $RSA1_KEY ]; then - rm -f $RSA1_KEY - if test ! -f $RSA1_KEY && $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' > /dev/null 2>&1; then - chmod 600 $RSA1_KEY - chmod 644 $RSA1_KEY.pub - if [ -x /sbin/restorecon ]; then - /sbin/restorecon $RSA1_KEY.pub - fi - log_success_msg "SSH1 RSA key generation" - else - log_failure_msg "SSH1 RSA key generation" - exit 1 - fi - fi -} - -do_rsa_keygen() { - if [ ! -s $RSA_KEY ]; then - rm -f $RSA_KEY - if test ! -f $RSA_KEY && $KEYGEN -q -t rsa -f $RSA_KEY -C '' -N '' >/dev/null 2>&1; then - chmod 600 $RSA_KEY - chmod 644 $RSA_KEY.pub - if [ -x /sbin/restorecon ]; then - /sbin/restorecon $RSA_KEY.pub - fi - log_success_msg "SSH2 RSA key generation" - echo - else - log_failure_msg "SSH2 RSA key generation" - echo - exit 1 - fi - fi -} - -do_dsa_keygen() { - if [ ! -s $DSA_KEY ]; then - rm -f $DSA_KEY - if test ! -f $DSA_KEY && $KEYGEN -q -t dsa -f $DSA_KEY -C '' -N '' >/dev/null 2>&1; then - chmod 600 $DSA_KEY - chmod 644 $DSA_KEY.pub - if [ -x /sbin/restorecon ]; then - /sbin/restorecon $DSA_KEY.pub - fi - log_success_msg "SSH2 DSA key generation" - echo - else - log_failure_msg "SSH2 DSA key generation" - echo - exit 1 - fi - fi -} - -do_ecdsa_keygen() { - if [ ! -s $ECDSA_KEY ]; then - rm -f $ECDSA_KEY - if test ! -f $ECDSA_KEY && $KEYGEN -q -t ecdsa -f $ECDSA_KEY -C '' -N '' >/dev/null 2>&1; then - chmod 600 $ECDSA_KEY - chmod 644 $ECDSA_KEY.pub - if [ -x /sbin/restorecon ]; then - /sbin/restorecon $ECDSA_KEY.pub - fi - log_success_msg "SSH2 ECDSA key generation" - echo - else - log_failure_msg "SSH2 ECDSA key generation" - echo - exit 1 - fi - fi - -} - -do_ed25519_keygen() { - if [ ! -s $ED25519_KEY ]; then - rm -f $ED25519_KEY - if test ! -f $ED25519_KEY && $KEYGEN -q -t ed25519 -f $ED25519_KEY -C '' -N '' >/dev/null 2>&1; then - chmod 600 $ED25519_KEY - chmod 644 $ED25519_KEY.pub - if [ -x /sbin/restorecon ]; then - /sbin/restorecon $ED25519_KEY.pub - fi - log_success_msg "SSH2 ED25519 key generation" - echo - else - log_failure_msg "SSH2 ED25519 key generation" - echo - exit 1 - fi - fi - -} - -do_restart_sanity_check() -{ - $SSHD -t - RETVAL=$? - if [ $RETVAL -ne 0 ]; then - log_failure_msg "Configuration file or keys are invalid" - echo - fi -} - -start() -{ - [ -x $SSHD ] || exit 5 - [ -f /etc/gsissh/sshd_config ] || exit 6 - # Create keys if necessary - # - Not necessary if running with keyex only - if [ "x${AUTOCREATE_SERVER_KEYS}" != xNO ]; then - do_rsa_keygen - if [ "x${AUTOCREATE_SERVER_KEYS}" != xRSAONLY ]; then - #do_rsa1_keygen - do_dsa_keygen - do_ecdsa_keygen - do_ed25519_keygen - fi - fi - - start_daemon -p /var/run/gsisshd.pid $SSHD $OPTIONS - RETVAL=$? - if [ $RETVAL -eq 0 ]; then - log_success_msg "Started $SSHD" - else - log_failure_msg "Failed to start $SSHD" - fi - return $RETVAL -} - -stop() -{ - killproc $SSHD - RETVAL=$? - # if we are in halt or reboot runlevel kill all running sessions - # so the TCP connections are closed cleanly - if [ "x$runlevel" = x0 -o "x$runlevel" = x6 ] ; then - trap '' TERM - killall $prog 2>/dev/null - trap TERM - fi - if [ $RETVAL -eq 0 ]; then - log_success_msg "Stopped $SSHD" - else - log_failure_msg "Failed to stop $SSHD" - fi - return $RETVAL -} - -reload() -{ - killproc $SSHD -HUP - RETVAL=$? - if [ $RETVAL -eq 0 ]; then - log_success_msg "Reloaded $prog" - else - log_failure_msg "Failed to reload $prog" - fi - - return $RETVAL -} - -restart() { - stop - start -} - -force_reload() { - restart -} - -rh_status() { - status_of_proc -p "$PID_FILE" "$SSHD" $prog -} - -rh_status_q() { - pidofproc -p "$PID_FILE" "$SSHD" > /dev/null -} - -case "$1" in - start) - rh_status_q && exit 0 - start - ;; - stop) - if ! rh_status_q; then - exit 0 - fi - stop - ;; - restart) - restart - ;; - reload) - rh_status_q || exit 7 - reload - ;; - force-reload) - force_reload - ;; - condrestart|try-restart) - rh_status_q || exit 0 - do_restart_sanity_check - if [ $RETVAL -eq 0 ] ; then - stop - # avoid race - sleep 3 - start - else - RETVAL=6 - fi - ;; - status) - rh_status - RETVAL=$? - if [ $RETVAL -eq 3 ] ; then - RETVAL=2 - fi - ;; - *) - echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" - RETVAL=2 -esac -exit $RETVAL diff --git a/packaging/debian/gsi-openssh/debian/gsi-openssh-server.install b/packaging/debian/gsi-openssh/debian/gsi-openssh-server.install deleted file mode 100644 index 790c254a06..0000000000 --- a/packaging/debian/gsi-openssh/debian/gsi-openssh-server.install +++ /dev/null @@ -1,10 +0,0 @@ -debian/tmp/etc/pam.d/gsissh -debian/tmp/etc/gsissh/sshd_config -debian/tmp/var/empty/gsisshd -debian/tmp/usr/share/man/man5/gsisshd_config.5 -debian/tmp/usr/share/man/man5/gsimoduli.5 -debian/tmp/usr/share/man/man8/gsisftp-server.8 -debian/tmp/usr/share/man/man8/gsisshd.8 -debian/tmp/usr/sbin/gsisshd -debian/tmp/usr/lib/gsissh/sftp-server - diff --git a/packaging/debian/gsi-openssh/debian/gsi-openssh-server.postinst b/packaging/debian/gsi-openssh/debian/gsi-openssh-server.postinst deleted file mode 100644 index 1b0e90a6ed..0000000000 --- a/packaging/debian/gsi-openssh/debian/gsi-openssh-server.postinst +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -set -e - -setup_sshd_user() { - if ! getent passwd sshd >/dev/null; then - adduser --quiet --system --no-create-home --home /var/run/sshd --shell /usr/sbin/nologin sshd - fi -} - -if [ "$1" = configure ]; then - setup_sshd_user -fi - -#DEBHELPER# diff --git a/packaging/debian/gsi-openssh/debian/gsi-openssh.install b/packaging/debian/gsi-openssh/debian/gsi-openssh.install deleted file mode 100644 index 0f6be2d87e..0000000000 --- a/packaging/debian/gsi-openssh/debian/gsi-openssh.install +++ /dev/null @@ -1,5 +0,0 @@ -debian/tmp/etc/gsissh/moduli -debian/tmp/usr/bin/gsissh-keygen -debian/tmp/usr/lib/gsissh/ssh-keysign -debian/tmp/usr/share/man/man1/gsissh-keygen.1 -debian/tmp/usr/share/man/man8/gsissh-keysign.8 diff --git a/packaging/debian/gsi-openssh/debian/patches/hpn-14.13-isshd.v3.19.1.patch b/packaging/debian/gsi-openssh/debian/patches/hpn-14.13-isshd.v3.19.1.patch deleted file mode 100644 index 095a56f09f..0000000000 --- a/packaging/debian/gsi-openssh/debian/patches/hpn-14.13-isshd.v3.19.1.patch +++ /dev/null @@ -1,3085 +0,0 @@ -diff --git a/Makefile.in b/Makefile.in -index d99e53a..9ceaf56 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -92,10 +92,11 @@ LIBSSH_OBJS=${LIBOPENSSH_OBJS} \ - kex.o kexdh.o kexgex.o kexecdh.o kexc25519.o \ - kexdhc.o kexgexc.o kexecdhc.o kexc25519c.o \ - kexdhs.o kexgexs.o kexecdhs.o kexc25519s.o \ -- platform-pledge.o platform-tracing.o -+ platform-pledge.o platform-tracing.o modp_burl.o nersc.o - - SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \ -- sshconnect.o sshconnect1.o sshconnect2.o mux.o -+ sshconnect.o sshconnect1.o sshconnect2.o mux.o \ -+ modp_burl.o nersc.o - - SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o \ - audit.o audit-bsm.o audit-linux.o platform.o \ -@@ -109,7 +110,7 @@ SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o \ - loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \ - sftp-server.o sftp-common.o \ - sandbox-null.o sandbox-rlimit.o sandbox-systrace.o sandbox-darwin.o \ -- sandbox-seccomp-filter.o sandbox-capsicum.o sandbox-pledge.o \ -+ sandbox-seccomp-filter.o sandbox-capsicum.o sandbox-pledge.o modp_burl.o nersc.o \ - sandbox-solaris.o - - 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 -diff --git a/TODO b/TODO -index f22c7e2..ab0c170 100644 ---- a/TODO -+++ b/TODO -@@ -1,4 +1,4 @@ --Documentation: -+Documentation: - - - Update the docs - - Update README -diff --git a/auth.c b/auth.c -index 6ee6116..a3fea79 100644 ---- a/auth.c -+++ b/auth.c -@@ -83,6 +83,14 @@ extern int use_privsep; - extern Buffer loginmsg; - extern struct passwd *privsep_pw; - -+#ifdef NERSC_MOD -+#include "nersc.h" -+#include -+extern int client_session_id; -+extern char n_ntop[NI_MAXHOST]; -+extern char n_port[NI_MAXHOST]; -+#endif -+ - /* Debugging messages */ - Buffer auth_debug; - int auth_debug_init; -@@ -322,6 +330,19 @@ auth_log(Authctxt *authctxt, int authenticated, int partial, - free(authctxt->info); - authctxt->info = NULL; - -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(authctxt->user, strlen(authctxt->user) ); -+ char* t2buf = encode_string(method, strlen(method) ); -+ char* t3buf = encode_string(authmsg, strlen(authmsg) ); -+ -+ s_audit("auth_info_3", "count=%i uristring=%s uristring=%s uristring=%s addr=%.200s port=%d/tcp addr=%s port=%s/tcp", -+ client_session_id, t3buf, t1buf, t2buf, ssh_remote_ipaddr(ssh), ssh_remote_port(ssh), n_ntop, -+ n_port); -+ free(t1buf); -+ free(t2buf); -+ free(t3buf); -+#endif -+ - #ifdef CUSTOM_FAILED_LOGIN - if (authenticated == 0 && !authctxt->postponed && - (strcmp(method, "password") == 0 || -@@ -665,6 +686,13 @@ getpwnamallow(const char *user) - record_failed_login(user, - auth_get_canonical_hostname(ssh, options.use_dns), "ssh"); - #endif -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(user, strlen(user)); -+ s_audit("auth_invalid_user_3", "count=%i uristring=%s", client_session_id, t1buf); -+ free(t1buf); -+#endif -+ - #ifdef SSH_AUDIT_EVENTS - audit_event(SSH_INVALID_USER); - #endif /* SSH_AUDIT_EVENTS */ -diff --git a/auth2-passwd.c b/auth2-passwd.c -index b638e87..ba38dc7 100644 ---- a/auth2-passwd.c -+++ b/auth2-passwd.c -@@ -44,6 +44,15 @@ - #include "misc.h" - #include "servconf.h" - -+#ifdef NERSC_MOD -+ -+#include -+#include -+ -+#include "nersc.h" -+extern int client_session_id; -+#endif -+ - /* import */ - extern ServerOptions options; - -@@ -69,6 +78,33 @@ userauth_passwd(Authctxt *authctxt) - logit("password change not supported"); - else if (PRIVSEP(auth_password(authctxt, password)) == 1) - authenticated = 1; -+ -+#ifdef NERSC_MOD -+ const EVP_MD *evp_md = EVP_sha1(); -+ EVP_MD_CTX ctx; -+ u_char digest[EVP_MAX_MD_SIZE]; -+ u_int dlen; -+ -+ char* t1buf = encode_string(authctxt->user, strlen(authctxt->user)); -+ -+ EVP_DigestInit(&ctx, evp_md); -+ EVP_DigestUpdate(&ctx, password, strlen(password)); -+ EVP_DigestFinal(&ctx, digest, &dlen); -+ -+#ifdef PASSWD_REC -+ char* t2buf = encode_string(password, strlen(password)); -+#else -+ char* t2buf = encode_string(digest, dlen); -+#endif -+ -+ s_audit("auth_pass_attempt_3", "count=%i uristring=%s uristring=%s", -+ client_session_id, t1buf, t2buf); -+ -+ free(t1buf); -+ free(t2buf); -+ -+#endif -+ - explicit_bzero(password, len); - free(password); - return authenticated; -diff --git a/auth2-pubkey.c b/auth2-pubkey.c -index 3e5706f..b997e2d 100644 ---- a/auth2-pubkey.c -+++ b/auth2-pubkey.c -@@ -69,6 +69,11 @@ - #include "channels.h" /* XXX for session.h */ - #include "session.h" /* XXX for child_set_env(); refactor? */ - -+#ifdef NERSC_MOD -+#include "nersc.h" -+extern int client_session_id; -+#endif -+ - /* import */ - extern ServerOptions options; - extern u_char *session_id2; -@@ -862,6 +867,18 @@ check_authkeys_file(FILE *f, char *file, Key* key, struct passwd *pw) - continue; - debug("matching key found: file %s, line %lu %s %s", - file, linenum, key_type(found), fp); -+ -+#ifdef NERSC_MOD -+ char* t1key = encode_string(fp, strlen(fp)); -+ char* t2key = encode_string(key_type(found), strlen(key_type(found)) ); -+ -+ s_audit("auth_key_fingerprint_3", "count=%i uristring=%s uristring=%s", -+ client_session_id, t1key, t2key); -+ -+ free(t1key); -+ free(t2key); -+#endif -+ - free(fp); - found_key = 1; - continue; -diff --git a/auth2.c b/auth2.c -index 8c65ca6..1c4ffe1 100644 ---- a/auth2.c -+++ b/auth2.c -@@ -56,6 +56,11 @@ - #endif - #include "monitor_wrap.h" - -+#ifdef NERSC_MOD -+#include "nersc.h" -+extern int client_session_id; -+#endif -+ - /* import */ - extern ServerOptions options; - extern u_char *session_id2; -diff --git a/channels.c b/channels.c -index e400e80..b1aa065 100644 ---- a/channels.c -+++ b/channels.c -@@ -83,6 +83,24 @@ - #include "authfd.h" - #include "pathnames.h" - -+#ifdef NERSC_MOD -+#include -+#include -+#include "nersc.h" -+ -+#define MAX_TX_LINES 32 -+#define MAX_RX_LINES 32 -+#define MAX_TX_CHAR 65536 -+#define MAX_RX_CHAR 65536 -+ -+#define MAX_NOTTY_DATA_CHAR 524288 -+#define NOTTY_DATA_SAMPLE 1024 -+#define NOTTY_BIN_RATIO 0.3 /* this is the percent of binary characters allowed in stream */ -+ -+regex_t re; -+extern int client_session_id; -+#endif /* NERSC_MOD */ -+ - /* -- channel core */ - - /* -@@ -379,8 +397,40 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, - c->mux_ctx = NULL; - c->mux_pause = 0; - c->delayed = 1; /* prevent call to channel_post handler */ -+ -+#ifdef NERSC_MOD -+ buffer_init(&c->rx_line_buf); -+ buffer_init(&c->tx_line_buf); -+ c->audit_enable = 1; -+ -+ c->max_tx_lines = MAX_TX_LINES; -+ c->max_rx_lines = MAX_RX_LINES; -+ c->max_tx_char = MAX_TX_CHAR; -+ c->max_rx_char = MAX_RX_CHAR; -+ c->tx_lines_sent = 0; -+ c->rx_lines_sent = 0; -+ c->tx_bytes_sent = 0; -+ c->rx_bytes_sent = 0; -+ c->tx_bytes_skipped = 0; -+ c->rx_bytes_skipped = 0; -+ c->rx_passwd_flag = 0; -+ if ( regcomp(&re, "pass(word|phrase| phrase|code)", REG_ICASE|REG_NOSUB|REG_EXTENDED) !=0 ) { -+ error("pw regex failed to compile."); -+ /* disable */ -+ c->audit_enable = 0; -+ } -+#endif -+ - TAILQ_INIT(&c->status_confirms); - debug("channel %d: new [%s]", found, remote_name); -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(remote_name, strlen(remote_name)); -+ s_audit("channel_new_3", "count=%i count=%d count=%i uristring=%s", -+ client_session_id, found, type, t1buf); -+ free(t1buf); -+#endif -+ - return c; - } - -@@ -483,6 +533,13 @@ channel_free(Channel *c) - } - - s = channel_open_message(); -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(c->remote_name ? c->remote_name : "???", strlen(c->remote_name ? c->remote_name : "???")); -+ s_audit("channel_free_3", "count=%i count=%i uristring=%s", client_session_id, c->self, t1buf); -+ free(t1buf); -+#endif -+ - debug3("channel %d: status: %s", c->self, s); - free(s); - -@@ -492,6 +549,12 @@ channel_free(Channel *c) - buffer_free(&c->input); - buffer_free(&c->output); - buffer_free(&c->extended); -+ -+#ifdef NERSC_MOD -+ buffer_free(&c->rx_line_buf); -+ buffer_free(&c->tx_line_buf); -+#endif -+ - free(c->remote_name); - c->remote_name = NULL; - free(c->path); -@@ -1236,6 +1299,17 @@ channel_decode_socks4(Channel *c, fd_set *readset, fd_set *writeset) - debug2("channel %d: dynamic request: socks4 host %s port %u command %u", - c->self, c->path, c->host_port, s4_req.command); - -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(c->path, strlen(c->path)); -+ char* t2buf = encode_string(username, strlen(username)); -+ -+ s_audit("channel_socks4_3", "count=%i count=%i uristring=%s port=%i/tcp count=%i uristring=%s", -+ client_session_id, c->self, t1buf, c->host_port, s4_req.command, t2buf); -+ -+ free(t1buf); -+ free(t2buf); -+#endif -+ - if (s4_req.command != 1) { - debug("channel %d: cannot handle: %s cn %d", - c->self, need == 1 ? "SOCKS4" : "SOCKS4A", s4_req.command); -@@ -1362,6 +1436,15 @@ channel_decode_socks5(Channel *c, fd_set *readset, fd_set *writeset) - debug2("channel %d: dynamic request: socks5 host %s port %u command %u", - c->self, c->path, c->host_port, s5_req.command); - -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(c->path, strlen(c->path)); -+ -+ s_audit("channel_socks5_3", "count=%i count=%i uristring=%s port=%i/tcp count=%i", -+ client_session_id, c->self, t1buf, c->host_port, s5_req.command); -+ -+ free(t1buf); -+#endif -+ - s5_rsp.version = 0x05; - s5_rsp.command = SSH_SOCKS5_SUCCESS; - s5_rsp.reserved = 0; /* ignored */ -@@ -1529,6 +1612,19 @@ port_open_helper(Channel *c, char *rtype) - rtype, c->listening_port, c->path, c->host_port, - remote_ipaddr, remote_port, local_ipaddr, local_port); - -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(rtype, strlen(rtype)); -+ char* t2buf = encode_string(c->path, strlen(c->path)); -+ char* t3buf = encode_string(remote_ipaddr, strlen(remote_ipaddr)); -+ -+ s_audit("channel_port_open_3", "count=%i count=%i uristring=%s port=%d/tcp uristring=%s port=%d/tcp uristring=%s port=%i/tcp", -+ client_session_id, c->self, t1buf, c->listening_port, t2buf, c->host_port, t3buf, remote_port); -+ -+ free(t1buf); -+ free(t2buf); -+ free(t3buf); -+#endif -+ - free(c->remote_name); - c->remote_name = xstrdup(buf); - -@@ -1649,6 +1745,17 @@ channel_post_port_listener(Channel *c, fd_set *readset, fd_set *writeset) - if (c->path != NULL) - nc->path = xstrdup(c->path); - -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(c->path, strlen(c->path)); -+ char* t2buf = encode_string(rtype, strlen(rtype)); -+ -+ s_audit("channel_post_fwd_listener_3", "count=%i count=%i port=%d/tcp uristring=%s port=%d/tcp uristring=%s", -+ client_session_id, c->self, c->listening_port, t1buf, c->host_port, t2buf); -+ -+ free(t1buf); -+ free(t2buf); -+#endif -+ - if (nextstate != SSH_CHANNEL_DYNAMIC) - port_open_helper(nc, rtype); - } -@@ -1797,6 +1904,78 @@ channel_handle_rfd(Channel *c, fd_set *readset, fd_set *writeset) - } - } else if (c->datagram) { - buffer_put_string(&c->input, buf, len); -+#ifdef NERSC_MOD -+ /* this section for filtering unwanted data */ -+ if ( !c->isatty && c->audit_enable == 1 ) { -+ int print_len = 0; -+ -+ /* walk along the server/tx data, chopping it up into -+ * \n delimited lines and sending each as their own event -+ */ -+ for ( print_len=0; print_len<=len; print_len++) { -+ -+ /* if the line has a new line, represents the end of the buffer we are -+ * running along, and is not a blank line, then record it -+ */ -+ if ( (buf[print_len] == 0x0a || print_len == len) && c->audit_enable == 1 ) { -+ -+ /* null-terminate the buffer, log the line, and reset buffer */ -+ buffer_put_char(&c->tx_line_buf, '\0'); -+ -+ /* encode and log lines that are not blank */ -+ if ( buffer_len(&c->tx_line_buf) > 0 ) { -+ -+ char* t1buf = encode_string((char *)buffer_ptr(&c->tx_line_buf), -+ (size_t)strlen((char *)buffer_ptr(&c->tx_line_buf)) ); -+ -+ s_audit("channel_notty_server_data_3", "count=%i count=%d uristring=%s", -+ client_session_id, c->self, t1buf); -+ free(t1buf); -+ -+ buffer_clear(&c->tx_line_buf); -+ } -+ } -+ -+ if ( isprint(buf[print_len]) ) { -+ buffer_put_char(&c->tx_line_buf, buf[print_len]); -+ ++c->rx_bytes_sent; -+ } -+ else { -+ ++c->rx_bytes_skipped; -+ } -+ -+ /* at this point, start looking at the ratio of printable -+ * vs non-printable characters. Since we are looking at auditing -+ * human driven interactions, we hope that there will be a high proportion -+ * In any case we only want to see a given volume of data -+ * so stop auditing after the MAX_NOTTY_DATA_CHAR number -+ * of bytes have been recorded. -+ */ -+ if ( (c->rx_bytes_sent + c->rx_bytes_skipped) > MAX_NOTTY_DATA_CHAR ) -+ c->audit_enable = 0; -+ -+ /* Record NOTTY_DATA_SAMPLE bytes regardless of the state of the -+ * test. The ifprint() should keep the worst of the binary crud -+ * out of the buffer. After NOTTY_DATA_SAMPLE bytes, start testing -+ * for too much binary goo. -+ */ -+ if ( (c->rx_bytes_sent + c->rx_bytes_skipped) > NOTTY_DATA_SAMPLE ) { -+ if ( c->rx_bytes_sent > 0 ) { -+ -+ if ( c->audit_enable == 1 && ( -+ (c->rx_bytes_skipped/c->rx_bytes_sent) > NOTTY_BIN_RATIO) ) { -+ c->audit_enable = 0; -+ -+ s_audit("channel_notty_analysis_disable_3", "count=%i count=%i int=%i int=%i", -+ client_session_id, c->self, c->rx_bytes_skipped,c->rx_bytes_sent); -+ } -+ } -+ } -+ } /* end ptr traversal loop */ -+ -+ } -+#endif -+ - } else { - buffer_append(&c->input, buf, len); - } -@@ -1857,6 +2036,83 @@ channel_handle_wfd(Channel *c, fd_set *readset, fd_set *writeset) - #endif - - len = write(c->wfd, buf, dlen); -+ -+#ifdef NERSC_MOD -+ /* this section for filtering unwanted data */ -+ if ( !c->isatty && c->audit_enable == 1 ) { -+ int print_len = 0; -+ -+ /* walk along the client/tx data, chopping it up into -+ * \n delimited lines and sending each as their own event -+ */ -+ for ( print_len=0; print_lenaudit_enable == 1 ) { -+ -+ /* null-terminate the buffer, log the line, and reset buffer */ -+ buffer_put_char(&c->rx_line_buf, '\0'); -+ -+ /* encode and log lines that are not blank */ -+ if ( buffer_len(&c->rx_line_buf) > 1 ) { -+ -+ char* t1buf = encode_string((char *)buffer_ptr(&c->rx_line_buf), -+ (size_t)strlen((char *)buffer_ptr(&c->rx_line_buf)) ); -+ -+ s_audit("channel_notty_client_data_3", "count=%i count=%d uristring=%s", -+ client_session_id, c->self, t1buf); -+ -+ free(t1buf); -+ -+ buffer_clear(&c->rx_line_buf); -+ } -+ } -+ -+ if ( isprint( (char)buf[print_len]) ) { -+ -+ buffer_put_char(&c->rx_line_buf, (char)buf[print_len]); -+ ++c->rx_bytes_sent; -+ } -+ else { -+ ++c->rx_bytes_skipped; -+ } -+ -+ /* At this point, start looking at the ratio of printable -+ * vs non-printable characters. Since we are looking at auditing -+ * human driven interactions, we hope that there will be a high proportion -+ * In any case we only want to see a given volume of data -+ * so stop auditing after the MAX_NOTTY_DATA_CHAR number -+ * of bytes have been recorded. -+ */ -+ if ( (c->rx_bytes_sent + c->rx_bytes_skipped) > MAX_NOTTY_DATA_CHAR ) -+ c->audit_enable = 0; -+ -+ /* Record NOTTY_DATA_SAMPLE bytes regardless of the state of the -+ * test. The ifprint() should keep the worst of the binary crud -+ * out of the buffer. After NOTTY_DATA_SAMPLE bytes, start testing -+ * for too much binary goo. -+ */ -+ if ( (c->rx_bytes_sent + c->rx_bytes_skipped) > NOTTY_DATA_SAMPLE ) { -+ -+ if ( c->rx_bytes_sent > 0 ) { -+ -+ if ( c->audit_enable == 1 && ( -+ (c->rx_bytes_skipped/c->rx_bytes_sent) > NOTTY_BIN_RATIO) ) { -+ c->audit_enable = 0; -+ -+ s_audit("channel_notty_analysis_disable_3", "count=%i count=%i int=%i int=%i", -+ client_session_id, c->self, c->rx_bytes_skipped,c->rx_bytes_sent); -+ } -+ -+ } -+ } -+ } /* end ptr traversal loop */ -+ } -+#endif -+ - if (len < 0 && - (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)) - return 1; -@@ -2414,6 +2670,84 @@ channel_output_poll(void) - } - } - if (len > 0) { -+ -+#ifdef NERSC_MOD -+ /* monitor ssh server w/ tty on channel end */ -+ if ( !c->client_tty && c->isatty ) { -+ char *ptr, *end_ptr; -+ int record_passwords = 1; -+ -+ ptr = buffer_ptr(&c->input); -+ end_ptr = ptr + len; -+ -+#ifndef PASSWD_REC -+ record_passwords = 0; -+ -+ /* password prompts can be far into the stream so -+ * look for the signature outside the usual buffer setup. -+ */ -+ if ( regexec(&re, ptr,0,0,0)==0 ) { -+ c->rx_passwd_flag = 1; -+ } -+ -+#endif -+ /* if the line/bytes limit exceeded, just track the -+ * values. Large chunks of data can then be skipped. -+ */ -+ -+ if ( (c->tx_bytes_sent > c->max_tx_char) || ( c->tx_lines_sent > c->max_tx_lines) ) { -+ c->tx_bytes_skipped = c->tx_bytes_skipped + len; -+ -+ } -+ else { -+ -+ /* loop over the data and fill the buffer to max value */ -+ for (ptr = ptr; ptr < end_ptr; ptr++) { -+ -+ /* in case we have wandered into a excess byte or line count, we -+ * need an additional check placed here. -+ */ -+ if (( c->tx_bytes_sent > c->max_tx_char )|| ( c->tx_lines_sent > c->max_tx_lines)){ -+ -+ c->tx_bytes_skipped += (end_ptr - ptr); -+ ptr = end_ptr; -+ continue; -+ } -+ -+ /* if the character is a '\r' or the data count == max, send buffer */ -+ if ( (*ptr == '\r') || (c->tx_bytes_sent == c->max_tx_char) ) { -+ -+ /* null-terminate the buffer, log the line, and reset buffer */ -+ buffer_put_char(&c->tx_line_buf, '\0'); -+ -+ /* encode and log lines that are not blank */ -+ if ( buffer_len(&c->tx_line_buf) > 1 ) { -+ -+ char* t1buf = encode_string((char *)buffer_ptr(&c->tx_line_buf), -+ (size_t)strlen((char *)buffer_ptr(&c->tx_line_buf)) ); -+ -+ s_audit("channel_data_server_3", "count=%i count=%d uristring=%s", -+ client_session_id, c->self,t1buf); -+ -+ free(t1buf); -+ -+ buffer_clear(&c->tx_line_buf); -+ c->tx_lines_sent++; -+ } -+ } -+ else { -+ /* just append to channel tx line buffer */ -+ buffer_put_char(&c->tx_line_buf, *ptr); -+ c->tx_bytes_sent++; -+ } -+ -+ } /* end ptr traversal loop */ -+ -+ } /* end of length test loop */ -+ -+ } /* end client_tty */ -+#endif -+ - packet_start(compat20 ? - SSH2_MSG_CHANNEL_DATA : SSH_MSG_CHANNEL_DATA); - packet_put_int(c->remote_id); -@@ -2802,6 +3136,106 @@ channel_input_data(int type, u_int32_t seq, void *ctxt) - else - buffer_append(&c->output, data, data_len); - packet_check_eom(); -+ -+#ifdef NERSC_MOD -+ /* monitor ssh server w/ tty on channel end */ -+ if (!c->client_tty && c->isatty ) { -+ -+ u_char *ptr, *end_ptr; -+ end_ptr = data + data_len; -+ -+ /* If we have skipped data, log it now then reset the whole tx buffer -+ * since we take the existance of client activity as an indication -+ * that there may be life at the end of the tty... -+ * -+ * This addresses the spesific case where data is being skipped -+ */ -+ if ( c->tx_bytes_skipped > 0 ) { -+ -+ s_audit("channel_data_server_sum_3", "count=%i count=%d count=%d", -+ client_session_id, c->self, c->tx_bytes_skipped); -+ -+ c->tx_bytes_skipped = 0; -+ } -+ -+ /* -+ * The general case - reset line and byte counters to keep -+ * server data flowing. -+ */ -+ c->tx_lines_sent = 0; -+ c->tx_bytes_sent = 0; -+ -+ /* Skip data if the line/bytes limit exceeded */ -+ if ( (c->rx_bytes_sent > c->max_rx_char) || ( c->rx_lines_sent > c->max_rx_lines) ) { -+ c->rx_bytes_skipped = c->rx_bytes_skipped + data_len; -+ } -+ else { -+ -+ for (ptr = data; ptr < end_ptr; ptr++) { -+ -+ /* need an additional check placed here for excess byte/line count */ -+ if (( c->rx_bytes_sent > c->max_rx_char )|| ( c->rx_lines_sent > c->max_rx_lines)){ -+ -+ c->rx_bytes_skipped += (end_ptr - ptr); -+ ptr = end_ptr; -+ continue; -+ } -+ -+ if (*ptr == '\r') { -+ -+ /* skip blank lines */ -+ if (buffer_len(&c->rx_line_buf) == 0) -+ continue; -+ -+ /* null terminate buffer */ -+ buffer_put_char(&c->rx_line_buf, '\0'); -+ -+ /* the received line is a password prompt reply -+ * if --with-passwdrec is enabled at configure time -+ * this section of code will never be reached */ -+ -+ if (c->rx_passwd_flag == 1) { -+ -+ s_audit("channel_data_client_3", "count=%i count=%d uristring=%s", -+ client_session_id, c->self, "PASSWD-FLAG-SKIP"); -+ -+ /* this additional event helps identify problems with the pass-skip */ -+ s_audit("channel_pass_skip_3", "count=%i count=%d", -+ client_session_id, c->self); -+ -+ c->rx_passwd_flag = 0; -+ } -+ else { -+ -+ /* send the client data */ -+ char* t1buf = encode_string((char *)buffer_ptr(&c->rx_line_buf), -+ (size_t)strlen((char *)buffer_ptr(&c->rx_line_buf))); -+ -+ s_audit("channel_data_client_3", "count=%i count=%d uristring=%s", -+ client_session_id, c->self, t1buf); -+ -+ free(t1buf); -+ } -+ -+ /* reset rx line buffer */ -+ buffer_clear(&c->rx_line_buf); -+ c->rx_bytes_sent = 0; -+ c->rx_lines_sent = 0; -+ c->rx_bytes_skipped = 0; -+ } -+ else { -+ /* append input to rx line buffer */ -+ buffer_put_char(&c->rx_line_buf, *ptr); -+ c->rx_bytes_sent += buffer_len(&c->rx_line_buf); -+ } -+ -+ } /* end of ptr traversal loop */ -+ -+ } /* end of length test */ -+ -+ } /* end tty check */ -+#endif -+ - return 0; - } - -@@ -3368,6 +3802,15 @@ channel_setup_fwd_listener_tcpip(int type, struct Forward *fwd, - else - c->listening_port = fwd->listen_port; - success = 1; -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(host, strlen(host)); -+ s_audit("channel_set_fwd_listener_3", "count=%i count=%i count=%i count=%i uristring=%s port=%i/tcp port=%i/tcp", -+ client_session_id, c->self, type, wildcard, t1buf, fwd->connect_port, fwd->listen_port); -+ -+ free(t1buf); -+#endif -+ - } - if (success == 0) - error("%s: cannot listen to port: %d", __func__, -diff --git a/channels.h b/channels.h -index 01c21b5..a08922b 100644 ---- a/channels.h -+++ b/channels.h -@@ -166,6 +166,26 @@ struct Channel { - void *mux_ctx; - int mux_pause; - int mux_downstream_id; -+ -+#ifdef NERSC_MOD -+ Buffer rx_line_buf; -+ Buffer tx_line_buf; -+ int audit_enable; -+ -+ int max_tx_lines; -+ int max_rx_lines; -+ int max_tx_char; -+ int max_rx_char; -+ -+ int tx_lines_sent; -+ int rx_lines_sent; -+ int tx_bytes_sent; -+ int rx_bytes_sent; -+ int tx_bytes_skipped; -+ int rx_bytes_skipped; -+ int rx_passwd_flag; -+ int tx_aux_size; -+#endif - }; - - #define CHAN_EXTENDED_IGNORE 0 -diff --git a/configure.ac b/configure.ac -index c2878e3..1ffd165 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1165,6 +1165,7 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[ exit(0); ]])], - dnl Checks for header files. - # Checks for libraries. - AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])]) -+AC_CHECK_FUNC([yp_match], , [AC_CHECK_LIB([nsl], [yp_match])]) - - dnl IRIX and Solaris 2.5.1 have dirname() in libgen - AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [ -@@ -1470,6 +1471,62 @@ AC_ARG_WITH([skey], - ] - ) - -+# Check whether user wants TCP wrappers support -+TCPW_MSG="no" -+AC_ARG_WITH([tcp-wrappers], -+ [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)], -+ [ -+ if test "x$withval" != "xno" ; then -+ saved_LIBS="$LIBS" -+ saved_LDFLAGS="$LDFLAGS" -+ saved_CPPFLAGS="$CPPFLAGS" -+ if test -n "${withval}" && \ -+ test "x${withval}" != "xyes"; then -+ if test -d "${withval}/lib"; then -+ if test -n "${need_dash_r}"; then -+ LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}" -+ else -+ LDFLAGS="-L${withval}/lib ${LDFLAGS}" -+ fi -+ else -+ if test -n "${need_dash_r}"; then -+ LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}" -+ else -+ LDFLAGS="-L${withval} ${LDFLAGS}" -+ fi -+ fi -+ if test -d "${withval}/include"; then -+ CPPFLAGS="-I${withval}/include ${CPPFLAGS}" -+ else -+ CPPFLAGS="-I${withval} ${CPPFLAGS}" -+ fi -+ fi -+ LIBS="-lwrap $LIBS" -+ AC_MSG_CHECKING([for libwrap]) -+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -+#include -+#include -+#include -+#include -+int deny_severity = 0, allow_severity = 0; -+ ]], [[ -+ hosts_access(0); -+ ]])], [ -+ AC_MSG_RESULT([yes]) -+ AC_DEFINE([LIBWRAP], [1], -+ [Define if you want -+ TCP Wrappers support]) -+ SSHDLIBS="$SSHDLIBS -lwrap" -+ TCPW_MSG="yes" -+ ], [ -+ AC_MSG_ERROR([*** libwrap missing]) -+ -+ ]) -+ LIBS="$saved_LIBS" -+ fi -+ ] -+) -+ - # Check whether user wants to use ldns - LDNS_MSG="no" - AC_ARG_WITH(ldns, -@@ -4168,6 +4225,69 @@ AC_ARG_WITH([selinux], - AC_SUBST([SSHLIBS]) - AC_SUBST([SSHDLIBS]) - -+NERSC_MOD='no' -+AC_ARG_WITH(nerscmod, -+ [ --with-nerscmod Add sshd instrumentation], -+ [ -+ if test "x$withval" != "xno" ; then -+ NERSC_MOD='yes' -+ AC_DEFINE(NERSC_MOD, 1, [define for NERSC mods]) -+ AC_MSG_RESULT(yes) -+ -+ fi -+ ] -+) -+ -+STUNNEL_PORT='799' -+AC_ARG_WITH(stunnelport, -+ [ --with-stunnelport=PORT Set stunnel port if other than 799/tcp ], -+ [ -+ -+ case "$withval" in -+ [[0-9]]*) -+ STUNNEL_PORT="$withval" -+ ;; -+ *) -+ AC_MSG_ERROR(You must specify a numeric port number for --with-stunnelport) -+ ;; -+ esac -+ -+ if test ! -z "$withval" ; then -+ #STUNNEL_PORT="$withval" -+ AC_DEFINE_UNQUOTED(STUNNEL_PORT, $STUNNEL_PORT, [define for NERSC mods]) -+ fi -+ ] -+) -+ -+STUNNEL_HOST='localhost' -+AC_ARG_WITH(stunnelhost, -+ [ --with-stunnelhost=HOST Set stunnel host if other than localhost. Do not quote.], -+ [ -+ -+ STUNNEL_HOST="localhost" -+ -+ if test "x$withval" != "xno" ; then -+ STUNNEL_HOST="\"$withval\"" -+ AC_DEFINE_UNQUOTED(STUNNEL_HOST, $STUNNEL_HOST, [define for NERSC mods]) -+ fi -+ ] -+) -+ -+ -+PASSWD_REC='no' -+AC_ARG_WITH(passwdrec, -+ [ --with-passwdrec record password data], -+ [ -+ if test "x$withval" != "xno" ; then -+ PASSWD_REC='yes' -+ AC_DEFINE(PASSWD_REC, 1, [set to record password info]) -+ AC_MSG_RESULT(yes) -+ -+ fi -+ ] -+) -+ -+ - # Check whether user wants Kerberos 5 support - KRB5_MSG="no" - AC_ARG_WITH([kerberos5], -@@ -5093,6 +5213,7 @@ echo " KerberosV support: $KRB5_MSG" - echo " SELinux support: $SELINUX_MSG" - echo " Smartcard support: $SCARD_MSG" - echo " S/KEY support: $SKEY_MSG" -+echo " TCP Wrappers support: $TCPW_MSG" - echo " MD5 password support: $MD5_MSG" - echo " libedit support: $LIBEDIT_MSG" - echo " libldns support: $LDNS_MSG" -@@ -5103,6 +5224,12 @@ echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" - echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" - echo " BSD Auth support: $BSD_AUTH_MSG" - echo " Random number source: $RAND_MSG" -+echo " NERSC Mods : $NERSC_MOD" -+if test "x$NERSC_MOD" = "xyes" ; then -+echo " STUNNEL Host : $STUNNEL_HOST" -+echo " STUNNEL Port : $STUNNEL_PORT" -+echo " Record Passwd Data : $PASSWD_REC" -+fi - echo " Privsep sandbox style: $SANDBOX_STYLE" - - echo "" -diff --git a/kex.c b/kex.c -index 5234752..32b6da8 100644 ---- a/kex.c -+++ b/kex.c -@@ -54,6 +54,11 @@ - #include "sshbuf.h" - #include "digest.h" - -+#ifdef NERSC_MOD -+#include "nersc.h" -+extern int client_session_id; -+#endif -+ - #if OPENSSL_VERSION_NUMBER >= 0x00907000L - # if defined(HAVE_EVP_SHA256) - # define evp_ssh_sha256 EVP_sha256 -@@ -865,6 +870,33 @@ kex_choose_conf(struct ssh *ssh) - newkeys->enc.name, - authlen == 0 ? newkeys->mac.name : "", - newkeys->comp.name); -+ -+#ifdef NERSC_MOD -+ if ( ctos ) { -+ -+ const char def_enc_name[] = ""; -+ const char def_mac_name[] = ""; -+ const char def_comp_name[] = ""; -+ const char def_vers_string[] = ""; -+ -+ char* t1buf = ((authlen != 0 || !newkeys->enc.name) ? (encode_string(def_enc_name, sizeof(def_enc_name)-1)) : (encode_string(newkeys->enc.name, strlen(newkeys->enc.name)))); -+ char* t2buf = ((authlen != 0 || !newkeys->mac.name) ? (encode_string(def_mac_name, sizeof(def_mac_name)-1)) : (encode_string(newkeys->mac.name, strlen(newkeys->mac.name)))); -+ char* t3buf = ((authlen != 0 || !newkeys->comp.name) ? (encode_string(def_comp_name, sizeof(def_comp_name)-1)) : (encode_string(newkeys->comp.name, strlen(newkeys->comp.name)))); -+ -+ /* t4buf is not derived from authlen directly, but in */ -+ /* the event that that value is borked, play it safe */ -+ /* and bail on this as well cause paranoid ... */ -+ char* t4buf = ((authlen != 0 || !kex->client_version_string) ? (encode_string(def_vers_string, sizeof(def_vers_string)-1)) : (encode_string(kex->client_version_string, strlen(kex->client_version_string)))); -+ -+ s_audit("session_key_exchange", "count=%i uristring=%s_%s_%s_%s", -+ client_session_id, t4buf, t1buf, t2buf, t3buf); -+ -+ free(t1buf); -+ free(t2buf); -+ free(t3buf); -+ free(t4buf); -+ } -+#endif - /* - * client starts with ctos = 0 && log flag = 0 and no log. - * 2nd client pass ctos = 1 and flag = 1 so no log. -diff --git a/modp_burl.c b/modp_burl.c -new file mode 100644 -index 0000000..f930d47 ---- /dev/null -+++ b/modp_burl.c -@@ -0,0 +1,200 @@ -+/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */ -+/* vi: set expandtab shiftwidth=4 tabstop=4: */ -+ -+/** -+ * \file -+ *
-+ * BFASTURL.c High performance URL encoder/decoder
-+ * http://code.google.com/p/stringencoders/
-+ *
-+ * Copyright © 2006,2007  Nick Galbreath -- nickg [at] modp [dot] com
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions are
-+ * met:
-+ *
-+ *   Redistributions of source code must retain the above copyright
-+ *   notice, this list of conditions and the following disclaimer.
-+ *
-+ *   Redistributions in binary form must reproduce the above copyright
-+ *   notice, this list of conditions and the following disclaimer in the
-+ *   documentation and/or other materials provided with the distribution.
-+ *
-+ *   Neither the name of the modp.com nor the names of its
-+ *   contributors may be used to endorse or promote products derived from
-+ *   this software without specific prior written permission.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+ *
-+ * This is the standard "new" BSD license:
-+ * http://www.opensource.org/licenses/bsd-license.php
-+ * 
-+ */ -+ -+#include "includes.h" -+#ifdef NERSC_MOD -+ -+#include "modp_burl.h" -+#include "modp_stdint.h" -+#include "modp_burl_data.h" -+ -+int modp_burl_encode(char* dest, const char* src, int len) -+{ -+ -+ const char* deststart = dest; -+ const uint8_t* s = (const uint8_t*)src; -+ const uint8_t* srcend = s + len; -+ char c; -+ uint8_t x; -+ -+ while (s < srcend) { -+ x = *s++; -+ c = (char)gsUrlEncodeMap[x]; -+ if (c) { -+ *dest++ = c; -+ } else { -+ *dest++ = '%'; -+ *dest++ = (char)gsHexEncodeMap1[x]; -+ *dest++ = (char)gsHexEncodeMap2[x]; -+ /* -+ is the equiv of this -+ static const char sHexChars[] = "0123456789ABCDEF"; -+ *dest++ = (char)sHexChars[x >> 4]; -+ *dest++ = (char)sHexChars[x & 0x0F]; -+ */ -+ } -+ } -+ *dest = '\0'; -+ return (int)(dest - deststart); // compute "strlen" of dest. -+} -+ -+/** -+ * The implementation is identical except it uses a -+ * different array -+ */ -+int modp_burl_min_encode(char* dest, const char* src, int len) -+{ -+ -+ const char* deststart = dest; -+ const uint8_t* s = (const uint8_t*)src; -+ const uint8_t* srcend = s + len; -+ char c; -+ uint8_t x; -+ -+ while (s < srcend) { -+ x = *s++; -+ c = (char)(gsUrlEncodeMinMap[x]); /** CHANGE HERE **/ -+ if (c) { -+ *dest++ = c; -+ } else { -+ *dest++ = '%'; -+ *dest++ = (char) gsHexEncodeMap1[x]; -+ *dest++ = (char)(gsHexEncodeMap2[x]); -+ /* -+ is the equiv of this -+ static const char sHexChars[] = "0123456789ABCDEF"; -+ *dest++ = sHexChars[x >> 4]; -+ *dest++ = sHexChars[x & 0x0F]; -+ */ -+ } -+ } -+ *dest = '\0'; -+ return (int)(dest - deststart); // compute "strlen" of dest. -+} -+ -+/** -+ * Give exact size of encoded output string -+ * without doing the encoding -+ */ -+int modp_burl_encode_strlen(const char* src, const int len) -+{ -+ int count = 0; -+ const char* srcend = src + len; -+ while (src < srcend) { -+ if (gsUrlEncodeMap[ (uint8_t) *src++]) { -+ count++; -+ } else { -+ count += 3; -+ } -+ } -+ return count; -+} -+ -+/** -+ * Give exact size of encoded output string -+ * without doing the encoding -+ */ -+int modp_burl_min_encode_strlen(const char* src, const int len) -+{ -+ int count = 0; -+ const char* srcend = src + len; -+ while (src < srcend) { -+ if (gsUrlEncodeMinMap[ (uint8_t) *src++]) { -+ count++; -+ } else { -+ count += 3; -+ } -+ } -+ return count; -+} -+ -+int modp_burl_decode(char* dest, const char* s, int len) -+{ -+ uint32_t d = 0; // used for decoding %XX -+ const uint8_t* src = (const uint8_t*) s; -+ const char* deststart = dest; -+ const uint8_t* srcend = (const uint8_t*)(src + len); -+ const uint8_t* srcendloop = (const uint8_t*)(srcend - 2); -+ -+ while (src < srcendloop) { -+ switch (*src) { -+ case '+': -+ *dest++ = ' '; -+ src++; -+ break; -+ case '%': -+ d = (gsHexDecodeMap[(uint32_t)(*(src + 1))] << 4) | -+ gsHexDecodeMap[(uint32_t)(*(src + 2))]; -+ if (d < 256) { // if one of the hex chars is bad, d >= 256 -+ *dest = (char) d; -+ dest++; -+ src += 3; -+ } else { -+ *dest++ = '%'; -+ src++; -+ } -+ break; -+ default: -+ *dest++ = (char) *src++; -+ } -+ } -+ -+ // handle last two chars -+ // dont decode "%XX" -+ while (src < srcend) { -+ switch (*src) { -+ case '+': -+ *dest++ = ' '; -+ src++; -+ break; -+ default: -+ *dest++ = (char)( *src++); -+ } -+ } -+ -+ *dest = '\0'; -+ return (int)(dest - deststart); // compute "strlen" of dest. -+} -+ -+#endif /* NERSC_MOD */ -diff --git a/modp_burl.h b/modp_burl.h -new file mode 100644 -index 0000000..e7739a0 ---- /dev/null -+++ b/modp_burl.h -@@ -0,0 +1,211 @@ -+/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */ -+/* vi: set expandtab shiftwidth=4 tabstop=4: */ -+ -+/** -+ * \file -+ *
-+ * High Performance URL Encoder/Decoder
-+ *
-+ * Copyright © 2006, 2007  Nick Galbreath -- nickg [at] modp [dot] com
-+ * All rights reserved.
-+ *
-+ * http://code.google.com/p/stringencoders/
-+ *
-+ * Released under bsd license.  See bfast64.c for details.
-+ * 
-+ */ -+ -+#ifndef COM_MODP_STRINGENCODERS_BURL -+#define COM_MODP_STRINGENCODERS_BURL -+ -+#ifdef __cplusplus -+#define BEGIN_C extern "C" { -+#define END_C } -+#else -+#define BEGIN_C -+#define END_C -+#endif -+ -+BEGIN_C -+ -+/** -+ * Url encode a string. This uses a very strict definition of url -+ * encoding. The only characters NOT encoded are A-Z, a-z, 0-9, "-", -+ * "_", ".", along with the space char getting mapped to "+". -+ * Everything else is escaped using "%HEXHEX" format. This is -+ * identical to the implementation of php's urlencode and nearly -+ * identical to Java's UrlEncoder class (they do not escape '*' for -+ * some reason). -+ * -+ * \param[out] dest output string. Must -+ * \param[in] str The input string -+ * \param[in] len The length of the input string, excluding any -+ * final null byte. -+ */ -+int modp_burl_encode(char* dest, const char* str, int len); -+ -+/** -+ * Url encode a string. This uses a minimal definition of url -+ * encoding. This works similar to the previous function except '~', -+ * '!', '$', '\'', '(', ')', '*', ',', ';', ':', '@', '/', '?' are NOT -+ * escaped. This will allow decoding by standard url-decoders and -+ * make the encoded urls more readable. -+ * -+ * \param[out] dest output string. Must -+ * \param[in] str The input string -+ * \param[in] len The length of the input string, excluding any -+ * final null byte. -+ */ -+int modp_burl_min_encode(char* dest, const char* str, int len); -+ -+/** \brief get size of output string w/o doing actual encoding -+ * -+ * \param[in] src input string, not null -+ * \param[in] len length of input string -+ * \return length of output string NOT including any final null byte -+ */ -+int modp_burl_min_encode_strlen(const char* src, const int len); -+ -+/** -+ * Provides the maximum size for output string given -+ * and input size of A bytes. -+ */ -+#define modp_burl_encode_len(A) (3*A + 1) -+ -+/** -+ * Given the exact size of output string. -+ * -+ * Can be used to allocate the right amount of memory for -+ * modp_burl_encode. Be sure to add 1 byte for final null. -+ * -+ * This is somewhat expensive since it examines every character -+ * in the input string -+ * -+ * \param[in] str The input string -+ * \param[in] len THe length of the input string, excluding any -+ * final null byte (i.e. strlen(str)) -+ * \return the size of the output string, excluding the final -+ * null byte. -+ */ -+int modp_burl_encode_strlen(const char* str, const int len); -+ -+/** -+ * URL Decode a string -+ * -+ * \param[out] dest The output string. Must be at least (len + 1) -+ * bytes allocated. This may be the same as the input buffer. -+ * \param[in] str The input string that is URL encoded. -+ * \param[in] len The length of the input string (excluding final -+ * null byte) -+ * \return the strlen of the output string. -+ */ -+int modp_burl_decode(char* dest, const char* str, int len); -+ -+/** -+ * Returns memory required to decoded a url-encoded -+ * string of length A. -+ * -+ */ -+#define modp_burl_decode_len(A) (A + 1) -+ -+END_C -+ -+#ifdef __cplusplus -+#include -+#include -+ -+namespace modp { -+ -+ inline std::string url_encode(const char* s, size_t len) -+ { -+ std::string x(modp_burl_encode_len(len), '\0'); -+ int d = modp_burl_encode(const_cast(x.data()), s, len); -+ x.erase(d, std::string::npos); -+ return x; -+ } -+ -+ inline std::string url_encode(const char* s) -+ { -+ return url_encode(s, strlen(s)); -+ } -+ -+ inline std::string url_encode(const std::string& s) -+ { -+ return url_encode(s.data(), s.size()); -+ } -+ -+ /** -+ * Standard (maximal) url encoding. -+ * -+ * \param[in,out] s the string to be encoded -+ * \return a reference to the input string -+ */ -+ inline std::string& url_encode(std::string& s) -+ { -+ std::string x(url_encode(s.data(), s.size())); -+ s.swap(x); -+ return s; -+ } -+ -+ /** -+ * Minimal Url Encoding -+ * -+ * \param[in,out] s the string to be encoded -+ * \return a reference to the input string -+ */ -+ inline std::string& url_min_encode(std::string& s) -+ { -+ std::string x(modp_burl_encode_len(s.size()), '\0'); -+ int d = modp_burl_min_encode(const_cast(x.data()), s.data(), s.size()); -+ x.erase(d, std::string::npos); -+ s.swap(x); -+ return s; -+ } -+ -+ inline std::string url_min_encode(const std::string& s) -+ { -+ std::string x(modp_burl_encode_len(s.size()), '\0'); -+ int d = modp_burl_min_encode(const_cast(x.data()), s.data(), s.size()); -+ x.erase(d, std::string::npos); -+ return x; -+ } -+ -+ /** -+ * Url decode a string. -+ * This function does not allocate memory. -+ * -+ * \param[in,out] s the string to be decoded -+ * \return a reference to the input string. -+ * There is no error case, bad characters are passed through -+ */ -+ inline std::string& url_decode(std::string& s) -+ { -+ int d = modp_burl_decode(const_cast(s.data()), s.data(), s.size()); -+ s.erase(d, std::string::npos); -+ return s; -+ } -+ -+ inline std::string url_decode(const char* str) -+ { -+ std::string s(str); -+ url_decode(s); -+ return s; -+ } -+ -+ inline std::string url_decode(const char* str, size_t len) -+ { -+ std::string s(str, len); -+ url_decode(s); -+ return s; -+ } -+ -+ inline std::string url_decode(const std::string& s) -+ { -+ std::string x(s); -+ url_decode(x); -+ return x; -+ } -+} -+#endif -+ -+#endif -diff --git a/modp_burl_data.h b/modp_burl_data.h -new file mode 100644 -index 0000000..11c5c72 ---- /dev/null -+++ b/modp_burl_data.h -@@ -0,0 +1,141 @@ -+static const unsigned char gsUrlEncodeMap[256] = { -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '+', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '-', '.', '\0', '0', '1', -+ '2', '3', '4', '5', '6', '7', '8', '9', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', 'A', 'B', 'C', 'D', 'E', -+ 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', -+ 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', -+ 'Z', '\0', '\0', '\0', '\0', '_', '\0', 'a', 'b', 'c', -+ 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', -+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', -+ 'x', 'y', 'z', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0' -+}; -+ -+static const unsigned char gsUrlEncodeMinMap[256] = { -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '+', '!', '\0', '\0', '$', '\0', '\0', '\0', -+ '(', ')', '*', '\0', ',', '-', '.', '/', '0', '1', -+ '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', -+'\0', '\0', '\0', '?', '@', 'A', 'B', 'C', 'D', 'E', -+ 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', -+ 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', -+ 'Z', '\0', '\0', '\0', '\0', '_', '\0', 'a', 'b', 'c', -+ 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', -+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', -+ 'x', 'y', 'z', '\0', '\0', '\0', '~', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', -+'\0', '\0', '\0', '\0', '\0', '\0' -+}; -+ -+static const uint32_t gsHexDecodeMap[256] = { -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 256, 256, -+256, 256, 256, 256, 256, 10, 11, 12, 13, 14, 15, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 10, 11, 12, 13, 14, 15, 256, 256, 256, 256, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -+256, 256, 256, 256 -+}; -+ -+static const unsigned char gsHexEncodeMap1[256] = { -+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', -+ '0', '0', '0', '0', '0', '0', '1', '1', '1', '1', -+ '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', -+ '1', '1', '2', '2', '2', '2', '2', '2', '2', '2', -+ '2', '2', '2', '2', '2', '2', '2', '2', '3', '3', -+ '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', -+ '3', '3', '3', '3', '4', '4', '4', '4', '4', '4', -+ '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', -+ '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', -+ '5', '5', '5', '5', '5', '5', '6', '6', '6', '6', -+ '6', '6', '6', '6', '6', '6', '6', '6', '6', '6', -+ '6', '6', '7', '7', '7', '7', '7', '7', '7', '7', -+ '7', '7', '7', '7', '7', '7', '7', '7', '8', '8', -+ '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', -+ '8', '8', '8', '8', '9', '9', '9', '9', '9', '9', -+ '9', '9', '9', '9', '9', '9', '9', '9', '9', '9', -+ 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', -+ 'A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', -+ 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', -+ 'B', 'B', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', -+ 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'D', 'D', -+ 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', -+ 'D', 'D', 'D', 'D', 'E', 'E', 'E', 'E', 'E', 'E', -+ 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', -+ 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F', -+ 'F', 'F', 'F', 'F', 'F', 'F' -+}; -+ -+static const unsigned char gsHexEncodeMap2[256] = { -+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', -+ 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', -+ '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', -+ 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', -+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', -+ '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', -+ 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', -+ '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', -+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', -+ 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', -+ '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', -+ 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', -+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', -+ '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', -+ 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', -+ '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', -+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', -+ 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', -+ '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', -+ 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', -+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', -+ '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', -+ 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', -+ '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', -+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', -+ 'A', 'B', 'C', 'D', 'E', 'F' -+}; -+ -diff --git a/modp_stdint.h b/modp_stdint.h -new file mode 100644 -index 0000000..8720119 ---- /dev/null -+++ b/modp_stdint.h -@@ -0,0 +1,21 @@ -+/* vi: set ft=c expandtab shiftwidth=4 tabstop=4: */ -+#ifndef MODP_STDINT_H_ -+#define MODP_STDINT_H_ -+ -+#ifndef _WIN32 -+# include -+#else -+/* win64 is llp64 so these are the same for 32/64bit -+ so no check for _WIN64 is required. -+ */ -+ typedef unsigned char uint8_t; -+ typedef signed char int8_t; -+ typedef unsigned short uint16_t; -+ typedef signed short int16_t; -+ typedef unsigned int uint32_t; -+ typedef signed int int32_t; -+ typedef unsigned __int64 uint64_t; -+ typedef signed __int64 int64_t; -+#endif -+ -+#endif /* MODP_STDINT_H_ */ -diff --git a/nersc.c b/nersc.c -new file mode 100644 -index 0000000..5280ee9 ---- /dev/null -+++ b/nersc.c -@@ -0,0 +1,586 @@ -+/* -+ * Author: Scott Campbell, Tom Davis -+ * Set of functions called by the command instrumentation and logging -+ * -+ * notes as follows: -+ * hostname and source port of the syslog listener are hardcoded into -+ * the code to prevent issues with configuration - both intentional and otherwise. -+ * -+ * ------------------------------------------------------------------------------ -+ * Instrumented Open SSHD, Copyright (c) *2013*, The -+ * Regents of the University of California, through Lawrence Berkeley National -+ * Laboratory (subject to receipt of any required approvals from the U.S. -+ * Dept. of Energy). All rights reserved. -+ * -+ * If you have questions about your rights to use or distribute this software, -+ * please contact Berkeley Lab's Technology Transfer Department at TTD@lbl.gov -+ * . -+ * -+ * NOTICE. This software is owned by the U.S. Department of Energy. As such, -+ * the U.S. Government has been granted for itself and others acting on its -+ * behalf a paid-up, nonexclusive, irrevocable, worldwide license in the -+ * Software to reproduce, prepare derivative works, and perform publicly and -+ * display publicly. Beginning five (5) years after the date permission to -+ * assert copyright is obtained from the U.S. -+ * Department of Energy, and subject to any subsequent five (5) year renewals, -+ * the U.S. Government is granted for itself and others acting on its behalf a -+ * paid-up, nonexclusive, irrevocable, worldwide license in the Software to -+ * reproduce, prepare derivative works, distribute copies to the public, -+ * perform publicly and display publicly, and to permit others to do so. -+ * -+ * *** License agreement *** -+ * -+ * " Instrumented Open SSHD, Copyright (c) 2013, The Regents of the -+ * University of California, through Lawrence Berkeley National Laboratory -+ * (subject to receipt of any required approvals from the U.S. Dept. of -+ * Energy). This software was developed under funding from the DOE Office of -+ * Advanced Scientific Computing Research* *and is associated with the -+ * Berkeley Lab OASCR project. All rights reserved." -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are met: -+ * -+ * (1) Redistributions of source code must retain the above copyright notice, -+ * this list of conditions and the following disclaimer. -+ * -+ * (2) Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * (3) Neither the name of the University of California, Lawrence Berkeley -+ * National Laboratory, U.S. Dept. of Energy nor the names of its contributors -+ * may be used to endorse or promote products derived from this software -+ * without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -+ * POSSIBILITY OF SUCH DAMAGE. -+ * -+ * *You are under no obligation whatsoever to provide any bug fixes, patches, -+ * or upgrades to the features, functionality or performance of the source -+ * code ("Enhancements") to anyone; however, if you choose to make your -+ * Enhancements available either publicly, or directly to Lawrence Berkeley -+ * National Laboratory, without imposing a separate written license agreement -+ * for such Enhancements, then you hereby grant the following license: a -+ * non-exclusive, royalty-free perpetual license to install, use, modify, -+ * prepare derivative works, incorporate into other computer software, -+ * distribute, and sublicense such enhancements or derivative works thereof, -+ * in binary and source code form.* -+ * -+ * ------------------------------------------------------------------------------ -+ * Additional URL encoding code taken from stringcoders-v3.10.3 source. Thanks! -+ * ------------------------------------------------------------------------------ -+ * http://code.google.com/p/stringencoders/ -+ * -+ * Copyright © 2006,2007 Nick Galbreath -- nickg [at] modp [dot] com -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are -+ * met: -+ * -+ * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * -+ * Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * Neither the name of the modp.com nor the names of its -+ * contributors may be used to endorse or promote products derived from -+ * this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ * This is the standard "new" BSD license: -+ * http://www.opensource.org/licenses/bsd-license.php -+ */ -+ -+ -+#include "includes.h" -+#ifdef NERSC_MOD -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "openbsd-compat/sys-queue.h" -+#include "ssh.h" -+#include "channels.h" -+#include "log.h" -+#include "misc.h" -+#include "xmalloc.h" -+#include "version.h" -+#include "servconf.h" -+#include "readconf.h" -+#include "nersc.h" -+ -+/* this is for the stringencoders data */ -+#include "modp_burl.h" -+#include "modp_burl_data.h" -+ -+/* import */ -+int audit_disabled; -+extern char *__progname; -+ -+int client_session_id; -+int sis_socket = -1; /* socket test varible */ -+int sis_connect = -1; /* connect test variable */ -+int stun_conn_error = 0; /* track the number of connection errors to the stunnel */ -+int stun_write_error = 0; /* track the number of write errors to the stunnel */ -+ -+char n_ntop[NI_MAXHOST] = "X"; -+char n_port[NI_MAXHOST] = "X"; -+ -+extern char *__progname; -+ -+static char server_id[128] = "X"; /* -+ * This is a unique value composed of: -+ * -+ * used for the lifetime of the process. -+ * 128 == max reasonable size expected -+ */ -+#define NERSCMSGBUF 4096 -+#define STUN_ERROR_MOD 10 /* -+ * Filter the number of errors down by this factor -+ * so that on a busy sustem the local syslog is not -+ * flooded with anoying and redundant messages -+ */ -+ -+char interface_list[256] = "X"; /* -+ * Contains space delimited list of system interfaces. -+ * at times we may need more than the host name to -+ * determine the system in question. Fill up and ship -+ * back to the bro instance to sort out -+ */ -+ -+void l_syslog(const char *fmt,...) -+{ -+ /* -+ * Function filtering accidental printing of log messages to -+ * stderr/stdout when logging messages. -+ * -+ * NOTE: for standalong binaries like ssh, some of this code will get -+ * called since there are common shared objects like channels.o which -+ * trigger annoying errors to stderr otherwise. -+ */ -+ -+ if ( ! log_is_on_stderr() ) { -+ va_list args; -+ -+ va_start(args, fmt); -+ do_log(SYSLOG_LEVEL_INFO, fmt, args); -+ va_end(args); -+ } -+} -+ -+ -+int get_client_session_id() -+ { -+ return client_session_id; -+ } -+ -+void set_server_id(int parent_pid, char* ntop, int port) -+ { -+ /* -+ * This is called to assert the server id from server_listen() -+ * in sshd.c . -+ */ -+ if ( server_id[0] == 'X' ) { -+ char hn[64]; -+ long hid; -+ -+ if ( gethostname((char*)hn, 64) == -1 ) -+ strncpy(hn, "unknown-hostname", sizeof(hn)); -+ -+ hid = gethostid(); -+ snprintf(server_id, 64,"%ld:%s:%i", hid, hn, port); -+ } -+ } -+ -+static char* get_server_id() -+ { -+ /* -+ * If this is the first reference to this variable, it may be blank and -+ * we can try filing it in via the values set up during the sshd run. -+ */ -+ char *cp = NULL; -+ char *p = NULL; -+ long hid; -+ -+ if( server_id[0] == 'X' ) { -+ -+ hid = gethostid(); -+ /* -+ * When invoking subsystems, we may have a situation where the -+ * server id will be incomplete. run an additional test here -+ * to make sure that n_top and n_port have been filled. if not, -+ * make a sanity guess based on: -+ * SSH_CONNECTION=127.0.0.1 33602 127.0.0.1 22 -+ */ -+ if ( n_port[0] == 'X' ) { -+ -+ if ((cp = getenv("SSH_CONNECTION")) != NULL) { -+ -+ p = strtok(cp," "); /* src IP */ -+ p = strtok(NULL, " "); /* src port */ -+ -+ if ( (p = strtok(NULL, " ")) != NULL) /* dst IP */ -+ strncpy(n_ntop,p,NI_MAXHOST-1); -+ -+ if ( (p = strtok(NULL, " ")) != NULL) /* dst port */ -+ strncpy(n_port,p,NI_MAXHOST-1); -+ -+ bzero(cp, strlen(cp)); -+ } -+ else { -+ /* -+ * Have not been able to extract SSH_CONNECTION from -+ * the running environment. WTF? -+ */ -+ strncpy(n_port, "unknown-port", strlen(n_port)); -+ strncpy(n_ntop, "unknown-ip", strlen(n_ntop)); -+ } -+ } -+ -+ char hn[64]; -+ gethostname((char*)hn, 64); -+ -+ snprintf(server_id, 64,"%ld:%s:%s", hid, hn, n_port); -+ -+ return (server_id); -+ } -+ else -+ return (server_id); -+ } -+ -+int set_interface_list() -+{ -+ int iSocket; -+ struct if_nameindex *pIndex, *pIndex2; -+ -+ if ( strlen(interface_list) > 1 ) -+ return 0; -+ -+ if ((iSocket = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { -+ -+ perror("socket"); -+ bzero(interface_list, sizeof(interface_list)); -+ interface_list[0] = 'S'; -+ return -1; -+ } -+ -+ bzero(interface_list, sizeof(interface_list)); -+ -+ /* -+ * if_nameindex() returns an array of if_nameindex structures. -+ * -+ * if_nametoindex is also defined in , and is as follows: -+ * -+ * struct if_nameindex { -+ * unsigned int if_index; 1, 2, ... -+ * char *if_name; null terminated name: "le0", ... -+ * }; -+ */ -+ pIndex = pIndex2 = if_nameindex(); -+ -+ /* for an error state, pIndex will be NULL */ -+ while ((pIndex != NULL) && (pIndex->if_name != NULL)) { -+ -+ struct ifreq req; -+ -+ strncpy(req.ifr_name, pIndex->if_name, IFNAMSIZ); -+ -+ if (ioctl(iSocket, SIOCGIFADDR, &req) < 0) { -+ -+ if (errno == EADDRNOTAVAIL) { -+ pIndex++; -+ continue; -+ } -+ -+ perror("ioctl"); -+ bzero(interface_list, sizeof(interface_list)); -+ interface_list[0] = 'I'; -+ close(iSocket); -+ -+ return -1; -+ } -+ -+ /* add a delimiter */ -+ if ( pIndex > pIndex2 ) -+ strncat(interface_list, "_", 2); -+ -+ size_t nl = strlen(inet_ntoa(((struct sockaddr_in*)&req.ifr_addr)->sin_addr)); -+ -+ if ( nl + strlen(interface_list) + 2 < sizeof(interface_list) ) { -+ -+ strncat( interface_list, -+ inet_ntoa(((struct sockaddr_in*)&req.ifr_addr)->sin_addr), -+ sizeof(interface_list) - nl -1); -+ } -+ -+ pIndex++; -+ -+ } -+ -+ if ( pIndex2 != NULL ) -+ if_freenameindex(pIndex2); -+ -+ close(iSocket); -+ -+ return 0; -+} -+ -+static int sis_opentcp(char *hostname, int portnum) -+{ -+ struct sockaddr_in sa = { 0 }; -+ struct hostent *hp = NULL; -+ int s, valopt; -+ fd_set myset; -+ struct timeval tv; -+ socklen_t lon; -+ -+ s = -1; -+ sis_connect = -1; -+ -+ hp = gethostbyname(hostname); -+ -+ if (hp == NULL) { -+ hp = gethostbyaddr(hostname, strlen(hostname), AF_INET); -+ if (hp == NULL) { -+ l_syslog("error resolving stunnel server address, exiting open"); -+ return(-1); -+ } -+ } -+ -+ sa.sin_family = AF_INET; -+ sa.sin_port = htons(portnum); -+ (void) memcpy(&sa.sin_addr, hp->h_addr, hp->h_length); -+ -+ if ((s=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { -+ -+ l_syslog("error opening connection to stunnel listener, exiting open"); -+ return (-1); -+ } -+ -+ /* now make the socket non-blocking */ -+ if ( fcntl(s,F_SETFL,FNDELAY) == -1) { -+ l_syslog("Failure setting socket to no-blocking"); -+ } -+ -+ sis_connect = connect(s, (struct sockaddr *) & sa, sizeof(sa)); -+ -+ if ( sis_connect < 0 ) { -+ -+ /* -+ * We might be waiting for the connection to complete - -+ * quick check for that condition. -+ */ -+ if (errno == EINPROGRESS) { -+ /* sit for 2 seconds */ -+ tv.tv_sec = 2; -+ tv.tv_usec = 0; -+ FD_ZERO(&myset); -+ FD_SET(s, &myset); -+ -+ if (select(s+1, NULL, &myset, NULL, &tv) > 0) { -+ lon = sizeof(int); -+ getsockopt(s, SOL_SOCKET, SO_ERROR, (void *)(&valopt), &lon); -+ -+ if (valopt) { -+ if ( ( stun_conn_error % STUN_ERROR_MOD ) == 0 ) { -+ l_syslog("connection to stunnel rejected/timeout, exiting open, error = %d, %s" , -+ valopt, strerror(valopt)); -+ -+ stun_conn_error++; -+ close(s); -+ sis_connect = -1; -+ return(-1); -+ } -+ } -+ else { -+ /* sitting around has worked, mark connect as successful */ -+ sis_connect = 1; -+ } -+ } -+ } -+ else { -+ /* some simple sanity filtering for connect errors */ -+ if ( ( stun_conn_error % STUN_ERROR_MOD ) == 0 ) { -+ l_syslog("connection to stunnel rejected, exiting open"); -+ -+ stun_conn_error++; -+ close(s); -+ return(-1); -+ } -+ } -+ } -+ -+ return(s); -+} -+ -+static int sis_write(char *buffer) -+{ -+ int err = 0; -+ size_t sent = 0; -+ -+ if ( sis_connect != -1 && sis_socket != -1) -+ sent = send(sis_socket, buffer, strlen(buffer), 0); -+ -+ /* this may be a little heavy handed ... */ -+ if (sent != strlen(buffer) || sis_socket == -1 || sis_connect == -1) { -+ -+#ifndef STUNNEL_PORT -+ #define STUNNEL_PORT 799 -+#endif -+ -+#ifndef STUNNEL_HOST -+ #define STUNNEL_HOST "localhost" -+#endif -+ /* -+ * Close the fd since writes are failing, but only -+ * if there is an error on it already since that would -+ * close a socket that was never opened ... -+ */ -+ if ( stun_write_error > 0 ) { -+ -+ close(sis_socket); -+ sis_socket = -1; -+ sis_connect = -1; -+ -+ /* -+ * Some simple sanity filtering for connect errors -+ * this will flag every 10th error starting after #1 -+ */ -+ if ( ( stun_write_error % STUN_ERROR_MOD ) == 1 ) { -+ l_syslog("write to stunnel failed, reopening connection"); -+ } -+ -+ } -+ -+ stun_write_error++; -+ sis_socket = sis_opentcp(STUNNEL_HOST, STUNNEL_PORT); -+ -+ if ( sis_socket == -1 || sis_connect == -1 ) { -+ err = -1; -+ } -+ else { -+ sent = send(sis_socket, buffer, strlen(buffer), 0); -+ -+ err=1; -+ } -+ -+ } -+ -+ return(err); -+} -+ -+ -+/* -+ * Main auditing function called by other code -+ * s_audit( , , ); -+ */ -+void s_audit(const char *_event, const char *fmt, ...) -+{ -+ if ( audit_disabled == 1 ) -+ return; -+ -+ va_list args; -+ char msgbuf[NERSCMSGBUF] = ""; -+ char fmtbuf[NERSCMSGBUF] = ""; -+ -+ struct timeval tv; -+ gettimeofday(&tv, NULL); -+ -+ char* t1buf = encode_string( get_server_id(), strlen(get_server_id()) ); -+ /* get version string */ -+ -+ /* -+ * If --with-nerscmod has not been set in confgure there is no access to -+ * SSH_AUDITING so we set a token value for the define. -+ */ -+#ifndef NERSC_MOD -+ #define SSH_AUDITING "XXX" -+#endif -+ char* t2buf = encode_string( SSH_AUDITING, strlen(SSH_AUDITING) ); -+ /* get interface list */ -+ set_interface_list(); -+ char* t3buf = encode_string( interface_list, strlen(interface_list) ); -+ -+ /* fmt defines how data provided by args should be formatted */ -+ va_start(args, fmt); -+ /* copy the data into msgbuf */ -+ vsnprintf(msgbuf, sizeof(msgbuf), fmt, args); -+ va_end(args); -+ -+ /* copy event and system data in front of the argument data */ -+ snprintf(fmtbuf, sizeof(fmtbuf), "%s time=%ld.%ld uristring=%s uristring=%s %s\n", _event, tv.tv_sec, (long int)tv.tv_usec, t2buf, t1buf, msgbuf); -+ -+ /*write(STDERR_FILENO, fmtbuf, strlen(fmtbuf)); */ -+ /*syslog(LOG_NOTICE, fmtbuf); */ -+ -+ /* -+ * If the socket open fails, sis_write() will return a -1. for the time -+ * being we will just let this ride since we will be reporting -+ * write failures anyway. -+ */ -+ sis_write(fmtbuf); -+ -+ free(t1buf); -+ free(t2buf); -+ free(t3buf); -+} -+ -+ -+char* encode_string(const char* src, const int len) -+{ -+ /* take a string and return a pointer to the URI encoded version */ -+ int new_len = modp_burl_encode_len(len); -+ -+ char *url_enc_string; -+ -+ url_enc_string = xmalloc(new_len); -+ -+ if ( url_enc_string == NULL ) -+ return (char*)src; -+ else -+ /* -+ * We do not test the return here since it -+ * is done via the call itself. -+ */ -+ modp_burl_encode(url_enc_string, src, len); -+ -+ return url_enc_string; -+} -+ -+#endif /* NERSC_MOD */ -diff --git a/nersc.h b/nersc.h -new file mode 100644 -index 0000000..2dda44d ---- /dev/null -+++ b/nersc.h -@@ -0,0 +1,15 @@ -+/* -+ * Author: Scott Campbell -+ * header file -+ * -+ * see nersc.c for complete copyright information -+ * -+ */ -+ -+int get_client_session_id(); -+void set_server_id(int,char*,int); -+void s_audit(const char *, const char *, ...); -+char* encode_string(const char *, const int len); -+int set_interface_list(); -+ -+ -diff --git a/readconf.c b/readconf.c -index bd68875..2e48632 100644 ---- a/readconf.c -+++ b/readconf.c -@@ -165,7 +165,7 @@ typedef enum { - oSendEnv, oControlPath, oControlMaster, oControlPersist, - oHashKnownHosts, - oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand, -- oNoneEnabled, oNoneSwitch, -+ oNoneEnabled, oNoneSwitch, oAuditDisabled, - oDisableMTAES, - oTcpRcvBufPoll, oTcpRcvBuf, oHPNDisabled, oHPNBufferSize, - oVisualHostKey, -@@ -319,6 +319,7 @@ static struct { - { "tcprcvbufpoll", oTcpRcvBufPoll }, - { "tcprcvbuf", oTcpRcvBuf }, - { "hpndisabled", oHPNDisabled }, -+ { "auditdisabled", oAuditDisabled }, - { "hpnbuffersize", oHPNBufferSize }, - - { NULL, oBadOption } -@@ -1025,6 +1026,10 @@ parse_time: - intptr = &options->hpn_disabled; - goto parse_flag; - -+ case oAuditDisabled: -+ intptr = &options->audit_disabled; -+ goto parse_flag; -+ - case oHPNBufferSize: - intptr = &options->hpn_buffer_size; - goto parse_int; -@@ -1924,6 +1929,7 @@ initialize_options(Options * options) - options->disable_multithreaded = -1; - options->hpn_disabled = -1; - options->hpn_buffer_size = -1; -+ options->audit_disabled = -1; - options->tcp_rcv_buf_poll = -1; - options->tcp_rcv_buf = -1; - options->proxy_use_fdpass = -1; -@@ -2097,6 +2103,8 @@ fill_default_options(Options * options) - options->disable_multithreaded = 0; - if (options->hpn_disabled == -1) - options->hpn_disabled = 0; -+ if (options->audit_disabled == -1) -+ options->audit_disabled = 0; - if (options->hpn_buffer_size > -1) { - /* if a user tries to set the size to 0 set it to 1KB */ - if (options->hpn_buffer_size == 0) -diff --git a/readconf.h b/readconf.h -index a023324..2a4ecbd 100644 ---- a/readconf.h -+++ b/readconf.h -@@ -60,6 +60,7 @@ typedef struct { - int tcp_rcv_buf; /* user switch to set tcp recv buffer */ - int tcp_rcv_buf_poll; /* Option to poll recv buf every window transfer */ - int hpn_disabled; /* Switch to disable HPN buffer management */ -+ int audit_disabled; /* disable SSHD instrumentation */ - int hpn_buffer_size; /* User definable size for HPN buffer window */ - int ip_qos_interactive; /* IP ToS/DSCP/class for interactive */ - int ip_qos_bulk; /* IP ToS/DSCP/class for bulk traffic */ -diff --git a/sandbox-seccomp-filter.c b/sandbox-seccomp-filter.c -index aef5fec..10d90fa 100644 ---- a/sandbox-seccomp-filter.c -+++ b/sandbox-seccomp-filter.c -@@ -140,12 +140,14 @@ static const struct sock_filter preauth_insns[] = { - #ifdef __NR_newfstatat - SC_DENY(__NR_newfstatat, EACCES), - #endif -+#ifndef NERSC_MOD - #ifdef __NR_stat - SC_DENY(__NR_stat, EACCES), - #endif - #ifdef __NR_stat64 - SC_DENY(__NR_stat64, EACCES), - #endif -+#endif - - /* Syscalls to permit */ - #ifdef __NR_brk -@@ -205,6 +207,22 @@ static const struct sock_filter preauth_insns[] = { - #ifdef __NR_read - SC_ALLOW(__NR_read), - #endif -+ -+#ifdef NERSC_MOD -+#ifdef __NR_sendto -+ SC_ALLOW(__NR_sendto), -+#endif -+#ifdef __NR_stat -+ SC_ALLOW(__NR_stat), -+#endif -+#ifdef __NR_socket -+ SC_ALLOW(__NR_socket), -+#endif -+#ifdef __NR_connect -+ SC_ALLOW(__NR_connect), -+#endif -+#endif -+ - #ifdef __NR_rt_sigprocmask - SC_ALLOW(__NR_rt_sigprocmask), - #endif -diff --git a/servconf.c b/servconf.c -index 8576d9d..25a8d5b 100644 ---- a/servconf.c -+++ b/servconf.c -@@ -165,6 +165,7 @@ initialize_server_options(ServerOptions *options) - options->tcp_rcv_buf_poll = -1; - options->hpn_disabled = -1; - options->hpn_buffer_size = -1; -+ options->audit_disabled = -1; - options->ip_qos_interactive = -1; - options->ip_qos_bulk = -1; - options->version_addendum = NULL; -@@ -335,6 +336,8 @@ fill_default_server_options(ServerOptions *options) - options->disable_multithreaded = 0; - if (options->hpn_disabled == -1) - options->hpn_disabled = 0; -+ if (options->audit_disabled == -1) -+ options->audit_disabled = 0; - - if (options->hpn_buffer_size == -1) { - /* option not explicitly set. Now we have to figure out */ -@@ -444,7 +447,7 @@ typedef enum { - sPasswordAuthentication, sKbdInteractiveAuthentication, - sListenAddress, sAddressFamily, - sPrintMotd, sPrintLastLog, sIgnoreRhosts, -- sNoneEnabled, -+ sNoneEnabled,sAuditDisabled, - sDisableMTAES, - sTcpRcvBufPoll, sHPNDisabled, sHPNBufferSize, - sX11Forwarding, sX11DisplayOffset, sX11UseLocalhost, -@@ -603,6 +606,7 @@ static struct { - { "noneenabled", sNoneEnabled, SSHCFG_ALL }, - { "disableMTAES", sDisableMTAES, SSHCFG_ALL }, - { "hpndisabled", sHPNDisabled, SSHCFG_ALL }, -+ { "auditdisabled", sAuditDisabled, SSHCFG_ALL }, - { "hpnbuffersize", sHPNBufferSize, SSHCFG_ALL }, - { "tcprcvbufpoll", sTcpRcvBufPoll, SSHCFG_ALL }, - { "kexalgorithms", sKexAlgorithms, SSHCFG_GLOBAL }, -@@ -1223,6 +1227,10 @@ process_server_config_line(ServerOptions *options, char *line, - intptr = &options->hpn_disabled; - goto parse_flag; - -+ case sAuditDisabled: -+ intptr = &options->audit_disabled; -+ goto parse_flag; -+ - case sHPNBufferSize: - intptr = &options->hpn_buffer_size; - goto parse_int; -diff --git a/servconf.h b/servconf.h -index 09c443e..996d23a 100644 ---- a/servconf.h -+++ b/servconf.h -@@ -172,6 +172,7 @@ typedef struct { - - int none_enabled; /* Enable NONE cipher switch */ - -+ int audit_disabled; /* disable SSHD instrumentation */ - int disable_multithreaded; /*disable multithreaded aes-ctr cipher */ - - int permit_tun; -diff --git a/serverloop.c b/serverloop.c -index 07507f3..a9bea94 100644 ---- a/serverloop.c -+++ b/serverloop.c -@@ -78,6 +78,11 @@ - #include "serverloop.h" - #include "ssherr.h" - -+#ifdef NERSC_MOD -+#include "nersc.h" -+extern int client_session_id; -+#endif -+ - extern ServerOptions options; - - /* XXX */ -@@ -396,6 +401,10 @@ server_loop2(Authctxt *authctxt) - - server_init_dispatch(); - -+#ifdef NERSC_MOD -+ s_audit("session_new_3", "count=%i int=%d uristring=SSH2", client_session_id, (int)getpid()); -+#endif -+ - for (;;) { - process_buffered_input_packets(); - -@@ -475,6 +484,18 @@ server_request_direct_tcpip(int *reason, const char **errmsg) - !no_port_forwarding_flag && !options.disable_forwarding) { - c = channel_connect_to_port(target, target_port, - "direct-tcpip", "direct-tcpip", reason, errmsg); -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(originator, strlen(originator)); -+ char* t2buf = encode_string(target, strlen(target)); -+ -+ s_audit("session_request_direct_tcpip_3", "count=%i count=%i uristring=%s port=%d/tcp string=%s port=%d/tcp count=%i", -+ client_session_id, c->self, t1buf, originator_port, t2buf, target_port); -+ -+ free(t1buf); -+ free(t2buf); -+#endif -+ - } else { - logit("refused local port forward: " - "originator %s port %d, target %s port %d", -@@ -557,6 +578,12 @@ server_request_tun(void) - sock = tun_open(tun, mode); - if (sock < 0) - goto done; -+ -+#ifdef NERSC_MOD -+ s_audit("session_tun_init_3", "count=%i count=%i count=%i", -+ client_session_id, c->self, mode); -+#endif -+ - c = channel_new("tun", SSH_CHANNEL_OPEN, sock, sock, -1, - options.hpn_disabled ? CHAN_TCP_WINDOW_DEFAULT : options.hpn_buffer_size, - CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1); -@@ -644,6 +671,15 @@ server_input_channel_open(int type, u_int32_t seq, void *ctxt) - packet_put_int(c->local_window); - packet_put_int(c->local_maxpacket); - packet_send(); -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(ctype, strlen(ctype)); -+ -+ s_audit("session_input_channel_open_3", "count=%i count=%i uristring=%s int=%d int=%i int=%d", -+ client_session_id, type, t1buf, rchan, rwindow, rmaxpack); -+ -+ free(t1buf); -+#endif -+ - } - } else { - debug("server_input_channel_open: failure %s", ctype); -diff --git a/session.c b/session.c -index 8a0d9c8..fc81b57 100644 ---- a/session.c -+++ b/session.c -@@ -95,6 +95,12 @@ - #include "monitor_wrap.h" - #include "sftp.h" - -+#ifdef NERSC_MOD -+#include "nersc.h" -+#include -+extern int client_session_id; -+#endif -+ - #if defined(KRB5) && defined(USE_AFS) - #include - #endif -@@ -342,6 +348,16 @@ do_exec_no_pty(Session *s, const char *command) - } - #endif - -+#ifdef NERSC_MOD -+ if ( command != NULL ) { -+ -+ char* t1buf = encode_string(command, strlen(command)); -+ s_audit("session_remote_exec_no_pty_3", "count=%i count=%i count=%ld uristring=%s", -+ client_session_id, s->chanid, (long)getppid(), t1buf); -+ free(t1buf); -+ } -+#endif -+ - session_proctitle(s); - - /* Fork the child. */ -@@ -486,6 +502,15 @@ do_exec_pty(Session *s, const char *command) - ptyfd = s->ptyfd; - ttyfd = s->ttyfd; - -+#ifdef NERSC_MOD -+ if ( command != NULL ) { -+ -+ char* t1buf = encode_string(command, strlen(command)); -+ s_audit("session_remote_exec_pty_3", "count=%i count=%i count=%ld uristring=%s", -+ client_session_id, s->chanid, (long)getppid(), t1buf); -+ free(t1buf); -+ } -+#endif - /* - * Create another descriptor of the pty master side for use as the - * standard input. We could use the original descriptor, but this -@@ -621,6 +646,19 @@ do_exec(Session *s, const char *command) - const char *forced = NULL, *tty = NULL; - char session_type[1024]; - -+#ifdef NERSC_MOD -+ /* since the channel client/server code now takes the raw string -+ * data, we remove the 'clean_command' functionality -+ */ -+ if ( command != NULL ) { -+ -+ char* t1buf = encode_string(command, strlen(command)); -+ s_audit("session_remote_do_exec_3", "count=%i count=%i count=%ld uristring=%s", -+ client_session_id, s->chanid, (long)getppid(), t1buf); -+ free(t1buf); -+ } -+#endif -+ - if (options.adm_forced_command) { - original_command = command; - command = options.adm_forced_command; -@@ -2103,6 +2141,17 @@ session_input_channel_req(Channel *c, const char *rtype) - success = session_env_req(s); - } - } -+ -+#ifdef NERSC_MOD -+ if ((strcmp(rtype,"window-change") != 0) && (strcmp(rtype,"env") != 0)) { -+ -+ char* t1buf = encode_string(rtype, strlen(rtype)); -+ s_audit("session_channel_request_3", "count=%i int=%d count=%d uristring=%s", -+ client_session_id, getpid(), c->self, t1buf); -+ free(t1buf); -+ } -+#endif -+ - if (strcmp(rtype, "window-change") == 0) { - success = session_window_change_req(s); - } else if (strcmp(rtype, "break") == 0) { -@@ -2275,6 +2324,10 @@ session_exit_message(Session *s, int status) - /* disconnect channel */ - debug("session_exit_message: release channel %d", s->chanid); - -+#ifdef NERSC_MOD -+ s_audit("session_exit_3", "count=%i count=%d count=%ld count=%d", client_session_id, s->chanid, (long)getppid(), status); -+#endif -+ - /* - * Adjust cleanup callback attachment to send close messages when - * the channel gets EOF. The session will be then be closed -@@ -2484,6 +2537,14 @@ session_setup_x11fwd(Session *s) - s->display_number, s->screen); - s->display = xstrdup(display); - s->auth_display = xstrdup(auth_display); -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(display, strlen(display)); -+ s_audit("session_x11fwd_3", "count=%i count=%i uristring=%s", -+ client_session_id, s->chanid, t1buf); -+ free(t1buf); -+#endif -+ - } else { - #ifdef IPADDR_IN_DISPLAY - struct hostent *he; -diff --git a/sftp-server.c b/sftp-server.c -index 3619cdf..7f1a1ae 100644 ---- a/sftp-server.c -+++ b/sftp-server.c -@@ -51,6 +51,11 @@ - #include "sftp.h" - #include "sftp-common.h" - -+#ifdef NERSC_MOD -+#include "nersc.h" -+extern int client_session_id; -+#endif -+ - /* Our verbosity */ - static LogLevel log_level = SYSLOG_LEVEL_ERROR; - -@@ -635,6 +640,12 @@ send_statvfs(u_int32_t id, struct statvfs *st) - fatal("%s: buffer error: %s", __func__, ssh_err(r)); - send_msg(msg); - sshbuf_free(msg); -+ -+#ifdef NERSC_MOD -+ s_audit("sftp_process_init_3", "count=%i int=%d int=%d", -+ get_client_session_id(), (int)getppid(), version); -+#endif -+ - } - - /* parse incoming */ -@@ -711,6 +722,14 @@ process_open(u_int32_t id) - } - if (status != SSH2_FX_OK) - send_status(id, status); -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string( name, strlen(name)); -+ s_audit("sftp_process_open_3", "count=%i int=%d uristring=%s", -+ get_client_session_id(), (int)getppid(), t1buf); -+ free(t1buf); -+#endif -+ - free(name); - } - -@@ -727,6 +746,11 @@ process_close(u_int32_t id) - ret = handle_close(handle); - status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; - send_status(id, status); -+ -+#ifdef NERSC_MOD -+ s_audit("sftp_process_close_3", "count=%i int=%d int=%d int=%d", -+ get_client_session_id(), (int)getppid(), id, handle); -+#endif - } - - static void -@@ -836,6 +860,14 @@ process_do_stat(u_int32_t id, int do_lstat) - } - if (status != SSH2_FX_OK) - send_status(id, status); -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(name, strlen(name)); -+ s_audit("sftp_process_do_stat_3", "count=%i int=%d uristring=%s", -+ get_client_session_id(), (int)getppid(), t1buf); -+ free(t1buf); -+#endif -+ - free(name); - } - -@@ -875,6 +907,11 @@ process_fstat(u_int32_t id) - } - if (status != SSH2_FX_OK) - send_status(id, status); -+ -+#ifdef NERSC_MOD -+ s_audit("sftp_process_fstat_3", "count=%i int=%d int=%d", -+ get_client_session_id(), (int)getppid(), handle); -+#endif - } - - static struct timeval * -@@ -999,6 +1036,13 @@ process_fsetstat(u_int32_t id) - } - } - send_status(id, status); -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string( handle_to_name(handle), strlen(handle_to_name(handle)) ); -+ s_audit("sftp_process_fsetstat_3", "count=%i int=%d int=%d uristring=%s", -+ get_client_session_id(), (int)getppid(), id, t1buf); -+ free(t1buf); -+#endif - } - - static void -@@ -1028,6 +1072,13 @@ process_opendir(u_int32_t id) - } - if (status != SSH2_FX_OK) - send_status(id, status); -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(path, strlen(path)); -+ s_audit("sftp_process_opendir_3", "count=%i int=%d uristring=%s", -+ get_client_session_id(), (int)getpid(), t1buf); -+ free(t1buf); -+#endif - free(path); - } - -@@ -1083,6 +1134,12 @@ process_readdir(u_int32_t id) - } else { - send_status(id, SSH2_FX_EOF); - } -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(path, strlen(path)); -+ s_audit("sftp_process_readdir_3", "count=%i int=%d uristring=%s", -+ get_client_session_id(), (int)getppid(), t1buf); -+#endif - free(stats); - } - } -@@ -1101,6 +1158,12 @@ process_remove(u_int32_t id) - r = unlink(name); - status = (r == -1) ? errno_to_portable(errno) : SSH2_FX_OK; - send_status(id, status); -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(name, strlen(name)); -+ s_audit("sftp_process_remove_3", "count=%i int=%d uristring=%s", -+ get_client_session_id(), (int)getppid(), t1buf); -+#endif - free(name); - } - -@@ -1122,6 +1185,13 @@ process_mkdir(u_int32_t id) - r = mkdir(name, mode); - status = (r == -1) ? errno_to_portable(errno) : SSH2_FX_OK; - send_status(id, status); -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(name, strlen(name)); -+ s_audit("sftp_process_mkdir_3", "count=%i int=%d uristring=%s", -+ get_client_session_id(), (int)getpid(), t1buf); -+ free(t1buf); -+#endif - free(name); - } - -@@ -1139,6 +1209,13 @@ process_rmdir(u_int32_t id) - r = rmdir(name); - status = (r == -1) ? errno_to_portable(errno) : SSH2_FX_OK; - send_status(id, status); -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(name, strlen(name)); -+ s_audit("sftp_process_rmdir_3", "count=%i int=%d uristring=%s", -+ get_client_session_id(), (int)getppid(), t1buf); -+ free(t1buf); -+#endif - free(name); - } - -@@ -1166,6 +1243,13 @@ process_realpath(u_int32_t id) - s.name = s.long_name = resolvedname; - send_names(id, 1, &s); - } -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(path, strlen(path)); -+ s_audit("sftp_process_realpath_3", "count=%i int=%d uristring=%s", -+ get_client_session_id(), (int)getppid(), t1buf); -+ free(t1buf); -+#endif - free(path); - } - -@@ -1225,6 +1309,17 @@ process_rename(u_int32_t id) - status = SSH2_FX_OK; - } - send_status(id, status); -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string( oldpath, strlen(oldpath)); -+ char* t2buf = encode_string( newpath, strlen(newpath)); -+ -+ s_audit("sftp_process_rename_3", "count=%i int=%d uristring=%s uristring=%s", -+ get_client_session_id(), (int)getppid(), t1buf, t2buf); -+ -+ free(t1buf); -+ free(t2buf); -+#endif - free(oldpath); - free(newpath); - } -@@ -1251,6 +1346,13 @@ process_readlink(u_int32_t id) - s.name = s.long_name = buf; - send_names(id, 1, &s); - } -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string( path, strlen(path)); -+ s_audit("sftp_process_readlink_3", "count=%i int=%d uristring=%s", -+ get_client_session_id(), (int)getppid(), t1buf); -+ free(t1buf); -+#endif - free(path); - } - -@@ -1270,6 +1372,17 @@ process_symlink(u_int32_t id) - r = symlink(oldpath, newpath); - status = (r == -1) ? errno_to_portable(errno) : SSH2_FX_OK; - send_status(id, status); -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string( oldpath, strlen(oldpath)); -+ char* t2buf = encode_string( newpath, strlen(newpath)); -+ -+ s_audit("sftp_process_symlink_3", "count=%i int=%d uristring=%s uristring=%s", -+ get_client_session_id(), (int)getppid(), t1buf, t2buf); -+ -+ free(t1buf); -+ free(t2buf); -+#endif - free(oldpath); - free(newpath); - } -@@ -1453,7 +1566,15 @@ process(void) - } - } - if (handlers[i].handler == NULL) -+#ifdef NERSC_MOD -+ { -+ s_audit("sftp_process_unknown_3", "count=%i int=%d uristring=%d", -+ get_client_session_id(), (int)getppid(), type); - error("Unknown message %u", type); -+ } -+#else -+ error("Unknown message %u", type); -+#endif - } - /* discard the remaining bytes from the current packet */ - if (buf_len < sshbuf_len(iqueue)) { -@@ -1638,7 +1759,15 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw) - } - } - -+#ifdef NERSC_MOD -+ char* t1buf = encode_string(pw->pw_name, strlen(pw->pw_name)); -+ s_audit("sftp_process_init_3", "count=%i int=%d uristring=%s addr=%s", -+ get_client_session_id(), (int)getppid(), t1buf, client_addr); -+ free(t1buf); -+#endif -+ - set_size = howmany(max + 1, NFDBITS) * sizeof(fd_mask); -+ - for (;;) { - memset(rset, 0, set_size); - memset(wset, 0, set_size); -diff --git a/sshd.8 b/sshd.8 -index 7725a69..e8c2a60 100644 ---- a/sshd.8 -+++ b/sshd.8 -@@ -825,6 +825,12 @@ the user's home directory becomes accessible. - This file should be writable only by the user, and need not be - readable by anyone else. - .Pp -+.It Pa /etc/hosts.allow -+.It Pa /etc/hosts.deny -+Access controls that should be enforced by tcp-wrappers are defined here. -+Further details described in -+.Xr hosts_access 5 . -+.Pp - .It Pa /etc/hosts.equiv - This file is for host-based authentication (see - .Xr ssh 1 ) . -@@ -929,6 +935,7 @@ The content of this file is not sensitive; it can be world-readable. - .Xr ssh-keygen 1 , - .Xr ssh-keyscan 1 , - .Xr chroot 2 , -+.Xr hosts_access 5 , - .Xr login.conf 5 , - .Xr moduli 5 , - .Xr sshd_config 5 , -diff --git a/sshd.c b/sshd.c -index 1bff88c..ccf90ec 100644 ---- a/sshd.c -+++ b/sshd.c -@@ -123,12 +123,32 @@ - #include "version.h" - #include "ssherr.h" - -+#ifdef LIBWRAP -+#include -+#include -+int allow_severity; -+int deny_severity; -+#endif /* LIBWRAP */ -+ -+#ifndef O_NOCTTY -+#define O_NOCTTY 0 -+#endif -+ - /* Re-exec fds */ - #define REEXEC_DEVCRYPTO_RESERVED_FD (STDERR_FILENO + 1) - #define REEXEC_STARTUP_PIPE_FD (STDERR_FILENO + 2) - #define REEXEC_CONFIG_PASS_FD (STDERR_FILENO + 3) - #define REEXEC_MIN_FREE_FD (STDERR_FILENO + 4) - -+#ifdef NERSC_MOD -+#include "nersc.h" -+extern char n_ntop[NI_MAXHOST]; -+extern char n_port[NI_MAXHOST]; -+extern int client_session_id; -+extern char interface_list[256]; -+extern int audit_disabled = 0; -+#endif -+ - extern char *__progname; - - /* Server configuration options. */ -@@ -289,6 +309,20 @@ sighup_handler(int sig) - static void - sighup_restart(void) - { -+ -+#ifdef NERSC_MOD -+ -+ struct addrinfo *ai; -+ char ntop[NI_MAXHOST], strport[NI_MAXSERV]; -+ -+ ai = options.listen_addrs; -+ -+ if ( getnameinfo(ai->ai_addr, ai->ai_addrlen,ntop, sizeof(ntop), strport, -+ sizeof(strport),NI_NUMERICHOST|NI_NUMERICSERV) == 0) { -+ s_audit("sshd_restart_3", "addr=%s port=%s/tcp", ntop, strport); -+ } -+#endif -+ - logit("Received SIGHUP; restarting."); - if (options.pid_file != NULL) - unlink(options.pid_file); -@@ -1090,6 +1124,15 @@ server_listen(void) - fatal("listen on [%s]:%s: %.100s", - ntop, strport, strerror(errno)); - logit("Server listening on %s port %s.", ntop, strport); -+ -+#ifdef NERSC_MOD -+ /* set using (pid,address,port) */ -+ set_server_id(getpid(),ntop,(int)options.ports[0]); -+ -+ s_audit("sshd_start_3", "addr=%s port=%s/tcp", ntop, strport); -+ client_session_id=0; -+ set_interface_list(); -+#endif - } - freeaddrinfo(options.listen_addrs); - -@@ -1104,6 +1147,16 @@ server_listen(void) - static void - server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s) - { -+ -+#ifdef NERSC_MOD -+ struct addrinfo *ai; -+ char ntop[NI_MAXHOST], strport[NI_MAXSERV]; -+ -+ ai = options.listen_addrs; -+ struct timeval l_tv; -+ l_tv.tv_sec = 60; -+ l_tv.tv_usec = 0; -+#endif - fd_set *fdset; - int i, j, ret, maxfd; - int startups = 0; -@@ -1142,7 +1195,28 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s) - FD_SET(startup_pipes[i], fdset); - - /* Wait in select until there is a connection. */ -+ -+#ifndef NERSC_MOD - ret = select(maxfd+1, fdset, NULL, NULL, NULL); -+#endif -+ -+#ifdef NERSC_MOD -+ -+ /* If a connection happens, we break from the loop with some ammount of -+ * data flagged in the return bits of select. On error we see ret < 0. -+ * -+ * This needs to be tested wqith great enthusiasm since there might be corner -+ * cases of ret == 0 that I am not aware of -+ */ -+ l_tv.tv_sec = 60; -+ l_tv.tv_usec = 0; -+ -+ ret = select(maxfd+1, fdset, NULL, NULL, &l_tv); -+ -+ s_audit("sshd_server_heartbeat_3", "count=%i", ret); -+ -+#endif -+ - if (ret < 0 && errno != EINTR) - error("select: %.100s", strerror(errno)); - if (received_sigterm) { -@@ -1151,6 +1225,13 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s) - close_listen_socks(); - if (options.pid_file != NULL) - unlink(options.pid_file); -+ -+#ifdef NERSC_MOD -+ if ( getnameinfo(ai->ai_addr, ai->ai_addrlen,ntop, sizeof(ntop), strport, -+ sizeof(strport),NI_NUMERICHOST|NI_NUMERICSERV) == 0) { -+ s_audit("sshd_exit_3", "addr=%s port=%s/tcp", ntop, strport); -+ } -+#endif - exit(received_sigterm == SIGTERM ? 0 : 255); - } - if (ret < 0) -@@ -1648,6 +1729,20 @@ main(int ac, char **av) - exit(1); - } - -+#ifdef NERSC_MOD -+ /* here we are setting the values for the server id which lives in nersc.c */ -+ getnameinfo(options.listen_addrs->ai_addr, options.listen_addrs->ai_addrlen, -+ n_ntop, sizeof(n_ntop), n_port,sizeof(n_port), -+ NI_NUMERICHOST|NI_NUMERICSERV); -+ -+ /* To avoid linking issues, we just set a variable here based on the running configuration -+ * not my favorite -+ */ -+ if ( options.audit_disabled ) -+ audit_disabled = 1; -+ -+#endif -+ - debug("sshd version %s, %s", SSH_VERSION, - #ifdef WITH_OPENSSL - SSLeay_version(SSLEAY_VERSION) -@@ -1999,9 +2094,44 @@ main(int ac, char **av) - */ - remote_ip = ssh_remote_ipaddr(ssh); - -+#ifdef NERSC_MOD -+ -+ /* here we were setting client_session_id to the current pid -+ * but will now use a positive random number -+ * to use as a tracking id for the remainder of the -+ * session. c_s_i is defined in nersc.c -+ */ -+ client_session_id = abs(arc4random() ); -+ -+ char* t1buf = encode_string(interface_list, strlen(interface_list)); -+ -+ s_audit("sshd_connection_start_3", "count=%i uristring=%s addr=%s port=%i/tcp addr=%s port=%s/tcp count=%ld", -+ client_session_id, interface_list, remote_ip, remote_port, n_ntop, n_port); -+ -+ free(t1buf); -+#endif -+ - #ifdef SSH_AUDIT_EVENTS - audit_connection_from(remote_ip, remote_port); - #endif -+#ifdef LIBWRAP -+ allow_severity = options.log_facility|LOG_INFO; -+ deny_severity = options.log_facility|LOG_WARNING; -+ /* Check whether logins are denied from this host. */ -+ if (packet_connection_is_on_socket()) { -+ struct request_info req; -+ -+ request_init(&req, RQ_DAEMON, __progname, RQ_FILE, sock_in, 0); -+ fromhost(&req); -+ -+ if (!hosts_access(&req)) { -+ debug("Connection refused by tcp wrapper"); -+ refuse(&req); -+ /* NOTREACHED */ -+ fatal("libwrap refuse returns"); -+ } -+ } -+#endif /* LIBWRAP */ - - /* Log the connection. */ - laddr = get_local_ipaddr(sock_in); -@@ -2132,6 +2262,10 @@ main(int ac, char **av) - - do_authenticated(authctxt); - -+#ifdef NERSC_MOD -+ s_audit("sshd_connection_end_3", "count=%i addr=%s port=%i/tcp addr=%s port=%s/tcp", -+ client_session_id, remote_ip, remote_port, n_ntop, n_port); -+#endif - /* The connection has been terminated. */ - packet_get_bytes(&ibytes, &obytes); - verbose("Transferred: sent %llu, received %llu bytes", -@@ -2192,11 +2326,11 @@ do_ssh2_kex(void) - struct kex *kex; - int r; - -- if (options.none_enabled == 1) -- debug("WARNING: None cipher enabled"); -+ if (options.none_enabled == 1) -+ debug ("WARNING: None cipher enabled"); - - myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal( -- options.kex_algorithms); -+ options.kex_algorithms); - myproposal[PROPOSAL_ENC_ALGS_CTOS] = compat_cipher_proposal( - options.ciphers); - myproposal[PROPOSAL_ENC_ALGS_STOC] = compat_cipher_proposal( -diff --git a/sshd_config b/sshd_config -index b8d51bf..00f2810 100644 ---- a/sshd_config -+++ b/sshd_config -@@ -123,6 +123,9 @@ Subsystem sftp /usr/libexec/sftp-server - # allow the use of the none cipher - #NoneEnabled no - -+# Disable sshd auditing -+#AuditDisabled no -+ - # Example of overriding settings on a per-user basis - #Match User anoncvs - # X11Forwarding no -diff --git a/version.h b/version.h -index 39750cd..13cc823 100644 ---- a/version.h -+++ b/version.h -@@ -5,3 +5,9 @@ - #define SSH_PORTABLE "p1" - #define SSH_HPN "-hpn14v13" - #define SSH_RELEASE SSH_VERSION SSH_PORTABLE SSH_HPN -+ -+#ifdef NERSC_MOD -+#undef SSH_RELEASE -+#define SSH_AUDITING "NMOD_3.19" -+#define SSH_RELEASE SSH_VERSION SSH_PORTABLE SSH_HPN SSH_AUDITING -+#endif /* NERSC_MOD */ diff --git a/packaging/debian/gsi-openssh/debian/patches/hpn_isshd-gsi.7.5p1c.patch b/packaging/debian/gsi-openssh/debian/patches/hpn_isshd-gsi.7.5p1c.patch deleted file mode 100644 index 744ac35b66..0000000000 --- a/packaging/debian/gsi-openssh/debian/patches/hpn_isshd-gsi.7.5p1c.patch +++ /dev/null @@ -1,16737 +0,0 @@ -diff -Nur openssh-7.5p1/auth2.c gsi-openssh/auth2.c ---- openssh-7.5p1/auth2.c 2018-12-20 11:48:40.808000000 +0100 -+++ gsi-openssh/auth2.c 2019-01-09 20:58:21.824000000 +0100 -@@ -75,6 +75,7 @@ - extern Authmethod method_kbdint; - extern Authmethod method_hostbased; - #ifdef GSSAPI -+extern Authmethod method_gsskeyex; - extern Authmethod method_gssapi; - #endif - -@@ -84,6 +85,7 @@ - &method_none, - &method_pubkey, - #ifdef GSSAPI -+ &method_gsskeyex, - &method_gssapi, - #endif - &method_passwd, -@@ -231,10 +233,31 @@ - user = packet_get_cstring(NULL); - service = packet_get_cstring(NULL); - method = packet_get_cstring(NULL); -- debug("userauth-request for user %s service %s method %s", user, service, method); -+ -+#ifdef GSSAPI -+ if (user[0] == '\0') { -+ debug("received empty username for %s", method); -+ if (strcmp(method, "gssapi-keyex") == 0) { -+ char *lname = NULL; -+ PRIVSEP(ssh_gssapi_localname(&lname)); -+ if (lname && lname[0] != '\0') { -+ free(user); -+ user = lname; -+ debug("set username to %s from gssapi context", user); -+ } else { -+ debug("failed to set username from gssapi context"); -+ packet_send_debug("failed to set username from gssapi context"); -+ } -+ } -+ } -+#endif -+ -+ debug("userauth-request for user %s service %s method %s", -+ user[0] ? user : "", service, method); - if (!log_flag) { - logit("SSH: Server;Ltype: Authname;Remote: %s-%d;Name: %s", -- ssh_remote_ipaddr(active_state), ssh_remote_port(active_state), user); -+ ssh_remote_ipaddr(active_state), ssh_remote_port(active_state), -+ user[0] ? user : ""); - log_flag = 1; - } - debug("attempt %d failures %d", authctxt->attempt, authctxt->failures); -@@ -242,11 +265,32 @@ - if ((style = strchr(user, ':')) != NULL) - *style++ = 0; - -- if (authctxt->attempt++ == 0) { -- /* setup auth context */ -- authctxt->pw = PRIVSEP(getpwnamallow(user)); -+ /* If first time or username changed or empty username, -+ setup/reset authentication context. */ -+ if ((authctxt->attempt++ == 0) || -+ (strcmp(user, authctxt->user) != 0) || -+ (strcmp(user, "") == 0)) { -+ if (authctxt->user) { -+ free(authctxt->user); -+ authctxt->user = NULL; -+ } -+ authctxt->valid = 0; - authctxt->user = xstrdup(user); -- if (authctxt->pw && strcmp(service, "ssh-connection")==0) { -+ if (strcmp(service, "ssh-connection") != 0) { -+ packet_disconnect("Unsupported service %s", service); -+ } -+#ifdef GSSAPI -+ /* If we're going to set the username based on the -+ GSSAPI context later, then wait until then to -+ verify it. Just put in placeholders for now. */ -+ if ((strcmp(user, "") == 0) && -+ ((strcmp(method, "gssapi") == 0) || -+ (strcmp(method, "gssapi-with-mic") == 0))) { -+ authctxt->pw = fakepw(); -+ } else { -+#endif -+ authctxt->pw = PRIVSEP(getpwnamallow(user)); -+ if (authctxt->pw) { - authctxt->valid = 1; - debug2("%s: setting up authctxt for %s", - __func__, user); -@@ -257,6 +301,9 @@ - PRIVSEP(audit_event(SSH_INVALID_USER)); - #endif - } -+#ifdef GSSAPI -+ } /* endif for setting username based on GSSAPI context */ -+#endif - #ifdef USE_PAM - if (options.use_pam) - PRIVSEP(start_pam(authctxt)); -@@ -265,6 +312,7 @@ - authctxt->valid ? "authenticating " : "invalid ", user); - setproctitle("%s%s", authctxt->valid ? user : "unknown", - use_privsep ? " [net]" : ""); -+ if (authctxt->attempt == 1) { - authctxt->service = xstrdup(service); - authctxt->style = style ? xstrdup(style) : NULL; - if (use_privsep) -@@ -272,9 +320,10 @@ - userauth_banner(); - if (auth2_setup_methods_lists(authctxt) != 0) - packet_disconnect("no authentication methods enabled"); -- } else if (strcmp(user, authctxt->user) != 0 || -- strcmp(service, authctxt->service) != 0) { -- packet_disconnect("Change of username or service not allowed: " -+ } -+ } -+ if (strcmp(service, authctxt->service) != 0) { -+ packet_disconnect("Change of service not allowed: " - "(%s,%s) -> (%s,%s)", - authctxt->user, authctxt->service, user, service); - } -diff -Nur openssh-7.5p1/auth2-gss.c gsi-openssh/auth2-gss.c ---- openssh-7.5p1/auth2-gss.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/auth2-gss.c 2019-01-09 22:37:25.460000000 +0100 -@@ -1,7 +1,7 @@ - /* $OpenBSD: auth2-gss.c,v 1.22 2015/01/19 20:07:45 markus Exp $ */ - - /* -- * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. -+ * Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions -@@ -48,11 +48,60 @@ - - extern ServerOptions options; - -+static void ssh_gssapi_userauth_error(Gssctxt *ctxt); - static int input_gssapi_token(int type, u_int32_t plen, void *ctxt); - static int input_gssapi_mic(int type, u_int32_t plen, void *ctxt); - static int input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt); - static int input_gssapi_errtok(int, u_int32_t, void *); - -+/* -+ * The 'gssapi_keyex' userauth mechanism. -+ */ -+static int -+userauth_gsskeyex(Authctxt *authctxt) -+{ -+ int authenticated = 0; -+ Buffer b, b2; -+ gss_buffer_desc mic, gssbuf, gssbuf2; -+ u_int len; -+ -+ mic.value = packet_get_string(&len); -+ mic.length = len; -+ -+ packet_check_eom(); -+ -+ ssh_gssapi_buildmic(&b, authctxt->user, authctxt->service, -+ "gssapi-keyex"); -+ -+ gssbuf.value = buffer_ptr(&b); -+ gssbuf.length = buffer_len(&b); -+ -+ /* client may have used empty username to determine target -+ name from GSSAPI context */ -+ ssh_gssapi_buildmic(&b2, "", authctxt->service, "gssapi-keyex"); -+ -+ gssbuf2.value = buffer_ptr(&b2); -+ gssbuf2.length = buffer_len(&b2); -+ -+ /* gss_kex_context is NULL with privsep, so we can't check it here */ -+ if (!GSS_ERROR(PRIVSEP(ssh_gssapi_checkmic(gss_kex_context, -+ &gssbuf, &mic))) || -+ !GSS_ERROR(PRIVSEP(ssh_gssapi_checkmic(gss_kex_context, -+ &gssbuf2, &mic)))) { -+ if (authctxt->valid && authctxt->user && authctxt->user[0]) { -+ authenticated = -+ PRIVSEP(ssh_gssapi_userok(authctxt->user, -+ authctxt->pw, 1 /* gssapi-keyex */)); -+ } -+ } -+ -+ buffer_free(&b); -+ buffer_free(&b2); -+ free(mic.value); -+ -+ return (authenticated); -+} -+ - /* - * We only support those mechanisms that we know about (ie ones that we know - * how to check local user kuserok and the like) -@@ -68,7 +117,10 @@ - u_int len; - u_char *doid = NULL; - -- if (!authctxt->valid || authctxt->user == NULL) -+ /* authctxt->valid may be 0 if we haven't yet determined -+ username from gssapi context. */ -+ -+ if (authctxt->user == NULL) - return (0); - - mechs = packet_get_int(); -@@ -133,7 +185,7 @@ - Gssctxt *gssctxt; - gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; - gss_buffer_desc recv_tok; -- OM_uint32 maj_status, min_status, flags; -+ OM_uint32 maj_status, min_status, flags = 0; - u_int len; - - if (authctxt == NULL || (authctxt->methoddata == NULL && !use_privsep)) -@@ -151,6 +203,7 @@ - free(recv_tok.value); - - if (GSS_ERROR(maj_status)) { -+ ssh_gssapi_userauth_error(gssctxt); - if (send_tok.length != 0) { - packet_start(SSH2_MSG_USERAUTH_GSSAPI_ERRTOK); - packet_put_string(send_tok.value, send_tok.length); -@@ -216,6 +269,32 @@ - return 0; - } - -+static void -+gssapi_set_username(Authctxt *authctxt) -+{ -+ char *lname = NULL; -+ -+ if ((authctxt->user == NULL) || (authctxt->user[0] == '\0')) { -+ PRIVSEP(ssh_gssapi_localname(&lname)); -+ if (lname && lname[0] != '\0') { -+ if (authctxt->user) free(authctxt->user); -+ authctxt->user = lname; -+ debug("set username to %s from gssapi context", lname); -+ authctxt->pw = PRIVSEP(getpwnamallow(authctxt->user)); -+ if (authctxt->pw) { -+ authctxt->valid = 1; -+#ifdef USE_PAM -+ if (options.use_pam) -+ PRIVSEP(start_pam(authctxt)); -+#endif -+ } -+ } else { -+ debug("failed to set username from gssapi context"); -+ packet_send_debug("failed to set username from gssapi context"); -+ } -+ } -+} -+ - /* - * This is called when the client thinks we've completed authentication. - * It should only be enabled in the dispatch handler by the function above, -@@ -226,11 +305,13 @@ - input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt) - { - Authctxt *authctxt = ctxt; -- int authenticated; -+ int authenticated = 0; - - if (authctxt == NULL || (authctxt->methoddata == NULL && !use_privsep)) - fatal("No authentication or GSSAPI context"); - -+ gssapi_set_username(authctxt); -+ - /* - * We don't need to check the status, because we're only enabled in - * the dispatcher once the exchange is complete -@@ -238,7 +319,11 @@ - - packet_check_eom(); - -- authenticated = PRIVSEP(ssh_gssapi_userok(authctxt->user)); -+ /* user should be set if valid but we double-check here */ -+ if (authctxt->valid && authctxt->user && authctxt->user[0]) { -+ authenticated = PRIVSEP(ssh_gssapi_userok(authctxt->user, -+ authctxt->pw, 0 /* !gssapi-keyex */)); -+ } - - authctxt->postponed = 0; - dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL); -@@ -273,10 +358,17 @@ - gssbuf.value = buffer_ptr(&b); - gssbuf.length = buffer_len(&b); - -- if (!GSS_ERROR(PRIVSEP(ssh_gssapi_checkmic(gssctxt, &gssbuf, &mic)))) -- authenticated = PRIVSEP(ssh_gssapi_userok(authctxt->user)); -- else -+ gssapi_set_username(authctxt); -+ -+ if (!GSS_ERROR(PRIVSEP(ssh_gssapi_checkmic(gssctxt, &gssbuf, &mic)))) { -+ if (authctxt->valid && authctxt->user && authctxt->user[0]) { -+ authenticated = -+ PRIVSEP(ssh_gssapi_userok(authctxt->user, -+ authctxt->pw, 0 /* !gssapi-keyex */)); -+ } -+ } else { - logit("GSSAPI MIC check failed"); -+ } - - buffer_free(&b); - free(mic.value); -@@ -290,6 +382,29 @@ - return 0; - } - -+static void ssh_gssapi_userauth_error(Gssctxt *ctxt) { -+ char *errstr; -+ OM_uint32 maj,min; -+ -+ errstr=PRIVSEP(ssh_gssapi_last_error(ctxt,&maj,&min)); -+ if (errstr) { -+ packet_start(SSH2_MSG_USERAUTH_GSSAPI_ERROR); -+ packet_put_int(maj); -+ packet_put_int(min); -+ packet_put_cstring(errstr); -+ packet_put_cstring(""); -+ packet_send(); -+ packet_write_wait(); -+ free(errstr); -+ } -+} -+ -+Authmethod method_gsskeyex = { -+ "gssapi-keyex", -+ userauth_gsskeyex, -+ &options.gss_authentication -+}; -+ - Authmethod method_gssapi = { - "gssapi-with-mic", - userauth_gssapi, -diff -Nur openssh-7.5p1/auth.c gsi-openssh/auth.c ---- openssh-7.5p1/auth.c 2018-12-20 11:48:40.808000000 +0100 -+++ gsi-openssh/auth.c 2019-01-09 22:46:02.284000000 +0100 -@@ -322,7 +322,8 @@ - method, - submethod != NULL ? "/" : "", submethod == NULL ? "" : submethod, - authctxt->valid ? "" : "invalid user ", -- authctxt->user, -+ (authctxt->user && authctxt->user[0]) ? -+ authctxt->user : "unknown", - ssh_remote_ipaddr(ssh), - ssh_remote_port(ssh), - authctxt->info != NULL ? ": " : "", -@@ -393,6 +394,7 @@ - case PERMIT_NO_PASSWD: - if (strcmp(method, "publickey") == 0 || - strcmp(method, "hostbased") == 0 || -+ strcmp(method, "gssapi-keyex") == 0 || - strcmp(method, "gssapi-with-mic") == 0) - return 1; - break; -@@ -662,6 +664,10 @@ - #endif - - pw = getpwnam(user); -+#ifdef USE_PAM -+ if (options.use_pam && options.permit_pam_user_change && pw == NULL) -+ pw = sshpam_getpw(user); -+#endif - - #if defined(_AIX) && defined(HAVE_SETAUTHDB) - aix_restoreauthdb(); -@@ -681,7 +687,8 @@ - #endif - if (pw == NULL) { - logit("Invalid user %.100s from %.100s port %d", -- user, ssh_remote_ipaddr(ssh), ssh_remote_port(ssh)); -+ (user && user[0]) ? user : "unknown", -+ ssh_remote_ipaddr(ssh), ssh_remote_port(ssh)); - #ifdef CUSTOM_FAILED_LOGIN - record_failed_login(user, - auth_get_canonical_hostname(ssh, options.use_dns), "ssh"); -diff -Nur openssh-7.5p1/auth-compat.c gsi-openssh/auth-compat.c ---- openssh-7.5p1/auth-compat.c 1970-01-01 01:00:00.000000000 +0100 -+++ gsi-openssh/auth-compat.c 2018-12-20 11:49:17.544000000 +0100 -@@ -0,0 +1,175 @@ -+/* -+ * Copyright (c) 2000 Markus Friedl. All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include "includes.h" -+ -+#include -+#include -+#include -+ -+#include -+ -+#include -+#include -+#ifdef HAVE_PATHS_H -+# include -+#endif -+#include -+#ifdef HAVE_LOGIN_H -+#include -+#endif -+#ifdef USE_SHADOW -+#include -+#endif -+#ifdef HAVE_LIBGEN_H -+#include -+#endif -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "auth-compat.h" -+#include "log.h" -+#include "canohost.h" -+#include "misc.h" -+ -+/**************** XXX moved from auth.c ****************/ -+ -+/* -+ * Returns the remote DNS hostname as a string. The returned string must not -+ * be freed. NB. this will usually trigger a DNS query the first time it is -+ * called. -+ * This function does additional checks on the hostname to mitigate some -+ * attacks on legacy rhosts-style authentication. -+ * XXX is RhostsRSAAuthentication vulnerable to these? -+ * XXX Can we remove these checks? (or if not, remove RhostsRSAAuthentication?) -+ */ -+ -+static char * -+remote_hostname(struct ssh *ssh) -+{ -+ struct sockaddr_storage from; -+ socklen_t fromlen; -+ struct addrinfo hints, *ai, *aitop; -+ char name[NI_MAXHOST], ntop2[NI_MAXHOST]; -+ const char *ntop = ssh_remote_ipaddr(ssh); -+ -+ /* Get IP address of client. */ -+ fromlen = sizeof(from); -+ memset(&from, 0, sizeof(from)); -+ if (getpeername(ssh_packet_get_connection_in(ssh), -+ (struct sockaddr *)&from, &fromlen) < 0) { -+ debug("getpeername failed: %.100s", strerror(errno)); -+ return strdup(ntop); -+ } -+ -+ ipv64_normalise_mapped(&from, &fromlen); -+ if (from.ss_family == AF_INET6) -+ fromlen = sizeof(struct sockaddr_in6); -+ -+ debug3("Trying to reverse map address %.100s.", ntop); -+ /* Map the IP address to a host name. */ -+ if (getnameinfo((struct sockaddr *)&from, fromlen, name, sizeof(name), -+ NULL, 0, NI_NAMEREQD) != 0) { -+ /* Host name not found. Use ip address. */ -+ return strdup(ntop); -+ } -+ -+ /* -+ * if reverse lookup result looks like a numeric hostname, -+ * someone is trying to trick us by PTR record like following: -+ * 1.1.1.10.in-addr.arpa. IN PTR 2.3.4.5 -+ */ -+ memset(&hints, 0, sizeof(hints)); -+ hints.ai_socktype = SOCK_DGRAM; /*dummy*/ -+ hints.ai_flags = AI_NUMERICHOST; -+ if (getaddrinfo(name, NULL, &hints, &ai) == 0) { -+ logit("Nasty PTR record \"%s\" is set up for %s, ignoring", -+ name, ntop); -+ freeaddrinfo(ai); -+ return strdup(ntop); -+ } -+ -+ /* Names are stored in lowercase. */ -+ lowercase(name); -+ -+ /* -+ * Map it back to an IP address and check that the given -+ * address actually is an address of this host. This is -+ * necessary because anyone with access to a name server can -+ * define arbitrary names for an IP address. Mapping from -+ * name to IP address can be trusted better (but can still be -+ * fooled if the intruder has access to the name server of -+ * the domain). -+ */ -+ memset(&hints, 0, sizeof(hints)); -+ hints.ai_family = from.ss_family; -+ hints.ai_socktype = SOCK_STREAM; -+ if (getaddrinfo(name, NULL, &hints, &aitop) != 0) { -+ logit("reverse mapping checking getaddrinfo for %.700s " -+ "[%s] failed - POSSIBLE BREAK-IN ATTEMPT!", name, ntop); -+ return strdup(ntop); -+ } -+ /* Look for the address from the list of addresses. */ -+ for (ai = aitop; ai; ai = ai->ai_next) { -+ if (getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop2, -+ sizeof(ntop2), NULL, 0, NI_NUMERICHOST) == 0 && -+ (strcmp(ntop, ntop2) == 0)) -+ break; -+ } -+ freeaddrinfo(aitop); -+ /* If we reached the end of the list, the address was not there. */ -+ if (ai == NULL) { -+ /* Address not found for the host name. */ -+ logit("Address %.100s maps to %.600s, but this does not " -+ "map back to the address - POSSIBLE BREAK-IN ATTEMPT!", -+ ntop, name); -+ return strdup(ntop); -+ } -+ return strdup(name); -+} -+ -+/* -+ * Return the canonical name of the host in the other side of the current -+ * connection. The host name is cached, so it is efficient to call this -+ * several times. -+ */ -+ -+const char * -+get_canonical_hostname(struct ssh *ssh, int use_dns) -+{ -+ static char *dnsname; -+ -+ if (!use_dns) -+ return ssh_remote_ipaddr(ssh); -+ else if (dnsname != NULL) -+ return dnsname; -+ else { -+ dnsname = remote_hostname(ssh); -+ return dnsname; -+ } -+} -diff -Nur openssh-7.5p1/auth-compat.h gsi-openssh/auth-compat.h ---- openssh-7.5p1/auth-compat.h 1970-01-01 01:00:00.000000000 +0100 -+++ gsi-openssh/auth-compat.h 2018-12-20 11:49:17.544000000 +0100 -@@ -0,0 +1,33 @@ -+/* -+ * Copyright (c) 2000 Markus Friedl. All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ * -+ */ -+ -+#ifndef AUTH_COMPAT_H -+#define AUTH_COMPAT_H -+ -+#include "packet.h" -+ -+const char *get_canonical_hostname(struct ssh *, int); -+ -+#endif -diff -Nur openssh-7.5p1/auth.h gsi-openssh/auth.h ---- openssh-7.5p1/auth.h 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/auth.h 2019-01-09 23:24:37.984000000 +0100 -@@ -41,6 +41,9 @@ - #ifdef KRB5 - #include - #endif -+#ifdef AFS_KRB5 -+#include -+#endif - - struct ssh; - struct sshkey; -@@ -76,6 +79,9 @@ - char *krb5_ticket_file; - char *krb5_ccname; - #endif -+#ifdef SESSION_HOOKS -+ char *session_env_file; -+#endif - Buffer *loginmsg; - void *methoddata; - -diff -Nur openssh-7.5p1/auth-krb5.c gsi-openssh/auth-krb5.c ---- openssh-7.5p1/auth-krb5.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/auth-krb5.c 2018-12-20 11:49:17.548000000 +0100 -@@ -182,8 +182,13 @@ - - len = strlen(authctxt->krb5_ticket_file) + 6; - authctxt->krb5_ccname = xmalloc(len); -+#ifdef USE_CCAPI -+ snprintf(authctxt->krb5_ccname, len, "API:%s", -+ authctxt->krb5_ticket_file); -+#else - snprintf(authctxt->krb5_ccname, len, "FILE:%s", - authctxt->krb5_ticket_file); -+#endif - - #ifdef USE_PAM - if (options.use_pam) -@@ -240,15 +245,22 @@ - #ifndef HEIMDAL - krb5_error_code - ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { -- int tmpfd, ret, oerrno; -+ int ret; - char ccname[40]; - mode_t old_umask; -+#ifdef USE_CCAPI -+ char cctemplate[] = "API:krb5cc_%d"; -+#else -+ char cctemplate[] = "FILE:/tmp/krb5cc_%d_XXXXXXXXXX"; -+ int tmpfd, oerrno; -+#endif - - ret = snprintf(ccname, sizeof(ccname), -- "FILE:/tmp/krb5cc_%d_XXXXXXXXXX", geteuid()); -+ cctemplate, geteuid()); - if (ret < 0 || (size_t)ret >= sizeof(ccname)) - return ENOMEM; - -+#ifndef USE_CCAPI - old_umask = umask(0177); - tmpfd = mkstemp(ccname + strlen("FILE:")); - oerrno = errno; -@@ -265,6 +277,7 @@ - return oerrno; - } - close(tmpfd); -+#endif - - return (krb5_cc_resolve(ctx, ccname, ccache)); - } -diff -Nur openssh-7.5p1/auth-pam.c gsi-openssh/auth-pam.c ---- openssh-7.5p1/auth-pam.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/auth-pam.c 2019-01-09 23:54:28.208000000 +0100 -@@ -128,6 +128,10 @@ - */ - typedef pthread_t sp_pthread_t; - #else -+#define pthread_create openssh_pthread_create -+#define pthread_exit openssh_pthread_exit -+#define pthread_cancel openssh_pthread_cancel -+#define pthread_join openssh_pthread_join - typedef pid_t sp_pthread_t; - #endif - -@@ -285,6 +289,56 @@ - # define pam_chauthtok(a,b) (sshpam_chauthtok_ruid((a), (b))) - #endif - -+struct passwd * -+sshpam_getpw(const char *user) -+{ -+ struct passwd *pw; -+ -+ if ((pw = getpwnam(user)) != NULL) -+ return(pw); -+ -+ debug("PAM: faking passwd struct for user '%.100s'", user); -+ if ((pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) -+ return NULL; -+ pw->pw_name = xstrdup(user); /* XXX leak */ -+ pw->pw_shell = "/bin/true"; -+ pw->pw_gecos = "sshd fake PAM user"; -+ return (pw); -+} -+ -+void -+sshpam_check_userchanged(void) -+{ -+ int sshpam_err; -+ struct passwd *pw; -+ const char *user; -+ -+ debug("sshpam_check_userchanged"); -+ sshpam_err = pam_get_item(sshpam_handle, PAM_USER, -+ (sshpam_const void **)&user); -+ if (sshpam_err != PAM_SUCCESS) -+ fatal("PAM: could not get PAM_USER: %s", -+ pam_strerror(sshpam_handle, sshpam_err)); -+ debug("sshpam_check_userchanged: user was '%.100s'", -+ sshpam_authctxt->pw->pw_name); -+ if (strcmp(user, sshpam_authctxt->pw->pw_name) != 0) { -+ debug("PAM: user mapped from '%.100s' to '%.100s'", -+ sshpam_authctxt->pw->pw_name, user); -+ if ((pw = getpwnam(user)) == NULL) -+ fatal("PAM: could not get passwd entry for user " -+ "'%.100s' provided by PAM_USER", user); -+ pwfree(sshpam_authctxt->pw); -+ sshpam_authctxt->pw = pwcopy(pw); -+ sshpam_authctxt->valid = allowed_user(pw); -+ free(sshpam_authctxt->user); -+ sshpam_authctxt->user = xstrdup(user); -+ debug("PAM: user '%.100s' now %svalid", user, -+ sshpam_authctxt->valid ? "" : "in"); -+ } -+ debug("sshpam_check_userchanged: user is '%.100s'", -+ sshpam_authctxt->pw->pw_name); -+} -+ - void - sshpam_password_change_required(int reqd) - { -@@ -307,7 +361,7 @@ - static void - import_environments(Buffer *b) - { -- char *env; -+ char *env, *user; - u_int i, num_env; - int err; - -@@ -317,6 +371,17 @@ - /* Import variables set by do_pam_account */ - sshpam_account_status = buffer_get_int(b); - sshpam_password_change_required(buffer_get_int(b)); -+ if (options.permit_pam_user_change) { -+ user = buffer_get_string(b, NULL); -+ debug("PAM: user is '%.100s'", -+ sshpam_authctxt->pw->pw_name); -+ debug("PAM: got username '%.100s' from thread", user); -+ if ((err = pam_set_item(sshpam_handle, PAM_USER, user)) != PAM_SUCCESS) -+ fatal("PAM: failed to set PAM_USER: %s", -+ pam_strerror(sshpam_handle, err)); -+ pwfree(sshpam_authctxt->pw); -+ sshpam_authctxt->pw = pwcopy(sshpam_getpw(user)); -+ } - - /* Import environment from subprocess */ - num_env = buffer_get_int(b); -@@ -468,6 +533,13 @@ - if (sshpam_err != PAM_SUCCESS) - goto auth_fail; - -+ if (options.permit_pam_user_change) { -+ debug("sshpam_thread: user is '%.100s'", -+ sshpam_authctxt->pw->pw_name); -+ sshpam_check_userchanged(); -+ debug("sshpam_thread: user is '%.100s'", -+ sshpam_authctxt->pw->pw_name); -+ } - if (compat20) { - if (!do_pam_account()) { - sshpam_err = PAM_ACCT_EXPIRED; -@@ -488,6 +560,11 @@ - /* Export variables set by do_pam_account */ - buffer_put_int(&buffer, sshpam_account_status); - buffer_put_int(&buffer, sshpam_authctxt->force_pwchange); -+ if (options.permit_pam_user_change) { -+ debug("sshpam_thread: user is '%.100s'", -+ sshpam_authctxt->pw->pw_name); -+ buffer_put_cstring(&buffer, sshpam_authctxt->pw->pw_name); -+ } - - /* Export any environment strings set in child */ - for(i = 0; environ[i] != NULL; i++) -@@ -940,6 +1017,18 @@ - debug3("PAM: %s pam_acct_mgmt = %d (%s)", __func__, sshpam_err, - pam_strerror(sshpam_handle, sshpam_err)); - -+ if (options.permit_pam_user_change) { -+ debug("do_pam_account: user is '%.100s'", -+ sshpam_authctxt->pw->pw_name); -+ sshpam_check_userchanged(); -+ debug("do_pam_account: user is '%.100s'", -+ sshpam_authctxt->pw->pw_name); -+ if (getpwnam(sshpam_authctxt->pw->pw_name) == NULL) -+ fatal("PAM: completed authentication but PAM account invalid"); -+ debug("do_pam_account: user is '%.100s'", -+ sshpam_authctxt->pw->pw_name); -+ } -+ - if (sshpam_err != PAM_SUCCESS && sshpam_err != PAM_NEW_AUTHTOK_REQD) { - sshpam_account_status = 0; - return (sshpam_account_status); -@@ -1226,6 +1315,9 @@ - pam_strerror(sshpam_handle, sshpam_err)); - - sshpam_err = pam_authenticate(sshpam_handle, flags); -+ if (options.permit_pam_user_change) { -+ sshpam_check_userchanged(); -+ } - sshpam_password = NULL; - free(fake); - if (sshpam_err == PAM_MAXTRIES) -diff -Nur openssh-7.5p1/auth-pam.h gsi-openssh/auth-pam.h ---- openssh-7.5p1/auth-pam.h 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/auth-pam.h 2018-12-20 11:49:17.548000000 +0100 -@@ -41,5 +41,6 @@ - int sshpam_get_maxtries_reached(void); - void sshpam_set_maxtries_reached(int); - int is_pam_session_open(void); -+struct passwd *sshpam_getpw(const char *); - - #endif /* USE_PAM */ -diff -Nur openssh-7.5p1/canohost.c gsi-openssh/canohost.c ---- openssh-7.5p1/canohost.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/canohost.c 2019-01-09 23:58:28.528000000 +0100 -@@ -16,6 +16,7 @@ - - #include - #include -+#include /* for MAXHOSTNAMELEN */ - #include - - #include -@@ -202,3 +203,33 @@ - { - return get_sock_port(sock, 1); - } -+ -+void -+resolve_localhost(char **host) -+{ -+ struct hostent *hostinfo; -+ -+ hostinfo = gethostbyname(*host); -+ if (hostinfo == NULL || hostinfo->h_name == NULL) { -+ debug("gethostbyname(%s) failed", *host); -+ return; -+ } -+ if (hostinfo->h_addrtype == AF_INET) { -+ struct in_addr addr; -+ addr = *(struct in_addr *)(hostinfo->h_addr); -+ if (ntohl(addr.s_addr) == INADDR_LOOPBACK) { -+ char buf[MAXHOSTNAMELEN]; -+ if (gethostname(buf, sizeof(buf)) < 0) { -+ debug("gethostname() failed"); -+ return; -+ } -+ hostinfo = gethostbyname(buf); -+ free(*host); -+ if (hostinfo == NULL || hostinfo->h_name == NULL) { -+ *host = xstrdup(buf); -+ } else { -+ *host = xstrdup(hostinfo->h_name); -+ } -+ } -+ } -+} -diff -Nur openssh-7.5p1/canohost.h gsi-openssh/canohost.h ---- openssh-7.5p1/canohost.h 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/canohost.h 2018-12-20 11:49:17.548000000 +0100 -@@ -23,4 +23,6 @@ - - #endif /* _CANOHOST_H */ - -+void resolve_localhost(char **host); -+ - void ipv64_normalise_mapped(struct sockaddr_storage *, socklen_t *); -diff -Nur openssh-7.5p1/ChangeLog gsi-openssh/ChangeLog ---- openssh-7.5p1/ChangeLog 2017-03-20 10:52:54.000000000 +0100 -+++ gsi-openssh/ChangeLog 2018-12-20 11:49:17.568000000 +0100 -@@ -1,3 +1,216 @@ -+commit 88b77e400c706cf749d622f8392bfeae73e87b8c -+Author: Venkat Yekkirala -+Date: Tue Jun 27 10:17:10 2017 -0500 -+ -+ Deleted scard references and updated version numbers. -+ -+commit ed5b2c7a64de5cfb63d2b31c2c8551e27e4c93a6 -+Merge: b0b4ee4 a45e14d -+Author: Venkat Yekkirala -+Date: Tue Jun 27 09:39:47 2017 -0500 -+ -+ Merge branch 'ISSHD_HPN_7_5_P1' into GSI_ISSHD_HPN_7_5_P1 -+ -+commit a45e14de56ab6e374e1e2b867326f813a1e1b427 -+Author: Venkat Yekkirala -+Date: Tue Jun 27 09:38:50 2017 -0500 -+ -+ Deleted spurious files. -+ -+commit b0b4ee4ca83bf3dd7efeb8d4c7fbd73c4a1d29be -+Merge: 8775fcb 72a443b -+Author: Venkat Yekkirala -+Date: Mon Jun 5 11:24:21 2017 -0500 -+ -+ Merge branch 'ISSHD_HPN_7_5_P1' into GSI_ISSHD_HPN_7_5_P1 -+ -+commit 72a443b8fe6c23b748d21e5f4a4c97c6bc0ab39c -+Merge: fcb776a 06faf0f -+Author: scott campbell -+Date: Sun Jun 4 12:00:20 2017 -0400 -+ -+ Merge branch 'globus-ISSHD_HPN_7_5_P1' into isshd -+ -+commit 8775fcbcaa02eb1561be2bc6a8f74377bdf08500 -+Author: Venkat Yekkirala -+Date: Tue May 23 15:43:24 2017 -0500 -+ -+ Disable DisableMTAES by default. -+ -+commit 42baf0b835ef843c0549264f79462953f94e9992 -+Merge: 67a61aa 06faf0f -+Author: Venkat Yekkirala -+Date: Tue May 23 11:49:51 2017 -0500 -+ -+ Merge branch 'ISSHD_HPN_7_5_P1' into GSI_ISSHD_HPN_7_5_P1 -+ -+commit 06faf0f3a223a6e46f3f9c3e2840dda5ba263399 -+Author: Venkat Yekkirala -+Date: Tue May 23 11:48:58 2017 -0500 -+ -+ isshd fixes for 7.5p1 -+ -+commit 67a61aaa6720933f0b2e8c05c4ea66313c2e0778 -+Author: Venkat Yekkirala -+Date: Mon May 22 11:51:37 2017 -0500 -+ -+ Added the missing GSSAPIRenewalForcesRekey option to ssh_config. Minor man page fixes. -+ -+commit 303163778f8f7e8b3319946f39850bd073191039 -+Merge: c9adf99 c06a261 -+Author: Venkat Yekkirala -+Date: Fri May 19 11:06:23 2017 -0500 -+ -+ Merge remote branch 'origin/GSI_ISSHD_HPN_7_3_P1' into GSI_ISSHD_HPN_7_5_P1 -+ -+ Conflicts: -+ Makefile.in -+ channels.c -+ monitor.c -+ readconf.c -+ servconf.c -+ servconf.h -+ session.c -+ ssh_config.5 -+ sshd.c -+ sshd_config.5 -+ version.h -+ -+commit c9adf99d917517b9d0f68d73bba8a43f771024dd -+Merge: 4f91848 fcb776a -+Author: Venkat Yekkirala -+Date: Tue May 16 19:29:15 2017 -0500 -+ -+ Merge remote branch 'isshd/isshd' into ISSHD_HPN_7_5_P1 -+ -+ Conflicts: -+ README -+ kex.c -+ readconf.c -+ readconf.h -+ servconf.c -+ servconf.h -+ serverloop.c -+ sshd.c -+ sshd_config -+ version.h -+ -+commit c06a2611d93bbc0c93d08cc446bc80b025fa12ca -+Author: Venkat Yekkirala -+Date: Mon Apr 17 10:46:16 2017 -0500 -+ -+ Minor compile warning fix. -+ -+commit 79fa01e392d59fa91aa284d3ef4993610d07fd6e -+Author: Venkat Yekkirala -+Date: Sun Apr 16 19:42:00 2017 -0500 -+ -+ Moved get_canonical_hostname() into auth-compat.c from port-linux.c so the code will build on non-linux platforms as well. -+ -+commit eeda2525a0eac16b38e0b31603109ab9abc00187 -+Author: Venkat Yekkirala -+Date: Sun Apr 16 19:37:23 2017 -0500 -+ -+ Moved get_canonical_hostname() into auth-compat.c from port-linux.c so the code will build on non-linux platforms as well. -+ -+commit 4f918482607a9c20eabb8e1e3144816f542f991d -+Author: Chris Rapier -+Date: Wed Apr 5 12:47:19 2017 -0400 -+ -+ Updated hpn version number -+ -+commit bcb4f6e7a1d932b2637450fc2faae3f653faa66e -+Author: Venkat Yekkirala -+Date: Mon Mar 27 12:00:06 2017 -0500 -+ -+ Older GSI-OpenSSH servers (xstream.stanford.xsede.org for example, which runs -+ OpenSSH_6.4p1-hpn14v1 GSI_GSSAPI_GPT_5.7 GSI) terminate connection with -+ GSS_C_CONF_FLAG set. So, it will now be set only on the user setting -+ GSISSH_FORCE_CONF_FLAG in the environment. -+ -+commit f7e0bf5a65ee7b57167fda0214282f97512d6001 -+Author: Chris Rapier -+Date: Sat Nov 15 16:02:15 2014 -0500 -+ -+ support dynamically sized receive buffers -+ -+ This is the core of HPN-SSH. Please note that this patch will not -+ necessarily improve all connections but only those that were being hampered -+ by undersized buffers. While optimal improvement requires this patch on -+ both sides of the connection many users see enhancement as long as the -+ patch is applied on the side of the connection receiving bulk data. -+ -+commit 2fa1fcc366727321077d6ea7c374beadcd192d37 -+Author: Chris Rapier -+Date: Sat Nov 15 15:49:16 2014 -0500 -+ -+ Add support for the multi-threaded AES-CTR cipher -+ -+ This patch provides the multi-threaded AES-CTR cipher. Essentially, -+ several buffers are created that are filled with pre-computed keystreads -+ generates by worker threads. These buffers are drained in order so as to -+ provide a keystream 100% compatible with non-threaded AES-CTR -+ implementations. Prior to this release there was a significant flaw in -+ the way in which this cipher was used in SSH (the security of this cipher -+ was not impacted) where forking the process to the background would cause -+ the threads to become divorced from the parent process. This would lead -+ to a failure in port forwarding applications and, starting with 6.1p1, -+ incompatibility with the sandbox used by the privsep process. Both -+ problems were resoloved by using the non-threaded AES-CTR cipher during -+ authentication and then switching to the MT-AES-CTR cipher immediately -+ after. -+ -+commit 40c3043d4dd625b6f9394f53c798a648d7dc3604 -+Author: Chris Rapier -+Date: Sat Nov 15 15:38:34 2014 -0500 -+ -+ add support for the NONE cipher -+ -+ This patch provides the post authentication switch to the NONE cipher. -+ This is useful for the transfer of bulk data via SCP. The NONE switch -+ is not allowed during interactive sessions. Both sides of the connection -+ *must* support the NONE switch. -+ -+commit 95f229565372ff545d6f4adb3d75e41ed77c2a98 -+Author: Chris Rapier -+Date: Sat Nov 15 15:22:24 2014 -0500 -+ -+ add peak throughput to the progress bar -+ -+ This patch modifes the progress bar to display the 1 second throughput -+ average. On completion of the transfer it will display the peak throughput -+ through the life of the connection. -+ -+commit cbd5126431a181edeb9364f1b142ba98ae2a126b -+Author: Chris Rapier -+Date: Sat Nov 15 15:20:30 2014 -0500 -+ -+ extended server logging -+ -+ This patch provides enhanced logging capabilities to the server process. -+ Information provided includes ciphers used, throughput, bytes transferred, -+ and the like. In order to use this patch you *must* direct syslogd to use -+ an additional logging socket. This socket will be located in the sshd -+ chroot, typically /var/empty. As such you will need to create a -+ /var/empty/dev directory and add '-a /var/empty/dev/log' to your syslogd -+ configuration. -+ -+commit 761da74466879077593d1005982ee181ae53f840 -+Merge: 9c95228 faeecac -+Author: Venkat Yekkirala -+Date: Mon Mar 20 12:49:20 2017 -0500 -+ -+ Merge branch 'GSI_ISSHD_HPN_7_1_P2' into GSI_ISSHD_HPN_7_3_P1 -+ -+ Conflicts: -+ version.h -+ -+commit 9c952287d429d8113852397b91e17e33dd5e8921 -+Author: Venkat Yekkirala -+Date: Mon Mar 20 12:43:53 2017 -0500 -+ -+ Bumping up version for 7.3p1a release. -+ - commit d38f05dbdd291212bc95ea80648b72b7177e9f4e - Author: Darren Tucker - Date: Mon Mar 20 13:38:27 2017 +1100 -@@ -55,6 +268,20 @@ - path limit for Unix domain sockets. As a bandaid for bz#2660, - reported by Colin Watson; ok dtucker@ - -+commit faeecacd1a50c8a74812ec95b61eb331461d3156 -+Author: Venkat Yekkirala -+Date: Fri Mar 17 11:09:32 2017 -0500 -+ -+ Updating NCSA_VERSION in preparation for next release 7.1p2i. -+ -+commit 4a39c9a29eb1107eeddc877c67fd26c1ea22b147 -+Author: Venkat Yekkirala -+Date: Fri Mar 17 11:07:52 2017 -0500 -+ -+ Setting GSS_C_CONF_FLAG to get around the issue of SSL_export_keying_material -+ not returning correct key material on CentOS6 with OpenSSL 1.0.1e build 48. -+ See: https://github.com/globus/globus-toolkit/issues/92 -+ - commit 2adbe1e63bc313d03e8e84e652cc623af8ebb163 - Author: markus@openbsd.org - Date: Wed Mar 15 07:07:39 2017 +0000 -@@ -556,6 +783,12 @@ - - Upstream-ID: 9dc582d9bb887ebe0164e030d619fc20b1a4ea08 - -+commit 3ca4ddf2294f286c02596b12aa6b9b0169da2acb -+Author: Venkat Yekkirala -+Date: Fri Mar 3 09:27:41 2017 -0600 -+ -+ Updating rev for new 7.1p2h release. -+ - commit 12d3767ba4c84c32150cbe6ff6494498780f12c9 - Author: djm@openbsd.org - Date: Fri Mar 3 06:13:11 2017 +0000 -@@ -569,6 +802,12 @@ - - Upstream-ID: da82ad653b93e8a753580d3cf5cd448bc2520528 - -+commit 70d5a3a53cc7ad1d6c6540003e422dc97971110a -+Author: Venkat Yekkirala -+Date: Mon Feb 27 11:25:44 2017 -0600 -+ -+ Fixed missing extern declaration for gss_mech_globus_gssapi_openssl_micv2 -+ - commit d7abb771bd5a941b26144ba400a34563a1afa589 - Author: djm@openbsd.org - Date: Tue Feb 28 06:10:08 2017 +0000 -@@ -600,6 +839,12 @@ - - Upstream-ID: 9c538433d6a0ca79f5f21decc5620e46fb68ab57 - -+commit 1b08c60cd4442fefb453c26e44e3c259756c11e2 -+Author: Venkat Yekkirala -+Date: Mon Feb 27 11:25:44 2017 -0600 -+ -+ Fixed missing extern declaration for gss_mech_globus_gssapi_openssl_micv2 -+ - commit d5499190559ebe374bcdfa8805408646ceffad64 - Author: djm@openbsd.org - Date: Sun Feb 19 00:11:29 2017 +0000 -@@ -690,6 +935,21 @@ - - Upstream-ID: 6fb6c2ae6b289aa07b6232dbc0be54682ef5419f - -+commit fcb776a3a14164e92aa52a24b0cec06bb373e995 -+Merge: 308ca91 8d2d017 -+Author: scott campbell -+Date: Mon Feb 13 20:44:20 2017 -0500 -+ -+ Merge branch 'master' into isshd -+ Move to 7.4p1 -+ -+commit 8d2d0178e7136553af3b95dff81c3751619bbef8 -+Merge: 8db330f 3e1f273 -+Author: scott campbell -+Date: Mon Feb 13 19:25:49 2017 -0500 -+ -+ Merge remote-tracking branch 'upstream/master' -+ - commit bd5d7d239525d595ecea92765334af33a45d9d63 - Author: Darren Tucker - Date: Sun Feb 12 15:45:15 2017 +1100 -@@ -699,6 +959,21 @@ - EVP_R_PRIVATE_KEY_DECODE_ERROR was added in OpenSSL 1.0.0 so ifdef out - for the benefit of OpenSSL versions prior to that. - -+commit 308ca9170cc78b7937b9dee3772d1dccdd780cf3 -+Author: scott campbell -+Date: Fri Feb 10 20:45:59 2017 -0500 -+ -+ fix uninitialized ret value -+ -+ Fix uninitialized ret value as pointed out by Venkatesh Sri Yekkirala @ -+ vyekkira_illinois.edu -+ -+commit 7f4d3bb77311c9c5a95f46700b8b01f6b2c7bd49 -+Author: Venkat Yekkirala -+Date: Fri Feb 10 16:40:08 2017 -0600 -+ -+ Fixed a 7.3p1 port error. -+ - commit 155d540d00ff55f063421ec182ec8ff2b7ab6cbe - Author: djm@openbsd.org - Date: Fri Feb 10 04:34:50 2017 +0000 -@@ -737,6 +1012,20 @@ - - Upstream-ID: 06beef7344da0208efa9275d504d60d2a5b9266c - -+commit 6e974253c85a31e997a843f56c78c516e1728520 -+Author: Venkat Yekkirala -+Date: Thu Feb 9 09:21:36 2017 -0600 -+ -+ Replaced NCSA_VERSION with a "-GSI " suffix to appear after the portable -+ version number to signify that this is GSI-OpenSSH and also to do away with -+ the date in NCSA_VERSION. -+ -+commit 5be536047a970dbd793441a6f92679fbd71f3343 -+Author: Venkat Yekkirala -+Date: Thu Feb 9 09:21:09 2017 -0600 -+ -+ Uncomment isshd audit line. -+ - commit 5b90709ab8704dafdb31e5651073b259d98352bc - Author: djm@openbsd.org - Date: Mon Feb 6 09:22:51 2017 +0000 -@@ -797,6 +1086,13 @@ - - Upstream-ID: c78c38f9f81a963b33d0eade559f6048add24a6d - -+commit 7905bfbf479790398b20e19c3a5110c1dec60a0b -+Merge: 206ac86 c8e592a -+Author: Venkat Yekkirala -+Date: Fri Feb 3 09:01:45 2017 -0600 -+ -+ Merge remote branch 'isshd/isshd' into GSI_ISSHD_HPN_7_3_P1 -+ - commit c924b2ef941028a1f31e6e94f54dfeeeef462a4e - Author: djm@openbsd.org - Date: Fri Feb 3 05:05:56 2017 +0000 -@@ -887,6 +1183,28 @@ - - Patch from yvoinov at gmail.com. - -+commit c8e592a05def297220923d01a2f4ac3f0d51f9ac -+Merge: 45285b0 ad3d92c -+Author: Scott Campbell -+Date: Thu Feb 2 21:42:46 2017 -0500 -+ -+ Merge pull request #5 from globus/ISSHD_HPN_7_3_P1 -+ -+ Isshd hpn 7 3 p1 -+ -+commit 206ac8670da9a9f427b901e8bae2847c94e0c3d2 -+Author: Venkat Yekkirala -+Date: Mon Jan 30 11:27:21 2017 -0600 -+ -+ Adding support for: -+ -+ gss-group14-sha256-* -+ gss-group16-sha512-* -+ gss-group18-sha512-* -+ -+ as required by: -+ https://github.com/globus/gsi-openssh/issues/12 -+ - commit f25ee13b3e81fd80efeb871dc150fe49d7fc8afd - Author: djm@openbsd.org - Date: Mon Jan 30 05:22:14 2017 +0000 -@@ -1118,6 +1436,50 @@ - - UseLogin is gone, remove leftover. bz#2665, from cjwatson at debian.org - -+commit 961a800812ef6a12bda736e4d4772e4779333d76 -+Merge: 206fddf ad3d92c -+Author: Venkat Yekkirala -+Date: Thu Jan 12 09:10:55 2017 -0600 -+ -+ Merge branch 'ISSHD_HPN_7_3_P1' into GSI_ISSHD_HPN_7_3_P1 -+ -+commit ad3d92c365407d47eeb6a0346c6c8dec8ae8cd5a -+Author: Venkat Yekkirala -+Date: Thu Jan 12 09:08:23 2017 -0600 -+ -+ Fix for issue: -+ https://github.com/globus/gsi-openssh/issues/16 -+ -+commit 206fddfa38183e709aa7fd3ccf11c7b92334121c -+Merge: 37d8bae 37df094 -+Author: Venkat Yekkirala -+Date: Wed Jan 11 08:36:19 2017 -0600 -+ -+ Merge branch 'ISSHD_HPN_7_3_P1' into GSI_ISSHD_HPN_7_3_P1 -+ -+commit 37df09418d2e87819a48851ddd32c0c2576286d6 -+Author: Venkat Yekkirala -+Date: Wed Jan 11 06:20:46 2017 -0600 -+ -+ Fix for 7.3p1 replacing get_remote_ipaddr invocation with ssh_remote_ipaddr. -+ -+commit 37d8bae28f6edc05bb37376b4c166122de8d4caf -+Merge: 45285b0 00c943e -+Author: Venkat Yekkirala -+Date: Wed Jan 11 06:07:07 2017 -0600 -+ -+ Merge remote branch 'origin/GSI_ISSHD_HPN_7_2_P2' into GSI_ISSHD_HPN_7_3_P1 -+ -+ Conflicts: -+ Makefile.in -+ auth.c -+ auth2.c -+ kex.h -+ pathnames.h -+ progressmeter.c -+ sshd.c -+ version.h -+ - commit b108ce92aae0ca0376dce9513d953be60e449ae1 - Author: djm@openbsd.org - Date: Wed Jan 4 02:21:43 2017 +0000 -@@ -1151,6 +1513,64 @@ - - Upstream-ID: e19456429bf99087ea994432c16d00a642060afe - -+commit 3e1f2738a9ec22bce1d015eb41181220b7695685 -+Author: djm@openbsd.org -+Date: Mon Dec 19 22:35:23 2016 +0000 -+ -+ upstream commit -+ -+ use standard /bin/sh equality test; from Mike Frysinger -+ -+ Upstream-Regress-ID: 7b6f0b63525f399844c8ac211003acb8e4b0bec2 -+ (cherry picked from commit c8c60f3663165edd6a52632c6ddbfabfce1ca865) -+ -+commit b069483c1ae09895a1240258e926a3dad448958b -+Merge: 5b05243 4a354fc -+Author: Mike Frysinger -+Date: Thu Dec 22 14:12:45 2016 -0500 -+ -+ Merge tag 'V_7_4_P1' into hpn -+ -+ openssh-7.4p1 -+ -+ Had to resolve conflicts due to removal of ssh1 code: -+ README -+ cipher.c -+ servconf.c -+ serverloop.c -+ sshconnect2.c -+ sshd.c -+ -+ Also had to adjust ssh_packet_get_send_context after upstream -+ reworked the cipher ctx logic. -+ -+commit 5b05243e2032bc4512d8c330ed63b5b676e810a8 -+Author: Mike Frysinger -+Date: Thu Dec 22 14:06:14 2016 -0500 -+ -+ unify channel_new logic -+ -+ We want to make it clear which fields we're actually changing with -+ hpn (just the window size) vs all the others we're leaving alone. -+ -+commit a39b3758ce05de786f4da65e49bc7acac8ed1647 -+Author: Mike Frysinger -+Date: Thu Dec 22 14:05:44 2016 -0500 -+ -+ fix up style in hpn code a bit -+ -+ Should be no functional changes here. Just deleting spurious whitespace -+ the hpn code added, or bad indentation/parens that the hpn code itself -+ uses. -+ -+commit 642cf71072fc875631b74fe6a1b09b91afae3c94 -+Author: Mike Frysinger -+Date: Thu Dec 22 03:07:00 2016 -0500 -+ -+ drop config parsing debug logic -+ -+ This isn't needed for hpn, so drop it from the patchset. -+ - commit 30eee7d1b2fec33c14870cc11910610be5d2aa6f - Author: Darren Tucker - Date: Tue Dec 20 12:16:11 2016 +1100 -@@ -1159,6 +1579,19 @@ - - Patch from HARUYAMA Seigo . - -+commit 1092b9219f47cc588426e6381b0b140efd7c7a88 -+Author: Mike Frysinger -+Date: Mon Dec 19 17:58:54 2016 -0500 -+ -+ rework cipher name checking -+ -+ Upstream has made sshcipher_ctx opaque to code outside of cipher.c, so -+ we can no longer access the cipher member directly in sshconnect/sshd. -+ Push the struct walking logic down into the existing helper. -+ -+ This doesn't matter for the 7.3p1 code or older, but will matter with -+ the new 7.4p1+ code. -+ - commit c8c60f3663165edd6a52632c6ddbfabfce1ca865 - Author: djm@openbsd.org - Date: Mon Dec 19 22:35:23 2016 +0000 -@@ -1207,6 +1640,12 @@ - - Upstream-Regress-ID: e3a16b7836a3ae24dc8f8a4e43fdf8127a60bdfa - -+commit b05612b75ad9fe9358079883374843d7e8de4b63 -+Author: Allan Jude -+Date: Sat Dec 17 17:24:29 2016 -0500 -+ -+ fix typos in HPN-README (#12) -+ - commit 0d2f88428487518eea60602bd593989013831dcf - Author: dtucker@openbsd.org - Date: Fri Dec 16 03:51:19 2016 +0000 -@@ -1343,6 +1782,14 @@ - - Fixes build on (at least) Solaris 10. - -+commit 45285b04324c35bf4ba3e1ea400866627bd64527 -+Author: scott campbell -+Date: Mon Dec 12 15:39:01 2016 -0500 -+ -+ add libwrap functionality -+ -+ mod configure.ac and sshd.c to support libwrap -+ - commit dda78a03af32e7994f132d923c2046e98b7c56c8 - Author: Damien Miller - Date: Mon Dec 12 13:57:10 2016 +1100 -@@ -1357,6 +1804,33 @@ - - ok dtucker@ - -+commit 00c943e07ff6f8176df5ad602d1f663145d10cee -+Author: Venkat Yekkirala -+Date: Fri Dec 9 10:25:45 2016 -0600 -+ -+ Applied patch from: https://bugzilla.redhat.com/show_bug.cgi?id=1323622 -+ to fix broken GSSAPI Authentication resulting in "Hash's MIC didn't verify". -+ -+commit 8367188d6a7fcd2abea08e9971bacb6d5f064df7 -+Author: Venkat Yekkirala -+Date: Fri Dec 9 10:07:59 2016 -0600 -+ -+ Merge fix. -+ -+commit 2adfe280ceed5897f1fb7a981da37162b4abafe5 -+Merge: e808952 8db330f -+Author: scott campbell -+Date: Thu Dec 8 22:57:59 2016 -0500 -+ -+ Merge branch 'master' into isshd -+ -+commit 8db330fb53e431e87fb15443ac39ae5dcdf289d1 -+Merge: eb8bc2e 461108b -+Author: scott campbell -+Date: Thu Dec 8 22:54:41 2016 -0500 -+ -+ Merge remote-tracking branch 'upstream/master' -+ - commit c35995048f41239fc8895aadc3374c5f75180554 - Author: Darren Tucker - Date: Fri Dec 9 12:52:02 2016 +1100 -@@ -1387,6 +1861,15 @@ - This will use the host-prefixed version when cross compiling; patch from - david.michael at coreos.com. - -+commit e8089526b72fbaa0ad185193824c4fd4a2677df9 -+Merge: 52e4d67 d8149ef -+Author: Scott Campbell -+Date: Tue Dec 6 21:02:30 2016 -0500 -+ -+ Merge pull request #4 from globus/ISSHD_HPN_7_2_P2 -+ -+ Fixes for isshd port to OpenSSH 7.2p2 -+ - commit b4867e0712c89b93be905220c82f0a15e6865d1e - Author: djm@openbsd.org - Date: Tue Dec 6 07:48:01 2016 +0000 -@@ -1417,6 +1900,42 @@ - - Patch from Colin Watson via bz#2640 - -+commit 251a386afa115e8f3c37f97351f9098b720bf32f -+Merge: ac1f931 e2ffd6e -+Author: Venkat Yekkirala -+Date: Mon Dec 5 11:42:35 2016 -0600 -+ -+ Merge remote branch 'origin/GSI_ISSHD_HPN_7_1_P2' into GSI_ISSHD_HPN_7_2_P2 -+ -+ Conflicts: -+ clientloop.c -+ -+commit d8149efa3b693829569d0665ae8d764a77bf082b -+Author: Venkat Yekkirala -+Date: Mon Dec 5 10:39:39 2016 -0600 -+ -+ Fixes for port to 7.2p2. -+ -+commit ac1f9312c0886c9d9f236a530e65b74f76478067 -+Merge: 52e4d67 6aa62f3 -+Author: Venkat Yekkirala -+Date: Mon Dec 5 09:49:59 2016 -0600 -+ -+ Merge remote branch 'origin/GSI_ISSHD_HPN_7_1_P2' into GSI_ISSHD_HPN_7_2_P2 -+ -+ Conflicts: -+ Makefile.in -+ clientloop.c -+ configure.ac -+ packet.c -+ session.c -+ ssh-keysign.c -+ ssh_config.5 -+ sshconnect2.c -+ sshd_config.5 -+ sshkey.c -+ version.h -+ - commit b9844a45c7f0162fd1b5465683879793d4cc4aaa - Author: djm@openbsd.org - Date: Sun Dec 4 23:54:02 2016 +0000 -@@ -1628,6 +2147,71 @@ - - Upstream-ID: 11b8a2795afeeb1418d508a2c8095b3355577ec2 - -+commit 461108b95d83d11cdb6309eaa353a7df9acc17d1 -+Author: Mike Frysinger -+Date: Sun Nov 27 16:00:35 2016 -0500 -+ -+ README: add notice from kitchensink branch -+ -+commit 77f0a945aeed7fa61201d08b32f2f6c15e084f9a -+Author: Mike Frysinger -+Date: Sun Nov 27 03:39:25 2016 -0500 -+ -+ bump hpn patch version -+ -+commit 07598e262856cf7e5de8f3a403188fce9c382ab0 -+Author: Mike Frysinger -+Date: Sun Nov 27 03:35:52 2016 -0500 -+ -+ revert customizations to packet send functions -+ -+ These changes were included with the original server logging patch, -+ but we don't actually need them as we don't use the updated return -+ value anywhere. Revert back to upstream version. -+ -+commit a1524038c9e79fcba7998a8c513c26ed4a626b2c -+Author: Mike Frysinger -+Date: Sun Nov 27 03:27:50 2016 -0500 -+ -+ drop unused ssh_packet_get_receive_context prototype -+ -+ The definition was dropped during an update from packet.c, -+ but the prototype in packet.h was missed. -+ -+commit a0d0bdacd639f3689b3afb16abbf9e567d467190 -+Merge: 1a16746 99522ba -+Author: Mike Frysinger -+Date: Sun Nov 27 02:17:46 2016 -0500 -+ -+ Merge tag 'V_7_3_P1' into hpn -+ -+ openssh-7.3p1 -+ -+commit 1a16746f8013a407ae2ed75d37412ab6efaaf35a -+Author: Mike Frysinger -+Date: Sun Nov 27 01:20:08 2016 -0500 -+ -+ switch to upstream ssh_remote_{ipaddr,port} funcs -+ -+ Upstream has added helpers to the packet.h api that we can switch over -+ to rather than defining our own copies on code in canohost they want to -+ purge. -+ -+commit b616cf2bdbdc616330440f775d9b990ac3f871e9 -+Merge: 59cb27f 526b442 -+Author: Mike Frysinger -+Date: Sun Nov 27 02:07:55 2016 -0500 -+ -+ Merge pull request #8 from chutz/use-flag-rather-than-pthread-cancel -+ -+ Use an exit flag as well as pthread_cancel to tell worker threads to terminate -+ -+commit 59cb27fddd5c7bb4c738c8cf5fb91e8e1f7b489f -+Author: Mike Frysinger -+Date: Fri Aug 12 02:33:25 2016 +0800 -+ -+ fix whitespace damage in version.h -+ - commit f0ddedee460486fa0e32fefb2950548009e5026e - Author: markus@openbsd.org - Date: Wed Nov 23 23:14:15 2016 +0000 -@@ -1639,6 +2223,30 @@ - - Upstream-ID: 8beb4c1eadd588f1080b58932281983864979f55 - -+commit e2ffd6e2bd4a57ffe024d635c0de37f1bf5ced90 -+Author: Venkat Yekkirala -+Date: Tue Nov 22 20:20:30 2016 -0600 -+ -+ Release date update. -+ -+commit 7f44271f26a367b1f22b50c8df5cc20ce61a99dc -+Author: Venkat Yekkirala -+Date: Tue Nov 22 13:25:11 2016 -0600 -+ -+ Adding mechanism OID negotiation with the introduction of micv2 OID. -+ -+commit b8323bfcc1867e10c150b2ec5912bc6c883dfd6d -+Author: Venkat Yekkirala -+Date: Thu Nov 17 11:34:48 2016 -0600 -+ -+ Fix for the X11Forwarding issue on Mac OS. -+ -+commit 7c39ac596b20a75fed6ef6231b2216add33e4b59 -+Author: Venkat Yekkirala -+Date: Tue Nov 15 11:44:09 2016 -0600 -+ -+ Fixed conflict. -+ - commit 1a6f9d2e2493d445cd9ee496e6e3c2a2f283f66a - Author: djm@openbsd.org - Date: Tue Nov 8 22:04:34 2016 +0000 -@@ -1677,6 +2285,22 @@ - - Upstream-ID: 3223ef693cfcbff9079edfc7e89f55bf63e1973d - -+commit 52e4d675b45ea0199d4bbb1fcd9b22c18b872603 -+Merge: 1f8bceb eb8bc2e -+Author: scott campbell -+Date: Sat Nov 5 23:10:43 2016 -0400 -+ -+ Merge branch 'master' into isshd -+ Fixed files and prep for repair. -+ -+commit eb8bc2ece51e7c7bab596bb4411ba05346fcd3bf -+Merge: 77e1e04 78b28a5 -+Author: scott campbell -+Date: Sat Nov 5 22:37:33 2016 -0400 -+ -+ Merge remote-tracking branch 'upstream/master' -+ sync test -+ - commit 5ee3fb5affd7646f141749483205ade5fc54adaf - Author: Darren Tucker - Date: Tue Nov 1 08:12:33 2016 +1100 -@@ -2569,6 +3193,113 @@ - - These were incorrectly removed in the 1d9a2e28 sync commit. - -+commit 526b442389502828eabd48bb9de35a405175587f -+Author: Patrick McLean -+Date: Thu Sep 8 10:50:12 2016 -0700 -+ -+ cipher-ctr-mt: Use an exit flag on Apple as well as pthread_cancel -+ -+ It turns out that apparently on OSX, pthread_cancel is not completely -+ reliable. It seems that occasionally a thread will fail to notice that it has -+ been cancelled. Repeatedly running the openssh integrity test suite will -+ eventually deadlock on exit on OSX (I think it took about an hour for -+ the person I had testing this). -+ -+ This changes the code to use an exit flag as well as pthread_cancel -+ to tell the worker threads to exit. This should give us the best of -+ both worlds. -+ -+commit 42c6108de93d70f6730e04413876463ef3644831 -+Author: Patrick McLean -+Date: Thu Sep 8 22:04:42 2016 -0700 -+ -+ cipher-ctr-mt: split the code to stop the pregen threads in to a function -+ -+ This code is pretty repetitive, so let's split it out to its own function so we -+ won't have so much repeated code. -+ -+commit 0d9931c0b5a37c04a994cf4c29fbc1835f45ece6 -+Author: Patrick McLean -+Date: Thu Sep 8 10:45:55 2016 -0700 -+ -+ cipher-ctr-mt: rename thread_lock to tid_lock to better reflect its purpose -+ -+commit ba59abb7ce19ee7c7cc737696d1c5cf0aed47464 -+Author: Patrick McLean -+Date: Thu Sep 8 10:47:03 2016 -0700 -+ -+ cipher-ctr-mt: make sure to use pthread_broadcast everywhere we are cancelling -+ -+commit a59092c180fe6f2445c50625633a1d4f57aeb83c -+Author: Patrick McLean -+Date: Thu Sep 8 11:45:03 2016 -0700 -+ -+ cipher-ctr-mt: remove volatile keyword from qstate -+ -+ Since this variable is protected by locks everywhere it is used, -+ volatile is useless, and just makes things slower. -+ -+commit 78b28a561a501122f9bfeab252451f36585dbd15 -+Merge: 9ed8887 2036596 -+Author: Chris Rapier -+Date: Thu Sep 8 13:39:44 2016 -0400 -+ -+ Merge pull request #7 from chutz/fix-deadlock-in-cipher-ctr-mt -+ -+ Fix deadlocks in cipher ctr mt -+ -+commit 2036596e5889b392ba98d1272f26d8b8470787c9 -+Author: Patrick McLean -+Date: Wed Sep 7 16:35:31 2016 -0700 -+ -+ In the CTR-MT cipher, make sure threads are getting woken up when they are cancelled -+ -+ It seems that on OSX a pthread_cancel does not necessarily wake up a -+ thread that is in pthread_cond_wait. This results in the process hanging -+ indefinetly when the main thread does a pthread_join on a thread that is -+ sleeping. This adds an explicit call to pthread_cond_broadcast to every -+ queue's condition so all the threads get woken up after they are -+ cancelled. -+ -+commit 9bc68eb1ec46908e86bf0d6bea44f58149d45915 -+Author: Patrick McLean -+Date: Wed Sep 7 15:14:35 2016 -0700 -+ -+ CTR-MT cipher, make sure that the thread startup function will terminate -+ -+ Currently it's possible that the other threads will transition the first -+ queue to another state than KQDRAINING before the starting thread gets -+ woken up, and if the queue never goes back to KQDRAINING then the init -+ thread will never continue. -+ -+commit 93b2c7d9e029dc8bc418cd137060c1fb4019d517 -+Author: Patrick McLean -+Date: Wed Sep 7 11:42:29 2016 -0700 -+ -+ Add reader/writer lock on thread creation to parallel ctr cipher -+ -+ There is no gurantee that pthread_create will have filled in the thread -+ id field when the thread starts, so there was a race condition. -+ Sometimes the first thread would see c->tid[0] as 0, and not initialize -+ the first queue, and the entire thing would deadlock. This uses a rwlock -+ to make sure that the tid is filled in before trying to access it. -+ -+commit 4c7b471a9d4315fc43018fcd0d005b841d1b6280 -+Author: Patrick McLean -+Date: Wed Sep 7 11:40:00 2016 -0700 -+ -+ Notify other threads every time the state changes in multi-threaded AES-CTR cipher -+ -+ The threads spend a lot of time in pthread_cond_wait waiting for the -+ state of a queue to change, but sometimes a thread will change the state -+ of a queue without notifying other threads. This makes sure other -+ threads will always get notified to avoid deadlocks. -+ -+ This uses pthread_cond_broadcast rather than pthread_cond_signal since -+ pthread_cond_signal only notifies one thread, which could end up being -+ the parent thread, which will just loop back to the cond, and nothing -+ will continue. -+ - commit 775f8a23f2353f5869003c57a213d14b28e0736e - Author: Damien Miller - Date: Wed Aug 31 10:48:07 2016 +1000 -@@ -3295,6 +4026,723 @@ - storage which goes away with the sshd PAM process (see bz#688). On the - other hand, those cases probably won't log a warning either. - -+commit 1f8bceb1a404b8961ddd788c6514061fb8257809 -+Author: scott campbell -+Date: Sun Jul 17 12:00:04 2016 -0400 -+ -+ fix version -+ -+commit fff3156e26c24f102ae9296e0dce63055d49d738 -+Merge: dbe7f8d 9b30925 -+Author: scott campbell -+Date: Sun Jul 17 11:37:10 2016 -0400 -+ -+ fixes .. -+ -+commit dbe7f8d99c875ec7937820a924dd7b8acfca8bf7 -+Author: scott campbell -+Date: Mon Jan 25 07:56:53 2016 -0500 -+ -+ bump version -+ -+commit 5ad25a8b0f01b8431d0880d2809d6eb89ef4b578 -+Author: scott campbell -+Date: Mon Jan 11 15:03:05 2016 -0500 -+ -+ fix type error -+ -+ char is not u_char -+ char is not u_char -+ char is not u_char -+ char is not u_char -+ -+commit 8345dac6c2ffae0d46be16446c185d2800b66574 -+Author: scott campbell -+Date: Mon Jan 11 14:27:25 2016 -0500 -+ -+ option for runtime disable for issued logging -+ -+ If —enable-nercmod is set at configure time, it still will be possible -+ to disable the logging of information by setting AuditDisabled to yes -+ in ssh_config -+ -+ Default value is on to preserve backwards compatibility. -+ -+commit 9ccd88dcd61c3aee60b7cad0a687663841fb84dc -+Author: rapier -+Date: Thu Nov 12 16:20:37 2015 -0500 -+ -+ Modified none cipher behaviour in sshd.c to match suggestioon from bdrewery - cf https://github.com/rapier1/openssh-portable/issues/3 -+ -+commit 6e621b2b30242ad9505b90ac8186566743f68d45 -+Author: rapier -+Date: Tue Nov 10 14:09:30 2015 -0500 -+ -+ Fixed problem with None cipher not being advertised by server -+ -+commit 9dc0e1162e6b0362c8dcb940365db987a9ed9e12 -+Author: Mike Frysinger -+Date: Thu Oct 29 01:30:08 2015 -0400 -+ -+ initialize hpn buffers sooner in the client -+ -+ When using the -w option to create a tunnel via tun devices, the client -+ sets up a window with a negative length. With 6.8+ servers, the channel -+ will be killed on the fly when the negative window is detected (see the -+ commit "fatal() when a remote window update causes the window"). With -+ older versions, the server ends up using negative windows and who knows -+ what happens next. -+ -+ Pull the hpn option logic up earlier in the ssh connection so that it -+ runs before we try to create any forwarding channels. -+ -+ You can reproduce by running the server in debug mode and having the -+ client connect like so: -+ sudo ssh -w 1:2 user@server -+ The server will log a line like: -+ debug1: server_input_channel_open: ctype tun@openssh.com rchan 0 win -1 max 32768 -+ That -1 is the window size and things go wrong from there. -+ -+ URL: https://bugs.gentoo.org/564236 -+ Reported-by: Daniel Heule -+ -+commit b5ab0d16b72f57b905b009165d91cf2e75b6fd94 -+Author: Mike Frysinger -+Date: Thu Oct 29 01:28:19 2015 -0400 -+ -+ pull the hpn init code out into a dedicated func -+ -+ This makes it more obvious what is hpn-specific and makes it easier -+ to manage the logic. -+ -+commit eb980de29ebeccbb76b7f8f186c79b609f1f89de -+Author: Mike Frysinger -+Date: Thu Oct 29 01:21:46 2015 -0400 -+ -+ clean up socket code a bit during hpn option init -+ -+ A few tweaks to improve the code to make it easier to manage: -+ - localize the vars in the scope they're actually used -+ - change socksizelen to socklen_t to match {g,s}etsockopt prototypes -+ - fix call to setsockopt to actually pass in the socklen_t -+ -+commit 68fe42fb6c1987aaf6ce9573f9d39e42b8e370c1 -+Author: rapier -+Date: Tue Oct 20 15:31:55 2015 -0400 -+ -+ Forgot to update version -+ -+commit 7daabc605f53fb1e1c7e2b958b729c6bdce62ec3 -+Author: scott campbell -+Date: Mon Sep 14 20:39:00 2015 -0400 -+ -+ complete fix for kex -+ -+ In working through the ‘make tests’, another issue re comp.name arose. -+ This change just assumes that any member of the mess can cause a -+ pathological state so test them all … -+ -+commit 8d90bedafd15ba2deeb46fd7eefcbee4fde16a29 -+Author: scott campbell -+Date: Fri Sep 11 20:19:15 2015 -0400 -+ -+ Fix segfault due to invoking strlen() on NULL string. -+ -+ See: -+ https://github.com/set-element/openssh-hpn-isshd/commit/805f39d13ac5de98 -+ 00b56f4ddcc27c3f40cf671a -+ -+ I make the bugs and mej fixes them … -+ -+commit b5c74214ebf012dbb67366e30f7cd7d05af8748e -+Author: scott campbell -+Date: Wed Jul 22 17:50:51 2015 +0200 -+ -+ fix typo -+ -+ need to have SSH_HPN in the version -+ -+commit b148101834bab4d52bc648cf7edff3499cc23219 -+Author: scott campbell -+Date: Tue Jul 21 23:46:29 2015 +0200 -+ -+ bump version -+ -+commit ef99e4eb9b6152cc5fe0a5af4f26cba67d13768a -+Author: scott campbell -+Date: Tue Jul 21 23:43:58 2015 +0200 -+ -+ add nersc mod -+ -+commit 207c8aa718356ed2a9cd854ff2fc8635ccf97818 -+Author: scott campbell -+Date: Mon May 25 08:38:51 2015 -0400 -+ -+ add key exchange event -+ -+commit c517d9a063ff6e83ea344eae9c00694cae4ff056 -+Author: scott campbell -+Date: Sun May 24 21:42:47 2015 -0400 -+ -+ fix typo -+ -+commit 98564459403abc2af519268211aa2cc3b4e4b653 -+Author: scott campbell -+Date: Wed May 20 00:07:22 2015 -0400 -+ -+ add modp_burl.o to makefile -+ -+commit 5ea0b5c24d1992c40e92b4b1231b0c73390bccec -+Author: scott campbell -+Date: Mon May 18 22:20:25 2015 -0400 -+ -+ checkin nersc mods -+ -+commit e3104f5e0e28d8b3c5a1240a6bd02e3cc4b270b2 -+Author: scott campbell -+Date: Mon May 18 22:17:58 2015 -0400 -+ -+ nersc changes -+ -+commit ae9b1dc64c6a30d057fb6805b0d0da68a4be665f -+Author: scott campbell -+Date: Mon May 18 21:29:30 2015 -0400 -+ -+ initial install -+ -+commit a48f92fb98e7d5c03f5df22e9142d61b6931ad98 -+Author: scott campbell -+Date: Mon May 18 21:01:40 2015 -0400 -+ -+ add nersc changes -+ -+commit 1017da7ab6511f1a53ab4d257f7c5341b4add2ee -+Author: scott campbell -+Date: Mon May 18 20:25:24 2015 -0400 -+ -+ add nersc reference -+ -+commit f65b329963ef936444e8b2ae4dbd3deeb4508666 -+Author: Mike Frysinger -+Date: Fri Aug 21 10:13:36 2015 -0400 -+ -+ clean up style a bit in hpn ssh code -+ -+commit 701a1a883caea75b552d44bc01b1a970a52acb19 -+Author: Damien Miller -+Date: Fri Aug 21 14:49:03 2015 +1000 -+ -+ we don't use Github for issues/pull-requests -+ -+commit cf12ef6c938653eaa40df390dc07f2ffe5b91f07 -+Author: Damien Miller -+Date: Fri Aug 21 13:47:10 2015 +1000 -+ -+ update version numbers for 7.1 -+ -+commit 07463d5dfec4c21a94f4b7c80a7a1945ac7e3299 -+Author: djm@openbsd.org -+Date: Fri Aug 21 03:45:26 2015 +0000 -+ -+ upstream commit -+ -+ openssh-7.1 -+ -+ Upstream-ID: ff7b1ef4b06caddfb45e08ba998128c88be3d73f -+ -+commit 67b1d12e62486bcd83bf23118a458294e9040bbb -+Author: djm@openbsd.org -+Date: Fri Aug 21 03:42:19 2015 +0000 -+ -+ upstream commit -+ -+ fix inverted logic that broke PermitRootLogin; reported -+ by Mantas Mikulenas; ok markus@ -+ -+ Upstream-ID: 260dd6a904c1bb7e43267e394b1c9cf70bdd5ea5 -+ -+commit cb18e0c0aec630e7f807c1ef972d8bf956d83817 -+Author: deraadt@openbsd.org -+Date: Thu Aug 20 22:32:42 2015 +0000 -+ -+ upstream commit -+ -+ Do not cast result of malloc/calloc/realloc* if stdlib.h -+ is in scope ok krw millert -+ -+ Upstream-ID: 5e50ded78cadf3841556649a16cc4b1cb6c58667 -+ -+commit f4fc49c2922083018b6f2907d5b626d270aa2aa1 -+Author: naddy@openbsd.org -+Date: Thu Aug 20 19:20:06 2015 +0000 -+ -+ upstream commit -+ -+ In the certificates section, be consistent about using -+ "host_key" and "user_key" for the respective key types. ok sthen@ deraadt@ -+ -+ Upstream-ID: 9e037ea3b15577b238604c5533e082a3947f13cb -+ -+commit 03228b875000095f5924d034e6b8b5a1ee27747f -+Author: djm@openbsd.org -+Date: Wed Aug 19 23:21:42 2015 +0000 -+ -+ upstream commit -+ -+ Better compat matching for WinSCP, add compat matching -+ for FuTTY (fork of PuTTY); ok markus@ deraadt@ -+ -+ Upstream-ID: 24001d1ac115fa3260fbdc329a4b9aeb283c5389 -+ -+commit 321c12618aa6ef6b55eacd82bf5fe89d39f59a09 -+Author: djm@openbsd.org -+Date: Wed Aug 19 23:19:01 2015 +0000 -+ -+ upstream commit -+ -+ fix double-free() in error path of DSA key generation -+ reported by Mateusz Kocielski; ok markus@ -+ -+ Upstream-ID: 4735d8f888b10599a935fa1b374787089116713c -+ -+commit b5b3d64b913801bc76c58f56cae62483168525f6 -+Author: djm@openbsd.org -+Date: Wed Aug 19 23:18:26 2015 +0000 -+ -+ upstream commit -+ -+ fix free() of uninitialised pointer reported by Mateusz -+ Kocielski; ok markus@ -+ -+ Upstream-ID: 519552b050618501a06b7b023de5cb104e2c5663 -+ -+commit 82e037829b0ba0010b2d1f62190c99cbd4eeb57f -+Author: djm@openbsd.org -+Date: Wed Aug 19 23:17:51 2015 +0000 -+ -+ upstream commit -+ -+ fixed unlink([uninitialised memory]) reported by Mateusz -+ Kocielski; ok markus@ -+ -+ Upstream-ID: 14a0c4e7d891f5a8dabc4b89d4f6b7c0d5a20109 -+ -+commit 28c98517809b785d319f31e5c78aecf11e6272bc -+Author: jmc@openbsd.org -+Date: Fri Aug 14 15:32:41 2015 +0000 -+ -+ upstream commit -+ -+ match myproposal.h order; from brian conway (i snuck in a -+ tweak while here) -+ -+ ok dtucker -+ -+ Upstream-ID: 35174a19b5237ea36aa3798f042bf5933b772c67 -+ -+commit 8d6580c49ed4c208aa9295e37b817197887e9160 -+Author: deraadt@openbsd.org -+Date: Thu Aug 6 14:53:21 2015 +0000 -+ -+ upstream commit -+ -+ add prohibit-password as a synonymn for without-password, -+ since the without-password is causing too many questions. Harden it to ban -+ all but pubkey, hostbased, and GSSAPI auth (when the latter is enabled) from -+ djm, ok markus -+ -+ Upstream-ID: d53317d7b28942153e6236d3fd6e12ceb482db7a -+ -+commit 8c1a659e0a3abee61cc677bc030d777f6f78713c -+Author: Damien Miller -+Date: Tue Aug 11 13:53:41 2015 +1000 -+ -+ update version in README -+ -+commit 4eeeadf8fad99086e66a982327720ab811520ebc -+Author: Damien Miller -+Date: Tue Aug 11 13:53:09 2015 +1000 -+ -+ update versions in *.spec -+ -+commit 644810eb1dc2d8f8b6dd42f1998afca94851bbc5 -+Author: Darren Tucker -+Date: Mon Jul 27 12:14:25 2015 +1000 -+ -+ Import updated moduli file from OpenBSD. -+ -+commit 1cfc0b19d9acb27dd7611bfcde52e87dde0cfb63 -+Author: Damien Miller -+Date: Mon Aug 10 11:13:44 2015 +1000 -+ -+ let principals-command.sh work for noexec /var/run -+ -+commit e213ca3f0645b147c8c190a14849b5b176b1704f -+Author: djm@openbsd.org -+Date: Wed Aug 5 05:27:33 2015 +0000 -+ -+ upstream commit -+ -+ adjust for RSA minimum modulus switch; ok deraadt@ -+ -+ Upstream-Regress-ID: 5a72c83431b96224d583c573ca281cd3a3ebfdae -+ -+commit cdd7ce1c9969c5f0c52f5ba1950967453b794989 -+Author: djm@openbsd.org -+Date: Tue Aug 4 05:23:06 2015 +0000 -+ -+ upstream commit -+ -+ backout SSH_RSA_MINIMUM_MODULUS_SIZE increase for this -+ release; problems spotted by sthen@ ok deraadt@ markus@ -+ -+ Upstream-ID: d0bd60dde9e8c3cd7030007680371894c1499822 -+ -+commit 9a0f3391798dd7a1011ec92f7611f70340432668 -+Author: djm@openbsd.org -+Date: Sun Aug 2 09:56:42 2015 +0000 -+ -+ upstream commit -+ -+ openssh 7.0; ok deraadt@ -+ -+ Upstream-ID: c63afdef537f57f28ae84145c5a8e29e9250221f -+ -+commit c9b37e9c6fccd7dd7bfcd8511eb61ed37d701a87 -+Author: chris@openbsd.org -+Date: Fri Jul 31 15:38:09 2015 +0000 -+ -+ upstream commit -+ -+ Allow PermitRootLogin to be overridden by config -+ -+ ok markus@ deeradt@ -+ -+ Upstream-ID: 5cf3e26ed702888de84e2dc9d0054ccf4d9125b4 -+ -+commit a64351a9e9fb3e33a79662bb08c218395c8b5e75 -+Author: deraadt@openbsd.org -+Date: Thu Jul 30 19:23:02 2015 +0000 -+ -+ upstream commit -+ -+ change default: PermitRootLogin without-password matching -+ install script changes coming as well ok djm markus -+ -+ Upstream-ID: 0e2a6c4441daf5498b47a61767382bead5eb8ea6 -+ -+commit 0ec8a1af1ee21670674e9fa84ac728f54d38c2c5 -+Author: djm@openbsd.org -+Date: Thu Jul 30 00:01:34 2015 +0000 -+ -+ upstream commit -+ -+ Allow ssh_config and sshd_config kex parameters options be -+ prefixed by a '+' to indicate that the specified items be appended to the -+ default rather than replacing it. -+ -+ approach suggested by dtucker@, feedback dlg@, ok markus@ -+ -+ Upstream-ID: 0f901137298fc17095d5756ff1561a7028e8882a -+ -+commit 218c47a0a9dde2d1e2dcc9fa4bc9caa774c7e072 -+Author: djm@openbsd.org -+Date: Wed Jul 29 08:34:54 2015 +0000 -+ -+ upstream commit -+ -+ fix bug in previous; was printing incorrect string for -+ failed host key algorithms negotiation -+ -+ Upstream-ID: 22c0dc6bc61930513065d92e11f0753adc4c6e6e -+ -+commit 3b717b558d0c8554a9bf467927de8b7b9a907902 -+Author: djm@openbsd.org -+Date: Wed Jul 29 04:43:06 2015 +0000 -+ -+ upstream commit -+ -+ include the peer's offer when logging a failure to -+ negotiate a mutual set of algorithms (kex, pubkey, ciphers, etc.) ok markus@ -+ -+ Upstream-ID: bbb8caabf5c01790bb845f5ce135565248d7c796 -+ -+commit 8a26a4d3a1115ba3806ead11526cc5c757dcb6e5 -+Author: djm@openbsd.org -+Date: Tue Jul 28 23:20:42 2015 +0000 -+ -+ upstream commit -+ -+ add Cisco to the list of clients that choke on the -+ hostkeys update extension. Pointed out by Howard Kash -+ -+ Upstream-ID: c9eadde28ecec056c73d09ee10ba4570dfba7e84 -+ -+commit aa3950cb80351289b989ae39b2caa75c7b1dfa86 -+Author: guenther@openbsd.org -+Date: Mon Jul 27 16:29:23 2015 +0000 -+ -+ upstream commit -+ -+ Permit kbind(2) use in the sandbox now, to ease testing -+ of ld.so work using it -+ -+ reminded by miod@, ok deraadt@ -+ -+ Upstream-ID: 523922e4d1ba7a091e3824e77a8a3c818ee97413 -+ -+commit b0bb5b8f91dbfe05cdcb6c66b4857a1969d9a8ce -+Author: millert@openbsd.org -+Date: Mon Jul 20 18:44:12 2015 +0000 -+ -+ upstream commit -+ -+ Move .Pp before .Bl, not after to quiet mandoc -Tlint. -+ Noticed by jmc@ -+ -+ Upstream-ID: 59fadbf8407cec4e6931e50c53cfa0214a848e23 -+ -+commit 67fcfd4e32ab4565c5ee4dd02285193d7e285348 -+Author: millert@openbsd.org -+Date: Mon Jul 20 18:42:35 2015 +0000 -+ -+ upstream commit -+ -+ Sync usage with SYNOPSIS -+ -+ Upstream-ID: 7a321a170181a54f6450deabaccb6ef60cf3f0b7 -+ -+commit f97022feaf07b8d8ad262f42137421f783d22244 -+Author: millert@openbsd.org -+Date: Mon Jul 20 15:39:52 2015 +0000 -+ -+ upstream commit -+ -+ Better desciption of Unix domain socket forwarding. -+ bz#2423; ok jmc@ -+ -+ Upstream-ID: 85e28874726897e3f26ae50dfa2e8d2de683805d -+ -+commit 5eb593a10916d3909f556fb253ed2ff89416f468 -+Author: djm@openbsd.org -+Date: Mon Jul 20 00:30:01 2015 +0000 -+ -+ upstream commit -+ -+ mention that the default of UseDNS=no implies that -+ hostnames cannot be used for host matching in sshd_config and -+ authorized_keys; bz#2045, ok dtucker@ -+ -+ Upstream-ID: 0812705d5f2dfa59aab01f2764ee800b1741c4e1 -+ -+commit 5b87b71827f2a02fad165ece29aad2caffe4bea6 -+Author: djm@openbsd.org -+Date: Sat Jul 18 08:02:17 2015 +0000 -+ -+ upstream commit -+ -+ don't ignore PKCS#11 hosted keys that return empty -+ CKA_ID; patch by Jakub Jelen via bz#2429; ok markus -+ -+ Upstream-ID: 2f7c94744eb0342f8ee8bf97b2351d4e00116485 -+ -+commit d5d141e3cfe158a380cdcc91f91b854848481ff2 -+Author: djm@openbsd.org -+Date: Sat Jul 18 08:00:21 2015 +0000 -+ -+ upstream commit -+ -+ skip uninitialised PKCS#11 slots; patch from Jakub Jelen -+ in bz#2427 ok markus@ -+ -+ Upstream-ID: 744c1e7796e237ad32992d0d02148e8a18f27d29 -+ -+commit 944eb474efb18abb5db83da508036ef77d013680 -+Author: djm@openbsd.org -+Date: Fri Jul 17 03:09:19 2015 +0000 -+ -+ upstream commit -+ -+ direct-streamlocal@openssh.com Unix domain foward -+ messages do not contain a "reserved for future use" field and in fact, -+ serverloop.c checks that there isn't one. Remove erroneous mention from -+ PROTOCOL description. bz#2421 from Daniel Black -+ -+ Upstream-ID: 3d51a19e64f72f764682f1b08f35a8aa810a43ac -+ -+commit 8bd4947a441351af152f736e1489475b899746b6 -+Author: djm@openbsd.org -+Date: Fri Jul 17 02:47:45 2015 +0000 -+ -+ upstream commit -+ -+ fix incorrect test for SSH1 keys when compiled without SSH1 -+ support -+ -+ Upstream-ID: 6004d720345b8e481c405e8ad05ce2271726e451 -+ -+commit 56f63c88a3b800773aeb2b50e5f6ab37adfdcade -+Author: djm@openbsd.org -+Date: Wed Jul 15 08:00:11 2015 +0000 -+ -+ upstream commit -+ -+ fix NULL-deref when SSH1 reenabled -+ -+ Upstream-ID: f22fd805288c92b3e9646782d15b48894b2d5295 -+ -+commit 055498a880268738c1985d3fc8965d531734b3c8 -+Author: djm@openbsd.org -+Date: Wed Jul 15 07:19:50 2015 +0000 -+ -+ upstream commit -+ -+ regen RSA1 test keys; the last batch was missing their -+ private parts -+ -+ Upstream-Regress-ID: 7ccf437305dd63ff0b48dd50c5fd0f4d4230c10a -+ -+commit cd598b92baea574198e740325a79bcab4077a5e5 -+Author: markus@openbsd.org -+Date: Fri Jul 10 06:23:25 2015 +0000 -+ -+ upstream commit -+ -+ Adapt tests, now that DSA if off by default; use -+ PubkeyAcceptedKeyTypes and PubkeyAcceptedKeyTypes to test DSA. -+ -+ Upstream-Regress-ID: 0ff2a3ff5ac1ce5f92321d27aa07b98656efcc5c -+ -+commit 3410eb307f9b36dd54ceea9b0c3994083aa6fb7c -+Author: markus@openbsd.org -+Date: Tue Jul 7 14:54:16 2015 +0000 -+ -+ upstream commit -+ -+ regen test data after mktestdata.sh changes -+ -+ Upstream-Regress-ID: 3495ecb082b9a7c048a2d7c5c845d3bf181d25a4 -+ -+commit 27c30c9e4d1a8926c73322dc60f5581569a1633b -+Author: markus@openbsd.org -+Date: Tue Jul 7 14:53:30 2015 +0000 -+ -+ upstream commit -+ -+ adapt tests to new minimum RSA size and default FP format -+ -+ Upstream-Regress-ID: a4b30afd174ce82b96df14eb49fb0b81398ffd0e -+ -+commit 09c63a7b2b24f2e8ab9516e172d1f4ef4f7a0192 -+Author: djm@openbsd.org -+Date: Fri Jul 3 04:39:23 2015 +0000 -+ -+ upstream commit -+ -+ legacy v00 certificates are gone; adapt and don't try to -+ test them; "sure" markus@ dtucker@ -+ -+ Upstream-Regress-ID: c57321e69b3cd4a3b3396dfcc43f0803d047da12 -+ -+commit b81ae2afb7c39029b7a17bf8232978296bcae36d -+Author: djm@openbsd.org -+Date: Wed Jul 1 23:11:18 2015 +0000 -+ -+ upstream commit -+ -+ don't expect SSH v.1 in unittests -+ -+ Upstream-Regress-ID: f8812b16668ba78e6a698646b2a652b90b653397 -+ -+commit f4b91dc85856739aa09b1a105902eae12e4a434c -+Author: djm@openbsd.org -+Date: Mon Jun 15 06:38:50 2015 +0000 -+ -+ upstream commit -+ -+ turn SSH1 back on to match src/usr.bin/ssh being tested -+ -+ Upstream-Regress-ID: 6c4f763a2f0cc6893bf33983919e9030ae638333 -+ -+commit 810e1e2cfca7bfc9dab44f2744fcc3c08f34bfe6 -+Author: dtucker@openbsd.org -+Date: Mon Jul 13 04:57:14 2015 +0000 -+ -+ upstream commit -+ -+ Add "PuTTY_Local:" to the clients to which we do not -+ offer DH-GEX. This was the string that was used for development versions -+ prior to September 2014 and they don't do RFC4419 DH-GEX, but unfortunately -+ there are some extant products based on those versions. bx2424 from Jay -+ Rouman, ok markus@ djm@ -+ -+ Upstream-ID: be34d41e18b966832fe09ca243d275b81882e1d5 -+ -+commit 22f6c5e09939262ebc48f8bc6a0ac8e87988002f -+Author: markus@openbsd.org -+Date: Fri Jul 10 06:21:53 2015 +0000 -+ -+ upstream commit -+ -+ Turn off DSA by default; add HostKeyAlgorithms to the -+ server and PubkeyAcceptedKeyTypes to the client side, so it still can be -+ tested or turned back on; feedback and ok djm@ -+ -+ Upstream-ID: 8450a9e6d83f80c9bfed864ff061dfc9323cec21 -+ -+commit 6c0d149a7d62c2d519acb12cc35cea4f1a137743 -+Author: markus@openbsd.org -+Date: Thu Jul 9 09:49:46 2015 +0000 -+ -+ upstream commit -+ -+ re-enable ed25519-certs if compiled w/o openssl; ok djm -+ -+ Upstream-ID: e10c90808b001fd2c7a93778418e9b318f5c4c49 -+ -+commit 5294cbbfe82a0466210f4683f5c006dbfa99be24 -+Author: markus@openbsd.org -+Date: Wed Jul 8 20:24:02 2015 +0000 -+ -+ upstream commit -+ -+ no need to include the old buffer/key API -+ -+ Upstream-ID: fb13c9f7c0bba2545f3eb0a0e69cb0030819f52b -+ -+commit 6e0250169895cbdb1b35120cb2a4cd3c2277fdeb -+Author: djm@openbsd.org -+Date: Fri Jul 3 04:05:54 2015 +0000 -+ -+ upstream commit -+ -+ another SSH_RSA_MINIMUM_MODULUS_SIZE that needed -+ cranking -+ -+ Upstream-ID: 9d8826cafe96aab4ae8e2f6fd22800874b7ffef1 -+ -+commit 81ddd4d42a49cc6f7eeeee1098172cf64c1fd3e3 -+Author: djm@openbsd.org -+Date: Fri Jul 3 03:56:25 2015 +0000 -+ -+ upstream commit -+ -+ add an XXX reminder for getting correct key paths from -+ sshd_config -+ -+ Upstream-ID: feae52b209d7782ad742df04a4260e9fe41741db -+ -+commit e30a6f7bc6b023c5cc29d69876deaf7be2ef0143 -+Author: djm@openbsd.org -+Date: Fri Jul 3 03:49:45 2015 +0000 -+ -+ upstream commit -+ -+ refuse to generate or accept RSA keys smaller than 1024 -+ bits; feedback and ok dtucker@ -+ -+ Upstream-ID: 7ea3d31271366ba264f06e34a3539bf1ac30f0ba -+ - commit 65c6c6b567ab5ab12945a5ad8e0ab3a8c26119cc - Author: djm@openbsd.org - Date: Sun Jul 17 04:20:16 2016 +0000 -@@ -3321,6 +4769,3887 @@ - - Upstream-ID: 43d318e14ce677a2eec8f21ef5ba2f9f68a59457 - -+commit ce66ae4db17e215f4c150d30d87dd2fa406652f6 -+Author: djm@openbsd.org -+Date: Fri Jul 3 03:47:00 2015 +0000 -+ -+ upstream commit -+ -+ turn off 1024 bit diffie-hellman-group1-sha1 key -+ exchange method (already off in server, this turns it off in the client by -+ default too) ok dtucker@ -+ -+ Upstream-ID: f59b88f449210ab7acf7d9d88f20f1daee97a4fa -+ -+commit f1334298d430a4284b49321e9efb358b23ad8e3f -+Author: djm@openbsd.org -+Date: Fri Jul 3 03:43:18 2015 +0000 -+ -+ upstream commit -+ -+ delete support for legacy v00 certificates; "sure" -+ markus@ dtucker@ -+ -+ Upstream-ID: b5b9bb5f9202d09e88f912989d74928601b6636f -+ -+commit 970f3d502c25eea979c159833282e9d02661b4f5 -+Author: djm@openbsd.org -+Date: Wed Jul 1 23:10:47 2015 +0000 -+ -+ upstream commit -+ -+ Compile-time disable SSH v.1 again -+ -+ Upstream-ID: 1d4b513a3a06232f02650b73bad25100d1b800af -+ -+commit bb2ad55eb949209fd4f3db39372ac6949d028904 -+Author: djm@openbsd.org -+Date: Wed Jul 1 02:39:06 2015 +0000 -+ -+ upstream commit -+ -+ twiddle PermitRootLogin back -+ -+ Upstream-ID: 2bd23976305d0512e9f84d054e1fc23cd70b89f2 -+ -+commit 82f46132f2a779ea42b998daca418eeec0fef926 -+Author: djm@openbsd.org -+Date: Wed Jul 1 02:32:17 2015 +0000 -+ -+ upstream commit -+ -+ twiddle; (this commit marks the openssh-6.9 release) -+ -+ Upstream-ID: 78500582819f61dd8adee36ec5cc9b9ac9351234 -+ -+commit a8985e2c0c3fef0a8dc65997b83314162691ec8a -+Author: djm@openbsd.org -+Date: Wed Jul 1 02:26:31 2015 +0000 -+ -+ upstream commit -+ -+ better refuse ForwardX11Trusted=no connections attempted -+ after ForwardX11Timeout expires; reported by Jann Horn -+ -+ Upstream-ID: bf0fddadc1b46a0334e26c080038313b4b6dea21 -+ -+commit dec7e70142a12326feaaf660e0ffbca1316c0ccf -+Author: djm@openbsd.org -+Date: Wed Jul 1 01:56:13 2015 +0000 -+ -+ upstream commit -+ -+ put back default PermitRootLogin=no -+ -+ Upstream-ID: 7bdedd5cead99c57ed5571f3b6b7840922d5f728 -+ -+commit 84986e3bcb09ade698138298a84dd723f9346c3c -+Author: djm@openbsd.org -+Date: Wed Jul 1 01:55:13 2015 +0000 -+ -+ upstream commit -+ -+ openssh-6.9 -+ -+ Upstream-ID: 6cfe8e1904812531080e6ab6e752d7001b5b2d45 -+ -+commit 36b58f82ca1644129f537bf04082ec99142e3c25 -+Author: djm@openbsd.org -+Date: Wed Jul 1 01:55:00 2015 +0000 -+ -+ upstream commit -+ -+ reset default PermitRootLogin to 'yes' (momentarily, for -+ release) -+ -+ Upstream-ID: cad8513527066e65dd7a1c16363d6903e8cefa24 -+ -+commit 69364c10469d05e3db4a6bfbee7cb46f474e664c -+Author: Damien Miller -+Date: Wed Jul 1 11:49:12 2015 +1000 -+ -+ crank version numbers for release -+ -+commit be1bb784e246eb392fb7e54dd39f51bcc030a81d -+Author: Damien Miller -+Date: Wed Jul 1 10:49:37 2015 +1000 -+ -+ s/--with-ssh1/--without-ssh1/ -+ -+commit 1a68a3d4f4c3c5075c09410a72bdec3a96afa39a -+Author: djm@openbsd.org -+Date: Tue Jun 30 05:25:07 2015 +0000 -+ -+ upstream commit -+ -+ fatal() when a remote window update causes the window -+ value to overflow. Reported by Georg Wicherski, ok markus@ -+ -+ Upstream-ID: ead397a9aceb3bf74ebfa5fcaf259d72e569f351 -+ -+commit 328154e01ba5eeceb03b9334bcd9f4817c5115da -+Author: djm@openbsd.org -+Date: Tue Jun 30 05:23:25 2015 +0000 -+ -+ upstream commit -+ -+ Fix math error in remote window calculations that causes -+ eventual stalls for datagram channels. Reported by Georg Wicherski, ok -+ markus@ -+ -+ Upstream-ID: be54059d11bf64e0d85061f7257f53067842e2ab -+ -+commit 8fc4153fc1a31f5b5b45652f333aa60e04675465 -+Author: Damien Miller -+Date: Tue Jun 30 16:05:40 2015 +1000 -+ -+ skip IPv6-related portions on hosts without IPv6 -+ -+ with Tim Rice -+ -+commit 2d96d5520784c1cfae02ab2c6110e5367e78bb89 -+Author: djm@openbsd.org -+Date: Mon Jun 29 22:35:12 2015 +0000 -+ -+ upstream commit -+ -+ add getpid to sandbox, reachable by grace_alarm_handler -+ -+ reported by Jakub Jelen; bz#2419 -+ -+ Upstream-ID: d0da1117c16d4c223954995d35b0f47c8f684cd8 -+ -+commit acbea09f6a4d23c1adcabcdc0acaa8d0625a5847 -+Author: djm@openbsd.org -+Date: Fri Jun 26 05:13:20 2015 +0000 -+ -+ upstream commit -+ -+ Fix \-escaping bug that caused forward path parsing to skip -+ two characters and skip past the end of the string. -+ -+ Based on patch by Salvador Fandino; ok dtucker@ -+ -+ Upstream-ID: 7b879dc446335677cbe4cb549495636a0535f3bd -+ -+commit ada0841191fa5b24c03d32e9e8cb16e98bda9c83 -+Author: djm@openbsd.org -+Date: Wed Jun 24 23:47:23 2015 +0000 -+ -+ upstream commit -+ -+ correct test to sshkey_sign(); spotted by Albert S. -+ -+ Upstream-ID: 5f7347f40f0ca6abdaca2edb3bd62f4776518933 -+ -+commit 6af0321241875d60e4819ac034e6b3594e36c7a1 -+Author: dtucker@openbsd.org -+Date: Wed Jun 24 01:49:19 2015 +0000 -+ -+ upstream commit -+ -+ Revert previous commit. We still want to call setgroups -+ in the case where there are zero groups to remove any that we might otherwise -+ inherit (as pointed out by grawity at gmail.com) and since the 2nd argument -+ to setgroups is always a static global it's always valid to dereference in -+ this case. ok deraadt@ djm@ -+ -+ Upstream-ID: 895b5ac560a10befc6b82afa778641315725fd01 -+ -+commit f7dadcc4a63e88dbd0dc8bafbf822e0879636026 -+Author: dtucker@openbsd.org -+Date: Wed Jun 24 01:49:19 2015 +0000 -+ -+ upstream commit -+ -+ Revert previous commit. We still want to call setgroups in -+ the case where there are zero groups to remove any that we might otherwise -+ inherit (as pointed out by grawity at gmail.com) and since the 2nd argument -+ to setgroups is always a static global it's always valid to dereference in -+ this case. ok deraadt@ djm@ -+ -+ Upstream-ID: 895b5ac560a10befc6b82afa778641315725fd01 -+ -+commit 57a3ddb3584b1456cd64d962532d4c8b526ca49c -+Author: djm@openbsd.org -+Date: Mon Jun 22 23:42:16 2015 +0000 -+ -+ upstream commit -+ -+ Don't count successful partial authentication as failures -+ in monitor; this may have caused the monitor to refuse multiple -+ authentications that would otherwise have successfully completed; ok markus@ -+ -+ Upstream-ID: eb74b8e506714d0f649bd5c300f762a527af04a3 -+ -+commit a6fb0f4beb2630cee324c500319f4577dee82fd8 -+Author: dtucker@openbsd.org -+Date: Mon Jun 22 12:29:57 2015 +0000 -+ -+ upstream commit -+ -+ Don't call setgroups if we have zero groups; there's no -+ guarantee that it won't try to deref the pointer. Based on a patch from mail -+ at quitesimple.org, ok djm deraadt -+ -+ Upstream-ID: 2fff85e11d7a9a387ef7fddf41fbfaf566708ab1 -+ -+commit f5058724bc44ec95ac569de6f14457e2e9e27640 -+Author: Damien Miller -+Date: Thu Jun 18 15:07:56 2015 +1000 -+ -+ fix syntax error -+ -+commit 645d0ea25b115ea50523618950df0e4357bda341 -+Author: jsing@openbsd.org -+Date: Mon Jun 15 18:44:22 2015 +0000 -+ -+ upstream commit -+ -+ If AuthorizedPrincipalsCommand is specified, however -+ AuthorizedPrincipalsFile is not (or is set to "none"), authentication will -+ potentially fail due to key_cert_check_authority() failing to locate a -+ principal that matches the username, even though an authorized principal has -+ already been matched in the output of the subprocess. Fix this by using the -+ same logic to determine if pw->pw_name should be passed, as is used to -+ determine if a authorized principal must be matched earlier on. -+ -+ ok djm@ -+ -+ Upstream-ID: 43b42302ec846b0ea68aceb40677245391b9409d -+ -+commit 0d67818831c8a4db10238e08be40d39aef7311e7 -+Author: jsing@openbsd.org -+Date: Mon Jun 15 18:42:19 2015 +0000 -+ -+ upstream commit -+ -+ Make the arguments to match_principals_command() similar -+ to match_principals_file(), by changing the last argument a struct -+ sshkey_cert * and dereferencing key->cert in the caller. -+ -+ No functional change. -+ -+ ok djm@ -+ -+ Upstream-ID: 533f99b844b21b47342b32b62e198dfffcf8651c -+ -+commit ce4caec2fb344f27e5d85c404a2e51a73045c3dd -+Author: Damien Miller -+Date: Wed Jun 17 14:36:54 2015 +1000 -+ -+ trivial optimisation for seccomp-bpf -+ -+ When doing arg inspection and the syscall doesn't match, skip -+ past the instruction that reloads the syscall into the accumulator, -+ since the accumulator hasn't been modified at this point. -+ -+commit dc8377ad9466bd50a93b9591c121458794ca8525 -+Author: Damien Miller -+Date: Wed Jun 17 10:50:51 2015 +1000 -+ -+ aarch64 support for seccomp-bpf sandbox -+ -+ Also resort and tidy syscall list. Based on patches by Jakub Jelen -+ bz#2361; ok dtucker@ -+ -+commit e6456c98f8ea7b3fadb318a65ef24fad91be3e36 -+Author: millert@openbsd.org -+Date: Fri Jun 5 15:13:13 2015 +0000 -+ -+ upstream commit -+ -+ For "ssh -L 12345:/tmp/sock" don't fail with "No forward host -+ name." (we have a path, not a host name). Based on a diff from Jared -+ Yanovich. OK djm@ -+ -+ Upstream-ID: 2846b0a8c7de037e33657f95afbd282837fc213f -+ -+commit 4847be5be32d126e72986b3ce3f656cd081296f7 -+Author: djm@openbsd.org -+Date: Fri Jun 5 03:44:14 2015 +0000 -+ -+ upstream commit -+ -+ typo: accidental repetition; bz#2386 -+ -+ Upstream-ID: 45e620d99f6bc301e5949d34a54027374991c88b -+ -+commit 86b639d724e2680df24303b003d5d3ab2db6e184 -+Author: djm@openbsd.org -+Date: Tue Jun 2 09:10:40 2015 +0000 -+ -+ upstream commit -+ -+ mention CheckHostIP adding addresses to known_hosts; -+ bz#1993; ok dtucker@ -+ -+ Upstream-ID: fd44b68440fd0dc29abf9f2d3f703d74a2396cb7 -+ -+commit 72b7775ace7d0ba2c619c4cb470b6ebcbddebd6f -+Author: Damien Miller -+Date: Fri May 29 18:27:21 2015 +1000 -+ -+ skip, rather than fatal when run without SUDO set -+ -+commit 96cb5b5cd388eab832b3a3045843a155312711c4 -+Author: Damien Miller -+Date: Fri May 29 18:03:15 2015 +1000 -+ -+ fix merge botch that left ",," in KEX algs -+ -+commit f869752cd45ee18dfd6f80dee27138df0e9ef63e -+Author: Damien Miller -+Date: Fri May 29 17:08:28 2015 +1000 -+ -+ re-enable SSH protocol 1 at compile time -+ -+commit f120888a9cffce6b56fe9f4824bd8bc992ac60d0 -+Author: djm@openbsd.org -+Date: Fri May 29 03:05:13 2015 +0000 -+ -+ upstream commit -+ -+ make this work without SUDO set; ok dtucker@ -+ -+ Upstream-Regress-ID: bca88217b70bce2fe52b23b8e06bdeb82d98c715 -+ -+commit 9b80e5ea6d2d5b2d0499526099f342484bdb4c6c -+Author: djm@openbsd.org -+Date: Thu May 28 07:37:31 2015 +0000 -+ -+ upstream commit -+ -+ wrap all moduli-related code in #ifdef WITH_OPENSSL. -+ based on patch from Reuben Hawkins; bz#2388 feedback and ok dtucker@ -+ -+ Upstream-ID: d80cfc8be3e6ec65b3fac9e87c4466533b31b7cf -+ -+commit b96e25b4f7aeb725bcf40e66f1cd67337b70534f -+Author: dtucker@openbsd.org -+Date: Thu May 28 05:41:29 2015 +0000 -+ -+ upstream commit -+ -+ Increase the allowed length of the known host file name -+ in the log message to be consistent with other cases. Part of bz#1993, ok -+ deraadt. -+ -+ Upstream-ID: a9e97567be49f25daf286721450968251ff78397 -+ -+commit 18ce0244965af7cb36567844c80285d883ed0914 -+Author: dtucker@openbsd.org -+Date: Thu May 28 05:09:45 2015 +0000 -+ -+ upstream commit -+ -+ Fix typo (keywork->keyword) -+ -+ Upstream-ID: 8aacd0f4089c0a244cf43417f4f9045dfaeab534 -+ -+commit 1db78a5284ef6a9b110795816582a5dd4aedbc50 -+Author: djm@openbsd.org -+Date: Thu May 28 04:50:53 2015 +0000 -+ -+ upstream commit -+ -+ add error message on ftruncate failure; bz#2176 -+ -+ Upstream-ID: cbcc606e0b748520c74a210d8f3cc9718d3148cf -+ -+commit 7fad91fe8ce4d1cc030022fa412e74c05598e5cf -+Author: djm@openbsd.org -+Date: Thu May 28 04:40:13 2015 +0000 -+ -+ upstream commit -+ -+ make ssh-keygen default to ed25519 keys when compiled -+ without OpenSSL; bz#2388, ok dtucker@ -+ -+ Upstream-ID: 85a471fa6d3fa57a7b8e882d22cfbfc1d84cdc71 -+ -+commit 340da6f29f531d00a0797fe6559f6b8d88a6640b -+Author: dtucker@openbsd.org -+Date: Wed May 27 23:51:10 2015 +0000 -+ -+ upstream commit -+ -+ Reorder client proposal to prefer -+ diffie-hellman-group-exchange-sha1 over diffie-hellman-group14-sha1. ok djm@ -+ -+ Upstream-ID: 552c08d47347c3ee1a9a57d88441ab50abe17058 -+ -+commit ffbbd50dcf3faadab9cc0e44066c66f8b202dec7 -+Author: dtucker@openbsd.org -+Date: Wed May 27 23:39:18 2015 +0000 -+ -+ upstream commit -+ -+ Add a stronger (4k bit) fallback group that sshd can use -+ when the moduli file is missing or broken, sourced from RFC3526. bz#2302, ok -+ markus@ (earlier version), djm@ -+ -+ Upstream-ID: b635215746a25a829d117673d5e5a76d4baee7f4 -+ -+commit 0a863ce8c545d3afe2751a3193053e615e226f97 -+Author: Darren Tucker -+Date: Thu May 28 10:03:40 2015 +1000 -+ -+ New moduli file from OpenBSD, removing 1k groups. -+ -+ Remove 1k bit groups. ok deraadt@, markus@ -+ -+commit 94133f4c867797e2907b51f63aed7ead40f78a5d -+Author: djm@openbsd.org -+Date: Wed May 27 05:15:02 2015 +0000 -+ -+ upstream commit -+ -+ support PKCS#11 devices with external PIN entry devices -+ bz#2240, based on patch from Dirk-Willem van Gulik; feedback and ok dtucker@ -+ -+ Upstream-ID: 504568992b55a8fc984375242b1bd505ced61b0d -+ -+commit 705f87cb6258845b95d1fef044672188fc16bd9c -+Author: dtucker@openbsd.org -+Date: Tue May 26 23:23:40 2015 +0000 -+ -+ upstream commit -+ -+ Cap DH-GEX group size at 4kbits for Cisco implementations. -+ Some of them will choke when asked for preferred sizes >4k instead of -+ returning the 4k group that they do have. bz#2209, ok djm@ -+ -+ Upstream-ID: 54b863a19713446b7431f9d06ad0532b4fcfef8d -+ -+commit e4a340fd4515527ad178bb4334ebad4325e5a4ef -+Author: djm@openbsd.org -+Date: Sun May 24 23:39:16 2015 +0000 -+ -+ upstream commit -+ -+ add missing 'c' option to getopt(), case statement was -+ already there; from Felix Bolte -+ -+ Upstream-ID: 9b19b4e2e0b54d6fefa0dfac707c51cf4bae3081 -+ -+commit a72d7fcdc4b17e4dd8e77f3e34e206a2efed5639 -+Author: jsg@openbsd.org -+Date: Sat May 23 14:28:37 2015 +0000 -+ -+ upstream commit -+ -+ fix a memory leak in an error path ok markus@ dtucker@ -+ -+ Upstream-ID: bc1da0f205494944918533d8780fde65dff6c598 -+ -+commit 41a7462a5c4f029491b0278d1930928c62805f35 -+Author: djm@openbsd.org -+Date: Fri May 22 05:28:45 2015 +0000 -+ -+ upstream commit -+ -+ mention ssh-keygen -E for comparing legacy MD5 -+ fingerprints; bz#2332 -+ -+ Upstream-ID: 079a3669549041dbf10dbc072d9563f0dc3b2859 -+ -+commit fe6d26cb66cce59bb86a0b5ed040cd59c5ef9b5b -+Author: djm@openbsd.org -+Date: Fri May 22 04:45:52 2015 +0000 -+ -+ upstream commit -+ -+ Reorder EscapeChar option parsing to avoid a single-byte -+ out- of-bounds read. bz#2396 from Jaak Ristioja; ok dtucker@ -+ -+ Upstream-ID: 1dc6b5b63d1c8d9a88619da0b27ade461d79b060 -+ -+commit a21e90fa5e72ce2138f72f1e4bdac097780d96a3 -+Author: djm@openbsd.org -+Date: Fri May 22 03:50:02 2015 +0000 -+ -+ upstream commit -+ -+ add knob to relax GSSAPI host credential check for -+ multihomed hosts bz#928, patch by Simon Wilkinson; ok dtucker -+ (kerberos/GSSAPI is not compiled by default on OpenBSD) -+ -+ Upstream-ID: 15ddf1c6f7fd9d98eea9962f480079ae3637285d -+ -+commit c3dc084029a80341052b8c5c3b79be953a30ecec -+Author: Darren Tucker -+Date: Fri May 22 12:47:24 2015 +1000 -+ -+ Import updated moduli file from OpenBSD. -+ -+commit 06eaf2018698f025c9677854f05372fdc78a180a -+Author: djm@openbsd.org -+Date: Thu May 21 12:01:19 2015 +0000 -+ -+ upstream commit -+ -+ Support "ssh-keygen -lF hostname" to find search known_hosts -+ and print key hashes. Already advertised by ssh-keygen(1), but not delivered -+ by code; ok dtucker@ -+ -+ Upstream-ID: 459e0e2bf39825e41b0811c336db2d56a1c23387 -+ -+commit 9f75b6ddd3a1f540e8749f26491e7ddd9511af0e -+Author: djm@openbsd.org -+Date: Thu May 21 06:44:25 2015 +0000 -+ -+ upstream commit -+ -+ regress test for AuthorizedPrincipalsCommand -+ -+ Upstream-Regress-ID: c658fbf1ab6b6011dc83b73402322e396f1e1219 -+ -+commit 527de8a6ebddb3545827c6cdc63296da67472c57 -+Author: djm@openbsd.org -+Date: Thu May 21 06:43:30 2015 +0000 -+ -+ upstream commit -+ -+ add AuthorizedPrincipalsCommand that allows getting -+ authorized_principals from a subprocess rather than a file, which is quite -+ useful in deployments with large userbases -+ -+ feedback and ok markus@ -+ -+ Upstream-ID: aa1bdac7b16fc6d2fa3524ef08f04c7258d247f6 -+ -+commit ce09c00bd21a4303a2925048c43baf4b4a5dc4d0 -+Author: djm@openbsd.org -+Date: Thu May 21 06:38:35 2015 +0000 -+ -+ upstream commit -+ -+ support arguments to AuthorizedKeysCommand -+ -+ bz#2081 loosely based on patch by Sami Hartikainen -+ feedback and ok markus@ -+ -+ Upstream-ID: b080387a14aa67dddd8ece67c00f268d626541f7 -+ -+commit ff2409013f215cf5cd134af422afc4c19147ca77 -+Author: djm@openbsd.org -+Date: Thu May 21 04:55:51 2015 +0000 -+ -+ upstream commit -+ -+ refactor: split base64 encoding of pubkey into its own -+ sshkey_to_base64() function and out of sshkey_write(); ok markus@ -+ -+ Upstream-ID: 54fc38f5832e9b91028900819bda46c3959a0c1a -+ -+commit 5aed94f5d8799e867a1fb8abbe98a1e9fa4086ab -+Author: deraadt@openbsd.org -+Date: Mon May 18 15:06:05 2015 +0000 -+ -+ upstream commit -+ -+ getentropy() and sendsyslog() have been around long -+ enough. openssh-portable may want the #ifdef's but not base. discussed with -+ djm few weeks back -+ -+ Upstream-ID: 0506a4334de108e3fb6c66f8d6e0f9c112866926 -+ -+commit 154e793aa149f40c0c555b7511f8c8046bdd1866 -+Author: dtucker@openbsd.org -+Date: Fri May 15 05:44:21 2015 +0000 -+ -+ upstream commit -+ -+ Use a salted hash of the lock passphrase instead of plain -+ text and do constant-time comparisons of it. Should prevent leaking any -+ information about it via timing, pointed out by Ryan Castellucci. Add a 0.1s -+ incrementing delay for each failed unlock attempt up to 10s. ok markus@ -+ (earlier version), djm@ -+ -+ Upstream-ID: c599fcc325aa1cc65496b25220b622d22208c85f -+ -+commit ede308f5a95f80bfbc7584297dffacc7d01e404b -+Author: Damien Miller -+Date: Tue May 5 19:10:58 2015 +1000 -+ -+ upstream commit -+ -+ - tedu@cvs.openbsd.org 2015/01/12 03:20:04 -+ [bcrypt_pbkdf.c] -+ rename blocks to words. bcrypt "blocks" are unrelated to blowfish blocks, -+ nor are they the same size. -+ -+commit 517e59900f355072b6d36377606112efdb1552ab -+Author: Damien Miller -+Date: Tue May 5 19:10:23 2015 +1000 -+ -+ upstream commit -+ -+ - deraadt@cvs.openbsd.org 2015/01/08 00:30:07 -+ [bcrypt_pbkdf.c] -+ declare a local version of MIN(), call it MINIMUM() -+ -+commit 1a1323f3cb71cc4c316bd7c47524a237216a58c9 -+Author: Damien Miller -+Date: Tue May 5 19:09:46 2015 +1000 -+ -+ upstream commit -+ -+ - djm@cvs.openbsd.org 2014/12/30 01:41:43 -+ [bcrypt_pbkdf.c] -+ typo in comment: ouput => output -+ -+commit 40a06107cd2bf50c0314cc54ad17b9cacf970e89 -+Author: djm@openbsd.org -+Date: Mon May 4 06:10:48 2015 +0000 -+ -+ upstream commit -+ -+ Remove pattern length argument from match_pattern_list(), we -+ only ever use it for strlen(pattern). -+ -+ Prompted by hanno AT hboeck.de pointing an out-of-bound read -+ error caused by an incorrect pattern length found using AFL -+ and his own tools. -+ -+ ok markus@ -+ -+commit 11ceb72cf34b378c1c45c4995f0910534002cfb5 -+Author: djm@openbsd.org -+Date: Fri May 1 07:10:01 2015 +0000 -+ -+ upstream commit -+ -+ refactor ssh_dispatch_run_fatal() to use sshpkt_fatal() -+ to better report error conditions. Teach sshpkt_fatal() about ECONNRESET. -+ -+ Improves error messages on TCP connection resets. bz#2257 -+ -+ ok dtucker@ -+ -+commit e12d83a0591c7c86eafa0c99a193b6e98a687375 -+Author: djm@openbsd.org -+Date: Fri May 1 07:08:08 2015 +0000 -+ -+ upstream commit -+ -+ a couple of parse targets were missing activep checks, -+ causing them to be misapplied in match context; bz#2272 diagnosis and -+ original patch from Sami Hartikainen ok dtucker@ -+ -+commit 509e69f316d45da8e501a015760f4dea2fb4d7c7 -+Author: djm@openbsd.org -+Date: Fri May 1 04:17:51 2015 +0000 -+ -+ upstream commit -+ -+ make handling of AuthorizedPrincipalsFile=none more -+ consistent with other =none options; bz#2288 from Jakub Jelen; ok dtucker@ -+ -+commit 61ea2d11e1147be015aef9364228da57e4966e49 -+Author: djm@openbsd.org -+Date: Fri May 1 04:03:20 2015 +0000 -+ -+ upstream commit -+ -+ remove failed remote forwards established by muliplexing -+ from the list of active forwards; bz#2363, patch mostly by Yoann Ricordel; ok -+ dtucker@ -+ -+commit ea811c772e44f42d318fa4cd4dce4bbd6b60f349 -+Author: djm@openbsd.org -+Date: Fri May 1 04:01:58 2015 +0000 -+ -+ upstream commit -+ -+ reduce stderr spam when using ssh -S /path/mux -O forward -+ -R 0:... ok dtucker@ -+ -+commit 592e659ab55945bcb04e84aa87536811c9acfd24 -+Author: djm@openbsd.org -+Date: Fri May 1 03:20:54 2015 +0000 -+ -+ upstream commit -+ -+ Don't make parsing of authorized_keys' environment= -+ option conditional on PermitUserEnv - always parse it, but only use the -+ result if the option is enabled. This prevents the syntax of authorized_keys -+ changing depending on which sshd_config options were enabled. -+ -+ bz#2329; based on patch from coladict AT gmail.com, ok dtucker@ -+ -+commit fe36599473766d2e7f6f13ec4ee31b26c95bff4d -+Author: djm@openbsd.org -+Date: Mon May 4 06:10:48 2015 +0000 -+ -+ upstream commit -+ -+ Remove pattern length argument from match_pattern_list(), we -+ only ever use it for strlen(pattern). -+ -+ Prompted by hanno AT hboeck.de pointing an out-of-bound read -+ error caused by an incorrect pattern length found using AFL -+ and his own tools. -+ -+ ok markus@ -+ -+commit 1138794f3379f5ac78078b74c716ca3ac12b1011 -+Author: dtucker@openbsd.org -+Date: Thu Apr 23 05:01:19 2015 +0000 -+ -+ upstream commit -+ -+ Add a simple regression test for sshd's configuration -+ parser. Right now, all it does is run the output of sshd -T back through -+ itself and ensure the output is valid and invariant. -+ -+commit 9ba083796c2b7c7c2b47363e17f07feb06103a3a -+Author: djm@openbsd.org -+Date: Wed Apr 22 01:38:36 2015 +0000 -+ -+ upstream commit -+ -+ use correct key for nested certificate test -+ -+commit bb3b8dd2dc37151e94fcf80fd48c6c989031c2d7 -+Author: djm@openbsd.org -+Date: Fri May 1 07:11:47 2015 +0000 -+ -+ upstream commit -+ -+ mention that the user's shell from /etc/passwd is used -+ for commands too; bz#1459 ok dtucker@ -+ -+commit 7f743806fd9e201996a0e6b26ab87affa2f22243 -+Author: djm@openbsd.org -+Date: Fri May 8 06:45:13 2015 +0000 -+ -+ upstream commit -+ -+ moar whitespace at eol -+ -+ Upstream-ID: 64eaf872a3ba52ed41e494287e80d40aaba4b515 -+ -+commit de0bf1840f29aac184f915233bc2fda6e7623780 -+Author: djm@openbsd.org -+Date: Fri May 8 03:56:51 2015 +0000 -+ -+ upstream commit -+ -+ whitespace at EOL -+ -+commit 9d767f9e02c47425e595aaf1b722eb6fa115838a -+Author: dtucker@openbsd.org -+Date: Mon May 4 01:47:53 2015 +0000 -+ -+ upstream commit -+ -+ Use diff w/out -u for better portability -+ -+commit 347fa9069962e879e83c58b3804b3a45ed47f58d -+Author: dtucker@openbsd.org -+Date: Fri May 8 03:25:07 2015 +0000 -+ -+ upstream commit -+ -+ Use xcalloc for permitted_adm_opens instead of xmalloc to -+ ensure it's zeroed. Fixes post-auth crash with permitopen=none. bz#2355, ok -+ djm@ -+ -+commit 1bbe9a4f30764de0eeb853baace78f812f853d39 -+Author: djm@openbsd.org -+Date: Fri May 8 03:17:49 2015 +0000 -+ -+ upstream commit -+ -+ don't choke on new-format private keys encrypted with an -+ AEAD cipher; bz#2366, patch from Ron Frederick; ok markus@ -+ -+commit 2eddaa2ed9bf22c39ec7244e2114defd9fc539d1 -+Author: dtucker@openbsd.org -+Date: Wed May 6 05:45:17 2015 +0000 -+ -+ upstream commit -+ -+ Clarify pseudo-terminal request behaviour and use -+ "pseudo-terminal" consistently. bz#1716, ok jmc@ "I like it" deraadt@. -+ -+commit 67d450ef4fe575c2f58c3ff4a472cd856d83da87 -+Author: dtucker@openbsd.org -+Date: Wed May 6 04:07:18 2015 +0000 -+ -+ upstream commit -+ -+ Blacklist DH-GEX for specific PuTTY versions known to -+ send non-RFC4419 DH-GEX messages rather than all versions of PuTTY. -+ According to Simon Tatham, 0.65 and newer versions will send RFC4419 DH-GEX -+ messages. ok djm@ -+ -+commit 14cfd47dda60ffc72a565427a253c890222885df -+Author: dtucker@openbsd.org -+Date: Tue May 5 10:17:49 2015 +0000 -+ -+ upstream commit -+ -+ WinSCP doesn't implement RFC4419 DH-GEX so flag it so we -+ don't offer that KEX method. ok markus@ -+ -+commit 0529fe42ece858e9777c1fa4bedb7a47aaaad1ee -+Author: dtucker@openbsd.org -+Date: Wed Apr 29 03:48:56 2015 +0000 -+ -+ upstream commit -+ -+ Allow ListenAddress, Port and AddressFamily in any -+ order. bz#68, ok djm@, jmc@ (for the man page bit). -+ -+commit 8e23c30ca4bbcc9f9494839db16961dfc83db120 -+Author: jmc@openbsd.org -+Date: Tue Apr 28 13:47:38 2015 +0000 -+ -+ upstream commit -+ -+ enviroment -> environment: apologies to darren for not -+ spotting that first time round... -+ -+commit 9f9d89b9b6dcc1ca8b58b2b6e01b7bbb8155f04c -+Author: dtucker@openbsd.org -+Date: Tue Apr 28 10:25:15 2015 +0000 -+ -+ upstream commit -+ -+ Fix typo in previous -+ -+commit 63b48e243e9da04a43ad8ccdb45dab2184f48d8a -+Author: dtucker@openbsd.org -+Date: Tue Apr 28 10:17:58 2015 +0000 -+ -+ upstream commit -+ -+ Document that the TERM environment variable is not -+ subject to SendEnv and AcceptEnv. bz#2386, based loosely on a patch from -+ jjelen at redhat, help and ok jmc@ -+ -+commit ad9985001ebd26d6e3a04fd49d3532db8f46bb33 -+Author: djm@openbsd.org -+Date: Mon Apr 27 21:42:48 2015 +0000 -+ -+ upstream commit -+ -+ Make sshd default to PermitRootLogin=no; ok deraadt@ -+ rpe@ -+ -+commit ccc951044d4d1e8b205ce6c5fbd90a7bc2221dcc -+Author: djm@openbsd.org -+Date: Mon Apr 27 01:52:30 2015 +0000 -+ -+ upstream commit -+ -+ fix compilation with OPENSSL=no; ok dtucker@ -+ -+commit b8149329a8e7ea08fbe4fc85509c87681e7748da -+Author: djm@openbsd.org -+Date: Mon Apr 27 00:21:21 2015 +0000 -+ -+ upstream commit -+ -+ allow "sshd -f none" to skip reading the config file, -+ much like "ssh -F none" does. ok dtucker -+ -+commit 6c6636bf778463add6b2efd8fb190914d1eba24c -+Author: jmc@openbsd.org -+Date: Fri Apr 24 06:26:49 2015 +0000 -+ -+ upstream commit -+ -+ combine -Dd onto one line and update usage(); -+ -+commit ee3ba32d8be37a16c57ee48771ba49f13f00b868 -+Author: djm@openbsd.org -+Date: Fri Apr 24 05:26:44 2015 +0000 -+ -+ upstream commit -+ -+ add ssh-agent -D to leave ssh-agent in foreground -+ without enabling debug mode; bz#2381 ok dtucker@ -+ -+commit a88b87bfd8031ddf951915989877b924a42fae96 -+Author: deraadt@openbsd.org -+Date: Fri Apr 24 01:36:00 2015 +0000 -+ -+ upstream commit -+ -+ rename xrealloc() to xreallocarray() since it follows -+ that form. ok djm -+ -+commit 98769ca49ed45f050359df15b41e2da393f2fff9 -+Author: dtucker@openbsd.org -+Date: Thu Apr 23 04:59:10 2015 +0000 -+ -+ upstream commit -+ -+ Two small fixes for sshd -T: ListenAddress'es are added -+ to a list head so reverse the order when printing them to ensure the -+ behaviour remains the same, and print StreamLocalBindMask as octal with -+ leading zero. ok deraadt@ -+ -+commit 74599895d69d1aee08c56052f8400c7dbe783b6c -+Author: dtucker@openbsd.org -+Date: Thu Apr 23 04:53:53 2015 +0000 -+ -+ upstream commit -+ -+ Check for and reject missing arguments for -+ VersionAddendum and ForceCommand. bz#2281, patch from plautrba at redhat com, -+ ok djm@ -+ -+commit 481d86a1ae73c61391deb514ce241cf257ce9476 -+Author: djm@openbsd.org -+Date: Wed Apr 22 01:24:01 2015 +0000 -+ -+ upstream commit -+ -+ unknown certificate extensions are non-fatal, so don't -+ fatal when they are encountered; bz#2387 reported by Bob Van Zant; ok -+ dtucker@ -+ -+commit 01b280e8f89366fdc2626bbb4bae0fb2eec8e9d1 -+Author: jsg@openbsd.org -+Date: Tue Apr 21 07:01:00 2015 +0000 -+ -+ upstream commit -+ -+ Add back a backslash removed in rev 1.42 so -+ KEX_SERVER_ENCRYPT will include aes again. -+ -+ ok deraadt@ -+ -+commit 17fcb9f212fe391866738efc4452bdb5869e3741 -+Author: djm@openbsd.org -+Date: Fri Apr 17 13:32:09 2015 +0000 -+ -+ upstream commit -+ -+ s/recommended/required/ that private keys be og-r this -+ wording change was made a while ago but got accidentally reverted -+ -+commit 1af3ba4ac5b38d17bd6b9dba0c9d5a0fdd7dab42 -+Author: djm@openbsd.org -+Date: Fri Apr 17 13:25:52 2015 +0000 -+ -+ upstream commit -+ -+ don't try to cleanup NULL KEX proposals in -+ kex_prop_free(); found by Jukka Taimisto and Markus Hietava -+ -+commit e8fefc79f623b4681335496a37b265c32696d913 -+Author: djm@openbsd.org -+Date: Fri Apr 17 13:19:22 2015 +0000 -+ -+ upstream commit -+ -+ use error/logit/fatal instead of fprintf(stderr, ...) -+ and exit(0), fix a few errors that were being printed to stdout instead of -+ stderr and a few non-errors that were going to stderr instead of stdout -+ bz#2325; ok dtucker -+ -+commit 64644b58cc42773a77f9f4e7cb0cd686c22e97f4 -+Author: djm@openbsd.org -+Date: Fri Apr 17 13:16:48 2015 +0000 -+ -+ upstream commit -+ -+ debug log missing DISPLAY environment when X11 -+ forwarding requested; bz#1682 ok dtucker@ -+ -+commit 7fb1123c06c4fd19bd1e701c7b2c558088f2a3c3 -+Author: djm@openbsd.org -+Date: Fri Apr 17 04:32:31 2015 +0000 -+ -+ upstream commit -+ -+ don't call record_login() in monitor when UseLogin is -+ enabled; bz#278 reported by drk AT sgi.com; ok dtucker -+ -+commit de3aa0aba886d1e7dc32cc6456a5718c6d6ddb5c -+Author: dtucker@openbsd.org -+Date: Fri Apr 17 04:12:35 2015 +0000 -+ -+ upstream commit -+ -+ Add some missing options to sshd -T and fix the output -+ of VersionAddendum HostCertificate. bz#2346, patch from jjelen at redhat -+ com, ok djm. -+ -+commit ef207884d7ac0ca46ce47e806240cd9353dada9d -+Author: dtucker@openbsd.org -+Date: Thu Apr 16 23:25:50 2015 +0000 -+ -+ upstream commit -+ -+ Document "none" for PidFile XAuthLocation -+ TrustedUserCAKeys and RevokedKeys. bz#2382, feedback from jmc@, ok djm@ -+ -+commit cf9a482947d78847369c06db37b0e2322a850615 -+Author: dtucker@openbsd.org -+Date: Wed Apr 15 23:23:25 2015 +0000 -+ -+ upstream commit -+ -+ Plug leak of address passed to logging. bz#2373, patch -+ from jjelen at redhat, ok markus@ -+ -+commit e008e32a49ca9305fe5d1be6e91e92b4c0ae95c5 -+Author: dtucker@openbsd.org -+Date: Tue Apr 14 04:17:03 2015 +0000 -+ -+ upstream commit -+ -+ Output remote username in debug output since with Host -+ and Match it's not always obvious what it will be. bz#2368, ok djm@ -+ -+commit 51aaf9f2becfd428d944324267aae8c0d13aa1b7 -+Author: djm@openbsd.org -+Date: Mon Apr 13 02:04:08 2015 +0000 -+ -+ upstream commit -+ -+ deprecate ancient, pre-RFC4419 and undocumented -+ SSH2_MSG_KEX_DH_GEX_REQUEST_OLD message; ok markus@ deraadt@ "seems -+ reasonable" dtucker@ -+ -+commit 06e12caedd047eb3b09dd76bfe95e3bf2aac441d -+Author: dtucker@openbsd.org -+Date: Fri Apr 10 05:16:50 2015 +0000 -+ -+ upstream commit -+ -+ Don't send hostkey advertisments -+ (hostkeys-00@openssh.com) to current versions of Tera Term as they can't -+ handle them. Newer versions should be OK. Patch from Bryan Drewery and -+ IWAMOTO Kouichi, ok djm@ -+ -+commit 9755399996a85fe9e1c4f4f9b00d66ebf82e8037 -+Author: djm@openbsd.org -+Date: Fri Apr 10 00:08:55 2015 +0000 -+ -+ upstream commit -+ -+ include port number if a non-default one has been -+ specified; based on patch from Michael Handler -+ -+commit 248872741ae758a21df93cee736e09fa41b14b03 -+Author: djm@openbsd.org -+Date: Tue Apr 7 23:00:42 2015 +0000 -+ -+ upstream commit -+ -+ treat Protocol=1,2|2,1 as Protocol=2 when compiled -+ without SSH1 support; ok dtucker@ millert@ -+ -+commit 0b7c73dc738664e69bbe53ebf296428c46d4b459 -+Author: miod@openbsd.org -+Date: Sun Apr 5 15:43:43 2015 +0000 -+ -+ upstream commit -+ -+ Do not use int for sig_atomic_t; spotted by -+ christos@netbsd; ok markus@ -+ -+commit 9cebfad82c928a6b0841c329e528956541a2df32 -+Author: djm@openbsd.org -+Date: Fri Apr 3 22:17:27 2015 +0000 -+ -+ upstream commit -+ -+ correct return value in pubkey parsing, spotted by Ben Hawkes -+ ok markus@ -+ -+commit 94bfef5540cc8cf6bda40ddbe991860e5dddf15a -+Author: markus@openbsd.org -+Date: Tue Mar 24 20:19:15 2015 +0000 -+ -+ upstream commit -+ -+ use ${SSH} for -Q instead of installed ssh -+ -+commit dcd5b5c33ae91850f74d1541f4545e2831321f04 -+Author: djm@openbsd.org -+Date: Mon Mar 16 22:46:14 2015 +0000 -+ -+ upstream commit -+ -+ make CLEANFILES clean up more of the tests' droppings -+ -+commit 7b0cf28b0abd38fbc90daafd106691b1d1c7f889 -+Author: djm@openbsd.org -+Date: Tue Mar 31 22:57:06 2015 +0000 -+ -+ upstream commit -+ -+ downgrade error() for known_hosts parse errors to debug() -+ to quiet warnings from ssh1 keys present when compiled !ssh1. -+ -+ also identify ssh1 keys when scanning, even when compiled !ssh1 -+ -+ ok markus@ miod@ -+ -+commit 2184f7b0191ab507556f2ecd4ac70bedad01762e -+Author: djm@openbsd.org -+Date: Tue Mar 31 22:55:50 2015 +0000 -+ -+ upstream commit -+ -+ fd leak for !ssh1 case; found by unittests; ok markus@ -+ -+commit 83be2a213559a2955067001c8d1494e65dad60cb -+Author: djm@openbsd.org -+Date: Tue Mar 31 22:55:24 2015 +0000 -+ -+ upstream commit -+ -+ don't fatal when a !ssh1 sshd is reexeced from a w/ssh1 -+ listener; reported by miod@; ok miod@ markus@ -+ -+commit 7490c15e15e8831e51bd5b2fe74e070d0fb0ace4 -+Author: tobias@openbsd.org -+Date: Tue Mar 31 11:06:49 2015 +0000 -+ -+ upstream commit -+ -+ Comments are only supported for RSA1 keys. If a user -+ tried to add one and entered his passphrase, explicitly clear it before exit. -+ This is done in all other error paths, too. -+ -+ ok djm -+ -+commit 991d96a8b7a6f10a0220dad4f3ebedc12e94d152 -+Author: jmc@openbsd.org -+Date: Mon Mar 30 18:28:37 2015 +0000 -+ -+ upstream commit -+ -+ ssh-askpass(1) is the default, overridden by SSH_ASKPASS; -+ diff originally from jiri b; -+ -+commit a0d1ed440800c99cb5e3ae70c25c248ce533c24b -+Author: djm@openbsd.org -+Date: Mon Mar 30 00:00:29 2015 +0000 -+ -+ upstream commit -+ -+ fix uninitialised memory read when parsing a config file -+ consisting of a single nul byte. Found by hanno AT hboeck.de using AFL; ok -+ dtucker -+ -+commit 8585a6d5c82cc49ec82598a47dd49b4a87e4e07c -+Author: markus@openbsd.org -+Date: Thu Mar 26 19:32:19 2015 +0000 -+ -+ upstream commit -+ -+ sigp and lenp are not optional in ssh_agent_sign(); ok -+ djm@ -+ -+commit 31b677d6dfdc1cf32eb34d4de0eb570aadaefdfb -+Author: naddy@openbsd.org -+Date: Thu Mar 26 12:32:38 2015 +0000 -+ -+ upstream commit -+ -+ don't try to load .ssh/identity by default if SSH1 is -+ disabled; ok markus@ -+ -+commit a790b6d5e1d644b51141b1c0a849ff6eb352a953 -+Author: djm@openbsd.org -+Date: Thu Mar 26 06:59:28 2015 +0000 -+ -+ upstream commit -+ -+ relax bits needed check to allow -+ diffie-hellman-group1-sha1 key exchange to complete for chacha20-poly1305 was -+ selected as symmetric cipher; ok markus -+ -+commit 3320c0e6f8c0e41f04dd638e84da93b746816abd -+Author: markus@openbsd.org -+Date: Wed Mar 25 19:29:58 2015 +0000 -+ -+ upstream commit -+ -+ ignore v1 errors on ssh-add -D; only try v2 keys on -+ -l/-L (unless WITH_SSH1) ok djm@ -+ -+commit d2787fbe03141728211f2ae2d549b62ec7753021 -+Author: markus@openbsd.org -+Date: Wed Mar 25 19:21:48 2015 +0000 -+ -+ upstream commit -+ -+ unbreak ssh_agent_sign (lenp vs *lenp) -+ -+commit ec4e71064831e4a2a81dc16d85905475ba6fe6f1 -+Author: markus@openbsd.org -+Date: Tue Mar 24 20:10:08 2015 +0000 -+ -+ upstream commit -+ -+ don't leak 'setp' on error; noted by Nicholas Lemonias; -+ ok djm@ -+ -+commit e2ec0fc608e3121d6d4571c178a648dbb1c677a3 -+Author: markus@openbsd.org -+Date: Tue Mar 24 20:09:11 2015 +0000 -+ -+ upstream commit -+ -+ consistent check for NULL as noted by Nicholas -+ Lemonias; ok djm@ -+ -+commit e9813792f9e7d0ee152ac5600ffd7f46a4466a27 -+Author: markus@openbsd.org -+Date: Tue Mar 24 20:03:44 2015 +0000 -+ -+ upstream commit -+ -+ correct fmt-string for size_t as noted by Nicholas -+ Lemonias; ok djm@ -+ -+commit 6fed141fe59bd541c46c0143232a58bab160f5e7 -+Author: djm@openbsd.org -+Date: Tue Mar 24 09:17:21 2015 +0000 -+ -+ upstream commit -+ -+ promote chacha20-poly1305@openssh.com to be the default -+ cipher; ok markus -+ -+commit f9ebc499fe878e3d7c3566419e8bcdc950702709 -+Author: djm@openbsd.org -+Date: Tue Mar 24 01:29:19 2015 +0000 -+ -+ upstream commit -+ -+ Compile-time disable SSH protocol 1. You can turn it -+ back on using the Makefile.inc knob if you need it to talk to ancient -+ devices. -+ -+commit d7010affedb2da1989969f5bb36dc37937c0ee41 -+Author: djm@openbsd.org -+Date: Tue Mar 24 01:11:12 2015 +0000 -+ -+ upstream commit -+ -+ fix double-negative error message "ssh1 is not -+ unsupported" -+ -+commit 3131c636569e127669b6d76fa90ae3c187efcd04 -+Author: djm@openbsd.org -+Date: Mon Mar 23 06:06:38 2015 +0000 -+ -+ upstream commit -+ -+ for ssh-keygen -A, don't try (and fail) to generate ssh -+ v.1 keys when compiled without SSH1 support RSA/DSA/ECDSA keys when compiled -+ without OpenSSL based on patch by Mike Frysinger; bz#2369 -+ -+commit 517507ce020c0015e01e6060e143b4aa7ffc217c -+Author: djm@openbsd.org -+Date: Wed Mar 18 01:44:21 2015 +0000 -+ -+ upstream commit -+ -+ KRL support doesn't need OpenSSL anymore, remove #ifdefs -+ from around call -+ -+commit 194ad0415d5ebb66bcdf036dff5a7de382690069 -+Author: jsg@openbsd.org -+Date: Wed Mar 11 00:48:39 2015 +0000 -+ -+ upstream commit -+ -+ add back the changes from rev 1.206, djm reverted this by -+ mistake in rev 1.207 -+ -+commit d8b4bda9aba1129f5a248c54c25b8ec3544303c9 -+Author: Mike Frysinger -+Date: Thu Jan 14 14:01:21 2016 -0500 -+ -+ fix misc style issues in hpn code -+ -+commit 6ede5445be78352eb47beedcb5d18387ca8fe86f -+Author: Damien Miller -+Date: Thu Jan 14 11:08:19 2016 +1100 -+ -+ bump version numbers -+ -+commit 34f9411f83a9fec3b316d109db3ce19d5c45c1f3 -+Author: Damien Miller -+Date: Thu Jan 14 11:04:04 2016 +1100 -+ -+ openssh-7.1p2 -+ -+commit 8c9f96fe24962c973e69267d191398f6a54aac7c -+Author: Damien Miller -+Date: Thu Jan 14 11:02:58 2016 +1100 -+ -+ forcibly disable roaming support in the client -+ -+commit 5adb66c550c27c60556326caabca6b572020c416 -+Author: djm@openbsd.org -+Date: Mon Oct 5 17:11:21 2015 +0000 -+ -+ upstream commit -+ -+ some more bzero->explicit_bzero, from Michael McConville -+ -+ Upstream-ID: 17f19545685c33327db2efdc357c1c9225ff00d0 -+ -+commit e513833f25bfd4c5dd01d9bf25070fb6a66f5c01 -+Author: guenther@openbsd.org -+Date: Fri Sep 11 08:50:04 2015 +0000 -+ -+ upstream commit -+ -+ Use explicit_bzero() when zeroing before free() -+ -+ from Michael McConville (mmcconv1 (at) sccs.swarthmore.edu) -+ ok millert@ djm@ -+ -+ Upstream-ID: 2e3337db046c3fe70c7369ee31515ac73ec00f50 -+ -+commit f2bebd944568ae0cc3397fce553e7ed23cd77f31 -+Author: djm@openbsd.org -+Date: Sun Nov 8 21:59:11 2015 +0000 -+ -+ upstream commit -+ -+ fix OOB read in packet code caused by missing return -+ statement found by Ben Hawkes; ok markus@ deraadt@ -+ -+ Upstream-ID: a3e3a85434ebfa0690d4879091959591f30efc62 -+ -+commit de29e0c6459d2fbb363b6dd18f5455823dfa5de3 -+Author: Damien Miller -+Date: Sat Nov 14 18:44:49 2015 +1100 -+ -+ read back from libcrypto RAND when privdropping -+ -+ makes certain libcrypto implementations cache a /dev/urandom fd -+ in preparation of sandboxing. Based on patch by Greg Hartman. -+ -+commit 0a31260e560fe0407f3dd1213321af1bf1b20a81 -+Author: djm@openbsd.org -+Date: Sun Dec 13 22:42:23 2015 +0000 -+ -+ upstream commit -+ -+ unbreak connections with peers that set -+ first_kex_follows; fix from Matt Johnston va bz#2515 -+ -+ Upstream-ID: decc88ec4fc7515594fdb42b04aa03189a44184b -+ -+commit 8ab7905664e6cdc1d447a32258e0a2f86f68bcf8 -+Author: djm@openbsd.org -+Date: Tue Jan 12 23:42:54 2016 +0000 -+ -+ upstream commit -+ -+ use explicit_bzero() more liberally in the buffer code; ok -+ deraadt -+ -+ Upstream-ID: 0ece37069fd66bc6e4f55eb1321f93df372b65bf -+ -+commit 5b0873ac39ec4ef3925f970215b76d35b6f92fc4 -+Author: scott campbell -+Date: Mon Jan 11 15:03:05 2016 -0500 -+ -+ fix type error -+ -+ char is not u_char -+ char is not u_char -+ char is not u_char -+ char is not u_char -+ -+commit fee8282a8b348982d636e639b5eda8a84061a102 -+Author: scott campbell -+Date: Mon Jan 11 14:27:25 2016 -0500 -+ -+ option for runtime disable for issued logging -+ -+ If —enable-nercmod is set at configure time, it still will be possible -+ to disable the logging of information by setting AuditDisabled to yes -+ in ssh_config -+ -+ Default value is on to preserve backwards compatibility. -+ -+commit a92ef913a2f2a85a51b372a12a79e51fd14254a6 -+Author: Chris Rapier -+Date: Thu Dec 17 17:51:22 2015 -0500 -+ -+ A funding appeal was added to the README. -+ -+commit 444c54e80b9e9cd6cbf970757959f5345b18d78f -+Author: rapier -+Date: Thu Nov 12 16:46:33 2015 -0500 -+ -+ remove KEX_ENCRYPT_INCLUDE_NONE define from myproposal.h -+ -+commit 5ed26892dbba8a24b05cf01e500139cf757afb69 -+Author: rapier -+Date: Thu Nov 12 16:20:37 2015 -0500 -+ -+ Modified none cipher behaviour in sshd.c to match suggestioon from bdrewery - cf https://github.com/rapier1/openssh-portable/issues/3 -+ -+commit f3abafdff684134619613a937bea27187f004c3a -+Author: rapier -+Date: Tue Nov 10 14:09:30 2015 -0500 -+ -+ Fixed problem with None cipher not being advertised by server -+ -+commit 9b1260fa948ae009f74f2facb244c33c844688b9 -+Author: rapier -+Date: Thu Oct 29 14:35:44 2015 -0400 -+ -+ Trying to open up the maximum size of the buffer to 256MB. This is to support 40 and 100Gb paths -+ -+commit ab45fa825460281c1cdc3055e08ce0124f45398c -+Author: Mike Frysinger -+Date: Thu Oct 29 01:30:08 2015 -0400 -+ -+ initialize hpn buffers sooner in the client -+ -+ When using the -w option to create a tunnel via tun devices, the client -+ sets up a window with a negative length. With 6.8+ servers, the channel -+ will be killed on the fly when the negative window is detected (see the -+ commit "fatal() when a remote window update causes the window"). With -+ older versions, the server ends up using negative windows and who knows -+ what happens next. -+ -+ Pull the hpn option logic up earlier in the ssh connection so that it -+ runs before we try to create any forwarding channels. -+ -+ You can reproduce by running the server in debug mode and having the -+ client connect like so: -+ sudo ssh -w 1:2 user@server -+ The server will log a line like: -+ debug1: server_input_channel_open: ctype tun@openssh.com rchan 0 win -1 max 32768 -+ That -1 is the window size and things go wrong from there. -+ -+ URL: https://bugs.gentoo.org/564236 -+ Reported-by: Daniel Heule -+ -+commit fcf0486da151d022fcd301cf8a65a486ba72951c -+Author: Mike Frysinger -+Date: Thu Oct 29 01:28:19 2015 -0400 -+ -+ pull the hpn init code out into a dedicated func -+ -+ This makes it more obvious what is hpn-specific and makes it easier -+ to manage the logic. -+ -+commit 3128ecb67fbae4796c86bbcfea7c6a97f9a2e485 -+Author: Mike Frysinger -+Date: Thu Oct 29 01:21:46 2015 -0400 -+ -+ clean up socket code a bit during hpn option init -+ -+ A few tweaks to improve the code to make it easier to manage: -+ - localize the vars in the scope they're actually used -+ - change socksizelen to socklen_t to match {g,s}etsockopt prototypes -+ - fix call to setsockopt to actually pass in the socklen_t -+ -+commit 47c17ffbbb3198140c1add9ed2b04aa7f5c3a061 -+Author: rapier -+Date: Tue Oct 20 15:31:55 2015 -0400 -+ -+ Forgot to update version -+ -+commit e17cfe850c5a508edc379adc3aba39183102dfb6 -+Author: scott campbell -+Date: Mon Sep 14 20:39:00 2015 -0400 -+ -+ complete fix for kex -+ -+ In working through the ‘make tests’, another issue re comp.name arose. -+ This change just assumes that any member of the mess can cause a -+ pathological state so test them all … -+ -+commit f91fc7e1601e1e9e3c1c8c0057328f0ca66b9b9e -+Author: scott campbell -+Date: Fri Sep 11 20:19:15 2015 -0400 -+ -+ Fix segfault due to invoking strlen() on NULL string. -+ -+ See: -+ https://github.com/set-element/openssh-hpn-isshd/commit/805f39d13ac5de98 -+ 00b56f4ddcc27c3f40cf671a -+ -+ I make the bugs and mej fixes them … -+ -+commit d0e545837bce5f7aca0894f3d2ea2a78514ab338 -+Author: scott campbell -+Date: Wed Jul 22 17:50:51 2015 +0200 -+ -+ fix typo -+ -+ need to have SSH_HPN in the version -+ -+commit db373ea945544478751832c5d851a7641a848ae0 -+Author: scott campbell -+Date: Tue Jul 21 23:46:29 2015 +0200 -+ -+ bump version -+ -+commit 9562e410b624a19dc5367fbff551f7d0cee0a398 -+Author: scott campbell -+Date: Tue Jul 21 23:43:58 2015 +0200 -+ -+ add nersc mod -+ -+commit 5fe1a0b93cad3517fb39dbb907df7e8d3c48d108 -+Author: scott campbell -+Date: Mon May 25 10:14:15 2015 -0400 -+ -+ fixing fixing ... -+ -+commit 524020a3a141d6402e2e5c3d16cf4ffeb8a6c96f -+Author: scott campbell -+Date: Mon May 25 08:38:51 2015 -0400 -+ -+ add key exchange event -+ -+commit 812ae952dc265d2e381d09b9ba7b8b19657f6271 -+Author: scott campbell -+Date: Sun May 24 21:42:47 2015 -0400 -+ -+ fix typo -+ -+commit d168cd302eeafa6057848e290fe9294bd4bc95fe -+Author: scott campbell -+Date: Wed May 20 00:07:22 2015 -0400 -+ -+ add modp_burl.o to makefile -+ -+commit a8b9a761fe213eccacdd2200cefd3bcd4caaca83 -+Author: scott campbell -+Date: Mon May 18 22:20:25 2015 -0400 -+ -+ checkin nersc mods -+ -+commit 3842d60219e2217fad8602e5d2cc1c2c87f29063 -+Author: scott campbell -+Date: Mon May 18 22:17:58 2015 -0400 -+ -+ nersc changes -+ -+commit f057c67d1f233384581a7329e6078dfc8e6b8919 -+Author: scott campbell -+Date: Mon May 18 22:15:52 2015 -0400 -+ -+ initial nersc checkin -+ -+commit 6916c3304d3faa49905e703cd1f78153d6e13bfb -+Author: scott campbell -+Date: Mon May 18 21:46:31 2015 -0400 -+ -+ initial nersc changes -+ -+commit b9993648788b32f9a4704efedf0d935ac2e5ac76 -+Author: scott campbell -+Date: Mon May 18 21:34:16 2015 -0400 -+ -+ add nersc changes -+ -+commit 7f0dc826c7eeed01fa9d0e4adc2c5e9ab654e0ec -+Author: scott campbell -+Date: Mon May 18 21:29:30 2015 -0400 -+ -+ initial install -+ -+commit 32c8c5a5bbded52f1bfe4269191b73e5c116ddef -+Author: scott campbell -+Date: Mon May 18 21:29:09 2015 -0400 -+ -+ code checkin -+ -+ This is for the uriencoding -+ -+commit b4c57cc9b2e23438668b2c66751c8eb90f226471 -+Author: scott campbell -+Date: Mon May 18 21:27:32 2015 -0400 -+ -+ initial nersc checkin -+ -+commit 984d37a3f61fbd63bc9a9fed2fa5e3c5dcf3ed28 -+Author: scott campbell -+Date: Mon May 18 21:26:02 2015 -0400 -+ -+ initial nersc checkin -+ -+commit de6424697df4bb6ccdce550423c098d2abca8a3f -+Author: scott campbell -+Date: Mon May 18 21:01:40 2015 -0400 -+ -+ add nersc changes -+ -+commit 27d2db1328ae1f7adbb12e0af74a4abc875cbe78 -+Author: scott campbell -+Date: Mon May 18 20:50:57 2015 -0400 -+ -+ add nersc mods -+ -+commit fe5118a300267f772e5f85b0d77829a24873952a -+Author: scott campbell -+Date: Mon May 18 20:49:18 2015 -0400 -+ -+ insert nersc mods -+ -+commit a5a000b91ac7bfd0b01a3e46874da3547f6dd65a -+Author: scott campbell -+Date: Mon May 18 20:45:09 2015 -0400 -+ -+ add nersc changes -+ -+commit faec801814c2fd2d9c1d70d3517298b1cc262173 -+Author: scott campbell -+Date: Mon May 18 20:38:06 2015 -0400 -+ -+ insert nersc mods -+ -+commit 910b068bc78e17f03ec5ad0f4513f4f8a3a4f61e -+Author: scott campbell -+Date: Mon May 18 20:34:22 2015 -0400 -+ -+ put in nersc mods -+ -+commit 328e6e47d3fcd4bc02a48aeacb304c4c50c7fb05 -+Author: scott campbell -+Date: Mon May 18 20:25:24 2015 -0400 -+ -+ add nersc reference -+ -+commit f79fa41d628fb803dc3825a40c0fbab94c21451e -+Author: Mike Frysinger -+Date: Fri Aug 21 10:13:36 2015 -0400 -+ -+ clean up style a bit in hpn ssh code -+ -+commit d2757c01fb5eda24fd9c37fc63ab7405fe50f9cc -+Author: Damien Miller -+Date: Fri Aug 21 14:49:03 2015 +1000 -+ -+ we don't use Github for issues/pull-requests -+ -+commit fe0d132446ef5d92a7f0fa85268be0371def541a -+Author: Damien Miller -+Date: Fri Aug 21 14:43:55 2015 +1000 -+ -+ fix URL for connect.c -+ -+commit 8ce4f73e1ab17b6592b274b24244280ca6968467 -+Author: Damien Miller -+Date: Fri Aug 21 13:47:10 2015 +1000 -+ -+ update version numbers for 7.1 -+ -+commit fcb7097c6739bc411afdd240c17671f8df940e7c -+Author: djm@openbsd.org -+Date: Fri Aug 21 03:45:26 2015 +0000 -+ -+ upstream commit -+ -+ openssh-7.1 -+ -+ Upstream-ID: ff7b1ef4b06caddfb45e08ba998128c88be3d73f -+ -+commit b087fa7839470a650bdd519a0e6f6da9f767e3ae -+Author: djm@openbsd.org -+Date: Fri Aug 21 03:42:19 2015 +0000 -+ -+ upstream commit -+ -+ fix inverted logic that broke PermitRootLogin; reported -+ by Mantas Mikulenas; ok markus@ -+ -+ Upstream-ID: 260dd6a904c1bb7e43267e394b1c9cf70bdd5ea5 -+ -+commit 8b5858e31d34d1f86adcb6f159804514d241b2c2 -+Author: deraadt@openbsd.org -+Date: Thu Aug 20 22:32:42 2015 +0000 -+ -+ upstream commit -+ -+ Do not cast result of malloc/calloc/realloc* if stdlib.h -+ is in scope ok krw millert -+ -+ Upstream-ID: 5e50ded78cadf3841556649a16cc4b1cb6c58667 -+ -+commit fa873850329318a8e5c6fbd3665fe995c72e3cbf -+Author: naddy@openbsd.org -+Date: Thu Aug 20 19:20:06 2015 +0000 -+ -+ upstream commit -+ -+ In the certificates section, be consistent about using -+ "host_key" and "user_key" for the respective key types. ok sthen@ deraadt@ -+ -+ Upstream-ID: 9e037ea3b15577b238604c5533e082a3947f13cb -+ -+commit 4c03a21c271d70ba01e7fbfd651d887749c6ec2e -+Author: djm@openbsd.org -+Date: Wed Aug 19 23:21:42 2015 +0000 -+ -+ upstream commit -+ -+ Better compat matching for WinSCP, add compat matching -+ for FuTTY (fork of PuTTY); ok markus@ deraadt@ -+ -+ Upstream-ID: 24001d1ac115fa3260fbdc329a4b9aeb283c5389 -+ -+commit 3478b78e82dc8c0fccf43be0ad4c16d0275a5603 -+Author: djm@openbsd.org -+Date: Wed Aug 19 23:19:01 2015 +0000 -+ -+ upstream commit -+ -+ fix double-free() in error path of DSA key generation -+ reported by Mateusz Kocielski; ok markus@ -+ -+ Upstream-ID: 4735d8f888b10599a935fa1b374787089116713c -+ -+commit 2c890876980eddbb923b4cc9998e0b7f9a39995f -+Author: djm@openbsd.org -+Date: Wed Aug 19 23:18:26 2015 +0000 -+ -+ upstream commit -+ -+ fix free() of uninitialised pointer reported by Mateusz -+ Kocielski; ok markus@ -+ -+ Upstream-ID: 519552b050618501a06b7b023de5cb104e2c5663 -+ -+commit 15d1580849881560e8d45c51e442e4b1a983c293 -+Author: djm@openbsd.org -+Date: Wed Aug 19 23:17:51 2015 +0000 -+ -+ upstream commit -+ -+ fixed unlink([uninitialised memory]) reported by Mateusz -+ Kocielski; ok markus@ -+ -+ Upstream-ID: 14a0c4e7d891f5a8dabc4b89d4f6b7c0d5a20109 -+ -+commit 2ac07471511202cab3abe3eb7fbbf76d2dae58c5 -+Author: jmc@openbsd.org -+Date: Fri Aug 14 15:32:41 2015 +0000 -+ -+ upstream commit -+ -+ match myproposal.h order; from brian conway (i snuck in a -+ tweak while here) -+ -+ ok dtucker -+ -+ Upstream-ID: 35174a19b5237ea36aa3798f042bf5933b772c67 -+ -+commit 3ef55f2bdbc31efbf6490335a4ffc434f54b361b -+Author: deraadt@openbsd.org -+Date: Thu Aug 6 14:53:21 2015 +0000 -+ -+ upstream commit -+ -+ add prohibit-password as a synonymn for without-password, -+ since the without-password is causing too many questions. Harden it to ban -+ all but pubkey, hostbased, and GSSAPI auth (when the latter is enabled) from -+ djm, ok markus -+ -+ Upstream-ID: d53317d7b28942153e6236d3fd6e12ceb482db7a -+ -+commit 4a319d2f7510d93717119f9d6cd32e3478229cea -+Author: Damien Miller -+Date: Tue Aug 11 13:53:41 2015 +1000 -+ -+ update version in README -+ -+commit 7bf0bc99dab739a4943a68cb072bb0c97408cbf2 -+Author: Damien Miller -+Date: Tue Aug 11 13:53:09 2015 +1000 -+ -+ update versions in *.spec -+ -+commit 7d43ff4120463a76315804dfc539c65520e402b1 -+Author: Damien Miller -+Date: Tue Aug 11 13:34:12 2015 +1000 -+ -+ set sshpam_ctxt to NULL after free -+ -+ Avoids use-after-free in monitor when privsep child is compromised. -+ Reported by Moritz Jodeit; ok dtucker@ -+ -+commit e7829c9ad5606c9aa9efcfff7ae7e1669e4a5f70 -+Author: Damien Miller -+Date: Tue Aug 11 13:33:24 2015 +1000 -+ -+ Don't resend username to PAM; it already has it. -+ -+ Pointed out by Moritz Jodeit; ok dtucker@ -+ -+commit 494f5c6c34a5cc8caa75457ec02e19efef141d11 -+Author: Darren Tucker -+Date: Mon Jul 27 12:14:25 2015 +1000 -+ -+ Import updated moduli file from OpenBSD. -+ -+commit 6692944469ae18ef892dd761e618afe0003d7614 -+Author: Damien Miller -+Date: Mon Aug 10 11:13:44 2015 +1000 -+ -+ let principals-command.sh work for noexec /var/run -+ -+commit 02b91eb3c36a5effe06d2f97df8c9e5ab265a4f5 -+Author: Damien Miller -+Date: Thu Aug 6 11:43:42 2015 +1000 -+ -+ work around echo -n / sed behaviour in tests -+ -+commit eb8f9e3e75be06442dfe8d7f74064dd64cea99c8 -+Author: djm@openbsd.org -+Date: Wed Aug 5 05:27:33 2015 +0000 -+ -+ upstream commit -+ -+ adjust for RSA minimum modulus switch; ok deraadt@ -+ -+ Upstream-Regress-ID: 5a72c83431b96224d583c573ca281cd3a3ebfdae -+ -+commit 417f0a95e61ef495db71babdb0fff615aa6378e7 -+Author: djm@openbsd.org -+Date: Tue Aug 4 05:23:06 2015 +0000 -+ -+ upstream commit -+ -+ backout SSH_RSA_MINIMUM_MODULUS_SIZE increase for this -+ release; problems spotted by sthen@ ok deraadt@ markus@ -+ -+ Upstream-ID: d0bd60dde9e8c3cd7030007680371894c1499822 -+ -+commit 9c4f4ee29277af4bd6221cf5bfb5219e92085c15 -+Author: djm@openbsd.org -+Date: Sun Aug 2 09:56:42 2015 +0000 -+ -+ upstream commit -+ -+ openssh 7.0; ok deraadt@ -+ -+ Upstream-ID: c63afdef537f57f28ae84145c5a8e29e9250221f -+ -+commit 49f9d4c1f1ad9a586eb602a2fd98a9ef866aba59 -+Author: chris@openbsd.org -+Date: Fri Jul 31 15:38:09 2015 +0000 -+ -+ upstream commit -+ -+ Allow PermitRootLogin to be overridden by config -+ -+ ok markus@ deeradt@ -+ -+ Upstream-ID: 5cf3e26ed702888de84e2dc9d0054ccf4d9125b4 -+ -+commit 06418eaa12d85ea03103e0c5c6289ed0a5c260a3 -+Author: djm@openbsd.org -+Date: Thu Jul 30 23:09:15 2015 +0000 -+ -+ upstream commit -+ -+ fix pty permissions; patch from Nikolay Edigaryev; ok -+ deraadt -+ -+ Upstream-ID: 40ff076d2878b916fbfd8e4f45dbe5bec019e550 -+ -+commit 19cd7e555c90cb3316ca552fc811999c4f42edac -+Author: deraadt@openbsd.org -+Date: Thu Jul 30 19:23:02 2015 +0000 -+ -+ upstream commit -+ -+ change default: PermitRootLogin without-password matching -+ install script changes coming as well ok djm markus -+ -+ Upstream-ID: 0e2a6c4441daf5498b47a61767382bead5eb8ea6 -+ -+commit 60094e8120ceff46736c36d269a71a10c252e309 -+Author: Damien Miller -+Date: Thu Jul 30 12:31:39 2015 +1000 -+ -+ downgrade OOM adjustment logging: verbose -> debug -+ -+commit b49b6c789c17840dc1f2b3e9cd74b8b2c53e4d37 -+Author: djm@openbsd.org -+Date: Thu Jul 30 00:01:34 2015 +0000 -+ -+ upstream commit -+ -+ Allow ssh_config and sshd_config kex parameters options be -+ prefixed by a '+' to indicate that the specified items be appended to the -+ default rather than replacing it. -+ -+ approach suggested by dtucker@, feedback dlg@, ok markus@ -+ -+ Upstream-ID: 0f901137298fc17095d5756ff1561a7028e8882a -+ -+commit 253c39bb0d0a066197349062d1172c23a52b6a04 -+Author: djm@openbsd.org -+Date: Wed Jul 29 08:34:54 2015 +0000 -+ -+ upstream commit -+ -+ fix bug in previous; was printing incorrect string for -+ failed host key algorithms negotiation -+ -+ Upstream-ID: 22c0dc6bc61930513065d92e11f0753adc4c6e6e -+ -+commit 5247c09dc31467f9d362dfa3299d297cb6fa6fb8 -+Author: djm@openbsd.org -+Date: Wed Jul 29 04:43:06 2015 +0000 -+ -+ upstream commit -+ -+ include the peer's offer when logging a failure to -+ negotiate a mutual set of algorithms (kex, pubkey, ciphers, etc.) ok markus@ -+ -+ Upstream-ID: bbb8caabf5c01790bb845f5ce135565248d7c796 -+ -+commit 4ad8b8cbbf7e147c7a3a4474c2c5ba3bec8b253e -+Author: djm@openbsd.org -+Date: Tue Jul 28 23:20:42 2015 +0000 -+ -+ upstream commit -+ -+ add Cisco to the list of clients that choke on the -+ hostkeys update extension. Pointed out by Howard Kash -+ -+ Upstream-ID: c9eadde28ecec056c73d09ee10ba4570dfba7e84 -+ -+commit 35835dc3285587bd7ed18565956f5750fae52700 -+Author: guenther@openbsd.org -+Date: Mon Jul 27 16:29:23 2015 +0000 -+ -+ upstream commit -+ -+ Permit kbind(2) use in the sandbox now, to ease testing -+ of ld.so work using it -+ -+ reminded by miod@, ok deraadt@ -+ -+ Upstream-ID: 523922e4d1ba7a091e3824e77a8a3c818ee97413 -+ -+commit eb1626a9ee1cd100cea6d416a5e3fa6814c5f662 -+Author: millert@openbsd.org -+Date: Mon Jul 20 18:44:12 2015 +0000 -+ -+ upstream commit -+ -+ Move .Pp before .Bl, not after to quiet mandoc -Tlint. -+ Noticed by jmc@ -+ -+ Upstream-ID: 59fadbf8407cec4e6931e50c53cfa0214a848e23 -+ -+commit 7c7ae8a88b83e54ccddf155a9d8674729d394c93 -+Author: millert@openbsd.org -+Date: Mon Jul 20 18:42:35 2015 +0000 -+ -+ upstream commit -+ -+ Sync usage with SYNOPSIS -+ -+ Upstream-ID: 7a321a170181a54f6450deabaccb6ef60cf3f0b7 -+ -+commit e5e70565d1746e6752531016f1fb9737e491f15f -+Author: millert@openbsd.org -+Date: Mon Jul 20 15:39:52 2015 +0000 -+ -+ upstream commit -+ -+ Better desciption of Unix domain socket forwarding. -+ bz#2423; ok jmc@ -+ -+ Upstream-ID: 85e28874726897e3f26ae50dfa2e8d2de683805d -+ -+commit 76334f29b0f957e73e65317988893dc0d6bdcb4a -+Author: Damien Miller -+Date: Mon Jul 20 11:19:51 2015 +1000 -+ -+ make realpath.c compile -Wsign-compare clean -+ -+commit eba7952ccabc039ccb80d5f7989e8a44617a6e17 -+Author: djm@openbsd.org -+Date: Mon Jul 20 00:30:01 2015 +0000 -+ -+ upstream commit -+ -+ mention that the default of UseDNS=no implies that -+ hostnames cannot be used for host matching in sshd_config and -+ authorized_keys; bz#2045, ok dtucker@ -+ -+ Upstream-ID: 0812705d5f2dfa59aab01f2764ee800b1741c4e1 -+ -+commit b81dea349f55d810d0cc4375b579b0bd8f8ea804 -+Author: djm@openbsd.org -+Date: Sat Jul 18 08:02:17 2015 +0000 -+ -+ upstream commit -+ -+ don't ignore PKCS#11 hosted keys that return empty -+ CKA_ID; patch by Jakub Jelen via bz#2429; ok markus -+ -+ Upstream-ID: 2f7c94744eb0342f8ee8bf97b2351d4e00116485 -+ -+commit 4c6afc11bfd10203fd1740ad31cde76fac2f6d49 -+Author: djm@openbsd.org -+Date: Sat Jul 18 08:00:21 2015 +0000 -+ -+ upstream commit -+ -+ skip uninitialised PKCS#11 slots; patch from Jakub Jelen -+ in bz#2427 ok markus@ -+ -+ Upstream-ID: 744c1e7796e237ad32992d0d02148e8a18f27d29 -+ -+commit 9c09b338e81fe56d9d0ad83d806013ce6436a1d9 -+Author: djm@openbsd.org -+Date: Sat Jul 18 07:57:14 2015 +0000 -+ -+ upstream commit -+ -+ only query each keyboard-interactive device once per -+ authentication request regardless of how many times it is listed; ok markus@ -+ -+ Upstream-ID: d73fafba6e86030436ff673656ec1f33d9ffeda1 -+ -+commit 8921e322278b610669728d1cb3162f420950e497 -+Author: djm@openbsd.org -+Date: Fri Jul 17 03:34:27 2015 +0000 -+ -+ upstream commit -+ -+ remove -u flag to diff (only used for error output) to make -+ things easier for -portable -+ -+ Upstream-Regress-ID: a5d6777d2909540d87afec3039d9bb2414ade548 -+ -+commit 0d226cf94f891ef420e03c5b9792f736215ab0e4 -+Author: djm@openbsd.org -+Date: Fri Jul 17 03:09:19 2015 +0000 -+ -+ upstream commit -+ -+ direct-streamlocal@openssh.com Unix domain foward -+ messages do not contain a "reserved for future use" field and in fact, -+ serverloop.c checks that there isn't one. Remove erroneous mention from -+ PROTOCOL description. bz#2421 from Daniel Black -+ -+ Upstream-ID: 3d51a19e64f72f764682f1b08f35a8aa810a43ac -+ -+commit 4177f4200c1e55ceaf4339d6e31cbf44e9b86185 -+Author: djm@openbsd.org -+Date: Fri Jul 17 03:04:27 2015 +0000 -+ -+ upstream commit -+ -+ describe magic for setting up Unix domain socket fowards -+ via the mux channel; bz#2422 patch from Daniel Black -+ -+ Upstream-ID: 943080fe3864715c423bdeb7c920bb30c4eee861 -+ -+commit 435b85fde6e729c08df8cb912d4a87bbde5db903 -+Author: Darren Tucker -+Date: Fri Jul 17 12:52:34 2015 +1000 -+ -+ Check if realpath works on nonexistent files. -+ -+ On some platforms the native realpath doesn't work with non-existent -+ files (this is actually specified in some versions of POSIX), however -+ the sftp spec says its realpath with "canonicalize any given path name". -+ On those platforms, use realpath from the compat library. -+ -+ In addition, when compiling with -DFORTIFY_SOURCE, glibc redefines -+ the realpath symbol to the checked version, so redefine ours to -+ something else so we pick up the compat version we want. -+ -+ bz#2428, ok djm@ -+ -+commit 18afb73e570c6a31c8cdf82d3716d62961def6ae -+Author: djm@openbsd.org -+Date: Fri Jul 17 02:47:45 2015 +0000 -+ -+ upstream commit -+ -+ fix incorrect test for SSH1 keys when compiled without SSH1 -+ support -+ -+ Upstream-ID: 6004d720345b8e481c405e8ad05ce2271726e451 -+ -+commit 04480195836293bb50b25fda4045ae2fb01660ec -+Author: djm@openbsd.org -+Date: Wed Jul 15 08:00:11 2015 +0000 -+ -+ upstream commit -+ -+ fix NULL-deref when SSH1 reenabled -+ -+ Upstream-ID: f22fd805288c92b3e9646782d15b48894b2d5295 -+ -+commit 9d98905747b99b0f3e5fe885ec912a7bba2103b5 -+Author: djm@openbsd.org -+Date: Wed Jul 15 07:19:50 2015 +0000 -+ -+ upstream commit -+ -+ regen RSA1 test keys; the last batch was missing their -+ private parts -+ -+ Upstream-Regress-ID: 7ccf437305dd63ff0b48dd50c5fd0f4d4230c10a -+ -+commit bdb8cc967d90848b64706fc859f7cf2d5e726710 -+Author: markus@openbsd.org -+Date: Fri Jul 10 06:23:25 2015 +0000 -+ -+ upstream commit -+ -+ Adapt tests, now that DSA if off by default; use -+ PubkeyAcceptedKeyTypes and PubkeyAcceptedKeyTypes to test DSA. -+ -+ Upstream-Regress-ID: 0ff2a3ff5ac1ce5f92321d27aa07b98656efcc5c -+ -+commit f156820f592304b7a271de87717c03a31e64e200 -+Author: markus@openbsd.org -+Date: Tue Jul 7 14:54:16 2015 +0000 -+ -+ upstream commit -+ -+ regen test data after mktestdata.sh changes -+ -+ Upstream-Regress-ID: 3495ecb082b9a7c048a2d7c5c845d3bf181d25a4 -+ -+commit ab7bf8084854354f4968b67f8834bf8021a51b61 -+Author: markus@openbsd.org -+Date: Tue Jul 7 14:53:30 2015 +0000 -+ -+ upstream commit -+ -+ adapt tests to new minimum RSA size and default FP format -+ -+ Upstream-Regress-ID: a4b30afd174ce82b96df14eb49fb0b81398ffd0e -+ -+commit 8a366acde646bbb13c30437a7973d9106121eaf4 -+Author: djm@openbsd.org -+Date: Fri Jul 3 04:39:23 2015 +0000 -+ -+ upstream commit -+ -+ legacy v00 certificates are gone; adapt and don't try to -+ test them; "sure" markus@ dtucker@ -+ -+ Upstream-Regress-ID: c57321e69b3cd4a3b3396dfcc43f0803d047da12 -+ -+commit 8ec2a9e168d059ec98315c3f382f2cc094c0b65b -+Author: djm@openbsd.org -+Date: Wed Jul 1 23:11:18 2015 +0000 -+ -+ upstream commit -+ -+ don't expect SSH v.1 in unittests -+ -+ Upstream-Regress-ID: f8812b16668ba78e6a698646b2a652b90b653397 -+ -+commit 5f183f14965a3ed2958115107d75886a0e4e6420 -+Author: djm@openbsd.org -+Date: Mon Jun 15 06:38:50 2015 +0000 -+ -+ upstream commit -+ -+ turn SSH1 back on to match src/usr.bin/ssh being tested -+ -+ Upstream-Regress-ID: 6c4f763a2f0cc6893bf33983919e9030ae638333 -+ -+commit 4887475f0d3f9149b08c8cc334c73d7ae4278d71 -+Author: dtucker@openbsd.org -+Date: Mon Jul 13 04:57:14 2015 +0000 -+ -+ upstream commit -+ -+ Add "PuTTY_Local:" to the clients to which we do not -+ offer DH-GEX. This was the string that was used for development versions -+ prior to September 2014 and they don't do RFC4419 DH-GEX, but unfortunately -+ there are some extant products based on those versions. bx2424 from Jay -+ Rouman, ok markus@ djm@ -+ -+ Upstream-ID: be34d41e18b966832fe09ca243d275b81882e1d5 -+ -+commit 5055b03437d584fd7c200bed9c54a899ef0adf97 -+Author: markus@openbsd.org -+Date: Fri Jul 10 06:21:53 2015 +0000 -+ -+ upstream commit -+ -+ Turn off DSA by default; add HostKeyAlgorithms to the -+ server and PubkeyAcceptedKeyTypes to the client side, so it still can be -+ tested or turned back on; feedback and ok djm@ -+ -+ Upstream-ID: 8450a9e6d83f80c9bfed864ff061dfc9323cec21 -+ -+commit 722d3d401fa9a8224113973553967716f020a78c -+Author: markus@openbsd.org -+Date: Thu Jul 9 09:49:46 2015 +0000 -+ -+ upstream commit -+ -+ re-enable ed25519-certs if compiled w/o openssl; ok djm -+ -+ Upstream-ID: e10c90808b001fd2c7a93778418e9b318f5c4c49 -+ -+commit 62d6516beca6f71e055236df09c86a338774ac67 -+Author: markus@openbsd.org -+Date: Wed Jul 8 20:24:02 2015 +0000 -+ -+ upstream commit -+ -+ no need to include the old buffer/key API -+ -+ Upstream-ID: fb13c9f7c0bba2545f3eb0a0e69cb0030819f52b -+ -+commit 4b6c9ea11cc00d07ca8b1013b49b27717ecc9668 -+Author: markus@openbsd.org -+Date: Wed Jul 8 19:09:25 2015 +0000 -+ -+ upstream commit -+ -+ typedefs for Cipher&CipherContext are unused -+ -+ Upstream-ID: 50e6a18ee92221d23ad173a96d5b6c42207cf9a7 -+ -+commit a6a84bcfcbcda5800c60fa1c1cbbaffa9f49f5ba -+Author: markus@openbsd.org -+Date: Wed Jul 8 19:04:21 2015 +0000 -+ -+ upstream commit -+ -+ xmalloc.h is unused -+ -+ Upstream-ID: afb532355b7fa7135a60d944ca1e644d1d63cb58 -+ -+commit 027aa80c555dea3e4bbfb6c68f157ac427792ffb -+Author: markus@openbsd.org -+Date: Wed Jul 8 19:01:15 2015 +0000 -+ -+ upstream commit -+ -+ compress.c is gone -+ -+ Upstream-ID: 174fa7faa9b9643cba06164b5e498591356fbced -+ -+commit ef84cebd9d26bfa99db67cfafd4b65579a9adb4c -+Author: djm@openbsd.org -+Date: Fri Jul 3 04:05:54 2015 +0000 -+ -+ upstream commit -+ -+ another SSH_RSA_MINIMUM_MODULUS_SIZE that needed -+ cranking -+ -+ Upstream-ID: 9d8826cafe96aab4ae8e2f6fd22800874b7ffef1 -+ -+commit bfecf910f4da69bc975e4dc252b3467f809d5c56 -+Author: djm@openbsd.org -+Date: Fri Jul 3 03:56:25 2015 +0000 -+ -+ upstream commit -+ -+ add an XXX reminder for getting correct key paths from -+ sshd_config -+ -+ Upstream-ID: feae52b209d7782ad742df04a4260e9fe41741db -+ -+commit dd2279e2d54614ba1d36374531853e3ac3d68aac -+Author: djm@openbsd.org -+Date: Fri Jul 3 03:49:45 2015 +0000 -+ -+ upstream commit -+ -+ refuse to generate or accept RSA keys smaller than 1024 -+ bits; feedback and ok dtucker@ -+ -+ Upstream-ID: 7ea3d31271366ba264f06e34a3539bf1ac30f0ba -+ -+commit e67fefd76c518bb89bf9007299d8bf9a0d36ce2e -+Author: djm@openbsd.org -+Date: Fri Jul 3 03:47:00 2015 +0000 -+ -+ upstream commit -+ -+ turn off 1024 bit diffie-hellman-group1-sha1 key -+ exchange method (already off in server, this turns it off in the client by -+ default too) ok dtucker@ -+ -+ Upstream-ID: f59b88f449210ab7acf7d9d88f20f1daee97a4fa -+ -+commit 18fa6d2c0d896c0210f538f7bc70f916bf45e8af -+Author: djm@openbsd.org -+Date: Fri Jul 3 03:43:18 2015 +0000 -+ -+ upstream commit -+ -+ delete support for legacy v00 certificates; "sure" -+ markus@ dtucker@ -+ -+ Upstream-ID: b5b9bb5f9202d09e88f912989d74928601b6636f -+ -+commit d4b2a222bc483a24e3d65788eb6a6deaf1f50195 -+Author: djm@openbsd.org -+Date: Wed Jul 1 23:10:47 2015 +0000 -+ -+ upstream commit -+ -+ Compile-time disable SSH v.1 again -+ -+ Upstream-ID: 1d4b513a3a06232f02650b73bad25100d1b800af -+ -+commit c0bf9c4b004ee471086fae33d56f72da7aa67f65 -+Author: djm@openbsd.org -+Date: Wed Jul 1 02:39:06 2015 +0000 -+ -+ upstream commit -+ -+ twiddle PermitRootLogin back -+ -+ Upstream-ID: 2bd23976305d0512e9f84d054e1fc23cd70b89f2 -+ -+commit 46bb1e45809b085092c2c6768f09bc19b777a68c -+Author: djm@openbsd.org -+Date: Wed Jul 1 02:32:17 2015 +0000 -+ -+ upstream commit -+ -+ twiddle; (this commit marks the openssh-6.9 release) -+ -+ Upstream-ID: 78500582819f61dd8adee36ec5cc9b9ac9351234 -+ -+commit 9abaa8bdc3c99d1d37d3cac7f98bbb054f93ea09 -+Author: djm@openbsd.org -+Date: Wed Jul 1 02:26:31 2015 +0000 -+ -+ upstream commit -+ -+ better refuse ForwardX11Trusted=no connections attempted -+ after ForwardX11Timeout expires; reported by Jann Horn -+ -+ Upstream-ID: bf0fddadc1b46a0334e26c080038313b4b6dea21 -+ -+commit 02e9f68bfd00facb91cfbf4a1e75f2688710fa62 -+Author: djm@openbsd.org -+Date: Wed Jul 1 01:56:13 2015 +0000 -+ -+ upstream commit -+ -+ put back default PermitRootLogin=no -+ -+ Upstream-ID: 7bdedd5cead99c57ed5571f3b6b7840922d5f728 -+ -+commit 019e0bf70cb0622a83100ceb380cc2173dc126ee -+Author: djm@openbsd.org -+Date: Wed Jul 1 01:55:13 2015 +0000 -+ -+ upstream commit -+ -+ openssh-6.9 -+ -+ Upstream-ID: 6cfe8e1904812531080e6ab6e752d7001b5b2d45 -+ -+commit e4f1a452bbdab3d6a5b8cbda2beca792bc14fd3d -+Author: djm@openbsd.org -+Date: Wed Jul 1 01:55:00 2015 +0000 -+ -+ upstream commit -+ -+ reset default PermitRootLogin to 'yes' (momentarily, for -+ release) -+ -+ Upstream-ID: cad8513527066e65dd7a1c16363d6903e8cefa24 -+ -+commit 45aa4352502f6799089c2551c44464cfad609904 -+Author: Damien Miller -+Date: Wed Jul 1 11:49:12 2015 +1000 -+ -+ crank version numbers for release -+ -+commit 9984c392c2a5a6e995cbf3fc6b9942f378b01731 -+Author: Damien Miller -+Date: Wed Jul 1 10:49:37 2015 +1000 -+ -+ s/--with-ssh1/--without-ssh1/ -+ -+commit 5c26037be23dfd98fecb0acc935e3a969b76c16d -+Author: djm@openbsd.org -+Date: Tue Jun 30 05:25:07 2015 +0000 -+ -+ upstream commit -+ -+ fatal() when a remote window update causes the window -+ value to overflow. Reported by Georg Wicherski, ok markus@ -+ -+ Upstream-ID: ead397a9aceb3bf74ebfa5fcaf259d72e569f351 -+ -+commit 38a550da98b7bb430174749b236ff8147b1d570a -+Author: djm@openbsd.org -+Date: Tue Jun 30 05:23:25 2015 +0000 -+ -+ upstream commit -+ -+ Fix math error in remote window calculations that causes -+ eventual stalls for datagram channels. Reported by Georg Wicherski, ok -+ markus@ -+ -+ Upstream-ID: be54059d11bf64e0d85061f7257f53067842e2ab -+ -+commit e6f741db73bbb747ddb520fef7ad71f7929d4762 -+Author: Damien Miller -+Date: Tue Jun 30 16:05:40 2015 +1000 -+ -+ skip IPv6-related portions on hosts without IPv6 -+ -+ with Tim Rice -+ -+commit f09afdf1091ab0892141ff8e55740022ef73b248 -+Author: djm@openbsd.org -+Date: Mon Jun 29 22:35:12 2015 +0000 -+ -+ upstream commit -+ -+ add getpid to sandbox, reachable by grace_alarm_handler -+ -+ reported by Jakub Jelen; bz#2419 -+ -+ Upstream-ID: d0da1117c16d4c223954995d35b0f47c8f684cd8 -+ -+commit 1cd2a4941d82ffb125610a299b80f2b3117b50a0 -+Author: djm@openbsd.org -+Date: Fri Jun 26 05:13:20 2015 +0000 -+ -+ upstream commit -+ -+ Fix \-escaping bug that caused forward path parsing to skip -+ two characters and skip past the end of the string. -+ -+ Based on patch by Salvador Fandino; ok dtucker@ -+ -+ Upstream-ID: 7b879dc446335677cbe4cb549495636a0535f3bd -+ -+commit 2aea7f04e8cd1a62244d2ac253339719ac98e11a -+Author: Damien Miller -+Date: Thu Jun 25 09:51:39 2015 +1000 -+ -+ add missing pselect6 -+ -+ patch from Jakub Jelen -+ -+commit 64d0bdfac2fc99de17921bdb427cb5bce73e6646 -+Author: djm@openbsd.org -+Date: Wed Jun 24 23:47:23 2015 +0000 -+ -+ upstream commit -+ -+ correct test to sshkey_sign(); spotted by Albert S. -+ -+ Upstream-ID: 5f7347f40f0ca6abdaca2edb3bd62f4776518933 -+ -+commit 50fca6a0c15874e54872240fff833775811e132e -+Author: dtucker@openbsd.org -+Date: Wed Jun 24 01:49:19 2015 +0000 -+ -+ upstream commit -+ -+ Revert previous commit. We still want to call setgroups -+ in the case where there are zero groups to remove any that we might otherwise -+ inherit (as pointed out by grawity at gmail.com) and since the 2nd argument -+ to setgroups is always a static global it's always valid to dereference in -+ this case. ok deraadt@ djm@ -+ -+ Upstream-ID: 895b5ac560a10befc6b82afa778641315725fd01 -+ -+commit d18a48973dfbeb24e25e12a9cfff82c3e1254ea3 -+Author: dtucker@openbsd.org -+Date: Wed Jun 24 01:49:19 2015 +0000 -+ -+ upstream commit -+ -+ Revert previous commit. We still want to call setgroups in -+ the case where there are zero groups to remove any that we might otherwise -+ inherit (as pointed out by grawity at gmail.com) and since the 2nd argument -+ to setgroups is always a static global it's always valid to dereference in -+ this case. ok deraadt@ djm@ -+ -+ Upstream-ID: 895b5ac560a10befc6b82afa778641315725fd01 -+ -+commit 3c609d38ed44a0a9371643776f3d92b79e517ebe -+Author: djm@openbsd.org -+Date: Mon Jun 22 23:42:16 2015 +0000 -+ -+ upstream commit -+ -+ Don't count successful partial authentication as failures -+ in monitor; this may have caused the monitor to refuse multiple -+ authentications that would otherwise have successfully completed; ok markus@ -+ -+ Upstream-ID: eb74b8e506714d0f649bd5c300f762a527af04a3 -+ -+commit 308505cb8bcfb19ef9d59bce706b6ce73e26155a -+Author: dtucker@openbsd.org -+Date: Mon Jun 22 12:29:57 2015 +0000 -+ -+ upstream commit -+ -+ Don't call setgroups if we have zero groups; there's no -+ guarantee that it won't try to deref the pointer. Based on a patch from mail -+ at quitesimple.org, ok djm deraadt -+ -+ Upstream-ID: 2fff85e11d7a9a387ef7fddf41fbfaf566708ab1 -+ -+commit 227920739dda3b7bc6a9cdcca3f70c8eb087302b -+Author: Damien Miller -+Date: Thu Jun 18 15:07:56 2015 +1000 -+ -+ fix syntax error -+ -+commit 72c51a5d89f2311c4e42e511249610a99fc90cb3 -+Author: jsing@openbsd.org -+Date: Mon Jun 15 18:44:22 2015 +0000 -+ -+ upstream commit -+ -+ If AuthorizedPrincipalsCommand is specified, however -+ AuthorizedPrincipalsFile is not (or is set to "none"), authentication will -+ potentially fail due to key_cert_check_authority() failing to locate a -+ principal that matches the username, even though an authorized principal has -+ already been matched in the output of the subprocess. Fix this by using the -+ same logic to determine if pw->pw_name should be passed, as is used to -+ determine if a authorized principal must be matched earlier on. -+ -+ ok djm@ -+ -+ Upstream-ID: 43b42302ec846b0ea68aceb40677245391b9409d -+ -+commit 0c07a7a2f02791756f4d78f2a7247fe9ed19dbac -+Author: jsing@openbsd.org -+Date: Mon Jun 15 18:42:19 2015 +0000 -+ -+ upstream commit -+ -+ Make the arguments to match_principals_command() similar -+ to match_principals_file(), by changing the last argument a struct -+ sshkey_cert * and dereferencing key->cert in the caller. -+ -+ No functional change. -+ -+ ok djm@ -+ -+ Upstream-ID: 533f99b844b21b47342b32b62e198dfffcf8651c -+ -+commit 3e348c0579e39cd838f7fccb6863377f7e841e7d -+Author: Damien Miller -+Date: Wed Jun 17 14:36:54 2015 +1000 -+ -+ trivial optimisation for seccomp-bpf -+ -+ When doing arg inspection and the syscall doesn't match, skip -+ past the instruction that reloads the syscall into the accumulator, -+ since the accumulator hasn't been modified at this point. -+ -+commit 36867cc4f5205033b47aa57335f3e1cbbe953cdb -+Author: Damien Miller -+Date: Wed Jun 17 10:50:51 2015 +1000 -+ -+ aarch64 support for seccomp-bpf sandbox -+ -+ Also resort and tidy syscall list. Based on patches by Jakub Jelen -+ bz#2361; ok dtucker@ -+ -+commit d38446d7fff6424d57ce3476cfaeddd65839576b -+Author: djm@openbsd.org -+Date: Mon Jun 15 01:32:50 2015 +0000 -+ -+ upstream commit -+ -+ return failure on RSA signature error; reported by Albert S -+ -+ Upstream-ID: e61bb93dbe0349625807b0810bc213a6822121fa -+ -+commit 0e17695d98062e27215f6e3a0df21c2d11b48360 -+Author: Tim Rice -+Date: Tue Jun 9 22:41:13 2015 -0700 -+ -+ Fix t12 rules for out of tree builds. -+ -+commit 9cf46f0068e73e6552745bce578158673f84bbda -+Author: millert@openbsd.org -+Date: Fri Jun 5 15:13:13 2015 +0000 -+ -+ upstream commit -+ -+ For "ssh -L 12345:/tmp/sock" don't fail with "No forward host -+ name." (we have a path, not a host name). Based on a diff from Jared -+ Yanovich. OK djm@ -+ -+ Upstream-ID: 2846b0a8c7de037e33657f95afbd282837fc213f -+ -+commit 7470860d48483f9a49be9c46f2e90ecf7264f0f8 -+Author: djm@openbsd.org -+Date: Fri Jun 5 03:44:14 2015 +0000 -+ -+ upstream commit -+ -+ typo: accidental repetition; bz#2386 -+ -+ Upstream-ID: 45e620d99f6bc301e5949d34a54027374991c88b -+ -+commit ad9be83f4e91db6f0939a0fd9bf1c32e4351e4b9 -+Author: Darren Tucker -+Date: Fri Jun 5 14:51:40 2015 +1000 -+ -+ Add Linux powerpc64le and powerpcle entries. -+ -+ Stopgap to resolve bz#2409 because we are so close to release and will -+ update config.guess and friends shortly after the release. ok djm@ -+ -+commit 941609c8e072a7b0787163198d699c1805542687 -+Author: Tim Rice -+Date: Wed Jun 3 21:41:11 2015 -0700 -+ -+ Remove unneeded backslashes. Patch from Ángel González -+ -+commit fa647dc1f7c0d4f1506fddf9fac398027294f4ab -+Author: Darren Tucker -+Date: Thu Jun 4 14:10:55 2015 +1000 -+ -+ Remove redundant include of stdarg.h. bz#2410 -+ -+commit f68403122b4481199c53579b90e3731ebc116a91 -+Author: djm@openbsd.org -+Date: Tue Jun 2 09:10:40 2015 +0000 -+ -+ upstream commit -+ -+ mention CheckHostIP adding addresses to known_hosts; -+ bz#1993; ok dtucker@ -+ -+ Upstream-ID: fd44b68440fd0dc29abf9f2d3f703d74a2396cb7 -+ -+commit c7c71cbc37fc3ee729b63f02e0ce305ff521a30c -+Author: Darren Tucker -+Date: Tue Jun 2 20:15:26 2015 +1000 -+ -+ Replace strcpy with strlcpy. -+ -+ ok djm, sanity check by Corinna Vinschen. -+ -+commit 60bd22f3cbf72f841ef8a3a3277d5ecabc7856c5 -+Author: Damien Miller -+Date: Fri May 29 18:27:21 2015 +1000 -+ -+ skip, rather than fatal when run without SUDO set -+ -+commit 5edbccea9d36ec618091e48fb9f180ff643bca57 -+Author: Damien Miller -+Date: Fri May 29 18:03:15 2015 +1000 -+ -+ fix merge botch that left ",," in KEX algs -+ -+commit b3d8cb34c1b7204227d786ccad38657c95576e4d -+Author: Damien Miller -+Date: Fri May 29 17:08:28 2015 +1000 -+ -+ re-enable SSH protocol 1 at compile time -+ -+commit 1bb6deaf0c2e71c350e36e336871dd987daf07e6 -+Author: djm@openbsd.org -+Date: Fri May 29 03:05:13 2015 +0000 -+ -+ upstream commit -+ -+ make this work without SUDO set; ok dtucker@ -+ -+ Upstream-Regress-ID: bca88217b70bce2fe52b23b8e06bdeb82d98c715 -+ -+commit e20265f3bf82b14c4a6b501056b9b021a297c1bf -+Author: djm@openbsd.org -+Date: Thu May 28 07:37:31 2015 +0000 -+ -+ upstream commit -+ -+ wrap all moduli-related code in #ifdef WITH_OPENSSL. -+ based on patch from Reuben Hawkins; bz#2388 feedback and ok dtucker@ -+ -+ Upstream-ID: d80cfc8be3e6ec65b3fac9e87c4466533b31b7cf -+ -+commit 2eedee76e96c5ff7def267c4776c7c7f8084d0f1 -+Author: dtucker@openbsd.org -+Date: Thu May 28 05:41:29 2015 +0000 -+ -+ upstream commit -+ -+ Increase the allowed length of the known host file name -+ in the log message to be consistent with other cases. Part of bz#1993, ok -+ deraadt. -+ -+ Upstream-ID: a9e97567be49f25daf286721450968251ff78397 -+ -+commit 2e0714573871091667f46855e4ba5482f8638c21 -+Author: dtucker@openbsd.org -+Date: Thu May 28 05:09:45 2015 +0000 -+ -+ upstream commit -+ -+ Fix typo (keywork->keyword) -+ -+ Upstream-ID: 8aacd0f4089c0a244cf43417f4f9045dfaeab534 -+ -+commit 380953ab53324fbaa945c12c9da8cf03e170b38a -+Author: djm@openbsd.org -+Date: Thu May 28 04:50:53 2015 +0000 -+ -+ upstream commit -+ -+ add error message on ftruncate failure; bz#2176 -+ -+ Upstream-ID: cbcc606e0b748520c74a210d8f3cc9718d3148cf -+ -+commit 469cb854c543dbbd06d1836abb62383e7be5ec70 -+Author: djm@openbsd.org -+Date: Thu May 28 04:40:13 2015 +0000 -+ -+ upstream commit -+ -+ make ssh-keygen default to ed25519 keys when compiled -+ without OpenSSL; bz#2388, ok dtucker@ -+ -+ Upstream-ID: 85a471fa6d3fa57a7b8e882d22cfbfc1d84cdc71 -+ -+commit 9ee00a3112a2a87b0e45ffab5fb34d5b1173f622 -+Author: dtucker@openbsd.org -+Date: Wed May 27 23:51:10 2015 +0000 -+ -+ upstream commit -+ -+ Reorder client proposal to prefer -+ diffie-hellman-group-exchange-sha1 over diffie-hellman-group14-sha1. ok djm@ -+ -+ Upstream-ID: 552c08d47347c3ee1a9a57d88441ab50abe17058 -+ -+commit c75a751a814205df7c72db322258a33be13f258a -+Author: dtucker@openbsd.org -+Date: Wed May 27 23:39:18 2015 +0000 -+ -+ upstream commit -+ -+ Add a stronger (4k bit) fallback group that sshd can use -+ when the moduli file is missing or broken, sourced from RFC3526. bz#2302, ok -+ markus@ (earlier version), djm@ -+ -+ Upstream-ID: b635215746a25a829d117673d5e5a76d4baee7f4 -+ -+commit 494d17abd008816a62469c5b9024764904609566 -+Author: Darren Tucker -+Date: Thu May 28 10:03:40 2015 +1000 -+ -+ New moduli file from OpenBSD, removing 1k groups. -+ -+ Remove 1k bit groups. ok deraadt@, markus@ -+ -+commit 702814c274cdfc8660dc1b28410956712585527c -+Author: djm@openbsd.org -+Date: Wed May 27 05:15:02 2015 +0000 -+ -+ upstream commit -+ -+ support PKCS#11 devices with external PIN entry devices -+ bz#2240, based on patch from Dirk-Willem van Gulik; feedback and ok dtucker@ -+ -+ Upstream-ID: 504568992b55a8fc984375242b1bd505ced61b0d -+ -+commit 0888c5a2b3b163a59691da4a15a41825514f5307 -+Author: dtucker@openbsd.org -+Date: Tue May 26 23:23:40 2015 +0000 -+ -+ upstream commit -+ -+ Cap DH-GEX group size at 4kbits for Cisco implementations. -+ Some of them will choke when asked for preferred sizes >4k instead of -+ returning the 4k group that they do have. bz#2209, ok djm@ -+ -+ Upstream-ID: 54b863a19713446b7431f9d06ad0532b4fcfef8d -+ -+commit 3c721c8a6123099731096b24810f7aa93c298241 -+Author: djm@openbsd.org -+Date: Sun May 24 23:39:16 2015 +0000 -+ -+ upstream commit -+ -+ add missing 'c' option to getopt(), case statement was -+ already there; from Felix Bolte -+ -+ Upstream-ID: 9b19b4e2e0b54d6fefa0dfac707c51cf4bae3081 -+ -+commit 9111eddd94b495f1c0e951d36e4e33a09c377dcd -+Author: jsg@openbsd.org -+Date: Sat May 23 14:28:37 2015 +0000 -+ -+ upstream commit -+ -+ fix a memory leak in an error path ok markus@ dtucker@ -+ -+ Upstream-ID: bc1da0f205494944918533d8780fde65dff6c598 -+ -+commit 74d411ad8423d5dfe60ab38183695b8032f2ab3a -+Author: djm@openbsd.org -+Date: Fri May 22 05:28:45 2015 +0000 -+ -+ upstream commit -+ -+ mention ssh-keygen -E for comparing legacy MD5 -+ fingerprints; bz#2332 -+ -+ Upstream-ID: 079a3669549041dbf10dbc072d9563f0dc3b2859 -+ -+commit 18da12cc7918fb2f733f6b12e07ceaa4cf8467c2 -+Author: djm@openbsd.org -+Date: Fri May 22 04:45:52 2015 +0000 -+ -+ upstream commit -+ -+ Reorder EscapeChar option parsing to avoid a single-byte -+ out- of-bounds read. bz#2396 from Jaak Ristioja; ok dtucker@ -+ -+ Upstream-ID: 1dc6b5b63d1c8d9a88619da0b27ade461d79b060 -+ -+commit 9c3f0f595d70a821190612b0b46b668276a8e6e2 -+Author: djm@openbsd.org -+Date: Fri May 22 03:50:02 2015 +0000 -+ -+ upstream commit -+ -+ add knob to relax GSSAPI host credential check for -+ multihomed hosts bz#928, patch by Simon Wilkinson; ok dtucker -+ (kerberos/GSSAPI is not compiled by default on OpenBSD) -+ -+ Upstream-ID: 15ddf1c6f7fd9d98eea9962f480079ae3637285d -+ -+commit c16db6b96cb524dbf34942ffc3ada74f53926768 -+Author: Darren Tucker -+Date: Fri May 22 17:49:46 2015 +1000 -+ -+ Include signal.h for sig_atomic_t, used by kex.h. -+ -+ bz#2402, from tomas.kuthan at oracle com. -+ -+commit 181fa61691cb96d50db3abdfeebd24e67ad3285e -+Author: Darren Tucker -+Date: Fri May 22 12:47:24 2015 +1000 -+ -+ Import updated moduli file from OpenBSD. -+ -+commit f24ab8f0fc5402e71ce1a9210d39721177cb93a2 -+Author: djm@openbsd.org -+Date: Thu May 21 12:01:19 2015 +0000 -+ -+ upstream commit -+ -+ Support "ssh-keygen -lF hostname" to find search known_hosts -+ and print key hashes. Already advertised by ssh-keygen(1), but not delivered -+ by code; ok dtucker@ -+ -+ Upstream-ID: 459e0e2bf39825e41b0811c336db2d56a1c23387 -+ -+commit 8844b7fe9a0abc31778c9b5c6fff604593d19d81 -+Author: Damien Miller -+Date: Thu May 21 17:55:15 2015 +1000 -+ -+ conditionalise util.h inclusion -+ -+commit bc1ca2e0932221e95b8965c11c17e2647e970ee3 -+Author: djm@openbsd.org -+Date: Thu May 21 06:44:25 2015 +0000 -+ -+ upstream commit -+ -+ regress test for AuthorizedPrincipalsCommand -+ -+ Upstream-Regress-ID: c658fbf1ab6b6011dc83b73402322e396f1e1219 -+ -+commit 54b9a77d9510d7df4df198b063dfe256cf0daa8b -+Author: djm@openbsd.org -+Date: Thu May 21 06:40:02 2015 +0000 -+ -+ upstream commit -+ -+ regress test for AuthorizedKeysCommand arguments -+ -+ Upstream-Regress-ID: bbd65c13c6b3be9a442ec115800bff9625898f12 -+ -+commit 545dd0091edf8861f603b2adddafaa4bdfa3b010 -+Author: djm@openbsd.org -+Date: Thu May 21 06:43:30 2015 +0000 -+ -+ upstream commit -+ -+ add AuthorizedPrincipalsCommand that allows getting -+ authorized_principals from a subprocess rather than a file, which is quite -+ useful in deployments with large userbases -+ -+ feedback and ok markus@ -+ -+ Upstream-ID: aa1bdac7b16fc6d2fa3524ef08f04c7258d247f6 -+ -+commit 5a3c56edb9e718b46924cf3d4a2ca13f3bcb5cb4 -+Author: djm@openbsd.org -+Date: Thu May 21 06:38:35 2015 +0000 -+ -+ upstream commit -+ -+ support arguments to AuthorizedKeysCommand -+ -+ bz#2081 loosely based on patch by Sami Hartikainen -+ feedback and ok markus@ -+ -+ Upstream-ID: b080387a14aa67dddd8ece67c00f268d626541f7 -+ -+commit 742908b22e82d6e4bcf1b7195e5d06d29c977816 -+Author: djm@openbsd.org -+Date: Thu May 21 04:55:51 2015 +0000 -+ -+ upstream commit -+ -+ refactor: split base64 encoding of pubkey into its own -+ sshkey_to_base64() function and out of sshkey_write(); ok markus@ -+ -+ Upstream-ID: 54fc38f5832e9b91028900819bda46c3959a0c1a -+ -+commit 71a9815cbfdb5bacf0309dd9105e0b43ce3bb6b6 -+Author: deraadt@openbsd.org -+Date: Mon May 18 15:06:05 2015 +0000 -+ -+ upstream commit -+ -+ getentropy() and sendsyslog() have been around long -+ enough. openssh-portable may want the #ifdef's but not base. discussed with -+ djm few weeks back -+ -+ Upstream-ID: 0506a4334de108e3fb6c66f8d6e0f9c112866926 -+ -+commit 62455495d315c80f7e2a0da9c633eb2e2a2913c8 -+Author: dtucker@openbsd.org -+Date: Fri May 15 05:44:21 2015 +0000 -+ -+ upstream commit -+ -+ Use a salted hash of the lock passphrase instead of plain -+ text and do constant-time comparisons of it. Should prevent leaking any -+ information about it via timing, pointed out by Ryan Castellucci. Add a 0.1s -+ incrementing delay for each failed unlock attempt up to 10s. ok markus@ -+ (earlier version), djm@ -+ -+ Upstream-ID: c599fcc325aa1cc65496b25220b622d22208c85f -+ -+commit 675a7cb7495cee59c98da1009d67956c8fe85a8a -+Author: Damien Miller -+Date: Tue May 5 19:10:58 2015 +1000 -+ -+ upstream commit -+ -+ - tedu@cvs.openbsd.org 2015/01/12 03:20:04 -+ [bcrypt_pbkdf.c] -+ rename blocks to words. bcrypt "blocks" are unrelated to blowfish blocks, -+ nor are they the same size. -+ -+commit 63111658dddb186aa07b19f89a99daeeec2ac449 -+Author: Damien Miller -+Date: Tue May 5 19:10:23 2015 +1000 -+ -+ upstream commit -+ -+ - deraadt@cvs.openbsd.org 2015/01/08 00:30:07 -+ [bcrypt_pbkdf.c] -+ declare a local version of MIN(), call it MINIMUM() -+ -+commit 5ef0b8ba0595905939df2ed02cb9e34f288c21f0 -+Author: Damien Miller -+Date: Tue May 5 19:09:46 2015 +1000 -+ -+ upstream commit -+ -+ - djm@cvs.openbsd.org 2014/12/30 01:41:43 -+ [bcrypt_pbkdf.c] -+ typo in comment: ouput => output -+ -+commit aefbbbe69770f65a2403b0966612d97d523e9be1 -+Author: djm@openbsd.org -+Date: Mon May 4 06:10:48 2015 +0000 -+ -+ upstream commit -+ -+ Remove pattern length argument from match_pattern_list(), we -+ only ever use it for strlen(pattern). -+ -+ Prompted by hanno AT hboeck.de pointing an out-of-bound read -+ error caused by an incorrect pattern length found using AFL -+ and his own tools. -+ -+ ok markus@ -+ -+commit e696ae7c0f3b753718fac02206545e740be7ba2c -+Author: djm@openbsd.org -+Date: Fri May 1 07:10:01 2015 +0000 -+ -+ upstream commit -+ -+ refactor ssh_dispatch_run_fatal() to use sshpkt_fatal() -+ to better report error conditions. Teach sshpkt_fatal() about ECONNRESET. -+ -+ Improves error messages on TCP connection resets. bz#2257 -+ -+ ok dtucker@ -+ -+commit e7b3293cb288e14eb6ffd24bafbe5d354f733332 -+Author: djm@openbsd.org -+Date: Fri May 1 07:08:08 2015 +0000 -+ -+ upstream commit -+ -+ a couple of parse targets were missing activep checks, -+ causing them to be misapplied in match context; bz#2272 diagnosis and -+ original patch from Sami Hartikainen ok dtucker@ -+ -+commit 7d58a0e74dc0dd402a7a6dc6309a6e9cf6f43900 -+Author: djm@openbsd.org -+Date: Fri May 1 04:17:51 2015 +0000 -+ -+ upstream commit -+ -+ make handling of AuthorizedPrincipalsFile=none more -+ consistent with other =none options; bz#2288 from Jakub Jelen; ok dtucker@ -+ -+commit 23e2924417894f0b381dc8737d4e35c0b2bcbd9f -+Author: djm@openbsd.org -+Date: Fri May 1 04:03:20 2015 +0000 -+ -+ upstream commit -+ -+ remove failed remote forwards established by muliplexing -+ from the list of active forwards; bz#2363, patch mostly by Yoann Ricordel; ok -+ dtucker@ -+ -+commit d046256582cdb7876ca0ca7de3916dc631eeeed8 -+Author: djm@openbsd.org -+Date: Fri May 1 04:01:58 2015 +0000 -+ -+ upstream commit -+ -+ reduce stderr spam when using ssh -S /path/mux -O forward -+ -R 0:... ok dtucker@ -+ -+commit 89b2d54b3e69cd58719a98c16b9d3f2bc00ab3ad -+Author: djm@openbsd.org -+Date: Fri May 1 03:23:51 2015 +0000 -+ -+ upstream commit -+ -+ prevent authorized_keys options picked up on public key -+ tests without a corresponding private key authentication being applied to -+ other authentication methods. Reported by halex@, ok markus@ -+ -+commit ae0b6603cf18c7959b86b67ab4749d9d9014e08b -+Author: djm@openbsd.org -+Date: Fri May 1 03:20:54 2015 +0000 -+ -+ upstream commit -+ -+ Don't make parsing of authorized_keys' environment= -+ option conditional on PermitUserEnv - always parse it, but only use the -+ result if the option is enabled. This prevents the syntax of authorized_keys -+ changing depending on which sshd_config options were enabled. -+ -+ bz#2329; based on patch from coladict AT gmail.com, ok dtucker@ -+ -+commit c0712dbfc38644640d5d6052c1b228110aea0bf4 -+Author: djm@openbsd.org -+Date: Mon May 4 06:10:48 2015 +0000 -+ -+ upstream commit -+ -+ Remove pattern length argument from match_pattern_list(), we -+ only ever use it for strlen(pattern). -+ -+ Prompted by hanno AT hboeck.de pointing an out-of-bound read -+ error caused by an incorrect pattern length found using AFL -+ and his own tools. -+ -+ ok markus@ -+ -+commit d59f191b6622aef92126a04cc58f9f3f0b2a5845 -+Author: dtucker@openbsd.org -+Date: Thu Apr 23 05:01:19 2015 +0000 -+ -+ upstream commit -+ -+ Add a simple regression test for sshd's configuration -+ parser. Right now, all it does is run the output of sshd -T back through -+ itself and ensure the output is valid and invariant. -+ -+commit fd920bb1d29d550387b6d99f06ea513d3572aa9e -+Author: djm@openbsd.org -+Date: Wed Apr 22 01:38:36 2015 +0000 -+ -+ upstream commit -+ -+ use correct key for nested certificate test -+ -+commit d9900a6e1da6dacf669f05605f7f2b29dfcaad29 -+Author: djm@openbsd.org -+Date: Fri May 1 07:11:47 2015 +0000 -+ -+ upstream commit -+ -+ mention that the user's shell from /etc/passwd is used -+ for commands too; bz#1459 ok dtucker@ -+ -+commit c15287fe6c45cff7e974d9a9ac63c1271aaa1cd7 -+Author: djm@openbsd.org -+Date: Fri May 8 07:29:00 2015 +0000 -+ -+ upstream commit -+ -+ whitespace -+ -+ Upstream-Regress-ID: 6b708a3e709d5b7fd37890f874bafdff1f597519 -+ -+commit e027e4fc6ee774291f87c4ceda971937ed7ff94a -+Author: djm@openbsd.org -+Date: Fri May 8 07:26:13 2015 +0000 -+ -+ upstream commit -+ -+ whitespace at EOL -+ -+ Upstream-Regress-ID: 9c48911643d5b05173b36a012041bed4080b8554 -+ -+commit 641d9e47db5c26f4e392f22ccc20dde581963d8d -+Author: djm@openbsd.org -+Date: Fri May 8 06:45:13 2015 +0000 -+ -+ upstream commit -+ -+ moar whitespace at eol -+ -+ Upstream-ID: 64eaf872a3ba52ed41e494287e80d40aaba4b515 -+ -+commit 97b740e001578b4a179bfbc7f1270b168d363690 -+Author: djm@openbsd.org -+Date: Fri May 8 06:41:56 2015 +0000 -+ -+ upstream commit -+ -+ whitespace at EOL -+ -+ Upstream-ID: 57bcf67d666c6fc1ad798aee448fdc3f70f7ec2c -+ -+commit e40a6ff28b2bcd503553aa7adf0a33adefe7052a -+Author: djm@openbsd.org -+Date: Fri May 8 03:56:51 2015 +0000 -+ -+ upstream commit -+ -+ whitespace at EOL -+ -+commit 452aa680004f983d150bfeccc5d131ca6e1c47a6 -+Author: dtucker@openbsd.org -+Date: Mon May 4 01:47:53 2015 +0000 -+ -+ upstream commit -+ -+ Use diff w/out -u for better portability -+ -+commit c520597f7a5bfd36d8fb5937e560f722550be39a -+Author: dtucker@openbsd.org -+Date: Fri May 8 03:25:07 2015 +0000 -+ -+ upstream commit -+ -+ Use xcalloc for permitted_adm_opens instead of xmalloc to -+ ensure it's zeroed. Fixes post-auth crash with permitopen=none. bz#2355, ok -+ djm@ -+ -+commit f76b441b38303b98e831f2c316d6840462e14146 -+Author: djm@openbsd.org -+Date: Fri May 8 03:17:49 2015 +0000 -+ -+ upstream commit -+ -+ don't choke on new-format private keys encrypted with an -+ AEAD cipher; bz#2366, patch from Ron Frederick; ok markus@ -+ -+commit 47cc21c3046ae41accc0dcf8e48a4e8ec086ad04 -+Author: dtucker@openbsd.org -+Date: Wed May 6 05:45:17 2015 +0000 -+ -+ upstream commit -+ -+ Clarify pseudo-terminal request behaviour and use -+ "pseudo-terminal" consistently. bz#1716, ok jmc@ "I like it" deraadt@. -+ -+commit bd97cced3dc5cf708ae85a20550defcf1f40c88a -+Author: dtucker@openbsd.org -+Date: Wed May 6 04:07:18 2015 +0000 -+ -+ upstream commit -+ -+ Blacklist DH-GEX for specific PuTTY versions known to -+ send non-RFC4419 DH-GEX messages rather than all versions of PuTTY. -+ According to Simon Tatham, 0.65 and newer versions will send RFC4419 DH-GEX -+ messages. ok djm@ -+ -+commit 81586a35c303a26b1e4350dedd83e62b2c943b93 -+Author: dtucker@openbsd.org -+Date: Tue May 5 10:17:49 2015 +0000 -+ -+ upstream commit -+ -+ WinSCP doesn't implement RFC4419 DH-GEX so flag it so we -+ don't offer that KEX method. ok markus@ -+ -+commit cfad95ba9ef0bab4b3c50f97386ce6f33706c00e -+Author: jsg@openbsd.org -+Date: Tue May 5 02:48:17 2015 +0000 -+ -+ upstream commit -+ -+ use the sizeof the struct not the sizeof a pointer to the -+ struct in ssh_digest_start() -+ -+ This file is only used if ssh is built with OPENSSL=no -+ -+ ok markus@ -+ -+commit 044a3cb310e345f7161d0cc03950b0585486c3d7 -+Author: Darren Tucker -+Date: Fri May 8 11:07:27 2015 +1000 -+ -+ Put brackets around mblen() compat constant. -+ -+ This might help with the reported problem cross compiling for Android -+ ("error: expected identifier or '(' before numeric constant") but -+ shouldn't hurt in any case. -+ -+commit bca14b4a070fa9f4608732d18032b0d21fa86e95 -+Author: Darren Tucker -+Date: Thu Apr 30 09:18:11 2015 +1000 -+ -+ xrealloc -> xreallocarray in portable code too. -+ -+commit 825dc0beaa0350714b41e9e36fad90e4f7bbfa6a -+Author: dtucker@openbsd.org -+Date: Wed Apr 29 03:48:56 2015 +0000 -+ -+ upstream commit -+ -+ Allow ListenAddress, Port and AddressFamily in any -+ order. bz#68, ok djm@, jmc@ (for the man page bit). -+ -+commit cfbf3fd44c6255e2eca3f13d68fae41c7be298b9 -+Author: jmc@openbsd.org -+Date: Tue Apr 28 13:47:38 2015 +0000 -+ -+ upstream commit -+ -+ enviroment -> environment: apologies to darren for not -+ spotting that first time round... -+ -+commit 8ca5ffc2c6af5f85330ec19409ce47b853723b5a -+Author: dtucker@openbsd.org -+Date: Tue Apr 28 10:25:15 2015 +0000 -+ -+ upstream commit -+ -+ Fix typo in previous -+ -+commit a1d15ecba8907fd9e5b2632bf387a4711e70f5e4 -+Author: dtucker@openbsd.org -+Date: Tue Apr 28 10:17:58 2015 +0000 -+ -+ upstream commit -+ -+ Document that the TERM environment variable is not -+ subject to SendEnv and AcceptEnv. bz#2386, based loosely on a patch from -+ jjelen at redhat, help and ok jmc@ -+ -+commit 14c8514c6a558868848516d3090415627ea9d7db -+Author: djm@openbsd.org -+Date: Mon Apr 27 21:42:48 2015 +0000 -+ -+ upstream commit -+ -+ Make sshd default to PermitRootLogin=no; ok deraadt@ -+ rpe@ -+ -+commit badd27ebf44b9fed834ffe7dca10a7f03c1670cf -+Author: djm@openbsd.org -+Date: Mon Apr 27 01:52:30 2015 +0000 -+ -+ upstream commit -+ -+ fix compilation with OPENSSL=no; ok dtucker@ -+ -+commit b10bb7e02c4797b13cf5314b0707588cef871571 -+Author: dtucker@openbsd.org -+Date: Mon Apr 27 00:37:53 2015 +0000 -+ -+ upstream commit -+ -+ Include stdio.h for FILE (used in sshkey.h) so it -+ compiles with OPENSSL=no. -+ -+commit d55cb41ae1caf0c255e193d1e3457a09f76a9dd2 -+Author: djm@openbsd.org -+Date: Mon Apr 27 00:21:21 2015 +0000 -+ -+ upstream commit -+ -+ allow "sshd -f none" to skip reading the config file, -+ much like "ssh -F none" does. ok dtucker -+ -+commit 63d4ab25ae1138352bf708f1e5904e31ad4a2486 -+Author: jmc@openbsd.org -+Date: Fri Apr 24 06:26:49 2015 +0000 -+ -+ upstream commit -+ -+ combine -Dd onto one line and update usage(); -+ -+commit 22616ba0daebce85fc47dfe55a4b560d792eb45e -+Author: djm@openbsd.org -+Date: Fri Apr 24 05:26:44 2015 +0000 -+ -+ upstream commit -+ -+ add ssh-agent -D to leave ssh-agent in foreground -+ without enabling debug mode; bz#2381 ok dtucker@ -+ -+commit 8e5165d5456ece5df2a108be1ef0351dbd76da4a -+Author: deraadt@openbsd.org -+Date: Fri Apr 24 01:36:24 2015 +0000 -+ -+ upstream commit -+ -+ 2*len -> use xreallocarray() ok djm -+ -+commit 771863d7470d8faa5c04a4dc212aba18198e3e3e -+Author: deraadt@openbsd.org -+Date: Fri Apr 24 01:36:00 2015 +0000 -+ -+ upstream commit -+ -+ rename xrealloc() to xreallocarray() since it follows -+ that form. ok djm -+ -+commit 22b25aad8ea096d780ca38482736c9483cc9f90b -+Author: dtucker@openbsd.org -+Date: Thu Apr 23 04:59:10 2015 +0000 -+ -+ upstream commit -+ -+ Two small fixes for sshd -T: ListenAddress'es are added -+ to a list head so reverse the order when printing them to ensure the -+ behaviour remains the same, and print StreamLocalBindMask as octal with -+ leading zero. ok deraadt@ -+ -+commit f5b674c8496277052adc93a4a6bf781e72f24b43 -+Author: dtucker@openbsd.org -+Date: Thu Apr 23 04:53:53 2015 +0000 -+ -+ upstream commit -+ -+ Check for and reject missing arguments for -+ VersionAddendum and ForceCommand. bz#2281, patch from plautrba at redhat com, -+ ok djm@ -+ -+commit 1b1af6a6361a5f05253b82177cf262450a3ea0f2 -+Author: djm@openbsd.org -+Date: Wed Apr 22 01:24:01 2015 +0000 -+ -+ upstream commit -+ -+ unknown certificate extensions are non-fatal, so don't -+ fatal when they are encountered; bz#2387 reported by Bob Van Zant; ok -+ dtucker@ -+ -+commit 140ebd5d4b2deb6b4fc9d0e252de7776f2001189 -+Author: jsg@openbsd.org -+Date: Tue Apr 21 07:01:00 2015 +0000 -+ -+ upstream commit -+ -+ Add back a backslash removed in rev 1.42 so -+ KEX_SERVER_ENCRYPT will include aes again. -+ -+ ok deraadt@ -+ -+commit 86cb5571b25964f682fc04d9aa5f0bd08dcd1e17 -+Author: djm@openbsd.org -+Date: Fri Apr 17 13:32:09 2015 +0000 -+ -+ upstream commit -+ -+ s/recommended/required/ that private keys be og-r this -+ wording change was made a while ago but got accidentally reverted -+ -+commit 1ff769330a9073b92f750e4fb16d47a53eb90be3 -+Author: djm@openbsd.org -+Date: Fri Apr 17 13:25:52 2015 +0000 -+ -+ upstream commit -+ -+ don't try to cleanup NULL KEX proposals in -+ kex_prop_free(); found by Jukka Taimisto and Markus Hietava -+ -+commit af96b0c0af6fce2f678e662e09aa09b58e565b7f -+Author: djm@openbsd.org -+Date: Fri Apr 17 13:19:22 2015 +0000 -+ -+ upstream commit -+ -+ use error/logit/fatal instead of fprintf(stderr, ...) -+ and exit(0), fix a few errors that were being printed to stdout instead of -+ stderr and a few non-errors that were going to stderr instead of stdout -+ bz#2325; ok dtucker -+ -+commit af481dffe012ea1c307796f7e5429440cae7cba9 -+Author: djm@openbsd.org -+Date: Fri Apr 17 13:16:48 2015 +0000 -+ -+ upstream commit -+ -+ debug log missing DISPLAY environment when X11 -+ forwarding requested; bz#1682 ok dtucker@ -+ -+commit 8fd3968a798d0a169b54d52a2bc43134ee43be4b -+Author: djm@openbsd.org -+Date: Fri Apr 17 04:32:31 2015 +0000 -+ -+ upstream commit -+ -+ don't call record_login() in monitor when UseLogin is -+ enabled; bz#278 reported by drk AT sgi.com; ok dtucker -+ -+commit 97f50a2b78fde64a9589bc7bd443ac1f6b7d263e -+Author: dtucker@openbsd.org -+Date: Fri Apr 17 04:12:35 2015 +0000 -+ -+ upstream commit -+ -+ Add some missing options to sshd -T and fix the output -+ of VersionAddendum HostCertificate. bz#2346, patch from jjelen at redhat -+ com, ok djm. -+ -+commit 2f36c64f0342420d48afa9587db0d98a481e60ed -+Author: dtucker@openbsd.org -+Date: Thu Apr 16 23:25:50 2015 +0000 -+ -+ upstream commit -+ -+ Document "none" for PidFile XAuthLocation -+ TrustedUserCAKeys and RevokedKeys. bz#2382, feedback from jmc@, ok djm@ -+ -+commit 81e7ec48915698930831cba4eec5bb0c1d5c35f0 -+Author: dtucker@openbsd.org -+Date: Wed Apr 15 23:23:25 2015 +0000 -+ -+ upstream commit -+ -+ Plug leak of address passed to logging. bz#2373, patch -+ from jjelen at redhat, ok markus@ -+ -+commit 3934a2c30f75c5d1990c66fb6b0d9825be68c628 -+Author: dtucker@openbsd.org -+Date: Tue Apr 14 04:17:03 2015 +0000 -+ -+ upstream commit -+ -+ Output remote username in debug output since with Host -+ and Match it's not always obvious what it will be. bz#2368, ok djm@ -+ -+commit 70282c43ba8649fd1cfefb057d8fa1ac3e6dc7d2 -+Author: Darren Tucker -+Date: Fri Apr 17 10:56:13 2015 +1000 -+ -+ Format UsePAM setting when using sshd -T. -+ -+ Part of bz#2346, patch from jjelen at redhat com. -+ -+commit 39e173a32831323157d889f31cd53f88dd58f1b4 -+Author: Darren Tucker -+Date: Fri Apr 17 10:40:23 2015 +1000 -+ -+ Wrap endian.h include inside ifdef (bz#2370). -+ -+commit 53ab080aabbed2851cea20322588816fa4822080 -+Author: Darren Tucker -+Date: Fri Apr 17 09:39:58 2015 +1000 -+ -+ Look for '${host}-ar' before 'ar'. -+ -+ This changes configure.ac to look for '${host}-ar' as set by -+ AC_CANONICAL_HOST before looking for the unprefixed 'ar'. -+ Useful when cross-compiling when all your binutils are prefixed. -+ -+ Patch from moben at exherbo org via astrand at lysator liu se and -+ bz#2352. -+ -+commit 302bf2dd03234133a7e64873cc521004ade0968f -+Author: Damien Miller -+Date: Thu Apr 16 11:40:20 2015 +1000 -+ -+ remove dependency on arpa/telnet.h -+ -+commit 2e9788285c366324451144ed717628f7e4a784f4 -+Author: Darren Tucker -+Date: Wed Apr 15 15:59:49 2015 +1000 -+ -+ Remove duplicate include of pwd.h. bz#2337, patch from Mordy Ovits. -+ -+commit b870b9408d02191161f773fdeaea6217e7c6de06 -+Author: Damien Miller -+Date: Thu Apr 9 10:14:48 2015 +1000 -+ -+ platform's with openpty don't need pty_release -+ -+commit ac7c8d1f0b4bab03c3cf8a9a5a8fc160c316018a -+Author: djm@openbsd.org -+Date: Mon Apr 13 02:04:08 2015 +0000 -+ -+ upstream commit -+ -+ deprecate ancient, pre-RFC4419 and undocumented -+ SSH2_MSG_KEX_DH_GEX_REQUEST_OLD message; ok markus@ deraadt@ "seems -+ reasonable" dtucker@ -+ -+commit baf4e5c201f83e09a7b0a4eb7e9e9cb4c6527188 -+Author: dtucker@openbsd.org -+Date: Fri Apr 10 05:16:50 2015 +0000 -+ -+ upstream commit -+ -+ Don't send hostkey advertisments -+ (hostkeys-00@openssh.com) to current versions of Tera Term as they can't -+ handle them. Newer versions should be OK. Patch from Bryan Drewery and -+ IWAMOTO Kouichi, ok djm@ -+ -+commit 1e3ff7c536ad5157e70156ad616849d9069514eb -+Author: djm@openbsd.org -+Date: Fri Apr 10 00:08:55 2015 +0000 -+ -+ upstream commit -+ -+ include port number if a non-default one has been -+ specified; based on patch from Michael Handler -+ -+commit 2faa9d5915b7cfab88a3ffe34d72c86045248a51 -+Author: djm@openbsd.org -+Date: Tue Apr 7 23:00:42 2015 +0000 -+ -+ upstream commit -+ -+ treat Protocol=1,2|2,1 as Protocol=2 when compiled -+ without SSH1 support; ok dtucker@ millert@ -+ -+commit cf16652511985188d2f2b45c92fd93b34581f50e -+Author: miod@openbsd.org -+Date: Sun Apr 5 15:43:43 2015 +0000 -+ -+ upstream commit -+ -+ Do not use int for sig_atomic_t; spotted by -+ christos@netbsd; ok markus@ -+ -+commit 815d06977866484c02e651b6f6461adfbdb8412e -+Author: Darren Tucker -+Date: Tue Apr 7 10:48:04 2015 +1000 -+ -+ Use do{}while(0) for no-op functions. -+ -+ From FreeBSD. -+ -+commit c19f4c1652a5ca390b3b53851342f5a0d3a614f1 -+Author: Darren Tucker -+Date: Tue Apr 7 10:47:15 2015 +1000 -+ -+ Wrap blf.h include in ifdef. From FreeBSD. -+ -+commit 8b3fc01e27d03325c7bcdeee15af9cee8c5a54d3 -+Author: Darren Tucker -+Date: Tue Apr 7 09:10:00 2015 +1000 -+ -+ Fix misspellings of regress CONFOPTS env variables. -+ -+ Patch from Bryan Drewery. -+ -+commit 07fbb2fa7c72dadc4321f56d28639d7b8d72dd68 -+Author: djm@openbsd.org -+Date: Fri Apr 3 22:17:27 2015 +0000 -+ -+ upstream commit -+ -+ correct return value in pubkey parsing, spotted by Ben Hawkes -+ ok markus@ -+ -+commit 7d201bd757e4461e36264acba5a51048b291d0b4 -+Author: djm@openbsd.org -+Date: Tue Mar 31 22:59:01 2015 +0000 -+ -+ upstream commit -+ -+ adapt to recent hostfile.c change: when parsing -+ known_hosts without fully parsing the keys therein, hostkeys_foreach() will -+ now correctly identify KEY_RSA1 keys; ok markus@ miod@ -+ -+commit 79fd33869146f4b466b937d3e2cde97fdb788018 -+Author: markus@openbsd.org -+Date: Tue Mar 24 20:19:15 2015 +0000 -+ -+ upstream commit -+ -+ use ${SSH} for -Q instead of installed ssh -+ -+commit c24ade912823bcda71bde621a9b835a2ccdddef6 -+Author: djm@openbsd.org -+Date: Mon Mar 16 22:46:14 2015 +0000 -+ -+ upstream commit -+ -+ make CLEANFILES clean up more of the tests' droppings -+ -+commit 6c174301d5d9bbff943f149b37660a46977da512 -+Author: djm@openbsd.org -+Date: Tue Mar 31 22:57:06 2015 +0000 -+ -+ upstream commit -+ -+ downgrade error() for known_hosts parse errors to debug() -+ to quiet warnings from ssh1 keys present when compiled !ssh1. -+ -+ also identify ssh1 keys when scanning, even when compiled !ssh1 -+ -+ ok markus@ miod@ -+ -+commit 7af512d9fe6fdc431735f95d4679b8d9fda4699c -+Author: djm@openbsd.org -+Date: Tue Mar 31 22:55:50 2015 +0000 -+ -+ upstream commit -+ -+ fd leak for !ssh1 case; found by unittests; ok markus@ -+ -+commit e39e6616970732533f4065bc8ce295c5e5ca9c6a -+Author: djm@openbsd.org -+Date: Tue Mar 31 22:55:24 2015 +0000 -+ -+ upstream commit -+ -+ don't fatal when a !ssh1 sshd is reexeced from a w/ssh1 -+ listener; reported by miod@; ok miod@ markus@ -+ -+commit 4b39fc71d57014d4b61c8e67641ee61e2abee194 -+Author: tobias@openbsd.org -+Date: Tue Mar 31 11:06:49 2015 +0000 -+ -+ upstream commit -+ -+ Comments are only supported for RSA1 keys. If a user -+ tried to add one and entered his passphrase, explicitly clear it before exit. -+ This is done in all other error paths, too. -+ -+ ok djm -+ -+commit e95e13468ac125d1d50354d861c49523c368be73 -+Author: jmc@openbsd.org -+Date: Mon Mar 30 18:28:37 2015 +0000 -+ -+ upstream commit -+ -+ ssh-askpass(1) is the default, overridden by SSH_ASKPASS; -+ diff originally from jiri b; -+ -+commit 80b90562210e1d330a60f33446f4e3c416259d4a -+Author: djm@openbsd.org -+Date: Mon Mar 30 00:00:29 2015 +0000 -+ -+ upstream commit -+ -+ fix uninitialised memory read when parsing a config file -+ consisting of a single nul byte. Found by hanno AT hboeck.de using AFL; ok -+ dtucker -+ -+commit 59f8a8df074602f7b15acd48a9afa67be2fa428a -+Author: markus@openbsd.org -+Date: Thu Mar 26 19:32:19 2015 +0000 -+ -+ upstream commit -+ -+ sigp and lenp are not optional in ssh_agent_sign(); ok -+ djm@ -+ -+commit 64c6afa0ebe46bf1d3888bb42b19d7a41fc0b108 -+Author: naddy@openbsd.org -+Date: Thu Mar 26 12:32:38 2015 +0000 -+ -+ upstream commit -+ -+ don't try to load .ssh/identity by default if SSH1 is -+ disabled; ok markus@ -+ -+commit ea14fc394d6823dc42a6b9919a41b8cc38eb4484 -+Author: djm@openbsd.org -+Date: Thu Mar 26 07:00:04 2015 +0000 -+ -+ upstream commit -+ -+ ban all-zero curve25519 keys as recommended by latest -+ CFRG curves draft; ok markus -+ -+commit a8bbfa1d0e905cbe3b7fc38dadfb7bf955df7db2 -+Author: djm@openbsd.org -+Date: Thu Mar 26 06:59:28 2015 +0000 -+ -+ upstream commit -+ -+ relax bits needed check to allow -+ diffie-hellman-group1-sha1 key exchange to complete for chacha20-poly1305 was -+ selected as symmetric cipher; ok markus -+ -+commit c341d3fc3d4888ca19d75aa0ff51ef3d86b7b0db -+Author: markus@openbsd.org -+Date: Wed Mar 25 19:29:58 2015 +0000 -+ -+ upstream commit -+ -+ ignore v1 errors on ssh-add -D; only try v2 keys on -+ -l/-L (unless WITH_SSH1) ok djm@ -+ -+commit ce76f0d00d27bae9bf18aad817497ca45042e14a -+Author: markus@openbsd.org -+Date: Wed Mar 25 19:21:48 2015 +0000 -+ -+ upstream commit -+ -+ unbreak ssh_agent_sign (lenp vs *lenp) -+ -+commit d90e2d9b5b93c9e102958c42848d10e5a96f624c -+Author: markus@openbsd.org -+Date: Tue Mar 24 20:10:08 2015 +0000 -+ -+ upstream commit -+ -+ don't leak 'setp' on error; noted by Nicholas Lemonias; -+ ok djm@ -+ -+commit a644ce315eeea99d4d8c47f990bd8243059328b9 -+Author: markus@openbsd.org -+Date: Tue Mar 24 20:09:11 2015 +0000 -+ -+ upstream commit -+ -+ consistent check for NULL as noted by Nicholas -+ Lemonias; ok djm@ -+ -+commit cba9884f9db3ca2a9dd8bef5f41c4aaa0ddb94aa -+Author: markus@openbsd.org -+Date: Tue Mar 24 20:03:44 2015 +0000 -+ -+ upstream commit -+ -+ correct fmt-string for size_t as noted by Nicholas -+ Lemonias; ok djm@ -+ -+commit ba85aed3338e4bc2597b7b2367837e605014b04c -+Author: djm@openbsd.org -+Date: Tue Mar 24 09:17:21 2015 +0000 -+ -+ upstream commit -+ -+ promote chacha20-poly1305@openssh.com to be the default -+ cipher; ok markus -+ -+commit fd303af886c743096a93e9cc37652ce2a88b7b27 -+Author: djm@openbsd.org -+Date: Tue Mar 24 01:29:19 2015 +0000 -+ -+ upstream commit -+ -+ Compile-time disable SSH protocol 1. You can turn it -+ back on using the Makefile.inc knob if you need it to talk to ancient -+ devices. -+ -+commit 15fe132a82653364dca3eab1e10bf44e56b5f9eb -+Author: djm@openbsd.org -+Date: Tue Mar 24 01:11:12 2015 +0000 -+ -+ upstream commit -+ -+ fix double-negative error message "ssh1 is not -+ unsupported" -+ -+commit 3abda331e3787211017a4f4d2c0bf8a3ae992aa5 -+Author: djm@openbsd.org -+Date: Mon Mar 23 06:06:38 2015 +0000 -+ -+ upstream commit -+ -+ for ssh-keygen -A, don't try (and fail) to generate ssh -+ v.1 keys when compiled without SSH1 support RSA/DSA/ECDSA keys when compiled -+ without OpenSSL based on patch by Mike Frysinger; bz#2369 -+ -+commit b44e46845f356b3663174ad663df5c1d464ee0a5 -+Author: djm@openbsd.org -+Date: Wed Mar 18 01:44:21 2015 +0000 -+ -+ upstream commit -+ -+ KRL support doesn't need OpenSSL anymore, remove #ifdefs -+ from around call -+ -+commit 4fc18adeebffb360a5de77f051335b776da0f3b3 -+Author: djm@openbsd.org -+Date: Mon Mar 16 11:09:52 2015 +0000 -+ -+ upstream commit -+ -+ #if 0 some more arrays used only for decrypting (we don't -+ use since we only need encrypt for AES-CTR) -+ -+commit b97433b9cefd924b89b9ff604fad24ad1f61334b -+Author: jsg@openbsd.org -+Date: Wed Mar 11 00:48:39 2015 +0000 -+ -+ upstream commit -+ -+ add back the changes from rev 1.206, djm reverted this by -+ mistake in rev 1.207 -+ -+commit d2462684ffd300420ea512147a73636b38748ae5 -+Author: Damien Miller -+Date: Fri Mar 20 09:11:59 2015 +1100 -+ -+ remove error() accidentally inserted for debugging -+ -+ pointed out by Christian Hesse -+ - commit af1f084857621f14bd9391aba8033d35886c2455 - Author: dtucker@openbsd.org - Date: Fri Jul 15 05:01:58 2016 +0000 -@@ -3607,6 +8936,12 @@ - - Upstream-ID: 1a97465ede8790b4d47cb618269978e07f41f8ac - -+commit 9ed8887c95b1a892b988c3dd30f1f5e7e48e0b56 -+Author: rapier -+Date: Fri Jul 1 15:19:40 2016 -0400 -+ -+ Added an option to disable the multithreaded cipher at runtime -oDisableMTAES=yes -+ - commit 46ecd19e554ccca15a7309cd1b6b44bc8e6b84af - Author: djm@openbsd.org - Date: Thu Jun 23 05:17:51 2016 +0000 -@@ -3939,6 +9274,12 @@ - - Upstream-ID: b4b84fa04aab2de7e79a6fee4a6e1c189c0fe775 - -+commit 6aa62f3d29e0ea1ccd01ffba80d0d2ee0c6c0cec -+Author: Venkat Yekkirala -+Date: Mon Jun 6 15:25:15 2016 -0500 -+ -+ Updated version tag for 7.1p2f -+ - commit df820722e40309c9b3f360ea4ed47a584ed74333 - Author: Darren Tucker - Date: Mon Jun 6 11:36:13 2016 +1000 -@@ -4071,6 +9412,12 @@ - - Upstream-ID: bf968da7cfcea2a41902832e7d548356a4e2af34 - -+commit a8a5e8b172da89b9992a1879ab68dd79d5b3b58d -+Author: Venkat Yekkirala -+Date: Sun Jun 5 16:42:23 2016 -0500 -+ -+ Fix to use sshd_config from installed location. -+ - commit ae9c0d4d5c581b3040d1f16b5c5f4b1cd1616743 - Author: Darren Tucker - Date: Fri Jun 3 16:03:44 2016 +1000 -@@ -4079,6 +9426,12 @@ - - This will be needed for the upcoming utf8 changes. - -+commit 8dc6768d74ae511a95ba73dbeb8ec180479c22e1 -+Author: rapier -+Date: Wed Jun 1 13:54:22 2016 -0400 -+ -+ None cipher switch was failing. Turns out that myproposal is no longer maintained as a const. Instead the default proposals are stored in myproposal_deafult and then memcpy'd to myproposal (in ssh_kex2). I wasn't aware of this so when setting the cipher to none via overwriting the values in myproposal the rest of the kex data was null. Fixed this with a memcpy prior to requesting the none cipher -+ - commit e1d93705f8f48f519433d6ca9fc3d0abe92a1b77 - Author: Tim Rice - Date: Tue May 31 11:13:22 2016 -0700 -@@ -4157,6 +9510,24 @@ - - Upstream-ID: c2f97502efc761a41b18c17ddf460e138ca7994e - -+commit d44dbf46d17cac79412638dfed97bf6c1e370967 -+Author: Venkat Yekkirala -+Date: Fri May 13 20:23:33 2016 -0500 -+ -+ DisableUsageStats now defaults to Yes. Also moved the DisableUsageStats directive to be ahead of the Match directives in sshd_config. -+ -+commit b8d71492f03f8d7a4bd5981a74df575c34f7bdfc -+Author: Venkat Yekkirala -+Date: Thu May 12 11:40:35 2016 -0500 -+ -+ Deleted conflicting initialization in extern declaration of audit_disabled. -+ -+commit b4c2e4cfa4858ea6a51ff8e9cdf358f1cf0b843e -+Author: Venkat Yekkirala -+Date: Thu May 12 11:24:07 2016 -0500 -+ -+ Make sure clients don't try to perform iSSHD auditing. -+ - commit 332ff3d770631e7513fea38cf0d3689f673f0e3f - Author: Damien Miller - Date: Tue May 10 09:51:06 2016 +1000 -@@ -4404,6 +9775,13 @@ - - Upstream-ID: 13e7327fe85f6c63f3f7f069e0fdc8c351515d11 - -+commit 6c21335ab1ad1586d93ea7d71f5a52f5c39fcbc4 -+Merge: d9754b4 5c35450 -+Author: rapier -+Date: Wed Apr 27 17:46:25 2016 -0400 -+ -+ First commit of 7.2 merge into HPN -+ - commit b6e0140a5aa883c27b98415bd8aa9f65fc04ee22 - Author: djm@openbsd.org - Date: Thu Apr 21 06:08:02 2016 +0000 -@@ -4701,6 +10079,48 @@ - survive paths containing whitespace. bz#2551, from Corinna Vinschen via - Philip Hands. - -+commit adedf65bb37cdbb9a4e6a30cdeeeb76646430699 -+Author: Venkat Yekkirala -+Date: Fri Mar 11 11:17:41 2016 -0600 -+ -+ Disable iSSHD auditing by default in the source code itself. -+ -+commit 44a487b2b9a34b42d7c741a95b0b591a49560413 -+Author: Venkat Yekkirala -+Date: Fri Mar 11 10:44:28 2016 -0600 -+ -+ Updated to GSI_GSSAPI_20160311 in preparation for new release. -+ -+commit e57671efd7d6da3cc1d0d05d514a5262cf3b4d45 -+Merge: e8da6be 4281a30 -+Author: Venkat Yekkirala -+Date: Fri Mar 11 10:38:04 2016 -0600 -+ -+ Merge branch 'master' into GSI_ISSHD_HPN_7_1_P2 -+ -+commit e8da6be0949830f6bc471d2f0c73556f44d15833 -+Author: Venkat Yekkirala -+Date: Fri Mar 11 10:37:41 2016 -0600 -+ -+ Fixes for building kerberos/mechglue without GSI. -+ -+commit 4281a30c30b40315e0e68f7e2336dd74f508ea43 -+Merge: a076b93 907167c -+Author: Venkat Yekkirala -+Date: Fri Mar 11 10:18:58 2016 -0600 -+ -+ Merge pull request #11 from globus/skip-function-probes -+ -+ Skip probing for specific globus funcs -+ -+commit 907167cfb3f9bcb4f4dcb747981724efb7b8d32c -+Author: Joseph Bester -+Date: Fri Mar 11 09:16:35 2016 -0500 -+ -+ Skip probing for specific globus funcs -+ -+ - Those functions are implied by the pkg-config dependency -+ - commit 627824480c01f0b24541842c7206ab9009644d02 - Author: Darren Tucker - Date: Fri Mar 11 14:47:41 2016 +1100 -@@ -4709,6 +10129,20 @@ - - From alex at cooperi.net. - -+commit 5c35450a0c901d9375fb23343a8dc82397da5f75 -+Author: Damien Miller -+Date: Thu Mar 10 05:04:48 2016 +1100 -+ -+ update versions for release -+ -+commit 9d47b8d3f50c3a6282896df8274147e3b9a38c56 -+Author: Damien Miller -+Date: Thu Mar 10 05:03:39 2016 +1100 -+ -+ sanitise characters destined for xauth(1) -+ -+ reported by github.com/tintinweb -+ - commit e960051f9a264f682c4d2fefbeecffcfc66b0ddf - Author: Darren Tucker - Date: Wed Mar 9 13:14:18 2016 +1100 -@@ -4768,6 +10202,12 @@ - - Upstream-ID: 5f2e4df88d4803fc8ec59ec53629105e23ce625e - -+commit a076b93b146df361b2ba98ac1b72164b0065535c -+Author: Venkat Yekkirala -+Date: Fri Mar 4 10:20:21 2016 -0600 -+ -+ Mechglue build fixes. -+ - commit af0bb38ffd1f2c4f9f43b0029be2efe922815255 - Author: Damien Miller - Date: Fri Mar 4 15:11:55 2016 +1100 -@@ -4868,6 +10308,15 @@ - - Upstream-ID: 9ad8a07e1a12684e1b329f9bd88941b249d4b2ad - -+commit dc37e887e7e006b5e2b9be0a181eec50d281d5fb -+Merge: d4c592f c8a85eb -+Author: Venkat Yekkirala -+Date: Wed Mar 2 10:41:00 2016 -0600 -+ -+ Merge pull request #10 from globus/allow-older-pkgconfig -+ -+ Reduce pkg-config version requirement -+ - commit 2ed17aa34008bdfc8db674315adc425a0712be11 - Author: Darren Tucker - Date: Tue Mar 1 15:24:20 2016 +1100 -@@ -4882,6 +10331,12 @@ - - Add a note about using xlc on AIX. - -+commit c8a85ebf90c7acacef363f5988cf0d4dfdebf3d4 -+Author: Joseph Bester -+Date: Wed Feb 24 13:02:24 2016 -0500 -+ -+ Reduce pkg-config version requirement -+ - commit fd4e4f2416baa2e6565ea49d52aade296bad3e28 - Author: Darren Tucker - Date: Wed Feb 24 10:44:25 2016 +1100 -@@ -5151,6 +10606,43 @@ - - sync ssh-copy-id with upstream 783ef08b0a75 - -+commit d4c592fd15ac938e994b1e4b6892125f8e88ef8a -+Merge: 50e958b 312ff28 -+Author: Venkat Yekkirala -+Date: Mon Feb 15 10:14:03 2016 -0600 -+ -+ Merge pull request #9 from globus/libtool-install -+ -+ Use libtool to install binaries -+ -+commit 312ff28e86c3ec47bd287c6a250abdfc5bc22c91 -+Author: Joseph Bester -+Date: Fri Feb 12 14:32:07 2016 -0500 -+ -+ Use libtool to install binaries -+ -+commit 50e958b2bd3c38dfeaf9bf23ae0500efb102850b -+Merge: 059bdb8 a3aaf3d -+Author: Venkat Yekkirala -+Date: Thu Feb 11 19:23:17 2016 -0600 -+ -+ Merge branch 'master' into GSI_ISSHD_HPN_7_1_P2 -+ -+commit a3aaf3d7a80e5316fce5e5df5764fdbea8b370b4 -+Merge: 041239e ac1b376 -+Author: Venkat Yekkirala -+Date: Thu Feb 11 19:36:00 2016 -0600 -+ -+ Merge pull request #8 from globus/autoconf-cleanup -+ -+ Autoconf cleanup -+ -+commit 059bdb85b19a5738ca80964eefbfebeb381b5436 -+Author: Venkat Yekkirala -+Date: Thu Feb 11 19:22:41 2016 -0600 -+ -+ MechGlue library doesn't define gss_duplicate_name so will use gss_import_name instead. -+ - commit d2d772f55b19bb0e8d03c2fe1b9bb176d9779efd - Author: djm@openbsd.org - Date: Fri Feb 12 00:20:30 2016 +0000 -@@ -5162,6 +10654,12 @@ - - Upstream-ID: 044a764fee526f2c4a9d530bd10695422d01fc54 - -+commit ac1b3760eba62a183bb43a3c4a2ffba96476f5b4 -+Author: Joseph Bester -+Date: Thu Feb 11 15:02:43 2016 -0500 -+ -+ Add distdir and dist rules, fix some configure errors -+ - commit e4c918a6c721410792b287c9fd21356a1bed5805 - Author: djm@openbsd.org - Date: Thu Feb 11 02:56:32 2016 +0000 -@@ -5185,6 +10683,18 @@ - - Upstream-ID: 3306be469f41f26758e3d447987ac6d662623e18 - -+commit d5c580465f89509495583cb6c7046b6c0a899858 -+Author: Joseph Bester -+Date: Tue Feb 9 12:22:48 2016 -0500 -+ -+ Fix pathnames for OSX installer -+ -+commit 3b16df0885e3a08393578cbc0a0c09d63a427cd3 -+Author: Joseph Bester -+Date: Tue Feb 9 12:14:17 2016 -0500 -+ -+ more fixes for building in source installer -+ - commit 714e367226ded4dc3897078be48b961637350b05 - Author: djm@openbsd.org - Date: Tue Feb 9 05:30:04 2016 +0000 -@@ -5208,6 +10718,12 @@ - - Upstream-ID: f24569cffa1a7cbde5f08dc739a72f4d78aa5c6a - -+commit 03e6303e41994576e914e9d7b329cc54adc5c2bb -+Author: Joseph Bester -+Date: Mon Feb 8 15:35:21 2016 -0500 -+ -+ More configure fixes -+ - commit 19bcf2ea2d17413f2d9730dd2a19575ff86b9b6a - Author: djm@openbsd.org - Date: Mon Feb 8 10:57:07 2016 +0000 -@@ -5369,6 +10885,52 @@ - - Upstream-ID: 67e268b547f990ed220f3cb70a5624d9bda12b8c - -+commit 041239e98f8e9cb97a78274d8766e43e504b0a52 -+Merge: 2c6f62f aacccd8 -+Author: Venkat Yekkirala -+Date: Wed Jan 27 11:18:03 2016 -0600 -+ -+ Merge branch 'GSI_ISSHD_HPN_7_1_P2' -+ -+commit aacccd89d51cdd2cfed360ba1dfca609d643b74f -+Author: Venkat Yekkirala -+Date: Wed Jan 27 11:16:51 2016 -0600 -+ -+ Disabling NERSCmod/iSSHD auditing. -+ -+commit 2c6f62fcaddbf3abf09a1b07ffd8281b2d68bc7e -+Merge: 8986a3f f348958 -+Author: Venkat Yekkirala -+Date: Wed Jan 27 10:55:49 2016 -0600 -+ -+ Merge branch 'GSI_ISSHD_HPN_7_1_P2' -+ -+commit f34895877bf4847fecf6a1058d21002c66fc12bd -+Author: Venkat Yekkirala -+Date: Wed Jan 27 10:55:21 2016 -0600 -+ -+ Bumped NCSA_VERSION -+ -+commit 8986a3f48d6a7a2960226bb4473393b5e29506b1 -+Merge: c3d61b6 849d453 -+Author: Venkat Yekkirala -+Date: Wed Jan 27 10:47:36 2016 -0600 -+ -+ Merge branch 'GSI_ISSHD_HPN_7_1_P2' -+ -+commit 849d453a07ff4aaa11eaf07a471aa3b0c8e4ae16 -+Author: Venkat Yekkirala -+Date: Wed Jan 27 10:46:33 2016 -0600 -+ -+ PAM file and init script for gsisshd. -+ -+commit c3d61b6b4eb64189e373c7cc3e02a533ec2fe15b -+Merge: fc17734 26aacc1 -+Author: Venkat Yekkirala -+Date: Wed Jan 27 10:37:38 2016 -0600 -+ -+ Merge remote branch 'origin/GSI_ISSHD_HPN_7_1_P2' -+ - commit 44cf930e670488c85c9efeb373fa5f4b455692ac - Author: djm@openbsd.org - Date: Wed Jan 27 06:44:58 2016 +0000 -@@ -5460,12 +11022,2750 @@ - - openssh-7.1p2 - -+commit 26aacc1d9a0a77db5af8c48c5c27b9e801824494 -+Merge: d70f914 dd307ff -+Author: Venkat Yekkirala -+Date: Tue Jan 26 15:13:54 2016 -0600 -+ -+ Merge branch 'ISSHD_HPN_7_1_P2' into GSI_ISSHD_HPN_7_1_P2 -+ -+commit dd307ffb133e1a383e2aaad2665acf738e12b6c2 -+Author: Venkat Yekkirala -+Date: Tue Jan 26 15:13:12 2016 -0600 -+ -+ Formatting fix to be in sync with isshd. -+ -+commit d70f914e99b9d64ef8ad9f8048635176ae847ebc -+Merge: 5e66573 80fe334 -+Author: Venkat Yekkirala -+Date: Tue Jan 26 14:54:52 2016 -0600 -+ -+ Merge branch 'ISSHD_HPN_7_1_P2' into GSI_ISSHD_HPN_7_1_P2 -+ -+commit 80fe334d356614ab8e7e63c0c3eee0d52d023f72 -+Merge: 7b4a3c9 9b30925 -+Author: Venkat Yekkirala -+Date: Tue Jan 26 14:52:25 2016 -0600 -+ -+ Merge commit 'v3.19.1' into ISSHD_HPN_7_1_P2 -+ -+ Conflicts: -+ kex.c -+ sandbox-seccomp-filter.c -+ -+commit 9b30925f4e27ed08fbfdace56657914223ec60ca -+Merge: 52ca475 d9754b4 -+Author: scott campbell -+Date: Mon Jan 25 18:30:56 2016 -0500 -+ -+ Merge remote-tracking branch 'rapier1/master' into isshd -+ -+ # Conflicts: -+ # kex.c -+ -+commit 35176f3b48de669e417d170d56dbfd8abf55399e -+Author: Joseph Bester -+Date: Mon Jan 25 15:59:44 2016 -0500 -+ -+ Clean up configure script -+ -+ - Remove unused options. -+ - Trust PKG_CONFIG_PATH instead of guessing from --with-gsi=PATH -+ - Don't require GLOBUS_LOCATION at configure time. -+ -+commit 52ca4752d164bbe40ccdcc84f056030d7ab0331a -+Author: scott campbell -+Date: Mon Jan 25 07:56:53 2016 -0500 -+ -+ bump version -+ -+commit ec49f5a3f3e0503623385f2d61eb05e3536d0b5a -+Merge: ced5c95 535137c -+Author: scott campbell -+Date: Sun Jan 24 21:50:03 2016 -0500 -+ -+ Merge remote-tracking branch 'origin/isshd' into isshd -+ -+ # Conflicts: -+ # channels.c -+ # kex.c -+ # sandbox-seccomp-filter.c -+ -+commit ced5c95b2e3520f13125fddebb62205162701f33 -+Author: scott campbell -+Date: Mon Jan 11 15:03:05 2016 -0500 -+ -+ fix type error -+ -+ char is not u_char -+ char is not u_char -+ char is not u_char -+ char is not u_char -+ -+commit 2646ae5347d16b9e293a5db491dc241524715c03 -+Author: scott campbell -+Date: Mon Jan 11 14:27:25 2016 -0500 -+ -+ option for runtime disable for issued logging -+ -+ If —enable-nercmod is set at configure time, it still will be possible -+ to disable the logging of information by setting AuditDisabled to yes -+ in ssh_config -+ -+ Default value is on to preserve backwards compatibility. -+ -+commit e3ca2152ebd7217c97e0fc9a1ed08ec8e168cca9 -+Author: rapier -+Date: Thu Nov 12 16:46:33 2015 -0500 -+ -+ remove KEX_ENCRYPT_INCLUDE_NONE define from myproposal.h -+ -+commit 3f9b282a3492a1a8a24de6b29a8d22f7747765b1 -+Author: rapier -+Date: Thu Nov 12 16:20:37 2015 -0500 -+ -+ Modified none cipher behaviour in sshd.c to match suggestioon from bdrewery - cf https://github.com/rapier1/openssh-portable/issues/3 -+ -+commit 69b5613169453b51f880656cfdef7e6d3f227821 -+Author: rapier -+Date: Tue Nov 10 14:09:30 2015 -0500 -+ -+ Fixed problem with None cipher not being advertised by server -+ -+commit 4d17b3da0616c48c08dfbda0c77e55da98985206 -+Author: rapier -+Date: Thu Oct 29 14:35:44 2015 -0400 -+ -+ Trying to open up the maximum size of the buffer to 256MB. This is to support 40 and 100Gb paths -+ -+commit 7ec004bb91a8f1f3a8e75d912f8321c27cca1229 -+Author: Mike Frysinger -+Date: Thu Oct 29 01:30:08 2015 -0400 -+ -+ initialize hpn buffers sooner in the client -+ -+ When using the -w option to create a tunnel via tun devices, the client -+ sets up a window with a negative length. With 6.8+ servers, the channel -+ will be killed on the fly when the negative window is detected (see the -+ commit "fatal() when a remote window update causes the window"). With -+ older versions, the server ends up using negative windows and who knows -+ what happens next. -+ -+ Pull the hpn option logic up earlier in the ssh connection so that it -+ runs before we try to create any forwarding channels. -+ -+ You can reproduce by running the server in debug mode and having the -+ client connect like so: -+ sudo ssh -w 1:2 user@server -+ The server will log a line like: -+ debug1: server_input_channel_open: ctype tun@openssh.com rchan 0 win -1 max 32768 -+ That -1 is the window size and things go wrong from there. -+ -+ URL: https://bugs.gentoo.org/564236 -+ Reported-by: Daniel Heule -+ -+commit 4edd8e96b07a56d0f348045b0634d76a68ccc443 -+Author: Mike Frysinger -+Date: Thu Oct 29 01:28:19 2015 -0400 -+ -+ pull the hpn init code out into a dedicated func -+ -+ This makes it more obvious what is hpn-specific and makes it easier -+ to manage the logic. -+ -+commit 289ee8292975d88c6d9f6bc554c1fb1917cb4abf -+Author: Mike Frysinger -+Date: Thu Oct 29 01:21:46 2015 -0400 -+ -+ clean up socket code a bit during hpn option init -+ -+ A few tweaks to improve the code to make it easier to manage: -+ - localize the vars in the scope they're actually used -+ - change socksizelen to socklen_t to match {g,s}etsockopt prototypes -+ - fix call to setsockopt to actually pass in the socklen_t -+ -+commit 13c6459a6695c0cbf490b42545c174e524640fb7 -+Author: rapier -+Date: Tue Oct 20 15:31:55 2015 -0400 -+ -+ Forgot to update version -+ -+commit 87012dd491ee7011ade8345eebdd313bedf86aa6 -+Author: scott campbell -+Date: Mon Sep 14 20:39:00 2015 -0400 -+ -+ complete fix for kex -+ -+ In working through the ‘make tests’, another issue re comp.name arose. -+ This change just assumes that any member of the mess can cause a -+ pathological state so test them all … -+ -+commit 362f35b5d2b714dbd2f45692e462ac0e9d917ab0 -+Author: scott campbell -+Date: Fri Sep 11 20:19:15 2015 -0400 -+ -+ Fix segfault due to invoking strlen() on NULL string. -+ -+ See: -+ https://github.com/set-element/openssh-hpn-isshd/commit/805f39d13ac5de98 -+ 00b56f4ddcc27c3f40cf671a -+ -+ I make the bugs and mej fixes them … -+ -+commit 8ab8680c14561c77fa3a54803aa9bf3f401c059b -+Author: scott campbell -+Date: Wed Jul 22 17:50:51 2015 +0200 -+ -+ fix typo -+ -+ need to have SSH_HPN in the version -+ -+commit 9e8ed55aadba2ca6f68e2ac2c348988872c56276 -+Author: scott campbell -+Date: Tue Jul 21 23:46:29 2015 +0200 -+ -+ bump version -+ -+commit 8c1fb8aa0ee32dd2acc59bcbaa49f7c44eb70712 -+Author: scott campbell -+Date: Tue Jul 21 23:43:58 2015 +0200 -+ -+ add nersc mod -+ -+commit 12962a0a60f3f438f08c04948d422482afe247a2 -+Author: scott campbell -+Date: Mon May 25 10:14:15 2015 -0400 -+ -+ fixing fixing ... -+ -+commit 0da19d3740c872be221fbb6cb5e23cae6b7407b8 -+Author: scott campbell -+Date: Mon May 25 08:38:51 2015 -0400 -+ -+ add key exchange event -+ -+commit c8713e0f70af3ff3954878bc1fd455ad6cea3a1f -+Author: scott campbell -+Date: Sun May 24 21:42:47 2015 -0400 -+ -+ fix typo -+ -+commit a8f648c8e8087621b627bb7b49db9511f6a88395 -+Author: scott campbell -+Date: Wed May 20 00:07:22 2015 -0400 -+ -+ add modp_burl.o to makefile -+ -+commit b9faaa05d39440f03c59ee69056c41aba53a2c2c -+Author: scott campbell -+Date: Mon May 18 22:20:25 2015 -0400 -+ -+ checkin nersc mods -+ -+commit 00f93d6c07ff281e8a84d1d93d4206339d8e5e1e -+Author: scott campbell -+Date: Mon May 18 22:17:58 2015 -0400 -+ -+ nersc changes -+ -+commit b2d700a8f0b9af81b84da9b4a7e189ba41a24c63 -+Author: scott campbell -+Date: Mon May 18 22:15:52 2015 -0400 -+ -+ initial nersc checkin -+ -+commit 9bf048235ec06c22134a511345fc2d111d0afdfa -+Author: scott campbell -+Date: Mon May 18 21:46:31 2015 -0400 -+ -+ initial nersc changes -+ -+commit 1ea576075a9bec43613c4bb15d8306749902439d -+Author: scott campbell -+Date: Mon May 18 21:34:16 2015 -0400 -+ -+ add nersc changes -+ -+commit 822c9d2f2120f59f64cc4a25fbd8aade3aa9d62f -+Author: scott campbell -+Date: Mon May 18 21:29:30 2015 -0400 -+ -+ initial install -+ -+commit 579284d125ad46357239a6c5fdb7139403c9d65a -+Author: scott campbell -+Date: Mon May 18 21:29:09 2015 -0400 -+ -+ code checkin -+ -+ This is for the uriencoding -+ -+commit 0a6c80337e157df37243e3901d8cd65fc6f65c1e -+Author: scott campbell -+Date: Mon May 18 21:27:32 2015 -0400 -+ -+ initial nersc checkin -+ -+commit 4a190fa8b51bdc10ab7d1076b1173e80a192f9e3 -+Author: scott campbell -+Date: Mon May 18 21:26:02 2015 -0400 -+ -+ initial nersc checkin -+ -+commit fed99c607e5eb0babc80601a24405413b3e3ced4 -+Author: scott campbell -+Date: Mon May 18 21:01:40 2015 -0400 -+ -+ add nersc changes -+ -+commit 3c648af21f7c4e75bafa0c4ccf3e8ec5e28b6a5c -+Author: scott campbell -+Date: Mon May 18 20:50:57 2015 -0400 -+ -+ add nersc mods -+ -+commit 88094924727e4b913cfee2b0532795f788670ab4 -+Author: scott campbell -+Date: Mon May 18 20:49:18 2015 -0400 -+ -+ insert nersc mods -+ -+commit ea9543a5c1b2f5375be8e12031ee3d6a60cf436f -+Author: scott campbell -+Date: Mon May 18 20:45:09 2015 -0400 -+ -+ add nersc changes -+ -+commit 689caad4b374bbf3df9bf01a16084c86b543e500 -+Author: scott campbell -+Date: Mon May 18 20:38:06 2015 -0400 -+ -+ insert nersc mods -+ -+commit 00406b186bc199c0aad433204cea6aab38a512bb -+Author: scott campbell -+Date: Mon May 18 20:34:22 2015 -0400 -+ -+ put in nersc mods -+ -+commit 4f730e7671023445827dd2e3adac81c44dc0b5aa -+Author: scott campbell -+Date: Mon May 18 20:25:24 2015 -0400 -+ -+ add nersc reference -+ -+commit cf91b1d5feeeedab52c0e09af31b238f7cb8ec92 -+Author: Mike Frysinger -+Date: Fri Aug 21 10:13:36 2015 -0400 -+ -+ clean up style a bit in hpn ssh code -+ -+commit 401fc67555682c0cd77f24ab197799b0c25b5211 -+Author: Damien Miller -+Date: Fri Aug 21 14:49:03 2015 +1000 -+ -+ we don't use Github for issues/pull-requests -+ -+commit cfb4d22d4c39be2372f49e8ac2024ceaa5b41af2 -+Author: Damien Miller -+Date: Fri Aug 21 14:43:55 2015 +1000 -+ -+ fix URL for connect.c -+ -+commit 9d00813e418932ee373783d2e63523abcd35d488 -+Author: Damien Miller -+Date: Fri Aug 21 13:47:10 2015 +1000 -+ -+ update version numbers for 7.1 -+ -+commit 85bcbdf9ba7c3673471cda216913a64ebf11f9d5 -+Author: djm@openbsd.org -+Date: Fri Aug 21 03:45:26 2015 +0000 -+ -+ upstream commit -+ -+ openssh-7.1 -+ -+ Upstream-ID: ff7b1ef4b06caddfb45e08ba998128c88be3d73f -+ -+commit fe1cd618c2e1a0ee52d4d1de69dff397c30e95af -+Author: djm@openbsd.org -+Date: Fri Aug 21 03:42:19 2015 +0000 -+ -+ upstream commit -+ -+ fix inverted logic that broke PermitRootLogin; reported -+ by Mantas Mikulenas; ok markus@ -+ -+ Upstream-ID: 260dd6a904c1bb7e43267e394b1c9cf70bdd5ea5 -+ -+commit 85425f73532f13cd35cfa6e8387634b50c3448e8 -+Author: deraadt@openbsd.org -+Date: Thu Aug 20 22:32:42 2015 +0000 -+ -+ upstream commit -+ -+ Do not cast result of malloc/calloc/realloc* if stdlib.h -+ is in scope ok krw millert -+ -+ Upstream-ID: 5e50ded78cadf3841556649a16cc4b1cb6c58667 -+ -+commit d0ac9fcc16fba5bed34ee616f1334d1fe422d764 -+Author: naddy@openbsd.org -+Date: Thu Aug 20 19:20:06 2015 +0000 -+ -+ upstream commit -+ -+ In the certificates section, be consistent about using -+ "host_key" and "user_key" for the respective key types. ok sthen@ deraadt@ -+ -+ Upstream-ID: 9e037ea3b15577b238604c5533e082a3947f13cb -+ -+commit 22e3751e7b254616984ccd73aeb151cc31315f76 -+Author: djm@openbsd.org -+Date: Wed Aug 19 23:21:42 2015 +0000 -+ -+ upstream commit -+ -+ Better compat matching for WinSCP, add compat matching -+ for FuTTY (fork of PuTTY); ok markus@ deraadt@ -+ -+ Upstream-ID: 24001d1ac115fa3260fbdc329a4b9aeb283c5389 -+ -+commit 868bf2a8e139b1d5f7d6cac6058e6e222c056a9a -+Author: djm@openbsd.org -+Date: Wed Aug 19 23:19:01 2015 +0000 -+ -+ upstream commit -+ -+ fix double-free() in error path of DSA key generation -+ reported by Mateusz Kocielski; ok markus@ -+ -+ Upstream-ID: 4735d8f888b10599a935fa1b374787089116713c -+ -+commit d97e7c03065e028ac370fe3e8d0f8db798119e07 -+Author: djm@openbsd.org -+Date: Wed Aug 19 23:18:26 2015 +0000 -+ -+ upstream commit -+ -+ fix free() of uninitialised pointer reported by Mateusz -+ Kocielski; ok markus@ -+ -+ Upstream-ID: 519552b050618501a06b7b023de5cb104e2c5663 -+ -+commit 7a9c0169c1020ac77a9112028bd5b79febb717d9 -+Author: djm@openbsd.org -+Date: Wed Aug 19 23:17:51 2015 +0000 -+ -+ upstream commit -+ -+ fixed unlink([uninitialised memory]) reported by Mateusz -+ Kocielski; ok markus@ -+ -+ Upstream-ID: 14a0c4e7d891f5a8dabc4b89d4f6b7c0d5a20109 -+ -+commit 7e92d04a60763abe135cb3ad1a379e8749ae8a2b -+Author: jmc@openbsd.org -+Date: Fri Aug 14 15:32:41 2015 +0000 -+ -+ upstream commit -+ -+ match myproposal.h order; from brian conway (i snuck in a -+ tweak while here) -+ -+ ok dtucker -+ -+ Upstream-ID: 35174a19b5237ea36aa3798f042bf5933b772c67 -+ -+commit c7da6ebf080210142f38e25e87920c844e747bd3 -+Author: deraadt@openbsd.org -+Date: Thu Aug 6 14:53:21 2015 +0000 -+ -+ upstream commit -+ -+ add prohibit-password as a synonymn for without-password, -+ since the without-password is causing too many questions. Harden it to ban -+ all but pubkey, hostbased, and GSSAPI auth (when the latter is enabled) from -+ djm, ok markus -+ -+ Upstream-ID: d53317d7b28942153e6236d3fd6e12ceb482db7a -+ -+commit 9faac2ac35d8c40d1787b3b1e067b69c4f49386a -+Author: Damien Miller -+Date: Tue Aug 11 13:53:41 2015 +1000 -+ -+ update version in README -+ -+commit c3be5c407a86c2a198fba84bd57209eee5d46558 -+Author: Damien Miller -+Date: Tue Aug 11 13:53:09 2015 +1000 -+ -+ update versions in *.spec -+ -+commit 4d8fb799fc819d714e0dc1474e80698620139622 -+Author: Damien Miller -+Date: Tue Aug 11 13:34:12 2015 +1000 -+ -+ set sshpam_ctxt to NULL after free -+ -+ Avoids use-after-free in monitor when privsep child is compromised. -+ Reported by Moritz Jodeit; ok dtucker@ -+ -+commit 288c78408246f161569ee6d1d770d1f3d0920f22 -+Author: Damien Miller -+Date: Tue Aug 11 13:33:24 2015 +1000 -+ -+ Don't resend username to PAM; it already has it. -+ -+ Pointed out by Moritz Jodeit; ok dtucker@ -+ -+commit 80a537c2228d009535f091f8827335444e207c64 -+Author: Darren Tucker -+Date: Mon Jul 27 12:14:25 2015 +1000 -+ -+ Import updated moduli file from OpenBSD. -+ -+commit 7fdb1f4f82d3ef6aadb44a56487dbbddab790b22 -+Author: Damien Miller -+Date: Mon Aug 10 11:13:44 2015 +1000 -+ -+ let principals-command.sh work for noexec /var/run -+ -+commit 41f98690d2ac375defcd4686fc3c7228a314a506 -+Author: Damien Miller -+Date: Thu Aug 6 11:43:42 2015 +1000 -+ -+ work around echo -n / sed behaviour in tests -+ -+commit 997ee520dcb828771032aa97323afdd48ad31b22 -+Author: djm@openbsd.org -+Date: Wed Aug 5 05:27:33 2015 +0000 -+ -+ upstream commit -+ -+ adjust for RSA minimum modulus switch; ok deraadt@ -+ -+ Upstream-Regress-ID: 5a72c83431b96224d583c573ca281cd3a3ebfdae -+ -+commit 5ccc10c1ff979d2dd6c349e49306cbeb3023c01d -+Author: djm@openbsd.org -+Date: Tue Aug 4 05:23:06 2015 +0000 -+ -+ upstream commit -+ -+ backout SSH_RSA_MINIMUM_MODULUS_SIZE increase for this -+ release; problems spotted by sthen@ ok deraadt@ markus@ -+ -+ Upstream-ID: d0bd60dde9e8c3cd7030007680371894c1499822 -+ -+commit f663dad0b0a1d1cca83caf6d284dd61d951decaa -+Author: djm@openbsd.org -+Date: Sun Aug 2 09:56:42 2015 +0000 -+ -+ upstream commit -+ -+ openssh 7.0; ok deraadt@ -+ -+ Upstream-ID: c63afdef537f57f28ae84145c5a8e29e9250221f -+ -+commit a6b73a0bec94577d84e078bdec722e6ee9d6a798 -+Author: chris@openbsd.org -+Date: Fri Jul 31 15:38:09 2015 +0000 -+ -+ upstream commit -+ -+ Allow PermitRootLogin to be overridden by config -+ -+ ok markus@ deeradt@ -+ -+ Upstream-ID: 5cf3e26ed702888de84e2dc9d0054ccf4d9125b4 -+ -+commit 7f7e2fc62f374b0fe2b5987b04ade320edee8072 -+Author: djm@openbsd.org -+Date: Thu Jul 30 23:09:15 2015 +0000 -+ -+ upstream commit -+ -+ fix pty permissions; patch from Nikolay Edigaryev; ok -+ deraadt -+ -+ Upstream-ID: 40ff076d2878b916fbfd8e4f45dbe5bec019e550 -+ -+commit 1904860405da37f6ba5300528c7f07f10992d1bf -+Author: deraadt@openbsd.org -+Date: Thu Jul 30 19:23:02 2015 +0000 -+ -+ upstream commit -+ -+ change default: PermitRootLogin without-password matching -+ install script changes coming as well ok djm markus -+ -+ Upstream-ID: 0e2a6c4441daf5498b47a61767382bead5eb8ea6 -+ -+commit 29b9bb486278b204d8501c553fff6bf7eeb385f0 -+Author: Damien Miller -+Date: Thu Jul 30 12:31:39 2015 +1000 -+ -+ downgrade OOM adjustment logging: verbose -> debug -+ -+commit 53dc04a1ace055e428a59e4868950fdfec312b4f -+Author: djm@openbsd.org -+Date: Thu Jul 30 00:01:34 2015 +0000 -+ -+ upstream commit -+ -+ Allow ssh_config and sshd_config kex parameters options be -+ prefixed by a '+' to indicate that the specified items be appended to the -+ default rather than replacing it. -+ -+ approach suggested by dtucker@, feedback dlg@, ok markus@ -+ -+ Upstream-ID: 0f901137298fc17095d5756ff1561a7028e8882a -+ -+commit 54b8774da3512454652695aaa5f664be7b6d883c -+Author: djm@openbsd.org -+Date: Wed Jul 29 08:34:54 2015 +0000 -+ -+ upstream commit -+ -+ fix bug in previous; was printing incorrect string for -+ failed host key algorithms negotiation -+ -+ Upstream-ID: 22c0dc6bc61930513065d92e11f0753adc4c6e6e -+ -+commit 346af7d9e317ca42f36fda958cc62b2b6d0356d6 -+Author: djm@openbsd.org -+Date: Wed Jul 29 04:43:06 2015 +0000 -+ -+ upstream commit -+ -+ include the peer's offer when logging a failure to -+ negotiate a mutual set of algorithms (kex, pubkey, ciphers, etc.) ok markus@ -+ -+ Upstream-ID: bbb8caabf5c01790bb845f5ce135565248d7c796 -+ -+commit 1fd0cad98c574e9f2196adea4858e97b856048cc -+Author: djm@openbsd.org -+Date: Tue Jul 28 23:20:42 2015 +0000 -+ -+ upstream commit -+ -+ add Cisco to the list of clients that choke on the -+ hostkeys update extension. Pointed out by Howard Kash -+ -+ Upstream-ID: c9eadde28ecec056c73d09ee10ba4570dfba7e84 -+ -+commit 8638a5571d42b11f16094defa1f0b42a347332b3 -+Author: guenther@openbsd.org -+Date: Mon Jul 27 16:29:23 2015 +0000 -+ -+ upstream commit -+ -+ Permit kbind(2) use in the sandbox now, to ease testing -+ of ld.so work using it -+ -+ reminded by miod@, ok deraadt@ -+ -+ Upstream-ID: 523922e4d1ba7a091e3824e77a8a3c818ee97413 -+ -+commit 12820956d70380b02dcde4076076ab5eab454086 -+Author: millert@openbsd.org -+Date: Mon Jul 20 18:44:12 2015 +0000 -+ -+ upstream commit -+ -+ Move .Pp before .Bl, not after to quiet mandoc -Tlint. -+ Noticed by jmc@ -+ -+ Upstream-ID: 59fadbf8407cec4e6931e50c53cfa0214a848e23 -+ -+commit bee9a59c396ac45153ad8b4e72e7838c4fd6de43 -+Author: millert@openbsd.org -+Date: Mon Jul 20 18:42:35 2015 +0000 -+ -+ upstream commit -+ -+ Sync usage with SYNOPSIS -+ -+ Upstream-ID: 7a321a170181a54f6450deabaccb6ef60cf3f0b7 -+ -+commit dd5de20eba8805baa320daf6927c1c5b081d7a5a -+Author: millert@openbsd.org -+Date: Mon Jul 20 15:39:52 2015 +0000 -+ -+ upstream commit -+ -+ Better desciption of Unix domain socket forwarding. -+ bz#2423; ok jmc@ -+ -+ Upstream-ID: 85e28874726897e3f26ae50dfa2e8d2de683805d -+ -+commit df1c018d281bee4fa9ea13926e3e36b987f7287f -+Author: Damien Miller -+Date: Mon Jul 20 11:19:51 2015 +1000 -+ -+ make realpath.c compile -Wsign-compare clean -+ -+commit 40d18c33b8b3c521beb7fac2f846b4161539f1b0 -+Author: djm@openbsd.org -+Date: Mon Jul 20 00:30:01 2015 +0000 -+ -+ upstream commit -+ -+ mention that the default of UseDNS=no implies that -+ hostnames cannot be used for host matching in sshd_config and -+ authorized_keys; bz#2045, ok dtucker@ -+ -+ Upstream-ID: 0812705d5f2dfa59aab01f2764ee800b1741c4e1 -+ -+commit 4ae6bd1f51c3465dc2af77db90f5f45a461f7f0f -+Author: djm@openbsd.org -+Date: Sat Jul 18 08:02:17 2015 +0000 -+ -+ upstream commit -+ -+ don't ignore PKCS#11 hosted keys that return empty -+ CKA_ID; patch by Jakub Jelen via bz#2429; ok markus -+ -+ Upstream-ID: 2f7c94744eb0342f8ee8bf97b2351d4e00116485 -+ -+commit ed069f581f4c2f70e9cc6b28374b0b5674be6385 -+Author: djm@openbsd.org -+Date: Sat Jul 18 08:00:21 2015 +0000 -+ -+ upstream commit -+ -+ skip uninitialised PKCS#11 slots; patch from Jakub Jelen -+ in bz#2427 ok markus@ -+ -+ Upstream-ID: 744c1e7796e237ad32992d0d02148e8a18f27d29 -+ -+commit 1303bcadd48b73fb215f8949b11360ee096ef24c -+Author: djm@openbsd.org -+Date: Sat Jul 18 07:57:14 2015 +0000 -+ -+ upstream commit -+ -+ only query each keyboard-interactive device once per -+ authentication request regardless of how many times it is listed; ok markus@ -+ -+ Upstream-ID: d73fafba6e86030436ff673656ec1f33d9ffeda1 -+ -+commit 1773a456b7fdb2a815026811f4b7e02597a05c42 -+Author: djm@openbsd.org -+Date: Fri Jul 17 03:34:27 2015 +0000 -+ -+ upstream commit -+ -+ remove -u flag to diff (only used for error output) to make -+ things easier for -portable -+ -+ Upstream-Regress-ID: a5d6777d2909540d87afec3039d9bb2414ade548 -+ -+commit c54a03e721963467146ec17b9bf0ab25baf7dc8f -+Author: djm@openbsd.org -+Date: Fri Jul 17 03:09:19 2015 +0000 -+ -+ upstream commit -+ -+ direct-streamlocal@openssh.com Unix domain foward -+ messages do not contain a "reserved for future use" field and in fact, -+ serverloop.c checks that there isn't one. Remove erroneous mention from -+ PROTOCOL description. bz#2421 from Daniel Black -+ -+ Upstream-ID: 3d51a19e64f72f764682f1b08f35a8aa810a43ac -+ -+commit f2eb62f0e1575e24518ba3ade7889440e89f0a57 -+Author: djm@openbsd.org -+Date: Fri Jul 17 03:04:27 2015 +0000 -+ -+ upstream commit -+ -+ describe magic for setting up Unix domain socket fowards -+ via the mux channel; bz#2422 patch from Daniel Black -+ -+ Upstream-ID: 943080fe3864715c423bdeb7c920bb30c4eee861 -+ -+commit 62a425fff910e3cfd7237c610ec554a0ba8f9851 -+Author: Darren Tucker -+Date: Fri Jul 17 12:52:34 2015 +1000 -+ -+ Check if realpath works on nonexistent files. -+ -+ On some platforms the native realpath doesn't work with non-existent -+ files (this is actually specified in some versions of POSIX), however -+ the sftp spec says its realpath with "canonicalize any given path name". -+ On those platforms, use realpath from the compat library. -+ -+ In addition, when compiling with -DFORTIFY_SOURCE, glibc redefines -+ the realpath symbol to the checked version, so redefine ours to -+ something else so we pick up the compat version we want. -+ -+ bz#2428, ok djm@ -+ -+commit 0f8987acc6746bdfbd623ddac296972c96926045 -+Author: djm@openbsd.org -+Date: Fri Jul 17 02:47:45 2015 +0000 -+ -+ upstream commit -+ -+ fix incorrect test for SSH1 keys when compiled without SSH1 -+ support -+ -+ Upstream-ID: 6004d720345b8e481c405e8ad05ce2271726e451 -+ -+commit 7d655b6f4b67277f1b8b105daaedd078a613f000 -+Author: djm@openbsd.org -+Date: Wed Jul 15 08:00:11 2015 +0000 -+ -+ upstream commit -+ -+ fix NULL-deref when SSH1 reenabled -+ -+ Upstream-ID: f22fd805288c92b3e9646782d15b48894b2d5295 -+ -+commit c9ef65e7e7ee4dae1c0ef8bb44a3d19b5cac80a2 -+Author: djm@openbsd.org -+Date: Wed Jul 15 07:19:50 2015 +0000 -+ -+ upstream commit -+ -+ regen RSA1 test keys; the last batch was missing their -+ private parts -+ -+ Upstream-Regress-ID: 7ccf437305dd63ff0b48dd50c5fd0f4d4230c10a -+ -+commit c4160b7bb8a3a64f69a0c9bdc40434f76a437ee1 -+Author: markus@openbsd.org -+Date: Fri Jul 10 06:23:25 2015 +0000 -+ -+ upstream commit -+ -+ Adapt tests, now that DSA if off by default; use -+ PubkeyAcceptedKeyTypes and PubkeyAcceptedKeyTypes to test DSA. -+ -+ Upstream-Regress-ID: 0ff2a3ff5ac1ce5f92321d27aa07b98656efcc5c -+ -+commit 504c8d9df087cfd3ec29c606d58b29327d2af582 -+Author: markus@openbsd.org -+Date: Tue Jul 7 14:54:16 2015 +0000 -+ -+ upstream commit -+ -+ regen test data after mktestdata.sh changes -+ -+ Upstream-Regress-ID: 3495ecb082b9a7c048a2d7c5c845d3bf181d25a4 -+ -+commit 4bfd1d3a5fd85fba827ac113c4aa5edd541ef4f5 -+Author: markus@openbsd.org -+Date: Tue Jul 7 14:53:30 2015 +0000 -+ -+ upstream commit -+ -+ adapt tests to new minimum RSA size and default FP format -+ -+ Upstream-Regress-ID: a4b30afd174ce82b96df14eb49fb0b81398ffd0e -+ -+commit 250bc4696c15bc159b0dbdc65cbf8ccbc6042fd8 -+Author: djm@openbsd.org -+Date: Fri Jul 3 04:39:23 2015 +0000 -+ -+ upstream commit -+ -+ legacy v00 certificates are gone; adapt and don't try to -+ test them; "sure" markus@ dtucker@ -+ -+ Upstream-Regress-ID: c57321e69b3cd4a3b3396dfcc43f0803d047da12 -+ -+commit fa1c4e7103f0125bc46f21351838be67a8716e6c -+Author: djm@openbsd.org -+Date: Wed Jul 1 23:11:18 2015 +0000 -+ -+ upstream commit -+ -+ don't expect SSH v.1 in unittests -+ -+ Upstream-Regress-ID: f8812b16668ba78e6a698646b2a652b90b653397 -+ -+commit ddbd3b5f0460c1f7e092d00dc2f5c3af992bd8cc -+Author: djm@openbsd.org -+Date: Mon Jun 15 06:38:50 2015 +0000 -+ -+ upstream commit -+ -+ turn SSH1 back on to match src/usr.bin/ssh being tested -+ -+ Upstream-Regress-ID: 6c4f763a2f0cc6893bf33983919e9030ae638333 -+ -+commit a998245d9c8ee94494204351967251810db7aa13 -+Author: dtucker@openbsd.org -+Date: Mon Jul 13 04:57:14 2015 +0000 -+ -+ upstream commit -+ -+ Add "PuTTY_Local:" to the clients to which we do not -+ offer DH-GEX. This was the string that was used for development versions -+ prior to September 2014 and they don't do RFC4419 DH-GEX, but unfortunately -+ there are some extant products based on those versions. bx2424 from Jay -+ Rouman, ok markus@ djm@ -+ -+ Upstream-ID: be34d41e18b966832fe09ca243d275b81882e1d5 -+ -+commit efc4d5eeb4aee0f4479e70892dc979e8f0670025 -+Author: markus@openbsd.org -+Date: Fri Jul 10 06:21:53 2015 +0000 -+ -+ upstream commit -+ -+ Turn off DSA by default; add HostKeyAlgorithms to the -+ server and PubkeyAcceptedKeyTypes to the client side, so it still can be -+ tested or turned back on; feedback and ok djm@ -+ -+ Upstream-ID: 8450a9e6d83f80c9bfed864ff061dfc9323cec21 -+ -+commit bb29ce593bc50ffa316bf8b0623885698137fc2e -+Author: markus@openbsd.org -+Date: Thu Jul 9 09:49:46 2015 +0000 -+ -+ upstream commit -+ -+ re-enable ed25519-certs if compiled w/o openssl; ok djm -+ -+ Upstream-ID: e10c90808b001fd2c7a93778418e9b318f5c4c49 -+ -+commit 1d9cd9a2558f2ee8af340cc1d34c015e41e5236c -+Author: markus@openbsd.org -+Date: Wed Jul 8 20:24:02 2015 +0000 -+ -+ upstream commit -+ -+ no need to include the old buffer/key API -+ -+ Upstream-ID: fb13c9f7c0bba2545f3eb0a0e69cb0030819f52b -+ -+commit ec3626c6d6d34bbdaf0f6442a526e4b2d352631a -+Author: markus@openbsd.org -+Date: Wed Jul 8 19:09:25 2015 +0000 -+ -+ upstream commit -+ -+ typedefs for Cipher&CipherContext are unused -+ -+ Upstream-ID: 50e6a18ee92221d23ad173a96d5b6c42207cf9a7 -+ -+commit 5ab4605159f9e5911c92f44e1cf82f5ea6a71069 -+Author: markus@openbsd.org -+Date: Wed Jul 8 19:04:21 2015 +0000 -+ -+ upstream commit -+ -+ xmalloc.h is unused -+ -+ Upstream-ID: afb532355b7fa7135a60d944ca1e644d1d63cb58 -+ -+commit 8ce38e7c7d4af259358d63668581d2cc7e7bebd8 -+Author: markus@openbsd.org -+Date: Wed Jul 8 19:01:15 2015 +0000 -+ -+ upstream commit -+ -+ compress.c is gone -+ -+ Upstream-ID: 174fa7faa9b9643cba06164b5e498591356fbced -+ -+commit e501934aa94420a4c7deffa9cae65bad25d0df2b -+Author: djm@openbsd.org -+Date: Fri Jul 3 04:05:54 2015 +0000 -+ -+ upstream commit -+ -+ another SSH_RSA_MINIMUM_MODULUS_SIZE that needed -+ cranking -+ -+ Upstream-ID: 9d8826cafe96aab4ae8e2f6fd22800874b7ffef1 -+ -+commit 76063205a9d4680d90e3f7ad7319a96aa9720cad -+Author: djm@openbsd.org -+Date: Fri Jul 3 03:56:25 2015 +0000 -+ -+ upstream commit -+ -+ add an XXX reminder for getting correct key paths from -+ sshd_config -+ -+ Upstream-ID: feae52b209d7782ad742df04a4260e9fe41741db -+ -+commit 692a8c855dd701176db152cfa3526795ffff6bea -+Author: djm@openbsd.org -+Date: Fri Jul 3 03:49:45 2015 +0000 -+ -+ upstream commit -+ -+ refuse to generate or accept RSA keys smaller than 1024 -+ bits; feedback and ok dtucker@ -+ -+ Upstream-ID: 7ea3d31271366ba264f06e34a3539bf1ac30f0ba -+ -+commit 286e35b654236e97a9e2f9469924131adbeb7354 -+Author: djm@openbsd.org -+Date: Fri Jul 3 03:47:00 2015 +0000 -+ -+ upstream commit -+ -+ turn off 1024 bit diffie-hellman-group1-sha1 key -+ exchange method (already off in server, this turns it off in the client by -+ default too) ok dtucker@ -+ -+ Upstream-ID: f59b88f449210ab7acf7d9d88f20f1daee97a4fa -+ -+commit b0b7e7bd79425598d667b396e24c2828e52fbc89 -+Author: djm@openbsd.org -+Date: Fri Jul 3 03:43:18 2015 +0000 -+ -+ upstream commit -+ -+ delete support for legacy v00 certificates; "sure" -+ markus@ dtucker@ -+ -+ Upstream-ID: b5b9bb5f9202d09e88f912989d74928601b6636f -+ -+commit a89de7a191095fef39cabe7e13989f7edcddae8f -+Author: djm@openbsd.org -+Date: Wed Jul 1 23:10:47 2015 +0000 -+ -+ upstream commit -+ -+ Compile-time disable SSH v.1 again -+ -+ Upstream-ID: 1d4b513a3a06232f02650b73bad25100d1b800af -+ -+commit 8ebfba571f89878d5ab44778931f5b78e7ebbc78 -+Author: djm@openbsd.org -+Date: Wed Jul 1 02:39:06 2015 +0000 -+ -+ upstream commit -+ -+ twiddle PermitRootLogin back -+ -+ Upstream-ID: 2bd23976305d0512e9f84d054e1fc23cd70b89f2 -+ -+commit 5197f4da818d60b683d31f3941fcdedc6021eac8 -+Author: djm@openbsd.org -+Date: Wed Jul 1 02:32:17 2015 +0000 -+ -+ upstream commit -+ -+ twiddle; (this commit marks the openssh-6.9 release) -+ -+ Upstream-ID: 78500582819f61dd8adee36ec5cc9b9ac9351234 -+ -+commit 88e86113a6cf54437c9c03e0101f3c60a3652631 -+Author: djm@openbsd.org -+Date: Wed Jul 1 02:26:31 2015 +0000 -+ -+ upstream commit -+ -+ better refuse ForwardX11Trusted=no connections attempted -+ after ForwardX11Timeout expires; reported by Jann Horn -+ -+ Upstream-ID: bf0fddadc1b46a0334e26c080038313b4b6dea21 -+ -+commit d428b0dc9d72fb2114efe50b022fa2a57d2a0d88 -+Author: djm@openbsd.org -+Date: Wed Jul 1 01:56:13 2015 +0000 -+ -+ upstream commit -+ -+ put back default PermitRootLogin=no -+ -+ Upstream-ID: 7bdedd5cead99c57ed5571f3b6b7840922d5f728 -+ -+commit 366a689c0d5eed8962df6a93bc6dac33ba293015 -+Author: djm@openbsd.org -+Date: Wed Jul 1 01:55:13 2015 +0000 -+ -+ upstream commit -+ -+ openssh-6.9 -+ -+ Upstream-ID: 6cfe8e1904812531080e6ab6e752d7001b5b2d45 -+ -+commit 9116be8286d0418207207285439f43aeb8b1a8f6 -+Author: djm@openbsd.org -+Date: Wed Jul 1 01:55:00 2015 +0000 -+ -+ upstream commit -+ -+ reset default PermitRootLogin to 'yes' (momentarily, for -+ release) -+ -+ Upstream-ID: cad8513527066e65dd7a1c16363d6903e8cefa24 -+ -+commit 90fe83b68afb98acb83d5e84b39d2c127f2aed41 -+Author: Damien Miller -+Date: Wed Jul 1 11:49:12 2015 +1000 -+ -+ crank version numbers for release -+ -+commit a2bda3d5fb47bbb918594a71b7d026c3ec3201a6 -+Author: Damien Miller -+Date: Wed Jul 1 10:49:37 2015 +1000 -+ -+ s/--with-ssh1/--without-ssh1/ -+ -+commit 1aa27fe8e1d7f97f8fd37aa4642f6a9ba31cfe9a -+Author: djm@openbsd.org -+Date: Tue Jun 30 05:25:07 2015 +0000 -+ -+ upstream commit -+ -+ fatal() when a remote window update causes the window -+ value to overflow. Reported by Georg Wicherski, ok markus@ -+ -+ Upstream-ID: ead397a9aceb3bf74ebfa5fcaf259d72e569f351 -+ -+commit 67bd33e16fb9621ff5c64508dc7e1325900210df -+Author: djm@openbsd.org -+Date: Tue Jun 30 05:23:25 2015 +0000 -+ -+ upstream commit -+ -+ Fix math error in remote window calculations that causes -+ eventual stalls for datagram channels. Reported by Georg Wicherski, ok -+ markus@ -+ -+ Upstream-ID: be54059d11bf64e0d85061f7257f53067842e2ab -+ -+commit b89efd6bf4f8691d0aeab7040aba2788e5b3c9f4 -+Author: Damien Miller -+Date: Tue Jun 30 16:05:40 2015 +1000 -+ -+ skip IPv6-related portions on hosts without IPv6 -+ -+ with Tim Rice -+ -+commit 1557ca89550158b8a53a3a228ff8c58043867141 -+Author: djm@openbsd.org -+Date: Mon Jun 29 22:35:12 2015 +0000 -+ -+ upstream commit -+ -+ add getpid to sandbox, reachable by grace_alarm_handler -+ -+ reported by Jakub Jelen; bz#2419 -+ -+ Upstream-ID: d0da1117c16d4c223954995d35b0f47c8f684cd8 -+ -+commit 8aeb1ded18a008e7aa590c09b23e43bebed389ff -+Author: djm@openbsd.org -+Date: Fri Jun 26 05:13:20 2015 +0000 -+ -+ upstream commit -+ -+ Fix \-escaping bug that caused forward path parsing to skip -+ two characters and skip past the end of the string. -+ -+ Based on patch by Salvador Fandino; ok dtucker@ -+ -+ Upstream-ID: 7b879dc446335677cbe4cb549495636a0535f3bd -+ -+commit 8bdfeda0088bc6cd48c9109047263cb21c91a206 -+Author: Damien Miller -+Date: Thu Jun 25 09:51:39 2015 +1000 -+ -+ add missing pselect6 -+ -+ patch from Jakub Jelen -+ -+commit b2a621e5411b9a56991c320ccc6396ff7b7670a5 -+Author: djm@openbsd.org -+Date: Wed Jun 24 23:47:23 2015 +0000 -+ -+ upstream commit -+ -+ correct test to sshkey_sign(); spotted by Albert S. -+ -+ Upstream-ID: 5f7347f40f0ca6abdaca2edb3bd62f4776518933 -+ -+commit b83ebbc03d0184786dac1de2cf591cdbb2050854 -+Author: dtucker@openbsd.org -+Date: Wed Jun 24 01:49:19 2015 +0000 -+ -+ upstream commit -+ -+ Revert previous commit. We still want to call setgroups -+ in the case where there are zero groups to remove any that we might otherwise -+ inherit (as pointed out by grawity at gmail.com) and since the 2nd argument -+ to setgroups is always a static global it's always valid to dereference in -+ this case. ok deraadt@ djm@ -+ -+ Upstream-ID: 895b5ac560a10befc6b82afa778641315725fd01 -+ -+commit 19118193a8ec390e333eac7b603997f03b5aa3e0 -+Author: dtucker@openbsd.org -+Date: Wed Jun 24 01:49:19 2015 +0000 -+ -+ upstream commit -+ -+ Revert previous commit. We still want to call setgroups in -+ the case where there are zero groups to remove any that we might otherwise -+ inherit (as pointed out by grawity at gmail.com) and since the 2nd argument -+ to setgroups is always a static global it's always valid to dereference in -+ this case. ok deraadt@ djm@ -+ -+ Upstream-ID: 895b5ac560a10befc6b82afa778641315725fd01 -+ -+commit 56ce45b42ac05d7a32ae55ab92a32a7f6d314be7 -+Author: djm@openbsd.org -+Date: Mon Jun 22 23:42:16 2015 +0000 -+ -+ upstream commit -+ -+ Don't count successful partial authentication as failures -+ in monitor; this may have caused the monitor to refuse multiple -+ authentications that would otherwise have successfully completed; ok markus@ -+ -+ Upstream-ID: eb74b8e506714d0f649bd5c300f762a527af04a3 -+ -+commit 55553af3f46f37e7dc2eec3f0773baff655e65e7 -+Author: dtucker@openbsd.org -+Date: Mon Jun 22 12:29:57 2015 +0000 -+ -+ upstream commit -+ -+ Don't call setgroups if we have zero groups; there's no -+ guarantee that it won't try to deref the pointer. Based on a patch from mail -+ at quitesimple.org, ok djm deraadt -+ -+ Upstream-ID: 2fff85e11d7a9a387ef7fddf41fbfaf566708ab1 -+ -+commit 3d1a4623e41066e476677ba69e7c04eb19b406da -+Author: Damien Miller -+Date: Thu Jun 18 15:07:56 2015 +1000 -+ -+ fix syntax error -+ -+commit 3e1e3a2f19241b3bb8a8208948e299c83775836d -+Author: jsing@openbsd.org -+Date: Mon Jun 15 18:44:22 2015 +0000 -+ -+ upstream commit -+ -+ If AuthorizedPrincipalsCommand is specified, however -+ AuthorizedPrincipalsFile is not (or is set to "none"), authentication will -+ potentially fail due to key_cert_check_authority() failing to locate a -+ principal that matches the username, even though an authorized principal has -+ already been matched in the output of the subprocess. Fix this by using the -+ same logic to determine if pw->pw_name should be passed, as is used to -+ determine if a authorized principal must be matched earlier on. -+ -+ ok djm@ -+ -+ Upstream-ID: 43b42302ec846b0ea68aceb40677245391b9409d -+ -+commit 3b79ce6e2664f31a71df33493ac44bf27f61ae0d -+Author: jsing@openbsd.org -+Date: Mon Jun 15 18:42:19 2015 +0000 -+ -+ upstream commit -+ -+ Make the arguments to match_principals_command() similar -+ to match_principals_file(), by changing the last argument a struct -+ sshkey_cert * and dereferencing key->cert in the caller. -+ -+ No functional change. -+ -+ ok djm@ -+ -+ Upstream-ID: 533f99b844b21b47342b32b62e198dfffcf8651c -+ -+commit 7e54c1c47e58ebd10715e53fb63a671a9919d674 -+Author: Damien Miller -+Date: Wed Jun 17 14:36:54 2015 +1000 -+ -+ trivial optimisation for seccomp-bpf -+ -+ When doing arg inspection and the syscall doesn't match, skip -+ past the instruction that reloads the syscall into the accumulator, -+ since the accumulator hasn't been modified at this point. -+ -+commit 5f9250f0d32f270ee87ac1da825bf3b25da00896 -+Author: Damien Miller -+Date: Wed Jun 17 10:50:51 2015 +1000 -+ -+ aarch64 support for seccomp-bpf sandbox -+ -+ Also resort and tidy syscall list. Based on patches by Jakub Jelen -+ bz#2361; ok dtucker@ -+ -+commit 57a180f9a5af7a6bc58c064b27e046c763bc1e47 -+Author: djm@openbsd.org -+Date: Mon Jun 15 01:32:50 2015 +0000 -+ -+ upstream commit -+ -+ return failure on RSA signature error; reported by Albert S -+ -+ Upstream-ID: e61bb93dbe0349625807b0810bc213a6822121fa -+ -+commit 28f606a719b3df898114a5854e059d251914aa98 -+Author: Tim Rice -+Date: Tue Jun 9 22:41:13 2015 -0700 -+ -+ Fix t12 rules for out of tree builds. -+ -+commit 74bc082f82ee1da95cb0e040c929169c91edf228 -+Author: millert@openbsd.org -+Date: Fri Jun 5 15:13:13 2015 +0000 -+ -+ upstream commit -+ -+ For "ssh -L 12345:/tmp/sock" don't fail with "No forward host -+ name." (we have a path, not a host name). Based on a diff from Jared -+ Yanovich. OK djm@ -+ -+ Upstream-ID: 2846b0a8c7de037e33657f95afbd282837fc213f -+ -+commit 173923d238bd79260d5cb68af008c04bd7fffea7 -+Author: djm@openbsd.org -+Date: Fri Jun 5 03:44:14 2015 +0000 -+ -+ upstream commit -+ -+ typo: accidental repetition; bz#2386 -+ -+ Upstream-ID: 45e620d99f6bc301e5949d34a54027374991c88b -+ -+commit 9f73d3fbbe4c91d78bf22b7c186f504940bfb449 -+Author: Darren Tucker -+Date: Fri Jun 5 14:51:40 2015 +1000 -+ -+ Add Linux powerpc64le and powerpcle entries. -+ -+ Stopgap to resolve bz#2409 because we are so close to release and will -+ update config.guess and friends shortly after the release. ok djm@ -+ -+commit 582fa4592b4182a16d5d0f26fa2265bdca83ad89 -+Author: Tim Rice -+Date: Wed Jun 3 21:41:11 2015 -0700 -+ -+ Remove unneeded backslashes. Patch from Ángel González -+ -+commit f821fb21d5f34cf8d639c1af9d1fb34ffa4e89aa -+Author: Darren Tucker -+Date: Thu Jun 4 14:10:55 2015 +1000 -+ -+ Remove redundant include of stdarg.h. bz#2410 -+ -+commit c7fe96d2a31e5a2a0e735d341050577011605655 -+Author: djm@openbsd.org -+Date: Tue Jun 2 09:10:40 2015 +0000 -+ -+ upstream commit -+ -+ mention CheckHostIP adding addresses to known_hosts; -+ bz#1993; ok dtucker@ -+ -+ Upstream-ID: fd44b68440fd0dc29abf9f2d3f703d74a2396cb7 -+ -+commit 2259c65402e4f0f7f71da31f21ebef4048c6a101 -+Author: Darren Tucker -+Date: Tue Jun 2 20:15:26 2015 +1000 -+ -+ Replace strcpy with strlcpy. -+ -+ ok djm, sanity check by Corinna Vinschen. -+ -+commit ef87e71d25a06792d7f1225aeab9482b879c68ef -+Author: Damien Miller -+Date: Fri May 29 18:27:21 2015 +1000 -+ -+ skip, rather than fatal when run without SUDO set -+ -+commit 60092858e806f2236ae26b60f68c7b0f441fb7c3 -+Author: Damien Miller -+Date: Fri May 29 18:03:15 2015 +1000 -+ -+ fix merge botch that left ",," in KEX algs -+ -+commit 1b3dccc76fdd613c7dd252704f14b733248e6a1c -+Author: Damien Miller -+Date: Fri May 29 17:08:28 2015 +1000 -+ -+ re-enable SSH protocol 1 at compile time -+ -+commit f1b60985a1e29c43383f0cb285b97d205cd9f4ed -+Author: djm@openbsd.org -+Date: Fri May 29 03:05:13 2015 +0000 -+ -+ upstream commit -+ -+ make this work without SUDO set; ok dtucker@ -+ -+ Upstream-Regress-ID: bca88217b70bce2fe52b23b8e06bdeb82d98c715 -+ -+commit 9ed307c6ad27915e665c5053ca21c9ca98233c3a -+Author: djm@openbsd.org -+Date: Thu May 28 07:37:31 2015 +0000 -+ -+ upstream commit -+ -+ wrap all moduli-related code in #ifdef WITH_OPENSSL. -+ based on patch from Reuben Hawkins; bz#2388 feedback and ok dtucker@ -+ -+ Upstream-ID: d80cfc8be3e6ec65b3fac9e87c4466533b31b7cf -+ -+commit 67faa0c83bcbf201ab4dcbed1e3afa8d41a861ab -+Author: dtucker@openbsd.org -+Date: Thu May 28 05:41:29 2015 +0000 -+ -+ upstream commit -+ -+ Increase the allowed length of the known host file name -+ in the log message to be consistent with other cases. Part of bz#1993, ok -+ deraadt. -+ -+ Upstream-ID: a9e97567be49f25daf286721450968251ff78397 -+ -+commit f1f1e2d340620703ebe60bc976a6c6e9115cfbdd -+Author: dtucker@openbsd.org -+Date: Thu May 28 05:09:45 2015 +0000 -+ -+ upstream commit -+ -+ Fix typo (keywork->keyword) -+ -+ Upstream-ID: 8aacd0f4089c0a244cf43417f4f9045dfaeab534 -+ -+commit 4e9bc287b2a19cf2820edfb455dedb86050c0c32 -+Author: djm@openbsd.org -+Date: Thu May 28 04:50:53 2015 +0000 -+ -+ upstream commit -+ -+ add error message on ftruncate failure; bz#2176 -+ -+ Upstream-ID: cbcc606e0b748520c74a210d8f3cc9718d3148cf -+ -+commit fa3418050e1cbef7804fbe12d0e9580867dadb79 -+Author: djm@openbsd.org -+Date: Thu May 28 04:40:13 2015 +0000 -+ -+ upstream commit -+ -+ make ssh-keygen default to ed25519 keys when compiled -+ without OpenSSL; bz#2388, ok dtucker@ -+ -+ Upstream-ID: 85a471fa6d3fa57a7b8e882d22cfbfc1d84cdc71 -+ -+commit f5224a54bfb5d961d03b2abf2ed2255f271bc118 -+Author: dtucker@openbsd.org -+Date: Wed May 27 23:51:10 2015 +0000 -+ -+ upstream commit -+ -+ Reorder client proposal to prefer -+ diffie-hellman-group-exchange-sha1 over diffie-hellman-group14-sha1. ok djm@ -+ -+ Upstream-ID: 552c08d47347c3ee1a9a57d88441ab50abe17058 -+ -+commit 66da3f6745a5f36e2a152ba7350649ca5bd791ab -+Author: dtucker@openbsd.org -+Date: Wed May 27 23:39:18 2015 +0000 -+ -+ upstream commit -+ -+ Add a stronger (4k bit) fallback group that sshd can use -+ when the moduli file is missing or broken, sourced from RFC3526. bz#2302, ok -+ markus@ (earlier version), djm@ -+ -+ Upstream-ID: b635215746a25a829d117673d5e5a76d4baee7f4 -+ -+commit 0c8b16a01523a7c9c5b159fb2cc4c4a9b9a62bdc -+Author: Darren Tucker -+Date: Thu May 28 10:03:40 2015 +1000 -+ -+ New moduli file from OpenBSD, removing 1k groups. -+ -+ Remove 1k bit groups. ok deraadt@, markus@ -+ -+commit 225efa89d79a98c7deac294a4e94515f0fb28eeb -+Author: djm@openbsd.org -+Date: Wed May 27 05:15:02 2015 +0000 -+ -+ upstream commit -+ -+ support PKCS#11 devices with external PIN entry devices -+ bz#2240, based on patch from Dirk-Willem van Gulik; feedback and ok dtucker@ -+ -+ Upstream-ID: 504568992b55a8fc984375242b1bd505ced61b0d -+ -+commit be9a9397df6ed860a575a2ee7f354e6af408d0dc -+Author: dtucker@openbsd.org -+Date: Tue May 26 23:23:40 2015 +0000 -+ -+ upstream commit -+ -+ Cap DH-GEX group size at 4kbits for Cisco implementations. -+ Some of them will choke when asked for preferred sizes >4k instead of -+ returning the 4k group that they do have. bz#2209, ok djm@ -+ -+ Upstream-ID: 54b863a19713446b7431f9d06ad0532b4fcfef8d -+ -+commit cf54d1e519458405253ad90b8b91d42d8d51b878 -+Author: djm@openbsd.org -+Date: Sun May 24 23:39:16 2015 +0000 -+ -+ upstream commit -+ -+ add missing 'c' option to getopt(), case statement was -+ already there; from Felix Bolte -+ -+ Upstream-ID: 9b19b4e2e0b54d6fefa0dfac707c51cf4bae3081 -+ -+commit 0e8674edfa086e964a6bb32825877b2545e3cb86 -+Author: jsg@openbsd.org -+Date: Sat May 23 14:28:37 2015 +0000 -+ -+ upstream commit -+ -+ fix a memory leak in an error path ok markus@ dtucker@ -+ -+ Upstream-ID: bc1da0f205494944918533d8780fde65dff6c598 -+ -+commit c09d001e89aa8d06e42313dcf451835e7b1de259 -+Author: djm@openbsd.org -+Date: Fri May 22 05:28:45 2015 +0000 -+ -+ upstream commit -+ -+ mention ssh-keygen -E for comparing legacy MD5 -+ fingerprints; bz#2332 -+ -+ Upstream-ID: 079a3669549041dbf10dbc072d9563f0dc3b2859 -+ -+commit bf028934045bec1bfe28118d784b80749656721f -+Author: djm@openbsd.org -+Date: Fri May 22 04:45:52 2015 +0000 -+ -+ upstream commit -+ -+ Reorder EscapeChar option parsing to avoid a single-byte -+ out- of-bounds read. bz#2396 from Jaak Ristioja; ok dtucker@ -+ -+ Upstream-ID: 1dc6b5b63d1c8d9a88619da0b27ade461d79b060 -+ -+commit 2ead9655af6b6ec021fb34779a49672d6f46ec7b -+Author: djm@openbsd.org -+Date: Fri May 22 03:50:02 2015 +0000 -+ -+ upstream commit -+ -+ add knob to relax GSSAPI host credential check for -+ multihomed hosts bz#928, patch by Simon Wilkinson; ok dtucker -+ (kerberos/GSSAPI is not compiled by default on OpenBSD) -+ -+ Upstream-ID: 15ddf1c6f7fd9d98eea9962f480079ae3637285d -+ -+commit b12800efef5be2cbd829d55ed1c1c014bcd30bb2 -+Author: Darren Tucker -+Date: Fri May 22 17:49:46 2015 +1000 -+ -+ Include signal.h for sig_atomic_t, used by kex.h. -+ -+ bz#2402, from tomas.kuthan at oracle com. -+ -+commit 03d570060c8e6ded2780cb96ef78d4f42126f1a2 -+Author: Darren Tucker -+Date: Fri May 22 12:47:24 2015 +1000 -+ -+ Import updated moduli file from OpenBSD. -+ -+commit a5206aa5ae2d0442dccd54ce2febf21c8ff57672 -+Author: djm@openbsd.org -+Date: Thu May 21 12:01:19 2015 +0000 -+ -+ upstream commit -+ -+ Support "ssh-keygen -lF hostname" to find search known_hosts -+ and print key hashes. Already advertised by ssh-keygen(1), but not delivered -+ by code; ok dtucker@ -+ -+ Upstream-ID: 459e0e2bf39825e41b0811c336db2d56a1c23387 -+ -+commit cb94234c08413f123ab7c43069f0f29744d78e09 -+Author: Damien Miller -+Date: Thu May 21 17:55:15 2015 +1000 -+ -+ conditionalise util.h inclusion -+ -+commit 21bc015d02aac47c5e0c7790d398366e4d0a9f96 -+Author: djm@openbsd.org -+Date: Thu May 21 06:44:25 2015 +0000 -+ -+ upstream commit -+ -+ regress test for AuthorizedPrincipalsCommand -+ -+ Upstream-Regress-ID: c658fbf1ab6b6011dc83b73402322e396f1e1219 -+ -+commit 737a485435e854edcb3f5f86e5374e9152168ebd -+Author: djm@openbsd.org -+Date: Thu May 21 06:40:02 2015 +0000 -+ -+ upstream commit -+ -+ regress test for AuthorizedKeysCommand arguments -+ -+ Upstream-Regress-ID: bbd65c13c6b3be9a442ec115800bff9625898f12 -+ -+commit 32868343127b54d7dc8fb272d4d5fbf86e050dea -+Author: djm@openbsd.org -+Date: Thu May 21 06:43:30 2015 +0000 -+ -+ upstream commit -+ -+ add AuthorizedPrincipalsCommand that allows getting -+ authorized_principals from a subprocess rather than a file, which is quite -+ useful in deployments with large userbases -+ -+ feedback and ok markus@ -+ -+ Upstream-ID: aa1bdac7b16fc6d2fa3524ef08f04c7258d247f6 -+ -+commit 48b78054ff2420d51139f1a2b75a4dd670f04f11 -+Author: djm@openbsd.org -+Date: Thu May 21 06:38:35 2015 +0000 -+ -+ upstream commit -+ -+ support arguments to AuthorizedKeysCommand -+ -+ bz#2081 loosely based on patch by Sami Hartikainen -+ feedback and ok markus@ -+ -+ Upstream-ID: b080387a14aa67dddd8ece67c00f268d626541f7 -+ -+commit a4994a5987629b473a7449d2b56b35fa14199835 -+Author: djm@openbsd.org -+Date: Thu May 21 04:55:51 2015 +0000 -+ -+ upstream commit -+ -+ refactor: split base64 encoding of pubkey into its own -+ sshkey_to_base64() function and out of sshkey_write(); ok markus@ -+ -+ Upstream-ID: 54fc38f5832e9b91028900819bda46c3959a0c1a -+ -+commit 541024d9a9925d8a40880373d33afee12d431b62 -+Author: deraadt@openbsd.org -+Date: Mon May 18 15:06:05 2015 +0000 -+ -+ upstream commit -+ -+ getentropy() and sendsyslog() have been around long -+ enough. openssh-portable may want the #ifdef's but not base. discussed with -+ djm few weeks back -+ -+ Upstream-ID: 0506a4334de108e3fb6c66f8d6e0f9c112866926 -+ -+commit 4647006134bd02da5dfcf5a95725c3208e7fb0ed -+Author: dtucker@openbsd.org -+Date: Fri May 15 05:44:21 2015 +0000 -+ -+ upstream commit -+ -+ Use a salted hash of the lock passphrase instead of plain -+ text and do constant-time comparisons of it. Should prevent leaking any -+ information about it via timing, pointed out by Ryan Castellucci. Add a 0.1s -+ incrementing delay for each failed unlock attempt up to 10s. ok markus@ -+ (earlier version), djm@ -+ -+ Upstream-ID: c599fcc325aa1cc65496b25220b622d22208c85f -+ -+commit 876e34ee137e60f01b09342c5cf55356b30f2fe0 -+Author: Damien Miller -+Date: Tue May 5 19:10:58 2015 +1000 -+ -+ upstream commit -+ -+ - tedu@cvs.openbsd.org 2015/01/12 03:20:04 -+ [bcrypt_pbkdf.c] -+ rename blocks to words. bcrypt "blocks" are unrelated to blowfish blocks, -+ nor are they the same size. -+ -+commit c1cf10e59afda5337675e63e7de2600d6dd29b65 -+Author: Damien Miller -+Date: Tue May 5 19:10:23 2015 +1000 -+ -+ upstream commit -+ -+ - deraadt@cvs.openbsd.org 2015/01/08 00:30:07 -+ [bcrypt_pbkdf.c] -+ declare a local version of MIN(), call it MINIMUM() -+ -+commit 9ff2817c3691cb3c0dbdebeef5b1ac83c42d1a82 -+Author: Damien Miller -+Date: Tue May 5 19:09:46 2015 +1000 -+ -+ upstream commit -+ -+ - djm@cvs.openbsd.org 2014/12/30 01:41:43 -+ [bcrypt_pbkdf.c] -+ typo in comment: ouput => output -+ -+commit 28c33e713908f9bda723919a4aefbe3dcf7b3fac -+Author: djm@openbsd.org -+Date: Mon May 4 06:10:48 2015 +0000 -+ -+ upstream commit -+ -+ Remove pattern length argument from match_pattern_list(), we -+ only ever use it for strlen(pattern). -+ -+ Prompted by hanno AT hboeck.de pointing an out-of-bound read -+ error caused by an incorrect pattern length found using AFL -+ and his own tools. -+ -+ ok markus@ -+ -+commit 30adb0c30b683c78aa08cbfaab070a022c36f867 -+Author: djm@openbsd.org -+Date: Fri May 1 07:10:01 2015 +0000 -+ -+ upstream commit -+ -+ refactor ssh_dispatch_run_fatal() to use sshpkt_fatal() -+ to better report error conditions. Teach sshpkt_fatal() about ECONNRESET. -+ -+ Improves error messages on TCP connection resets. bz#2257 -+ -+ ok dtucker@ -+ -+commit c35c4d44ea9f688a28db2e47d6eea2b0c958f257 -+Author: djm@openbsd.org -+Date: Fri May 1 07:08:08 2015 +0000 -+ -+ upstream commit -+ -+ a couple of parse targets were missing activep checks, -+ causing them to be misapplied in match context; bz#2272 diagnosis and -+ original patch from Sami Hartikainen ok dtucker@ -+ -+commit 51bc7881531bd272439495b9c29b25e6bc8033f7 -+Author: djm@openbsd.org -+Date: Fri May 1 04:17:51 2015 +0000 -+ -+ upstream commit -+ -+ make handling of AuthorizedPrincipalsFile=none more -+ consistent with other =none options; bz#2288 from Jakub Jelen; ok dtucker@ -+ -+commit 510bc3dc09324cb5d3e825dd4c72dca451d0c824 -+Author: djm@openbsd.org -+Date: Fri May 1 04:03:20 2015 +0000 -+ -+ upstream commit -+ -+ remove failed remote forwards established by muliplexing -+ from the list of active forwards; bz#2363, patch mostly by Yoann Ricordel; ok -+ dtucker@ -+ -+commit 000f9f2953fb62e7c5ee6e364ba7fc6e4daf993f -+Author: djm@openbsd.org -+Date: Fri May 1 04:01:58 2015 +0000 -+ -+ upstream commit -+ -+ reduce stderr spam when using ssh -S /path/mux -O forward -+ -R 0:... ok dtucker@ -+ -+commit 88e8e63accff9e602314f8bf446ab7d877a96eef -+Author: djm@openbsd.org -+Date: Fri May 1 03:23:51 2015 +0000 -+ -+ upstream commit -+ -+ prevent authorized_keys options picked up on public key -+ tests without a corresponding private key authentication being applied to -+ other authentication methods. Reported by halex@, ok markus@ -+ -+commit 4338aef5199017cf0dad6bdd7213f5f8f9b47ce4 -+Author: djm@openbsd.org -+Date: Fri May 1 03:20:54 2015 +0000 -+ -+ upstream commit -+ -+ Don't make parsing of authorized_keys' environment= -+ option conditional on PermitUserEnv - always parse it, but only use the -+ result if the option is enabled. This prevents the syntax of authorized_keys -+ changing depending on which sshd_config options were enabled. -+ -+ bz#2329; based on patch from coladict AT gmail.com, ok dtucker@ -+ -+commit 5d7dc9ff51f6356bdf8a967ae83b5568e69475d8 -+Author: djm@openbsd.org -+Date: Mon May 4 06:10:48 2015 +0000 -+ -+ upstream commit -+ -+ Remove pattern length argument from match_pattern_list(), we -+ only ever use it for strlen(pattern). -+ -+ Prompted by hanno AT hboeck.de pointing an out-of-bound read -+ error caused by an incorrect pattern length found using AFL -+ and his own tools. -+ -+ ok markus@ -+ -+commit 0dd15df88028065a0f68796d037ca561906debeb -+Author: dtucker@openbsd.org -+Date: Thu Apr 23 05:01:19 2015 +0000 -+ -+ upstream commit -+ -+ Add a simple regression test for sshd's configuration -+ parser. Right now, all it does is run the output of sshd -T back through -+ itself and ensure the output is valid and invariant. -+ -+commit 301a4c92bea0a8d79f0fc9b2accbcf90f2904421 -+Author: djm@openbsd.org -+Date: Wed Apr 22 01:38:36 2015 +0000 -+ -+ upstream commit -+ -+ use correct key for nested certificate test -+ -+commit 4087a4809463da5e97ce5fb919776f54d176a2a4 -+Author: djm@openbsd.org -+Date: Fri May 1 07:11:47 2015 +0000 -+ -+ upstream commit -+ -+ mention that the user's shell from /etc/passwd is used -+ for commands too; bz#1459 ok dtucker@ -+ -+commit 156650090c7e196930d83535b4be101f73d0564a -+Author: djm@openbsd.org -+Date: Fri May 8 07:29:00 2015 +0000 -+ -+ upstream commit -+ -+ whitespace -+ -+ Upstream-Regress-ID: 6b708a3e709d5b7fd37890f874bafdff1f597519 -+ -+commit e9b45f58bf7eb40d94e1428cb326d9a8bff04403 -+Author: djm@openbsd.org -+Date: Fri May 8 07:26:13 2015 +0000 -+ -+ upstream commit -+ -+ whitespace at EOL -+ -+ Upstream-Regress-ID: 9c48911643d5b05173b36a012041bed4080b8554 -+ -+commit a8fd8573099fc2bc3474a09ef85f384e656b2551 -+Author: djm@openbsd.org -+Date: Fri May 8 06:45:13 2015 +0000 -+ -+ upstream commit -+ -+ moar whitespace at eol -+ -+ Upstream-ID: 64eaf872a3ba52ed41e494287e80d40aaba4b515 -+ -+commit 7c0fecd6d5df2d5df0476e0089e0e82b7b6d6b61 -+Author: djm@openbsd.org -+Date: Fri May 8 06:41:56 2015 +0000 -+ -+ upstream commit -+ -+ whitespace at EOL -+ -+ Upstream-ID: 57bcf67d666c6fc1ad798aee448fdc3f70f7ec2c -+ -+commit 28e07ee5a1c2baf1119916753879d3a86555f181 -+Author: djm@openbsd.org -+Date: Fri May 8 03:56:51 2015 +0000 -+ -+ upstream commit -+ -+ whitespace at EOL -+ -+commit 74bc49d260c867c36bb32d1dad28f941442c52af -+Author: dtucker@openbsd.org -+Date: Mon May 4 01:47:53 2015 +0000 -+ -+ upstream commit -+ -+ Use diff w/out -u for better portability -+ -+commit 25b99b16d050c2bcdafd1fca228b4a48e7f04df2 -+Author: dtucker@openbsd.org -+Date: Fri May 8 03:25:07 2015 +0000 -+ -+ upstream commit -+ -+ Use xcalloc for permitted_adm_opens instead of xmalloc to -+ ensure it's zeroed. Fixes post-auth crash with permitopen=none. bz#2355, ok -+ djm@ -+ -+commit f4305e7193f9d50681479799e9f41c406d72c207 -+Author: djm@openbsd.org -+Date: Fri May 8 03:17:49 2015 +0000 -+ -+ upstream commit -+ -+ don't choke on new-format private keys encrypted with an -+ AEAD cipher; bz#2366, patch from Ron Frederick; ok markus@ -+ -+commit 40ada25da022fd6ea4a1bad8eb3bcf0d38de94cd -+Author: dtucker@openbsd.org -+Date: Wed May 6 05:45:17 2015 +0000 -+ -+ upstream commit -+ -+ Clarify pseudo-terminal request behaviour and use -+ "pseudo-terminal" consistently. bz#1716, ok jmc@ "I like it" deraadt@. -+ -+commit 2a34fd3931d607199715c0fe198c23c33493d49b -+Author: dtucker@openbsd.org -+Date: Wed May 6 04:07:18 2015 +0000 -+ -+ upstream commit -+ -+ Blacklist DH-GEX for specific PuTTY versions known to -+ send non-RFC4419 DH-GEX messages rather than all versions of PuTTY. -+ According to Simon Tatham, 0.65 and newer versions will send RFC4419 DH-GEX -+ messages. ok djm@ -+ -+commit 81c4517030119ce7026b44cd2b037932c11e002d -+Author: dtucker@openbsd.org -+Date: Tue May 5 10:17:49 2015 +0000 -+ -+ upstream commit -+ -+ WinSCP doesn't implement RFC4419 DH-GEX so flag it so we -+ don't offer that KEX method. ok markus@ -+ -+commit 52c5496e0fbaf6b30fa1c4d665e1434e8f26f64b -+Author: jsg@openbsd.org -+Date: Tue May 5 02:48:17 2015 +0000 -+ -+ upstream commit -+ -+ use the sizeof the struct not the sizeof a pointer to the -+ struct in ssh_digest_start() -+ -+ This file is only used if ssh is built with OPENSSL=no -+ -+ ok markus@ -+ -+commit a34e3b03deaf03a9b65b772684b3961ecc102c06 -+Author: Darren Tucker -+Date: Fri May 8 11:07:27 2015 +1000 -+ -+ Put brackets around mblen() compat constant. -+ -+ This might help with the reported problem cross compiling for Android -+ ("error: expected identifier or '(' before numeric constant") but -+ shouldn't hurt in any case. -+ -+commit 15a8b21ba56face9c1ad55be990642d3405436bf -+Author: Darren Tucker -+Date: Thu Apr 30 09:18:11 2015 +1000 -+ -+ xrealloc -> xreallocarray in portable code too. -+ -+commit 2681f273d20c8a5b1feeff11c4be03180255e4e5 -+Author: dtucker@openbsd.org -+Date: Wed Apr 29 03:48:56 2015 +0000 -+ -+ upstream commit -+ -+ Allow ListenAddress, Port and AddressFamily in any -+ order. bz#68, ok djm@, jmc@ (for the man page bit). -+ -+commit abcdea8bdbe7075ecce13388687663cbaa11b621 -+Author: jmc@openbsd.org -+Date: Tue Apr 28 13:47:38 2015 +0000 -+ -+ upstream commit -+ -+ enviroment -> environment: apologies to darren for not -+ spotting that first time round... -+ -+commit 3c6c358085d2dd0657aeb319fe16ca7cf710cfa2 -+Author: dtucker@openbsd.org -+Date: Tue Apr 28 10:25:15 2015 +0000 -+ -+ upstream commit -+ -+ Fix typo in previous -+ -+commit da99ec2a6d5a5c5c4f216884ff1242841eb6d068 -+Author: dtucker@openbsd.org -+Date: Tue Apr 28 10:17:58 2015 +0000 -+ -+ upstream commit -+ -+ Document that the TERM environment variable is not -+ subject to SendEnv and AcceptEnv. bz#2386, based loosely on a patch from -+ jjelen at redhat, help and ok jmc@ -+ -+commit be478b026b72dd219c2ea8c285ea6709551b9cab -+Author: djm@openbsd.org -+Date: Mon Apr 27 21:42:48 2015 +0000 -+ -+ upstream commit -+ -+ Make sshd default to PermitRootLogin=no; ok deraadt@ -+ rpe@ -+ -+commit 9ab14131e1a0daa07aaeab3ec76a517adfe65d29 -+Author: djm@openbsd.org -+Date: Mon Apr 27 01:52:30 2015 +0000 -+ -+ upstream commit -+ -+ fix compilation with OPENSSL=no; ok dtucker@ -+ -+commit 4f42c6d1d1a8870b47cc427131af8ac055b99ab8 -+Author: dtucker@openbsd.org -+Date: Mon Apr 27 00:37:53 2015 +0000 -+ -+ upstream commit -+ -+ Include stdio.h for FILE (used in sshkey.h) so it -+ compiles with OPENSSL=no. -+ -+commit 57c33f7704ebadc0ffc9544dc3af19564c4837d6 -+Author: djm@openbsd.org -+Date: Mon Apr 27 00:21:21 2015 +0000 -+ -+ upstream commit -+ -+ allow "sshd -f none" to skip reading the config file, -+ much like "ssh -F none" does. ok dtucker -+ -+commit 2639a73d1f92a1b7fef0ce6d91a96cd905c43655 -+Author: jmc@openbsd.org -+Date: Fri Apr 24 06:26:49 2015 +0000 -+ -+ upstream commit -+ -+ combine -Dd onto one line and update usage(); -+ -+commit a1c40c8873cf5d342571992f6c6262a8461d69d1 -+Author: djm@openbsd.org -+Date: Fri Apr 24 05:26:44 2015 +0000 -+ -+ upstream commit -+ -+ add ssh-agent -D to leave ssh-agent in foreground -+ without enabling debug mode; bz#2381 ok dtucker@ -+ -+commit 2e916625c4961c234d4d230e847adaf8fab556b0 -+Author: deraadt@openbsd.org -+Date: Fri Apr 24 01:36:24 2015 +0000 -+ -+ upstream commit -+ -+ 2*len -> use xreallocarray() ok djm -+ -+commit c46d10e2dc65b9d06276c284b39219bf2a193d65 -+Author: deraadt@openbsd.org -+Date: Fri Apr 24 01:36:00 2015 +0000 -+ -+ upstream commit -+ -+ rename xrealloc() to xreallocarray() since it follows -+ that form. ok djm -+ -+commit e8b471f33a890138149e661dc8dd3e17ce3fc81f -+Author: dtucker@openbsd.org -+Date: Thu Apr 23 04:59:10 2015 +0000 -+ -+ upstream commit -+ -+ Two small fixes for sshd -T: ListenAddress'es are added -+ to a list head so reverse the order when printing them to ensure the -+ behaviour remains the same, and print StreamLocalBindMask as octal with -+ leading zero. ok deraadt@ -+ -+commit cc918de22fea3eb8fb64a4c9c4c6a2587e157b27 -+Author: dtucker@openbsd.org -+Date: Thu Apr 23 04:53:53 2015 +0000 -+ -+ upstream commit -+ -+ Check for and reject missing arguments for -+ VersionAddendum and ForceCommand. bz#2281, patch from plautrba at redhat com, -+ ok djm@ -+ -+commit 30b3bf18afada633d35ba7d7ab95ec3d6c619cd2 -+Author: djm@openbsd.org -+Date: Wed Apr 22 01:24:01 2015 +0000 -+ -+ upstream commit -+ -+ unknown certificate extensions are non-fatal, so don't -+ fatal when they are encountered; bz#2387 reported by Bob Van Zant; ok -+ dtucker@ -+ -+commit f4d3faf42c43ddf9a5860f0d4548a36e4f8e2a23 -+Author: jsg@openbsd.org -+Date: Tue Apr 21 07:01:00 2015 +0000 -+ -+ upstream commit -+ -+ Add back a backslash removed in rev 1.42 so -+ KEX_SERVER_ENCRYPT will include aes again. -+ -+ ok deraadt@ -+ -+commit 30f32c3fee51ae4e3e3071270abb8991720a2bc1 -+Author: djm@openbsd.org -+Date: Fri Apr 17 13:32:09 2015 +0000 -+ -+ upstream commit -+ -+ s/recommended/required/ that private keys be og-r this -+ wording change was made a while ago but got accidentally reverted -+ -+commit 9597ab4b19de4cfd2ff84b6f1e0ce710bfddf207 -+Author: djm@openbsd.org -+Date: Fri Apr 17 13:25:52 2015 +0000 -+ -+ upstream commit -+ -+ don't try to cleanup NULL KEX proposals in -+ kex_prop_free(); found by Jukka Taimisto and Markus Hietava -+ -+commit dc32ea5cd2eb400f4a368ff6088d43fba95adf18 -+Author: djm@openbsd.org -+Date: Fri Apr 17 13:19:22 2015 +0000 -+ -+ upstream commit -+ -+ use error/logit/fatal instead of fprintf(stderr, ...) -+ and exit(0), fix a few errors that were being printed to stdout instead of -+ stderr and a few non-errors that were going to stderr instead of stdout -+ bz#2325; ok dtucker -+ -+commit 40cfe00f22da9d3afd3d967dcdff75b2ea84baa7 -+Author: djm@openbsd.org -+Date: Fri Apr 17 13:16:48 2015 +0000 -+ -+ upstream commit -+ -+ debug log missing DISPLAY environment when X11 -+ forwarding requested; bz#1682 ok dtucker@ -+ -+commit ef2212b3e5b54d10aa8db413e29d55fc179a9ab5 -+Author: djm@openbsd.org -+Date: Fri Apr 17 04:32:31 2015 +0000 -+ -+ upstream commit -+ -+ don't call record_login() in monitor when UseLogin is -+ enabled; bz#278 reported by drk AT sgi.com; ok dtucker -+ -+commit 319d2e33d5565ce73be7156936a39b77c1b0c5ba -+Author: dtucker@openbsd.org -+Date: Fri Apr 17 04:12:35 2015 +0000 -+ -+ upstream commit -+ -+ Add some missing options to sshd -T and fix the output -+ of VersionAddendum HostCertificate. bz#2346, patch from jjelen at redhat -+ com, ok djm. -+ -+commit a262eddc234ea6b79fb4e9c6a37cf7530467b2cb -+Author: dtucker@openbsd.org -+Date: Thu Apr 16 23:25:50 2015 +0000 -+ -+ upstream commit -+ -+ Document "none" for PidFile XAuthLocation -+ TrustedUserCAKeys and RevokedKeys. bz#2382, feedback from jmc@, ok djm@ -+ -+commit 2a57c9ea0ee2e085375457219305592430831371 -+Author: dtucker@openbsd.org -+Date: Wed Apr 15 23:23:25 2015 +0000 -+ -+ upstream commit -+ -+ Plug leak of address passed to logging. bz#2373, patch -+ from jjelen at redhat, ok markus@ -+ -+commit 447627baf16b13bed21edc32f56c8bdd4d691378 -+Author: dtucker@openbsd.org -+Date: Tue Apr 14 04:17:03 2015 +0000 -+ -+ upstream commit -+ -+ Output remote username in debug output since with Host -+ and Match it's not always obvious what it will be. bz#2368, ok djm@ -+ -+commit 6080662e99e6c2f8bec0f40b18bd60df91c44393 -+Author: Darren Tucker -+Date: Fri Apr 17 10:56:13 2015 +1000 -+ -+ Format UsePAM setting when using sshd -T. -+ -+ Part of bz#2346, patch from jjelen at redhat com. -+ -+commit 9583d7ef67bea8b6d7a8e11d164136f362286fc2 -+Author: Darren Tucker -+Date: Fri Apr 17 10:40:23 2015 +1000 -+ -+ Wrap endian.h include inside ifdef (bz#2370). -+ -+commit f1c0b82b2584024c86c35b3ab1a90a6c57490f8a -+Author: Darren Tucker -+Date: Fri Apr 17 09:39:58 2015 +1000 -+ -+ Look for '${host}-ar' before 'ar'. -+ -+ This changes configure.ac to look for '${host}-ar' as set by -+ AC_CANONICAL_HOST before looking for the unprefixed 'ar'. -+ Useful when cross-compiling when all your binutils are prefixed. -+ -+ Patch from moben at exherbo org via astrand at lysator liu se and -+ bz#2352. -+ -+commit db4ee4b7349d247d80682beed0e62fa83bc51594 -+Author: Damien Miller -+Date: Thu Apr 16 11:40:20 2015 +1000 -+ -+ remove dependency on arpa/telnet.h -+ -+commit 3785afe7ec9ee71883976a98d606f20d95b46245 -+Author: Darren Tucker -+Date: Wed Apr 15 15:59:49 2015 +1000 -+ -+ Remove duplicate include of pwd.h. bz#2337, patch from Mordy Ovits. -+ -+commit a06487a7194a080a2dbf2b206c65d1c18cd2eb0d -+Author: Damien Miller -+Date: Thu Apr 9 10:14:48 2015 +1000 -+ -+ platform's with openpty don't need pty_release -+ -+commit 419118f8d4ad6866788efd5bf60448062365c27f -+Author: djm@openbsd.org -+Date: Mon Apr 13 02:04:08 2015 +0000 -+ -+ upstream commit -+ -+ deprecate ancient, pre-RFC4419 and undocumented -+ SSH2_MSG_KEX_DH_GEX_REQUEST_OLD message; ok markus@ deraadt@ "seems -+ reasonable" dtucker@ -+ -+commit ae8579c166e70b292ed9fd9ed36c96d872562e11 -+Author: dtucker@openbsd.org -+Date: Fri Apr 10 05:16:50 2015 +0000 -+ -+ upstream commit -+ -+ Don't send hostkey advertisments -+ (hostkeys-00@openssh.com) to current versions of Tera Term as they can't -+ handle them. Newer versions should be OK. Patch from Bryan Drewery and -+ IWAMOTO Kouichi, ok djm@ -+ -+commit 74db660b0a74f6bf1cd14883760702e273acf192 -+Author: djm@openbsd.org -+Date: Fri Apr 10 00:08:55 2015 +0000 -+ -+ upstream commit -+ -+ include port number if a non-default one has been -+ specified; based on patch from Michael Handler -+ -+commit 91a4b2ec624588cd6a0c16728bd86c79c99371cf -+Author: djm@openbsd.org -+Date: Tue Apr 7 23:00:42 2015 +0000 -+ -+ upstream commit -+ -+ treat Protocol=1,2|2,1 as Protocol=2 when compiled -+ without SSH1 support; ok dtucker@ millert@ -+ -+commit f32be062394542acca8a188cd606ceaeff5145da -+Author: miod@openbsd.org -+Date: Sun Apr 5 15:43:43 2015 +0000 -+ -+ upstream commit -+ -+ Do not use int for sig_atomic_t; spotted by -+ christos@netbsd; ok markus@ -+ -+commit 444e1283ccd2cdb0fb53a72f60c35e26cd1844fc -+Author: Darren Tucker -+Date: Tue Apr 7 10:48:04 2015 +1000 -+ -+ Use do{}while(0) for no-op functions. -+ -+ From FreeBSD. -+ -+commit 7618ade50952bac02058f20ed5751a4515397a0b -+Author: Darren Tucker -+Date: Tue Apr 7 10:47:15 2015 +1000 -+ -+ Wrap blf.h include in ifdef. From FreeBSD. -+ -+commit 395c7fd1aa81d3368167d402a1f605695cca4fb1 -+Author: Darren Tucker -+Date: Tue Apr 7 09:10:00 2015 +1000 -+ -+ Fix misspellings of regress CONFOPTS env variables. -+ -+ Patch from Bryan Drewery. -+ -+commit d034c08866a7bbcac8c76c41b1c7cc7357813649 -+Author: djm@openbsd.org -+Date: Fri Apr 3 22:17:27 2015 +0000 -+ -+ upstream commit -+ -+ correct return value in pubkey parsing, spotted by Ben Hawkes -+ ok markus@ -+ -+commit 3e2736509038175e503084f04467ce6420c65a54 -+Author: djm@openbsd.org -+Date: Tue Mar 31 22:59:01 2015 +0000 -+ -+ upstream commit -+ -+ adapt to recent hostfile.c change: when parsing -+ known_hosts without fully parsing the keys therein, hostkeys_foreach() will -+ now correctly identify KEY_RSA1 keys; ok markus@ miod@ -+ -+commit 8bca8cf259018b4121e3e67489782ccac7358db1 -+Author: markus@openbsd.org -+Date: Tue Mar 24 20:19:15 2015 +0000 -+ -+ upstream commit -+ -+ use ${SSH} for -Q instead of installed ssh -+ -+commit 4be02118444d39f406d91b09525bfacbdac66c43 -+Author: djm@openbsd.org -+Date: Mon Mar 16 22:46:14 2015 +0000 -+ -+ upstream commit -+ -+ make CLEANFILES clean up more of the tests' droppings -+ -+commit e42557a347ddf42eabcd59762f3d2f6da79033a5 -+Author: djm@openbsd.org -+Date: Tue Mar 31 22:57:06 2015 +0000 -+ -+ upstream commit -+ -+ downgrade error() for known_hosts parse errors to debug() -+ to quiet warnings from ssh1 keys present when compiled !ssh1. -+ -+ also identify ssh1 keys when scanning, even when compiled !ssh1 -+ -+ ok markus@ miod@ -+ -+commit eea883d188671549952f165df2b785395b7a58db -+Author: djm@openbsd.org -+Date: Tue Mar 31 22:55:50 2015 +0000 -+ -+ upstream commit -+ -+ fd leak for !ssh1 case; found by unittests; ok markus@ -+ -+commit e434c111e0599a1a879bd4aa2e2a1e8854e8d2b1 -+Author: djm@openbsd.org -+Date: Tue Mar 31 22:55:24 2015 +0000 -+ -+ upstream commit -+ -+ don't fatal when a !ssh1 sshd is reexeced from a w/ssh1 -+ listener; reported by miod@; ok miod@ markus@ -+ -+commit 51996956f1073dfb6a29bf4f28de8f38b0b1da09 -+Author: tobias@openbsd.org -+Date: Tue Mar 31 11:06:49 2015 +0000 -+ -+ upstream commit -+ -+ Comments are only supported for RSA1 keys. If a user -+ tried to add one and entered his passphrase, explicitly clear it before exit. -+ This is done in all other error paths, too. -+ -+ ok djm -+ -+commit 84d5032288a18854fefafd26c9dd227a219863e6 -+Author: jmc@openbsd.org -+Date: Mon Mar 30 18:28:37 2015 +0000 -+ -+ upstream commit -+ -+ ssh-askpass(1) is the default, overridden by SSH_ASKPASS; -+ diff originally from jiri b; -+ -+commit 792037edff7d1a5edbe31cdd6924febf8a600403 -+Author: djm@openbsd.org -+Date: Mon Mar 30 00:00:29 2015 +0000 -+ -+ upstream commit -+ -+ fix uninitialised memory read when parsing a config file -+ consisting of a single nul byte. Found by hanno AT hboeck.de using AFL; ok -+ dtucker -+ -+commit dfeb44f2caea1f97cd667188383167611f4e7760 -+Author: markus@openbsd.org -+Date: Thu Mar 26 19:32:19 2015 +0000 -+ -+ upstream commit -+ -+ sigp and lenp are not optional in ssh_agent_sign(); ok -+ djm@ -+ -+commit bc1fb5095d745a4b8ae317e0a3715cf53f13ecba -+Author: naddy@openbsd.org -+Date: Thu Mar 26 12:32:38 2015 +0000 -+ -+ upstream commit -+ -+ don't try to load .ssh/identity by default if SSH1 is -+ disabled; ok markus@ -+ -+commit 63f675d0c0494e2049bd33012be5a421bc9372f6 -+Author: djm@openbsd.org -+Date: Thu Mar 26 07:00:04 2015 +0000 -+ -+ upstream commit -+ -+ ban all-zero curve25519 keys as recommended by latest -+ CFRG curves draft; ok markus -+ -+commit e64adfb531449ce3958664489c2ab501ba22e75a -+Author: djm@openbsd.org -+Date: Thu Mar 26 06:59:28 2015 +0000 -+ -+ upstream commit -+ -+ relax bits needed check to allow -+ diffie-hellman-group1-sha1 key exchange to complete for chacha20-poly1305 was -+ selected as symmetric cipher; ok markus -+ -+commit fc497733a3cb0abd3c02dbc3b5c53677f738b277 -+Author: markus@openbsd.org -+Date: Wed Mar 25 19:29:58 2015 +0000 -+ -+ upstream commit -+ -+ ignore v1 errors on ssh-add -D; only try v2 keys on -+ -l/-L (unless WITH_SSH1) ok djm@ -+ -+commit 733e315109c2e8d910836994af4f38f128b8ccdc -+Author: markus@openbsd.org -+Date: Wed Mar 25 19:21:48 2015 +0000 -+ -+ upstream commit -+ -+ unbreak ssh_agent_sign (lenp vs *lenp) -+ -+commit 908ff5bf0c33619e6f1e95984be88f3c7080d0af -+Author: markus@openbsd.org -+Date: Tue Mar 24 20:10:08 2015 +0000 -+ -+ upstream commit -+ -+ don't leak 'setp' on error; noted by Nicholas Lemonias; -+ ok djm@ -+ -+commit b5e4c9d68d425f8f165c10763daf345b59939c81 -+Author: markus@openbsd.org -+Date: Tue Mar 24 20:09:11 2015 +0000 -+ -+ upstream commit -+ -+ consistent check for NULL as noted by Nicholas -+ Lemonias; ok djm@ -+ -+commit a080fb46443fd42f36215461d91091c245e50e78 -+Author: markus@openbsd.org -+Date: Tue Mar 24 20:03:44 2015 +0000 -+ -+ upstream commit -+ -+ correct fmt-string for size_t as noted by Nicholas -+ Lemonias; ok djm@ -+ -+commit dbe1e3289c7fa72f014ccc07ca83dba968aeae4d -+Author: djm@openbsd.org -+Date: Tue Mar 24 09:17:21 2015 +0000 -+ -+ upstream commit -+ -+ promote chacha20-poly1305@openssh.com to be the default -+ cipher; ok markus -+ -+commit f3be4c75b85c92b977451ae12c00cab0a43f5fee -+Author: djm@openbsd.org -+Date: Tue Mar 24 01:29:19 2015 +0000 -+ -+ upstream commit -+ -+ Compile-time disable SSH protocol 1. You can turn it -+ back on using the Makefile.inc knob if you need it to talk to ancient -+ devices. -+ -+commit 47b9fedfe660fb788faf94bc886c97d6739144fc -+Author: djm@openbsd.org -+Date: Tue Mar 24 01:11:12 2015 +0000 -+ -+ upstream commit -+ -+ fix double-negative error message "ssh1 is not -+ unsupported" -+ -+commit b755c628438669df399d526769c3febf94eb18f5 -+Author: djm@openbsd.org -+Date: Mon Mar 23 06:06:38 2015 +0000 -+ -+ upstream commit -+ -+ for ssh-keygen -A, don't try (and fail) to generate ssh -+ v.1 keys when compiled without SSH1 support RSA/DSA/ECDSA keys when compiled -+ without OpenSSL based on patch by Mike Frysinger; bz#2369 -+ -+commit 3a2e3e32afa9e12058e37a28659777b29535f19a -+Author: djm@openbsd.org -+Date: Wed Mar 18 01:44:21 2015 +0000 -+ -+ upstream commit -+ -+ KRL support doesn't need OpenSSL anymore, remove #ifdefs -+ from around call -+ -+commit 957768444835c68446516e0fb20ff059585675bf -+Author: djm@openbsd.org -+Date: Mon Mar 16 11:09:52 2015 +0000 -+ -+ upstream commit -+ -+ #if 0 some more arrays used only for decrypting (we don't -+ use since we only need encrypt for AES-CTR) -+ -+commit a9f2540f8d74eb48f0a216a4f797fec9228b804e -+Author: jsg@openbsd.org -+Date: Wed Mar 11 00:48:39 2015 +0000 -+ -+ upstream commit -+ -+ add back the changes from rev 1.206, djm reverted this by -+ mistake in rev 1.207 -+ -+commit 6d79ae4a500b6a156b6a9fb86b120890535d133e -+Author: Damien Miller -+Date: Fri Mar 20 09:11:59 2015 +1100 -+ -+ remove error() accidentally inserted for debugging -+ -+ pointed out by Christian Hesse -+ -+commit fc177349006c91049eea47ff711e62e942c16768 -+Merge: 8460b2f 98972bf -+Author: Venkat Yekkirala -+Date: Fri Jan 22 11:12:45 2016 -0600 -+ -+ Merge branch 'master' into GSI_ISSHD_HPN_7_1_P1 -+ -+commit 5e66573bd50818b37a7322ebc4520ed10f5749bf -+Merge: 5c6feeb 98972bf -+Author: Venkat Yekkirala -+Date: Fri Jan 22 11:12:13 2016 -0600 -+ -+ Merge branch 'master' into GSI_ISSHD_HPN_7_1_P2 -+ -+commit 98972bfc72ebfb878400297bbf8a1d82f68f8ee0 -+Author: Venkat Yekkirala -+Date: Fri Jan 22 11:10:55 2016 -0600 -+ -+ Deleted PATH* settings that conflict with pathnames.h mods for GLOBUS_LOCATION. -+ -+commit 8460b2f84eda69c0c0c4638aa4b213376d11d4bc -+Author: Damien Miller -+Date: Thu Jan 14 11:02:58 2016 +1100 -+ -+ forcibly disable roaming support in the client -+ (cherry picked from commit 6b33763242c063e4e0593877e835eeb1fd1b60aa) -+ -+commit 1a7ff74d4716bd140fcf3796495476a63280aeae -+Author: Venkat Yekkirala -+Date: Tue Jan 19 12:13:30 2016 -0600 -+ -+ Allowing gssapi-keyex for root as suggested in: -+ https://bugzilla.mindrot.org/show_bug.cgi?id=2456 -+ (cherry picked from commit d1d720a51df6429a88a296308af2056d153e134c) -+ -+commit ebd292bdba84f8613be705d997984b31c2d969d9 -+Merge: e08c5a4 7b8e179 -+Author: Venkat Yekkirala -+Date: Thu Jan 21 17:25:18 2016 -0600 -+ -+ Merge pull request #6 from globus/gpt-5.7 -+ -+ merging GPT branch functionality from CVS to GitHub -+ -+commit 5c6feeb7e28454e9b2b62d8845fdac5bfdbb5ffb -+Merge: d1d720a 7b4a3c9 -+Author: Venkat Yekkirala -+Date: Thu Jan 21 09:36:04 2016 -0600 -+ -+ Merge branch 'ISSHD_HPN_7_1_P2' into GSI_ISSHD_HPN_7_1_P2 -+ -+commit 7b4a3c935dd1a689cba0109f75eb4712bca7c2f6 -+Author: Venkat Yekkirala -+Date: Wed Jan 20 12:41:27 2016 -0600 -+ -+ Attempted merge-conflict resolution from previous commit; resolved the merge conflict tags. -+ -+commit fce96cdbdb59f1e1ce075afa9d661936837638e1 -+Author: Venkat Yekkirala -+Date: Wed Jan 20 12:34:27 2016 -0600 -+ -+ Updated NMOD version to be the same as the NMOD release tag of 3.19. -+ -+commit d1d720a51df6429a88a296308af2056d153e134c -+Author: Venkat Yekkirala -+Date: Tue Jan 19 12:13:30 2016 -0600 -+ -+ Allowing gssapi-keyex for root as suggested in: -+ https://bugzilla.mindrot.org/show_bug.cgi?id=2456 -+ -+commit 23dc3dd457f60d30eaf7426b10ae4071a21c3ed8 -+Merge: a723d71 e08c5a4 -+Author: Venkat Yekkirala -+Date: Tue Jan 19 11:57:20 2016 -0600 -+ -+ Merge remote branch 'origin/GSI_ISSHD_HPN_7_1_P1' into GSI_ISSHD_HPN_7_1_P2 -+ -+commit a723d71f9136926174236cc12e9556c099ab24d5 -+Merge: d9754b4 535137c -+Author: Venkat Yekkirala -+Date: Tue Jan 19 11:53:18 2016 -0600 -+ -+ Merge commit 'v3.19.0' into ISSHD_HPN_7_1_P2 -+ -+ Conflicts: -+ kex.c -+ -+commit d9754b458e342afde7f1759b40618458887119a1 -+Author: Mike Frysinger -+Date: Thu Jan 14 14:01:21 2016 -0500 -+ -+ fix misc style issues in hpn code -+ -+commit c0cc86b7698f8f2e776f0d256aa9db2d7fa48863 -+Merge: 2f3e41b c88ac10 -+Author: Mike Frysinger -+Date: Thu Jan 14 13:30:33 2016 -0500 -+ -+ Merge tag 'V_7_1_P2' into hpn -+ -+ openssh-7.1p2 -+ - commit e6c85f8889c5c9eb04796fdb76d2807636b9eef5 - Author: Damien Miller - Date: Fri Jan 15 01:30:36 2016 +1100 - - forcibly disable roaming support in the client - -+commit c88ac102f0eb89f2eaa314cb2e2e0ca3c890c443 -+Author: Damien Miller -+Date: Thu Jan 14 11:08:19 2016 +1100 -+ -+ bump version numbers -+ -+commit 302bc21e6fadacb04b665868cd69b625ef69df90 -+Author: Damien Miller -+Date: Thu Jan 14 11:04:04 2016 +1100 -+ -+ openssh-7.1p2 -+ -+commit 6b33763242c063e4e0593877e835eeb1fd1b60aa -+Author: Damien Miller -+Date: Thu Jan 14 11:02:58 2016 +1100 -+ -+ forcibly disable roaming support in the client -+ -+commit 34d364f0d2e1e30a444009f0e04299bb7c94ba13 -+Author: djm@openbsd.org -+Date: Mon Oct 5 17:11:21 2015 +0000 -+ -+ upstream commit -+ -+ some more bzero->explicit_bzero, from Michael McConville -+ -+ Upstream-ID: 17f19545685c33327db2efdc357c1c9225ff00d0 -+ -+commit 8f5b93026797b9f7fba90d0c717570421ccebbd3 -+Author: guenther@openbsd.org -+Date: Fri Sep 11 08:50:04 2015 +0000 -+ -+ upstream commit -+ -+ Use explicit_bzero() when zeroing before free() -+ -+ from Michael McConville (mmcconv1 (at) sccs.swarthmore.edu) -+ ok millert@ djm@ -+ -+ Upstream-ID: 2e3337db046c3fe70c7369ee31515ac73ec00f50 -+ -+commit d77148e3a3ef6c29b26ec74331455394581aa257 -+Author: djm@openbsd.org -+Date: Sun Nov 8 21:59:11 2015 +0000 -+ -+ upstream commit -+ -+ fix OOB read in packet code caused by missing return -+ statement found by Ben Hawkes; ok markus@ deraadt@ -+ -+ Upstream-ID: a3e3a85434ebfa0690d4879091959591f30efc62 -+ -+commit 076d849e17ab12603627f87b301e2dca71bae518 -+Author: Damien Miller -+Date: Sat Nov 14 18:44:49 2015 +1100 -+ -+ read back from libcrypto RAND when privdropping -+ -+ makes certain libcrypto implementations cache a /dev/urandom fd -+ in preparation of sandboxing. Based on patch by Greg Hartman. -+ -+commit f72adc0150011a28f177617a8456e1f83733099d -+Author: djm@openbsd.org -+Date: Sun Dec 13 22:42:23 2015 +0000 -+ -+ upstream commit -+ -+ unbreak connections with peers that set -+ first_kex_follows; fix from Matt Johnston va bz#2515 -+ -+ Upstream-ID: decc88ec4fc7515594fdb42b04aa03189a44184b -+ -+commit 04bd8d019ccd906cac1a2b362517b8505f3759e6 -+Author: djm@openbsd.org -+Date: Tue Jan 12 23:42:54 2016 +0000 -+ -+ upstream commit -+ -+ use explicit_bzero() more liberally in the buffer code; ok -+ deraadt -+ -+ Upstream-ID: 0ece37069fd66bc6e4f55eb1321f93df372b65bf -+ - commit ed4ce82dbfa8a3a3c8ea6fa0db113c71e234416c - Author: djm@openbsd.org - Date: Wed Jan 13 23:04:47 2016 +0000 -@@ -5489,6 +13789,29 @@ - - Upstream-ID: 0ece37069fd66bc6e4f55eb1321f93df372b65bf - -+commit 535137cf60192c7887e11fb2ab2cc85c3dc79ff8 -+Author: scott campbell -+Date: Mon Jan 11 15:03:05 2016 -0500 -+ -+ fix type error -+ -+ char is not u_char -+ char is not u_char -+ char is not u_char -+ char is not u_char -+ -+commit d1d06d2829ecf94a90063e08f6dd3e907ec5ec77 -+Author: scott campbell -+Date: Mon Jan 11 14:27:25 2016 -0500 -+ -+ option for runtime disable for issued logging -+ -+ If —enable-nercmod is set at configure time, it still will be possible -+ to disable the logging of information by setting AuditDisabled to yes -+ in ssh_config -+ -+ Default value is on to preserve backwards compatibility. -+ - commit 4626cbaf78767fc8e9c86dd04785386c59ae0839 - Author: Damien Miller - Date: Fri Jan 8 14:24:56 2016 +1100 -@@ -5551,6 +13874,24 @@ - - Upstream-ID: 38a58b30ae3eef85051c74d3c247216ec0735f80 - -+commit e08c5a40c44af7adf27af5c3144c53b4628183dd -+Author: Venkat Yekkirala -+Date: Mon Dec 21 12:58:11 2015 -0600 -+ -+ Made it explicit in log message that ignoring no-keys-available error since GSI is enabled. -+ -+commit 583166d44324d2a591c75b95bdf6299a9fac1bfb -+Author: Venkat Yekkirala -+Date: Mon Dec 21 12:54:12 2015 -0600 -+ -+ If GSI is enabled, no host keys being available to be notified to the client isn't an error. -+ -+commit 77e1e047921614d65b6af485c515e84d8836ccda -+Author: scott campbell -+Date: Fri Dec 18 19:06:17 2015 -0500 -+ -+ test -+ - commit 271df8185d9689b3fb0523f58514481b858f6843 - Author: djm@openbsd.org - Date: Sun Dec 13 22:42:23 2015 +0000 -@@ -5647,6 +13988,31 @@ - - Upstream-ID: b0c6b4cd2cdb01d7e9eefbffdc522e35b5bc4acc - -+commit 2f3e41bc29f61d7d4575a6d763c2f3198ad7cc3e -+Author: Chris Rapier -+Date: Thu Dec 17 17:51:22 2015 -0500 -+ -+ A funding appeal was added to the README. -+ -+commit a4fd12ddfb5db91e94300000a40f4b1541eb4198 -+Merge: 9fe4f81 764931d -+Author: scott campbell -+Date: Thu Dec 17 14:58:02 2015 -0500 -+ -+ Merge remote-tracking branch 'rapier1/master' into isshd -+ -+commit 04a5d50df0499ded20be897886937f65ba388ae0 -+Author: Venkat Yekkirala -+Date: Thu Dec 17 10:21:06 2015 -0600 -+ -+ Automatically set program_prefix to "gsi" if GSI is configured. -+ -+commit 3d0deb6d4db1ad324d9ab5a1158a693e77d7a8e3 -+Author: Venkat Yekkirala -+Date: Tue Dec 15 11:15:34 2015 -0600 -+ -+ Enabled configuration for program_prefix. -+ - commit ee607cccb6636eb543282ba90e0677b0604d8b7a - Author: Darren Tucker - Date: Tue Dec 15 15:23:49 2015 +1100 -@@ -5684,6 +14050,12 @@ - Should allow it it compile with MUSL libc. Based on patch from - doughdemon via github. - -+commit 11eb0f4ea2a3682e14080aab1f4b4dad8ffa9a1a -+Author: Venkat Yekkirala -+Date: Mon Dec 14 11:39:16 2015 -0600 -+ -+ Adding missing ChangeLog.gssapi back. -+ - commit 39736be06c7498ef57d6970f2d85cf066ae57c82 - Author: djm@openbsd.org - Date: Fri Dec 11 02:20:28 2015 +0000 -@@ -5739,6 +14111,12 @@ - - Upstream-ID: 8cca7c787599a5e8391e184d0b4f36fdc3665650 - -+commit 93c3ed1c59f247bd16bcef6bc27d28e7730737e2 -+Author: Venkat Yekkirala -+Date: Wed Dec 9 15:22:09 2015 -0600 -+ -+ Fix merge from 5.8p1: now using packet_get_cstring in input_userauth_request() as does OpenSSH Portable. -+ - commit d86a3ba7af160c13496102aed861ae48a4297072 - Author: Damien Miller - Date: Wed Dec 9 09:18:45 2015 +1100 -@@ -5854,6 +14232,32 @@ - - Upstream-ID: 5b5b03c88162fce549e45e1b6dd833f20bbb5e13 - -+commit f00374ae07a2b5c37ff4df02a2221695aa6c1e2c -+Merge: 6d6ee63 d872994 -+Author: Venkat Yekkirala -+Date: Wed Dec 2 15:56:09 2015 -0600 -+ -+ Merge remote branch 'venkat/GSI_7_1_P1' into GSI_ISSHD_HPN_7_1_P1 -+ -+commit 6d6ee6335da58ab32fefdb46f9d8d1745c830791 -+Merge: 764931d 9fe4f81 -+Author: Venkat Yekkirala -+Date: Wed Dec 2 15:49:03 2015 -0600 -+ -+ Merge commit '3.15.0' into ISSHD_HPN_7_1_P1 -+ -+commit d87299432b4b93ec74792451e9ec626b22e1d9c5 -+Author: Venkat Yekkirala -+Date: Mon Nov 30 14:24:52 2015 -0600 -+ -+ Merge fixes. -+ -+commit 9c7e1c4e600184a352eb990d234a975d1b15c275 -+Author: Venkat Yekkirala -+Date: Mon Nov 30 11:04:37 2015 -0600 -+ -+ Build fixes. -+ - commit f0191d7c8e76e30551084b79341886d9bb38e453 - Author: Damien Miller - Date: Mon Nov 30 10:53:25 2015 +1100 -@@ -5943,6 +14347,78 @@ - - Upstream-ID: 5fc477cf2f119b2d44aa9c683af16cb00bb3744b - -+commit cc5b346f5ef7ceca2bddca528a4aa6ff1fc64cd9 -+Merge: a466119 9e8b6da -+Author: Venkat Yekkirala -+Date: Wed Nov 25 14:40:19 2015 -0600 -+ -+ Merge branch 'ISSHD_HPN_7_1_P1' into GSI_7_1_P1 -+ -+ Conflicts: -+ sshd.c -+ -+commit 9e8b6da277c22ec2a0ada88ce97e73468d82d7bd -+Merge: d07a816 b88fe11 -+Author: Venkat Yekkirala -+Date: Wed Nov 25 14:36:30 2015 -0600 -+ -+ Merge branch 'HPN_7_1_P1' into ISSHD_HPN_7_1_P1 -+ -+commit b88fe115642d7ebe232cf7e17684aacbfe7d3af9 -+Merge: bf8e0e9 764931d -+Author: Venkat Yekkirala -+Date: Wed Nov 25 14:34:37 2015 -0600 -+ -+ Merge commit 'hpn-7_1_P1' into HPN_7_1_P1 -+ -+ Conflicts: -+ channels.c -+ readconf.c -+ servconf.c -+ ssh.c -+ sshd.c -+ -+commit a466119cba68ae5eddf51845c4dee151d4cac435 -+Author: Venkat Yekkirala -+Date: Wed Nov 25 13:04:38 2015 -0600 -+ -+ Cleanup of redundant code from the GSI patch. -+ -+commit ae08552906ef5b611c5d51036b9b9a7ef209261e -+Merge: d07a816 3dffdce -+Author: Venkat Yekkirala -+Date: Sun Nov 22 17:17:58 2015 -0600 -+ -+ Merge branch 'master' into GSI_7_1_P1 -+ -+ Conflicts: -+ HPN-README -+ auth1.c -+ auth2-passwd.c -+ auth2-pubkey.c -+ auth2.c -+ channels.c -+ clientloop.c -+ compat.c -+ compat.h -+ configure.ac -+ kex.c -+ nersc.c -+ packet.c -+ progressmeter.c -+ readconf.c -+ readconf.h -+ servconf.c -+ servconf.h -+ serverloop.c -+ session.c -+ sftp-server.c -+ ssh.c -+ sshconnect2.c -+ sshd.c -+ sshd_config -+ version.h -+ - commit 8ca915fc761519dd1f7766a550ec597a81db5646 - Author: djm@openbsd.org - Date: Fri Nov 20 01:45:29 2015 +0000 -@@ -6213,6 +14689,24 @@ - makes certain libcrypto implementations cache a /dev/urandom fd - in preparation of sandboxing. Based on patch by Greg Hartman. - -+commit 764931dfa1482a906c4624c7186c0aa2e0058b73 -+Author: rapier -+Date: Thu Nov 12 16:46:33 2015 -0500 -+ -+ remove KEX_ENCRYPT_INCLUDE_NONE define from myproposal.h -+ -+commit e2fcefbda19a3ca27f44923ba0b0bc8d3ef6ab43 -+Author: rapier -+Date: Thu Nov 12 16:20:37 2015 -0500 -+ -+ Modified none cipher behaviour in sshd.c to match suggestioon from bdrewery - cf https://github.com/rapier1/openssh-portable/issues/3 -+ -+commit 6a32b2881f73e3fa825cd3df502b0edeeba703e7 -+Author: rapier -+Date: Tue Nov 10 14:09:30 2015 -0500 -+ -+ Fixed problem with None cipher not being advertised by server -+ - commit 1560596f44c01bb0cef977816410950ed17b8ecd - Author: Darren Tucker - Date: Tue Nov 10 11:14:47 2015 +1100 -@@ -6290,6 +14784,24 @@ - - Upstream-ID: 78459d59bff74223f8139d9001ccd56fc4310659 - -+commit d07a816fdf507a297040496b3eee235f8491fed6 -+Merge: bf8e0e9 9fe4f81 -+Author: Venkat Yekkirala -+Date: Fri Nov 6 14:26:31 2015 -0600 -+ -+ Merge commit '3.15.0' into ISSHD_HPN_7_1_P1 -+ -+ Conflicts: -+ kex.c -+ serverloop.c -+ version.h -+ -+commit fa023f7ea593cc57f8fe90867f214d7cb539b351 -+Author: rapier -+Date: Thu Oct 29 14:35:44 2015 -0400 -+ -+ Trying to open up the maximum size of the buffer to 256MB. This is to support 40 and 100Gb paths -+ - commit 996b24cebf20077fbe5db07b3a2c20c2d9db736e - Author: Darren Tucker - Date: Thu Oct 29 20:57:34 2015 +1100 -@@ -6392,6 +14904,52 @@ - - Upstream-ID: a1ead25ae336bfa15fb58d8c6b5589f85b4c33a3 - -+commit 2c8449c7ed2a54ada84532ac7faad8797c7c035c -+Author: Mike Frysinger -+Date: Thu Oct 29 01:30:08 2015 -0400 -+ -+ initialize hpn buffers sooner in the client -+ -+ When using the -w option to create a tunnel via tun devices, the client -+ sets up a window with a negative length. With 6.8+ servers, the channel -+ will be killed on the fly when the negative window is detected (see the -+ commit "fatal() when a remote window update causes the window"). With -+ older versions, the server ends up using negative windows and who knows -+ what happens next. -+ -+ Pull the hpn option logic up earlier in the ssh connection so that it -+ runs before we try to create any forwarding channels. -+ -+ You can reproduce by running the server in debug mode and having the -+ client connect like so: -+ sudo ssh -w 1:2 user@server -+ The server will log a line like: -+ debug1: server_input_channel_open: ctype tun@openssh.com rchan 0 win -1 max 32768 -+ That -1 is the window size and things go wrong from there. -+ -+ URL: https://bugs.gentoo.org/564236 -+ Reported-by: Daniel Heule -+ -+commit 7b527d7b4ad97a6703de70446cc24758be4437d6 -+Author: Mike Frysinger -+Date: Thu Oct 29 01:28:19 2015 -0400 -+ -+ pull the hpn init code out into a dedicated func -+ -+ This makes it more obvious what is hpn-specific and makes it easier -+ to manage the logic. -+ -+commit c39ed15fd08340a3dc6189b1bff1f18cc8cb47bc -+Author: Mike Frysinger -+Date: Thu Oct 29 01:21:46 2015 -0400 -+ -+ clean up socket code a bit during hpn option init -+ -+ A few tweaks to improve the code to make it easier to manage: -+ - localize the vars in the scope they're actually used -+ - change socksizelen to socklen_t to match {g,s}etsockopt prototypes -+ - fix call to setsockopt to actually pass in the socklen_t -+ - commit 8db134e7f457bcb069ec72bc4ee722e2af557c69 - Author: Darren Tucker - Date: Thu Oct 29 10:48:23 2015 +1100 -@@ -6491,6 +15049,18 @@ - - bz#2278 from Brent Paulson - -+commit ba241ddd4e7ffc9e25d10846c57da6f78112105f -+Author: rapier -+Date: Tue Oct 20 15:31:55 2015 -0400 -+ -+ Forgot to update version -+ -+commit bf8e0e9971186984d82befecb363cfe417815f3b -+Author: rapier -+Date: Tue Oct 20 15:31:17 2015 -0400 -+ -+ Forgot to update version number -+ - commit b56deb847f4a0115a8bf488bf6ee8524658162fd - Author: djm@openbsd.org - Date: Fri Oct 16 22:32:22 2015 +0000 -@@ -6967,6 +15537,16 @@ - - Upstream-ID: c8f1f8169332e4fa73ac96b0043e3b84e01d4896 - -+commit 9fe4f810c383016235ed5fa2bb42236a44e87ce4 -+Author: scott campbell -+Date: Mon Sep 14 20:39:00 2015 -0400 -+ -+ complete fix for kex -+ -+ In working through the ‘make tests’, another issue re comp.name arose. -+ This change just assumes that any member of the mess can cause a -+ pathological state so test them all … -+ - commit cfffbdb10fdf0f02d3f4232232eef7ec3876c383 - Author: Darren Tucker - Date: Mon Sep 14 16:24:21 2015 +1000 -@@ -6977,6 +15557,160 @@ - keys. Add tests when doing host-key-force since we can't use ssh-keygen -A - since it can't specify alternate locations. bz#2459, ok djm@ - -+commit 00d6045b23a5d1122499ce46cce8cba1dab01b6d -+Author: scott campbell -+Date: Fri Sep 11 20:19:15 2015 -0400 -+ -+ Fix segfault due to invoking strlen() on NULL string. -+ -+ See: -+ https://github.com/set-element/openssh-hpn-isshd/commit/805f39d13ac5de98 -+ 00b56f4ddcc27c3f40cf671a -+ -+ I make the bugs and mej fixes them … -+ -+commit 58b43dcbf30208b5f49d4d940e4f1889e3376a7b -+Author: scott campbell -+Date: Wed Jul 22 17:50:51 2015 +0200 -+ -+ fix typo -+ -+ need to have SSH_HPN in the version -+ -+commit 78b5e08587b0d47c3262a5ee6bbc15120d1d63ae -+Author: scott campbell -+Date: Tue Jul 21 23:46:29 2015 +0200 -+ -+ bump version -+ -+commit 0f4d5370ff96306da246ba964649caf0398fcf95 -+Author: scott campbell -+Date: Tue Jul 21 23:43:58 2015 +0200 -+ -+ add nersc mod -+ -+commit b2ae64684658c9b08032353f1032081030536626 -+Author: scott campbell -+Date: Mon May 25 10:14:15 2015 -0400 -+ -+ fixing fixing ... -+ -+commit f834753e00928c029798ec2ff1fd4f8e334fd855 -+Author: scott campbell -+Date: Mon May 25 08:38:51 2015 -0400 -+ -+ add key exchange event -+ -+commit bd4531b408cd4652bceee069a2df9fbae201c78c -+Author: scott campbell -+Date: Sun May 24 21:42:47 2015 -0400 -+ -+ fix typo -+ -+commit 23c3f9f775db0b7d37ac1a16842f97b6452e8a20 -+Author: scott campbell -+Date: Wed May 20 00:07:22 2015 -0400 -+ -+ add modp_burl.o to makefile -+ -+commit c1e201d5d2c3429f9eadf8de232222a9cbeb500e -+Author: scott campbell -+Date: Mon May 18 22:20:25 2015 -0400 -+ -+ checkin nersc mods -+ -+commit 18b4f38279d9c33259a93126ac9ee4e6c2e34c53 -+Author: scott campbell -+Date: Mon May 18 22:17:58 2015 -0400 -+ -+ nersc changes -+ -+commit 9094bc2c2b0a49d123c68aeb65d9cc246f0fc6ee -+Author: scott campbell -+Date: Mon May 18 22:15:52 2015 -0400 -+ -+ initial nersc checkin -+ -+commit 2b21591df2a8b1b41074066cadd5b96cb2d5da5b -+Author: scott campbell -+Date: Mon May 18 21:46:31 2015 -0400 -+ -+ initial nersc changes -+ -+commit 22833892442650b9c23faf8e1679b1f76cdba720 -+Author: scott campbell -+Date: Mon May 18 21:34:16 2015 -0400 -+ -+ add nersc changes -+ -+commit 3504de6e9b31700d84cf58e4ec60b8185bc7362e -+Author: scott campbell -+Date: Mon May 18 21:29:30 2015 -0400 -+ -+ initial install -+ -+commit 9bddcf81e488dfa93c50db26789a830fc911bf2d -+Author: scott campbell -+Date: Mon May 18 21:29:09 2015 -0400 -+ -+ code checkin -+ -+ This is for the uriencoding -+ -+commit 36b3c67597e0e436e1aa7ab077814f5e7a66857f -+Author: scott campbell -+Date: Mon May 18 21:27:32 2015 -0400 -+ -+ initial nersc checkin -+ -+commit 9293b371d71759a925fc4564fe33aa789d5b8305 -+Author: scott campbell -+Date: Mon May 18 21:26:02 2015 -0400 -+ -+ initial nersc checkin -+ -+commit 74ddd09d8fddfb197149c1f85036eb7d734536e5 -+Author: scott campbell -+Date: Mon May 18 21:01:40 2015 -0400 -+ -+ add nersc changes -+ -+commit 75cf9753d93c2ec5cb98f90212d594c7a484ae34 -+Author: scott campbell -+Date: Mon May 18 20:50:57 2015 -0400 -+ -+ add nersc mods -+ -+commit 668ae5f66b3e9f02c2fb27a2ef4b3b949ef7130c -+Author: scott campbell -+Date: Mon May 18 20:49:18 2015 -0400 -+ -+ insert nersc mods -+ -+commit 66cbd9037407b49e61e0c39ea75737c09b63bc38 -+Author: scott campbell -+Date: Mon May 18 20:45:09 2015 -0400 -+ -+ add nersc changes -+ -+commit 30b48310aa0f29802149f40a91752aa5b41ed7a8 -+Author: scott campbell -+Date: Mon May 18 20:38:06 2015 -0400 -+ -+ insert nersc mods -+ -+commit d13aa5a98662bddc6a7ab3c81802a266148cbb20 -+Author: scott campbell -+Date: Mon May 18 20:34:22 2015 -0400 -+ -+ put in nersc mods -+ -+commit 710841ed5b27af5d603fe0db0ce378fa4ed6aa01 -+Author: scott campbell -+Date: Mon May 18 20:25:24 2015 -0400 -+ -+ add nersc reference -+ - commit 366bada1e9e124654aac55b72b6ccf878755b0dc - Author: Darren Tucker - Date: Fri Sep 11 13:29:22 2015 +1000 -@@ -7126,6 +15860,28 @@ - - don't check for yp_match; ok tim@ - -+commit 7b8e17975d414fca3ae27edff5d74f0f5ef558bf -+Author: Jim Basney -+Date: Mon Aug 24 10:35:53 2015 -0500 -+ -+ initial git merge of gpt-5.7 modifications from CVS (part 2) -+ * includes pathnames.c stuff for binary relocatability -+ * doesn't include Makefile changes for bin/ssh.d install location -+ * doesn't include GPT-specific configure script changes -+ * doesn't include GPT-specific ssh_config/sshd_config changes -+ * code in scp.c related to "gsissh/gsiscp" vs "ssh/scp" needs update? -+ -+commit 70df5cec6602723217b18afa7ef2038c2f569c16 -+Author: Jim Basney -+Date: Mon Aug 24 10:25:09 2015 -0500 -+ -+ initial git merge of gpt-5.7 modifications from CVS -+ * includes pathnames.c stuff for binary relocatability -+ * doesn't include Makefile changes for bin/ssh.d install location -+ * doesn't include GPT-specific configure script changes -+ * doesn't include GPT-specific ssh_config/sshd_config changes -+ * code in scp.c related to "gsissh/gsiscp" vs "ssh/scp" needs update? -+ - commit 9690b78b7848b0b376980a61d51b1613e187ddb5 - Author: djm@openbsd.org - Date: Fri Aug 21 23:57:48 2015 +0000 -@@ -7173,6 +15929,108 @@ - - Upstream-ID: 899b021be43b913fad3eca1aef44efe710c53e29 - -+commit 08a6553d3e2acc6b810611a36871c781c62ccdc0 -+Author: Chris Rapier -+Date: Sat Nov 15 16:02:15 2014 -0500 -+ -+ support dynamically sized receive buffers -+ -+ This is the core of HPN-SSH. Please note that this patch will not -+ necessarily improve all connections but only those that were being hampered -+ by undersized buffers. While optimal improvement requires this patch on -+ both sides of the connection many users see enhancement as long as the -+ patch is applied on the side of the connection receiving bulk data. -+ -+commit 7c24b58ce3100df10ec70a066d4129a1b013e035 -+Author: Chris Rapier -+Date: Sat Nov 15 15:49:16 2014 -0500 -+ -+ Add support for the multi-threaded AES-CTR cipher -+ -+ This patch provides the multi-threaded AES-CTR cipher. Essentially, -+ several buffers are created that are filled with pre-computed keystreads -+ generates by worker threads. These buffers are drained in order so as to -+ provide a keystream 100% compatible with non-threaded AES-CTR -+ implementations. Prior to this release there was a significant flaw in -+ the way in which this cipher was used in SSH (the security of this cipher -+ was not impacted) where forking the process to the background would cause -+ the threads to become divorced from the parent process. This would lead -+ to a failure in port forwarding applications and, starting with 6.1p1, -+ incompatibility with the sandbox used by the privsep process. Both -+ problems were resoloved by using the non-threaded AES-CTR cipher during -+ authentication and then switching to the MT-AES-CTR cipher immediately -+ after. -+ -+commit 11aac24499cddb4c67a0bcb94aabc8c8ca278a5d -+Author: Chris Rapier -+Date: Sat Nov 15 15:38:34 2014 -0500 -+ -+ add support for the NONE cipher -+ -+ This patch provides the post authentication switch to the NONE cipher. -+ This is useful for the transfer of bulk data via SCP. The NONE switch -+ is not allowed during interactive sessions. Both sides of the connection -+ *must* support the NONE switch. -+ -+commit c29cc4422f7bc36e3573178fbd4e10d0e541bda4 -+Author: Chris Rapier -+Date: Sat Nov 15 15:22:24 2014 -0500 -+ -+ add peak throughput to the progress bar -+ -+ This patch modifes the progress bar to display the 1 second throughput -+ average. On completion of the transfer it will display the peak throughput -+ through the life of the connection. -+ -+commit 34bfd65044b7d886db8e5bcfcf2c08875623aaa3 -+Author: Chris Rapier -+Date: Sat Nov 15 15:20:30 2014 -0500 -+ -+ extended server logging -+ -+ This patch provides enhanced logging capabilities to the server process. -+ Information provided includes ciphers used, throughput, bytes transferred, -+ and the like. In order to use this patch you *must* direct syslogd to use -+ an additional logging socket. This socket will be located in the sshd -+ chroot, typically /var/empty. As such you will need to create a -+ /var/empty/dev directory and add '-a /var/empty/dev/log' to your syslogd -+ configuration. -+ -+commit 3d385debd32eb0f23bbcaaf43593e8c2d7360e68 -+Author: Mike Frysinger -+Date: Fri Aug 21 10:13:36 2015 -0400 -+ -+ clean up style a bit in hpn ssh code -+ -+commit 9a5061b74cb075968c4bb8bed6ae35bcc6703929 -+Merge: 944776f e91346d -+Author: Mike Frysinger -+Date: Fri Aug 21 10:08:10 2015 -0400 -+ -+ Merge tag 'V_7_1_P1' into hpn -+ -+ openssh-7.1p1 -+ -+commit 3dffdce59e7b9d47208483a9f20642145fa562bd -+Author: Jim Basney -+Date: Fri Aug 21 08:56:43 2015 -0500 -+ -+ update date in NCSA_VERSION -+ -+commit 31e9367dc10cea1ef6dd6144e0a721b96b869f1a -+Merge: 7ae7a3c 6a15b47 -+Author: Jim Basney -+Date: Fri Aug 21 08:15:14 2015 -0500 -+ -+ Merge branch 'openssh-V_7_1' to resolve #5 -+ -+commit 6a15b4749da4862617d30aff32b0c05ed60eb863 -+Merge: 7ae7a3c e91346d -+Author: Jim Basney -+Date: Fri Aug 21 08:14:12 2015 -0500 -+ -+ Merge branch 'V_7_1' of https://github.com/openssh/openssh-portable into openssh-V_7_1 -+ - commit 189de02d9ad6f3645417c0ddf359b923aae5f926 - Author: Damien Miller - Date: Fri Aug 21 15:45:02 2015 +1000 -@@ -7297,6 +16155,100 @@ - - Upstream-ID: 35174a19b5237ea36aa3798f042bf5933b772c67 - -+commit 7ae7a3c12266d66df6f3deabe45d85dabcffa0ea -+Author: Jim Basney -+Date: Sat Aug 15 07:34:21 2015 -0500 -+ -+ need $GSSLIBS for gss_localname and gss_userok -+ -+commit 55f518358be57072d6e92d9e9a8fcfe43d5dbc41 -+Author: Jim Basney -+Date: Thu Aug 13 14:54:55 2015 -0500 -+ -+ bump date in version number for today's snapshot -+ -+commit 5464d3ebb911ac7cb35b7bb062d0a863f10cb256 -+Author: mancha -+Date: Thu Aug 13 14:50:46 2015 -0500 -+ -+ Re-introduce TCP Wrapper support -+ -+ Support for TCP Wrapper was dropped as of OpenSSH 6.7. This patch -+ resurrects the feature for OpenSSH 7.0p1. -+ -+commit 2a5aefd5dc42e5b3e8e74e9a14878cb7dfbaa820 -+Author: Jim Basney -+Date: Thu Aug 13 13:49:50 2015 -0500 -+ -+ compile fixes for !HAVE_GSS_USEROK and !HAVE_GSS_INDICATE_MECHS_BY_ATTRS -+ -+commit 482af16e66a01dbfeef947c1d643d60f12b054dc -+Author: Sam Hartman -+Date: Tue Aug 19 08:54:58 2014 -0400 -+ -+ Support Generic GSS-API Mechanisms -+ -+ Previously, OpenSSH required that mechanisms be registered in a static -+ table within the ssh server. There are three reasons for this: -+ -+ * To meet requirements from RFC 4462 about which mechanisms are used -+ -+ * To have mechanism-specific code to determine whether a user is authorized -+ -+ * A mechanism-specific implementation of localname -+ -+ Since then the GSS-API vendors have added support for gss_localname -+ and gss_userok. In addition, mechanism attributes allow sshd to probe -+ for which mechanisms meet the requirements from RFC 4462. -+ -+ Add support for arbitrary GSS-API mechanisms using gss_localname and -+ gss_userok. Filter out negotiation mechanisms. -+ -+commit bd79e470fbfe16ac6d8d1d8b40b0e421f5a07362 -+Author: Jim Basney -+Date: Thu Aug 13 12:09:02 2015 -0500 -+ -+ OPENSSH_7_0P1_GSSAPI_20150812 patch -+ -+commit 3c0617e30abcd8559c86a28f121c9d6529b552f4 -+Author: Jim Basney -+Date: Thu Aug 13 12:07:03 2015 -0500 -+ -+ OPENSSH_7_0P1_GSSAPI_20150812 patch -+ -+commit ac8af14393f92202088ad06e967f178b61d849ef -+Author: Jim Basney -+Date: Thu Aug 13 12:05:10 2015 -0500 -+ -+ more files added by OPENSSH_7_0P1_GSSAPI_20150812 patch -+ -+commit 0a2800dcf02173e357a70782086fe4b0174b27b0 -+Author: Jim Basney -+Date: Thu Aug 13 11:58:19 2015 -0500 -+ -+ files added by OPENSSH_7_0P1_GSSAPI_20150812 patch -+ -+commit 694a0f9876d746c5a39bb484c05001e5c10ffc44 -+Author: Jim Basney -+Date: Wed Aug 12 17:14:29 2015 -0500 -+ -+ fix merge typo -+ -+commit 5c74e21f246a5f4a58886f42b149cc307a6eea8a -+Author: Jim Basney -+Date: Wed Aug 12 16:51:08 2015 -0500 -+ -+ GSI patch OPENSSH_7_0P1_GSSAPI_20150812 -+ -+commit 944776fd9a53c8bbfc0e4558db20d5bbf077489a -+Merge: 8001ddf 1dc8d93 -+Author: Mike Frysinger -+Date: Wed Aug 12 02:02:38 2015 -0400 -+ -+ Merge tag 'V_7_0_P1' into hpn -+ -+ openssh-7.0p1 -+ - commit 1dc8d93ce69d6565747eb44446ed117187621b26 - Author: deraadt@openbsd.org - Date: Thu Aug 6 14:53:21 2015 +0000 -@@ -7869,6 +16821,15 @@ - - Upstream-ID: 2bd23976305d0512e9f84d054e1fc23cd70b89f2 - -+commit 8001ddf739d3048ed777d2bc9fb80971d3695d7e -+Merge: 8f3991a 7de4b03 -+Author: Mike Frysinger -+Date: Wed Jul 8 04:11:37 2015 -0400 -+ -+ Merge tag 'V_6_9_P1' into hpn -+ -+ OpenSSH 6.9p1 -+ - commit 7de4b03a6e4071d454b72927ffaf52949fa34545 - Author: djm@openbsd.org - Date: Wed Jul 1 02:32:17 2015 +0000 -@@ -9036,6 +17997,15 @@ - Output remote username in debug output since with Host - and Match it's not always obvious what it will be. bz#2368, ok djm@ - -+commit 8f3991a256090293835af487b83baf5a8c0b332a -+Merge: fec6798 3771ff3 -+Author: Chris Rapier -+Date: Mon Apr 27 12:01:56 2015 -0400 -+ -+ Merge pull request #2 from bdrewery/hpn-upstream-fixes -+ -+ Hpn upstream fixes -+ - commit 70860b6d07461906730632f9758ff1b7c98c695a - Author: Darren Tucker - Date: Fri Apr 17 10:56:13 2015 +1000 -@@ -9160,6 +18130,43 @@ - correct return value in pubkey parsing, spotted by Ben Hawkes - ok markus@ - -+commit 3771ff3ce3146cd00e650f1815a1632e1d3f00b3 -+Author: Bryan Drewery -+Date: Fri Apr 3 15:59:00 2015 -0500 -+ -+ Followup 584a0b44a and use proper CHAN_TCP_PACKET_DEFAULT for auth agent when using HPN. -+ -+commit 7d520024a4872b7521ae86abedfe851a43ae58e0 -+Author: Bryan Drewery -+Date: Fri Apr 3 15:49:20 2015 -0500 -+ -+ Use proper CHAN_SES_WINDOW_DEFAULT using a TTY. -+ -+ The previous value of 4*CHAN_SES_PACKET_DEFAULT matched an older -+ CHAN_SES_WINDOW_DEFAULT. It was updated in upstream 395ecc2bdeefd86a31562dd4145f370b816814bd -+ though: -+ -+ - markus@cvs.openbsd.org 2007/06/11 09:14:00 -+ [channels.h] -+ increase default channel windows; ok djm -+ -+ This fixes a smaller window than the default being used when HPN is disabled as -+ well. -+ -+commit 584a0b44a575d5dd756eb8425f6fbb73c4b6d440 -+Author: Bryan Drewery -+Date: Fri Apr 3 15:47:22 2015 -0500 -+ -+ Use proper CHAN_TCP_PACKET_DEFAULT for agent channel. -+ -+ This was updated in upstream 5baa170d771de9e95cf30b4c469ece684244cf3e: -+ -+ - dtucker@cvs.openbsd.org 2007/12/28 22:34:47 -+ [clientloop.c] -+ Use the correct packet maximum sizes for remote port and agent forwarding. -+ Prevents the server from killing the connection if too much data is queued -+ and an excessively large packet gets sent. bz #1360, ok djm@. -+ - commit 7da2be0cb9601ed25460c83aa4d44052b967ba0f - Author: djm@openbsd.org - Date: Tue Mar 31 22:59:01 2015 +0000 -@@ -9356,6 +18363,31 @@ - fix double-negative error message "ssh1 is not - unsupported" - -+commit fec67989ea3f93b9b18466f69a43e9fd45a948e3 -+Author: Mike Frysinger -+Date: Wed Mar 25 16:59:59 2015 -0400 -+ -+ whitelist socketcall in the sandbox -+ -+ The server logging uses this syscall to get details about the remote side. -+ -+commit e7e161480961efba2ef1e493488fea4242aff727 -+Author: Mike Frysinger -+Date: Wed Mar 25 16:48:24 2015 -0400 -+ -+ extend get_remote_ipaddr/+get_remote_port api to except ssh state -+ -+ This is to better support the server logging patch. These inner functions -+ do a bit of sanity checks before returning the result. Rather than copy -+ those into the main server path, extend the API to take the ssh state and -+ not operate implicitly on the global active_state. -+ -+commit b806aa593f90179640687486b86b3d344d8b58e6 -+Author: Mike Frysinger -+Date: Mon Mar 23 12:42:05 2015 -0400 -+ -+ fix build errors on arches w/out getpeername syscall -+ - commit 5c27e3b6ec2db711dfcd40e6359c0bcdd0b62ea9 - Author: djm@openbsd.org - Date: Mon Mar 23 06:06:38 2015 +0000 -@@ -9392,3 +18424,96 @@ - - add back the changes from rev 1.206, djm reverted this by - mistake in rev 1.207 -+ -+commit 7e53eff333178a6edd62606b45a15d1d7bd0dbf7 -+Author: Mike Frysinger -+Date: Sun Mar 22 01:24:34 2015 -0400 -+ -+ whitelist getpeername in the sandbox -+ -+ The server logging uses this syscall to get details about the remote side. -+ -+commit 41cb641ce7bfb2a32b0ef6495e46682f5891df81 -+Author: Mike Frysinger -+Date: Sat Mar 21 12:54:53 2015 -0400 -+ -+ fix crash in server logging during tests -+ -+ The testsuite does not have a valid active_state set up which means using -+ the get_remote_{ipaddr,port} functions crash. Since this func is passed -+ in the ssh state directly now, use that instead. -+ -+commit 9abbac46faaf5e7072b31f1fa518e037f488b444 -+Author: Mike Frysinger -+Date: Sat Nov 15 16:43:14 2014 -0500 -+ -+ fix unaligned memory access in parallel cipher routines -+ -+ https://bugs.gentoo.org/498632 -+ -+commit 62bf077b06ee990f2bd8b798bdf3ffa03bf6af92 -+Author: Chris Rapier -+Date: Sat Nov 15 16:02:15 2014 -0500 -+ -+ support dynamically sized receive buffers -+ -+ This is the core of HPN-SSH. Please note that this patch will not -+ necessarily improve all connections but only those that were being hampered -+ by undersized buffers. While optimal improvement requires this patch on -+ both sides of the connection many users see enhancement as long as the -+ patch is applied on the side of the connection receiving bulk data. -+ -+commit 73b41f6d2cb1c2a0e72a89d15d1163840de906aa -+Author: Chris Rapier -+Date: Sat Nov 15 15:49:16 2014 -0500 -+ -+ Add support for the multi-threaded AES-CTR cipher -+ -+ This patch provides the multi-threaded AES-CTR cipher. Essentially, -+ several buffers are created that are filled with pre-computed keystreads -+ generates by worker threads. These buffers are drained in order so as to -+ provide a keystream 100% compatible with non-threaded AES-CTR -+ implementations. Prior to this release there was a significant flaw in -+ the way in which this cipher was used in SSH (the security of this cipher -+ was not impacted) where forking the process to the background would cause -+ the threads to become divorced from the parent process. This would lead -+ to a failure in port forwarding applications and, starting with 6.1p1, -+ incompatibility with the sandbox used by the privsep process. Both -+ problems were resoloved by using the non-threaded AES-CTR cipher during -+ authentication and then switching to the MT-AES-CTR cipher immediately -+ after. -+ -+commit a1fd490ff24e220eb37fe3170b339570df68dfca -+Author: Chris Rapier -+Date: Sat Nov 15 15:38:34 2014 -0500 -+ -+ add support for the NONE cipher -+ -+ This patch provides the post authentication switch to the NONE cipher. -+ This is useful for the transfer of bulk data via SCP. The NONE switch -+ is not allowed during interactive sessions. Both sides of the connection -+ *must* support the NONE switch. -+ -+commit aae34242b8fe5c8df89f5b546c4104c93fa94d02 -+Author: Chris Rapier -+Date: Sat Nov 15 15:22:24 2014 -0500 -+ -+ add peak throughput to the progress bar -+ -+ This patch modifes the progress bar to display the 1 second throughput -+ average. On completion of the transfer it will display the peak throughput -+ through the life of the connection. -+ -+commit ce270952bb266583d53fc154220b512da95bcfed -+Author: Chris Rapier -+Date: Sat Nov 15 15:20:30 2014 -0500 -+ -+ extended server logging -+ -+ This patch provides enhanced logging capabilities to the server process. -+ Information provided includes ciphers used, throughput, bytes transferred, -+ and the like. In order to use this patch you *must* direct syslogd to use -+ an additional logging socket. This socket will be located in the sshd -+ chroot, typically /var/empty. As such you will need to create a -+ /var/empty/dev directory and add '-a /var/empty/dev/log' to your syslogd -+ configuration. -diff -Nur openssh-7.5p1/ChangeLog.gssapi gsi-openssh/ChangeLog.gssapi ---- openssh-7.5p1/ChangeLog.gssapi 1970-01-01 01:00:00.000000000 +0100 -+++ gsi-openssh/ChangeLog.gssapi 2018-12-20 11:49:17.568000000 +0100 -@@ -0,0 +1,113 @@ -+20110101 -+ - Finally update for OpenSSH 5.6p1 -+ - Add GSSAPIServerIdentity option from Jim Basney -+ -+20100308 -+ - [ Makefile.in, key.c, key.h ] -+ Updates for OpenSSH 5.4p1 -+ - [ servconf.c ] -+ Include GSSAPI options in the sshd -T configuration dump, and flag -+ some older configuration options as being unsupported. Thanks to Colin -+ Watson. -+ - -+ -+20100124 -+ - [ sshconnect2.c ] -+ Adapt to deal with additional element in Authmethod structure. Thanks to -+ Colin Watson -+ -+20090615 -+ - [ gss-genr.c gss-serv.c kexgssc.c kexgsss.c monitor.c sshconnect2.c -+ sshd.c ] -+ Fix issues identified by Greg Hudson following a code review -+ Check return value of gss_indicate_mechs -+ Protect GSSAPI calls in monitor, so they can only be used if enabled -+ Check return values of bignum functions in key exchange -+ Use BN_clear_free to clear other side's DH value -+ Make ssh_gssapi_id_kex more robust -+ Only configure kex table pointers if GSSAPI is enabled -+ Don't leak mechanism list, or gss mechanism list -+ Cast data.length before printing -+ If serverkey isn't provided, use an empty string, rather than NULL -+ -+20090201 -+ - [ gss-genr.c gss-serv.c kex.h kexgssc.c readconf.c readconf.h ssh-gss.h -+ ssh_config.5 sshconnet2.c ] -+ Add support for the GSSAPIClientIdentity option, which allows the user -+ to specify which GSSAPI identity to use to contact a given server -+ -+20080404 -+ - [ gss-serv.c ] -+ Add code to actually implement GSSAPIStrictAcceptCheck, which had somehow -+ been omitted from a previous version of this patch. Reported by Borislav -+ Stoichkov -+ -+20070317 -+ - [ gss-serv-krb5.c ] -+ Remove C99ism, where new_ccname was being declared in the middle of a -+ function -+ -+20061220 -+ - [ servconf.c ] -+ Make default for GSSAPIStrictAcceptorCheck be Yes, to match previous, and -+ documented, behaviour. Reported by Dan Watson. -+ -+20060910 -+ - [ gss-genr.c kexgssc.c kexgsss.c kex.h monitor.c sshconnect2.c sshd.c -+ ssh-gss.h ] -+ add support for gss-group14-sha1 key exchange mechanisms -+ - [ gss-serv.c servconf.c servconf.h sshd_config sshd_config.5 ] -+ Add GSSAPIStrictAcceptorCheck option to allow the disabling of -+ acceptor principal checking on multi-homed machines. -+ -+ - [ sshd_config ssh_config ] -+ Add settings for GSSAPIKeyExchange and GSSAPITrustDNS to the sample -+ configuration files -+ - [ kexgss.c kegsss.c sshconnect2.c sshd.c ] -+ Code cleanup. Replace strlen/xmalloc/snprintf sequences with xasprintf() -+ Limit length of error messages displayed by client -+ -+20060909 -+ - [ gss-genr.c gss-serv.c ] -+ move ssh_gssapi_acquire_cred() and ssh_gssapi_server_ctx to be server -+ only, where they belong -+ -+ -+20060829 -+ - [ gss-serv-krb5.c ] -+ Fix CCAPI credentials cache name when creating KRB5CCNAME environment -+ variable -+ -+20060828 -+ - [ gss-genr.c ] -+ Avoid Heimdal context freeing problem -+ -+ -+20060818 -+ - [ gss-genr.c ssh-gss.h sshconnect2.c ] -+ Make sure that SPENGO is disabled -+ -+ -+20060421 -+ - [ gssgenr.c, sshconnect2.c ] -+ a few type changes (signed versus unsigned, int versus size_t) to -+ fix compiler errors/warnings -+ (from jbasney AT ncsa.uiuc.edu) -+ - [ kexgssc.c, sshconnect2.c ] -+ fix uninitialized variable warnings -+ (from jbasney AT ncsa.uiuc.edu) -+ - [ gssgenr.c ] -+ pass oid to gss_display_status (helpful when using GSSAPI mechglue) -+ (from jbasney AT ncsa.uiuc.edu) -+ -+ - [ gss-serv-krb5.c ] -+ #ifdef HAVE_GSSAPI_KRB5 should be #ifdef HAVE_GSSAPI_KRB5_H -+ (from jbasney AT ncsa.uiuc.edu) -+ -+ - [ readconf.c, readconf.h, ssh_config.5, sshconnect2.c -+ add client-side GssapiKeyExchange option -+ (from jbasney AT ncsa.uiuc.edu) -+ - [ sshconnect2.c ] -+ add support for GssapiTrustDns option for gssapi-with-mic -+ (from jbasney AT ncsa.uiuc.edu) -+ -diff -Nur openssh-7.5p1/clientloop.c gsi-openssh/clientloop.c ---- openssh-7.5p1/clientloop.c 2018-12-20 11:48:23.664000000 +0100 -+++ gsi-openssh/clientloop.c 2018-12-20 11:49:17.568000000 +0100 -@@ -113,6 +113,10 @@ - #include "ssherr.h" - #include "hostfile.h" - -+#ifdef GSSAPI -+#include "ssh-gss.h" -+#endif -+ - /* import options */ - extern Options options; - -@@ -315,6 +319,10 @@ - struct stat st; - u_int now, x11_timeout_real; - -+#if __APPLE__ -+ int is_path_to_socket = 0; -+#endif /* __APPLE__ */ -+ - *_proto = proto; - *_data = data; - proto[0] = data[0] = xauthfile[0] = xauthdir[0] = '\0'; -@@ -331,6 +339,34 @@ - } - - if (xauth_path != NULL) { -+#if __APPLE__ -+ { -+ /* -+ * If using launchd socket, remove the screen number from the end -+ * of $DISPLAY. is_path_to_socket is used later in this function -+ * to determine if an error should be displayed. -+ */ -+ char path[PATH_MAX]; -+ struct stat sbuf; -+ -+ strlcpy(path, display, sizeof(path)); -+ if (0 == stat(path, &sbuf)) { -+ is_path_to_socket = 1; -+ } else { -+ char *dot = strrchr(path, '.'); -+ if (dot) { -+ *dot = '\0'; -+ /* screen = atoi(dot + 1); */ -+ if (0 == stat(path, &sbuf)) { -+ is_path_to_socket = 1; -+ debug("x11_get_proto: $DISPLAY is launchd, removing screennum"); -+ setenv("DISPLAY", path, 1); -+ } -+ } -+ } -+ } -+#endif /* __APPLE__ */ -+ - /* - * Handle FamilyLocal case where $DISPLAY does - * not match an authorization entry. For this we -@@ -441,6 +477,9 @@ - u_int8_t rnd[16]; - u_int i; - -+#if __APPLE__ -+ if (!is_path_to_socket) -+#endif /* __APPLE__ */ - logit("Warning: No xauth data; " - "using fake authentication data for X11 forwarding."); - strlcpy(proto, SSH_X11_PROTO, sizeof proto); -@@ -1664,9 +1703,18 @@ - break; - - /* Do channel operations unless rekeying in progress. */ -- if (!ssh_packet_is_rekeying(active_state)) -+ if (!ssh_packet_is_rekeying(active_state)) { - channel_after_select(readset, writeset); - -+#ifdef GSSAPI -+ if (options.gss_renewal_rekey && -+ ssh_gssapi_credentials_updated((Gssctxt *)GSS_C_NO_CONTEXT)) { -+ debug("credentials updated - forcing rekey"); -+ need_rekeying = 1; -+ } -+#endif -+ } -+ - /* Buffer input from the connection. */ - client_process_net_input(readset); - -diff -Nur openssh-7.5p1/configure.ac gsi-openssh/configure.ac ---- openssh-7.5p1/configure.ac 2018-12-20 11:48:40.816000000 +0100 -+++ gsi-openssh/configure.ac 2019-01-12 18:55:48.948000000 +0100 -@@ -17,8 +17,91 @@ - AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org]) - AC_REVISION($Revision: 1.583 $) - AC_CONFIG_SRCDIR([ssh.c]) -+AC_CONFIG_MACRO_DIR([m4]) -+m4_include([m4/ltoptions.m4]) -+m4_include([m4/ltversion.m4]) -+m4_include([m4/libtool.m4]) -+m4_include([m4/ltsugar.m4]) -+m4_include([m4/lt~obsolete.m4]) - AC_LANG([C]) - -+# Handle Globus configuration right away, because the Globus flavor -+# determines our compiler options. -+ -+# Check whether the user wants GSSAPI mechglue support -+AC_ARG_WITH(mechglue, -+ [ --with-mechglue=PATH Build with GSSAPI mechglue library], -+ [ -+ AC_MSG_CHECKING(for mechglue library) -+ -+ if test -e ${withval}/libgssapi.a ; then -+ mechglue_lib=${withval}/libgssapi.a -+ elif test -e ${withval}/lib/libgssapi.a ; then -+ mechglue_lib=${withval}/lib/libgssapi.a -+ else -+ AC_MSG_ERROR("Can't find libgssapi in ${withval}"); -+ fi -+ GLOBUS_LIBS="${mechglue_lib} $GLOBUS_LIBS" -+ AC_MSG_RESULT(${mechglue_lib}) -+ -+ AC_CHECK_LIB(dl, dlopen, , ) -+ if test $ac_cv_lib_dl_dlopen = yes; then -+ LDFLAGS="$LDFLAGS -ldl -Wl,-Bsymbolic" -+ fi -+ -+ AC_DEFINE(GSSAPI) -+ AC_DEFINE(MECHGLUE, 1, [Define this if you're building with GSSAPI MechGlue.]) -+ GSSAPI="mechglue" -+ ] -+) -+ -+ -+# Check whether the user wants GSI (Globus) support -+gsi_path="no" -+program_prefix="" -+LT_INIT -+AC_ARG_WITH([gsi], -+ AS_HELP_STRING( -+ [--with-gsi], -+ [Enable Globus GSI authentication support]), -+ [gsi_path="$withval"]) -+ -+AC_ARG_WITH([globus], -+ AS_HELP_STRING( -+ [--with-globus], -+ [Enable Globus GSI authentication support]), -+ [gsi_path="$withval"]) -+ -+if test "x$gsi_path" != "xno" ; then -+ # Globus GSSAPI configuration -+ AC_MSG_CHECKING(for Globus GSI) -+ AC_DEFINE(GSI, 1, [Define if you want GSI/Globus authentication support.]) -+ if test -z "$GSSAPI"; then -+ AC_DEFINE(GSSAPI) -+ GSSAPI="GSI" -+ fi -+ -+ AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no]) -+ if test "x$PKGCONFIG" != "xno"; then -+ GLOBUS_PKG_LIBS=`$PKGCONFIG --libs "globus-gss-assist >= 2, globus-gssapi-gsi, globus-common"` -+ GLOBUS_PKG_CFLAGS=`$PKGCONFIG --cflags "globus-gss-assist >= 2, globus-gssapi-gsi, globus-common"` -+ fi -+ -+ GLOBUS_CFLAGS="$GLOBUS_CFLAGS $GLOBUS_PKG_CFLAGS" -+ GLOBUS_LIBS="$GLOBUS_LIBS $GLOBUS_PKG_LIBS" -+ AC_DEFINE([HAVE_GLOBUS_GSS_ASSIST_MAP_AND_AUTHORIZE], [1], -+ [Have globus_gss_assist_map_and_authorize]) -+ -+ AC_DEFINE(HAVE_GSSAPI_H) -+ AC_SUBST(program_prefix, "gsi") -+fi -+AC_SUBST(GLOBUS_CFLAGS) -+AC_SUBST(GLOBUS_LIBS) -+# End Globus/GSI section -+ -+# applies to non-GSI builds as well. -+LD="\$(LIBTOOL) --mode=link $CC" -+ - AC_CONFIG_HEADER([config.h]) - AC_PROG_CC - AC_CANONICAL_HOST -@@ -183,7 +266,8 @@ - OSSH_CHECK_CFLAG_COMPILE([-Wunknown-warning-option]) - OSSH_CHECK_CFLAG_COMPILE([-Wall]) - OSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith]) -- OSSH_CHECK_CFLAG_COMPILE([-Wuninitialized]) -+# cc1: warning: -Wuninitialized is not supported without -O -+# OSSH_CHECK_CFLAG_COMPILE([-Wuninitialized]) - OSSH_CHECK_CFLAG_COMPILE([-Wsign-compare]) - OSSH_CHECK_CFLAG_COMPILE([-Wformat-security]) - OSSH_CHECK_CFLAG_COMPILE([-Wsizeof-pointer-memaccess]) -@@ -597,21 +681,8 @@ - AC_DEFINE([BROKEN_SETREGID]) - ;; - *-*-darwin*) -- use_pie=auto -- AC_MSG_CHECKING([if we have working getaddrinfo]) -- AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include --main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) -- exit(0); -- else -- exit(1); --} -- ]])], -- [AC_MSG_RESULT([working])], -- [AC_MSG_RESULT([buggy]) -- AC_DEFINE([BROKEN_GETADDRINFO], [1], -- [getaddrinfo is broken (if present)]) -- ], -- [AC_MSG_RESULT([assume it is working])]) -+ CFLAGS="$CFLAGS -Wno-deprecated-declarations" # suppress openssl warns -+ AC_DEFINE(BROKEN_GETADDRINFO, 1, [assume getaddrinfo is broken)]) - AC_DEFINE([SETEUID_BREAKS_SETUID]) - AC_DEFINE([BROKEN_SETREUID]) - AC_DEFINE([BROKEN_SETREGID]) -@@ -623,6 +694,30 @@ - [Use tunnel device compatibility to OpenBSD]) - AC_DEFINE([SSH_TUN_PREPEND_AF], [1], - [Prepend the address family to IP tunnel traffic]) -+ AC_MSG_CHECKING(if we have the Security Authorization Session API) -+ AC_TRY_COMPILE([#include ], -+ [SessionCreate(0, 0);], -+ [ac_cv_use_security_session_api="yes" -+ AC_DEFINE(USE_SECURITY_SESSION_API, 1, -+ [platform has the Security Authorization Session API]) -+ LIBS="$LIBS -framework Security" -+ AC_MSG_RESULT(yes)], -+ [ac_cv_use_security_session_api="no" -+ AC_MSG_RESULT(no)]) -+ AC_MSG_CHECKING(if we have an in-memory credentials cache) -+ AC_TRY_COMPILE( -+ [#include ], -+ [cc_context_t c; -+ (void) cc_initialize (&c, 0, NULL, NULL);], -+ [AC_DEFINE(USE_CCAPI, 1, -+ [platform uses an in-memory credentials cache]) -+ LIBS="$LIBS -framework Security" -+ AC_MSG_RESULT(yes) -+ if test "x$ac_cv_use_security_session_api" = "xno"; then -+ AC_MSG_ERROR(*** Need a security framework to use the credentials cache API ***) -+ fi], -+ [AC_MSG_RESULT(no)] -+ ) - m4_pattern_allow([AU_IPv]) - AC_CHECK_DECL([AU_IPv4], [], - AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records]) -@@ -634,6 +729,7 @@ - [Define to a Set Process Title type if your system is - supported by bsd-setproctitle.c]) - AC_CHECK_FUNCS([sandbox_init]) -+ # unreliable with autoconf pre-2.64 (such as used by GPT) - AC_CHECK_HEADERS([sandbox.h]) - AC_CHECK_LIB([sandbox], [sandbox_apply], [ - SSHDLIBS="$SSHDLIBS -lsandbox" -@@ -4363,6 +4459,8 @@ - ]) - ]) - -+ # These headers conflict with GSI headers -+ if test "x$gsi_path" = "xno" ; then - AC_CHECK_HEADER([gssapi.h], , - [ unset ac_cv_header_gssapi_h - CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi" -@@ -4371,13 +4469,28 @@ - ) - ] - ) -+ fi - - oldCPP="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi" - AC_CHECK_HEADER([gssapi_krb5.h], , - [ CPPFLAGS="$oldCPP" ]) - -- fi -+ # If we're using some other GSSAPI -+ if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then -+ AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.]) -+ fi -+ -+ if test -z "$GSSAPI"; then -+ GSSAPI="KRB5"; -+ fi -+ -+ oldCPP="$CPPFLAGS" -+ CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi" -+ AC_CHECK_HEADER(gssapi_krb5.h, , -+ [ CPPFLAGS="$oldCPP" ]) -+ -+ fi - if test ! -z "$need_dash_r" ; then - LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib" - fi -@@ -4385,9 +4498,12 @@ - blibpath="$blibpath:${KRB5ROOT}/lib" - fi - -- AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h]) -+ # These headers conflict with GSI headers -+ if test "x$gsi_path" = "xno" ; then -+ AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h gssapi/gssapi_ext.h]) - AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h]) - AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h]) -+ fi - - AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1], - [Define this if you want to use libkafs' AFS support])]) -@@ -4398,16 +4514,15 @@ - #elif defined(HAVE_GSSAPI_GSSAPI_H) - # include - #endif -- --#ifdef HAVE_GSSAPI_GENERIC_H --# include --#elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H) --# include --#endif - ]]) - saved_LIBS="$LIBS" -- LIBS="$LIBS $K5LIBS" -+ LIBS="$LIBS $K5LIBS $GSSLIBS" - AC_CHECK_FUNCS([krb5_cc_new_unique krb5_get_error_message krb5_free_error_message]) -+ AC_CHECK_FUNCS([gss_localname gss_userok]) -+ # mechglue library doesn't have gss_indicate_mechs_by_attrs -+ if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then -+ AC_CHECK_FUNCS([gss_indicate_mechs_by_attrs]) -+ fi - LIBS="$saved_LIBS" - - fi -@@ -4416,6 +4531,42 @@ - AC_SUBST([GSSLIBS]) - AC_SUBST([K5LIBS]) - -+# Check whether user wants AFS_KRB5 support -+AFS_KRB5_MSG="no" -+AC_ARG_WITH(afs-krb5, -+ [ --with-afs-krb5[[=AKLOG_PATH]] Enable aklog to get token (default=/usr/bin/aklog).], -+ [ -+ if test "x$withval" != "xno" ; then -+ -+ if test "x$withval" != "xyes" ; then -+ AC_DEFINE_UNQUOTED(AKLOG_PATH, "$withval", -+ [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.]) -+ else -+ AC_DEFINE_UNQUOTED(AKLOG_PATH, -+ "/usr/bin/aklog", -+ [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.]) -+ fi -+ -+ if test -z "$KRB5ROOT" ; then -+ AC_MSG_WARN([AFS_KRB5 requires Kerberos 5 support, build may fail]) -+ fi -+ -+ LIBS="-lkrbafs -lkrb4 $LIBS" -+ if test ! -z "$AFS_LIBS" ; then -+ LIBS="$LIBS $AFS_LIBS" -+ fi -+ AC_DEFINE(AFS_KRB5, 1, -+ [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.]) -+ AFS_KRB5_MSG="yes" -+ fi -+ ] -+) -+ -+AC_ARG_WITH(session-hooks, -+ [ --with-session-hooks Enable hooks for executing external commands before/after a session], -+ [ AC_DEFINE(SESSION_HOOKS, 1, [Define this if you want support for startup/shutdown hooks]) ] -+) -+ - # Looking for programs, paths and files - - PRIVSEP_PATH=/var/empty -@@ -4451,7 +4602,10 @@ - ] - ) - -+# strip causes problems with GSI libraries... -+if test -z "$GLOBUS_LDFLAGS" ; then - STRIP_OPT=-s -+fi - AC_ARG_ENABLE([strip], - [ --disable-strip Disable calling strip(1) on install], - [ -diff -Nur openssh-7.5p1/contrib/redhat/gsisshd.init gsi-openssh/contrib/redhat/gsisshd.init ---- openssh-7.5p1/contrib/redhat/gsisshd.init 1970-01-01 01:00:00.000000000 +0100 -+++ gsi-openssh/contrib/redhat/gsisshd.init 2018-12-20 11:49:17.616000000 +0100 -@@ -0,0 +1,240 @@ -+#!/bin/bash -+# -+# gsisshd Start up the OpenSSH server daemon -+# -+# chkconfig: - 55 25 -+# description: SSH is a protocol for secure remote shell access. \ -+# This service starts up the OpenSSH server daemon. -+# -+# processname: gsisshd -+# config: /etc/gsissh/ssh_host_key -+# config: /etc/gsissh/ssh_host_key.pub -+# config: /etc/gsissh/ssh_random_seed -+# config: /etc/gsissh/sshd_config -+# pidfile: /var/run/gsisshd.pid -+ -+### BEGIN INIT INFO -+# Provides: gsisshd -+# Required-Start: $local_fs $network $syslog -+# Required-Stop: $local_fs $syslog -+# Should-Start: $syslog -+# Should-Stop: $network $syslog -+# Default-Start: 2 3 4 5 -+# Default-Stop: 0 1 6 -+# Short-Description: Start up the OpenSSH server daemon -+# Description: SSH is a protocol for secure remote shell access. -+# This service starts up the OpenSSH server daemon. -+### END INIT INFO -+ -+# source function library -+. /etc/rc.d/init.d/functions -+ -+# pull in sysconfig settings -+[ -f /etc/sysconfig/gsisshd ] && . /etc/sysconfig/gsisshd -+ -+RETVAL=0 -+prog="gsisshd" -+lockfile=/var/lock/subsys/$prog -+ -+# Some functions to make the below more readable -+KEYGEN=/usr/bin/gsissh-keygen -+SSHD=/usr/sbin/gsisshd -+RSA1_KEY=/etc/ssh/ssh_host_key -+RSA_KEY=/etc/ssh/ssh_host_rsa_key -+DSA_KEY=/etc/ssh/ssh_host_dsa_key -+PID_FILE=/var/run/gsisshd.pid -+ -+runlevel=$(set -- $(runlevel); eval "echo \$$#" ) -+ -+do_rsa1_keygen() { -+ if [ ! -s $RSA1_KEY ]; then -+ echo -n $"Generating SSH1 RSA host key: " -+ rm -f $RSA1_KEY -+ if test ! -f $RSA1_KEY && $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null; then -+ chmod 600 $RSA1_KEY -+ chmod 644 $RSA1_KEY.pub -+ if [ -x /sbin/restorecon ]; then -+ /sbin/restorecon $RSA1_KEY.pub -+ fi -+ success $"RSA1 key generation" -+ echo -+ else -+ failure $"RSA1 key generation" -+ echo -+ exit 1 -+ fi -+ fi -+} -+ -+do_rsa_keygen() { -+ if [ ! -s $RSA_KEY ]; then -+ echo -n $"Generating SSH2 RSA host key: " -+ rm -f $RSA_KEY -+ if test ! -f $RSA_KEY && $KEYGEN -q -t rsa -f $RSA_KEY -C '' -N '' >&/dev/null; then -+ chmod 600 $RSA_KEY -+ chmod 644 $RSA_KEY.pub -+ if [ -x /sbin/restorecon ]; then -+ /sbin/restorecon $RSA_KEY.pub -+ fi -+ success $"RSA key generation" -+ echo -+ else -+ failure $"RSA key generation" -+ echo -+ exit 1 -+ fi -+ fi -+} -+ -+do_dsa_keygen() { -+ if [ ! -s $DSA_KEY ]; then -+ echo -n $"Generating SSH2 DSA host key: " -+ rm -f $DSA_KEY -+ if test ! -f $DSA_KEY && $KEYGEN -q -t dsa -f $DSA_KEY -C '' -N '' >&/dev/null; then -+ chmod 600 $DSA_KEY -+ chmod 644 $DSA_KEY.pub -+ if [ -x /sbin/restorecon ]; then -+ /sbin/restorecon $DSA_KEY.pub -+ fi -+ success $"DSA key generation" -+ echo -+ else -+ failure $"DSA key generation" -+ echo -+ exit 1 -+ fi -+ fi -+} -+ -+do_restart_sanity_check() -+{ -+ $SSHD -t -+ RETVAL=$? -+ if [ $RETVAL -ne 0 ]; then -+ failure $"Configuration file or keys are invalid" -+ echo -+ fi -+} -+ -+start() -+{ -+ [ -x $SSHD ] || exit 5 -+ [ -f /etc/gsissh/sshd_config ] || exit 6 -+ # Create keys if necessary -+ # - Not necessary if running with keyex only -+ # if [ "x${AUTOCREATE_SERVER_KEYS}" != xNO ]; then -+ # do_rsa_keygen -+ # if [ "x${AUTOCREATE_SERVER_KEYS}" != xRSAONLY ]; then -+ # do_rsa1_keygen -+ # do_dsa_keygen -+ # fi -+ # fi -+ -+ echo -n $"Starting $prog: " -+ $SSHD $OPTIONS && success || failure -+ RETVAL=$? -+ [ $RETVAL -eq 0 ] && touch $lockfile -+ echo -+ return $RETVAL -+} -+ -+stop() -+{ -+ echo -n $"Stopping $prog: " -+# uncommenting below since pidfileofproc doesn't look at /var/run/gsissh/ -+# instead we will use killproc -p like sshd.init does. -+# if [ -n "`pidfileofproc $SSHD`" ] ; then -+# killproc $SSHD -+# else -+# failure $"Stopping $prog" -+# fi -+ killproc -p $PID_FILE $SSHD -+ RETVAL=$? -+ # if we are in halt or reboot runlevel kill all running sessions -+ # so the TCP connections are closed cleanly -+ if [ "x$runlevel" = x0 -o "x$runlevel" = x6 ] ; then -+ trap '' TERM -+ killall $prog 2>/dev/null -+ trap TERM -+ fi -+ [ $RETVAL -eq 0 ] && rm -f $lockfile -+ echo -+} -+ -+reload() -+{ -+ echo -n $"Reloading $prog: " -+ if [ -n "`pidfileofproc $SSHD`" ] ; then -+ killproc $SSHD -HUP -+ else -+ failure $"Reloading $prog" -+ fi -+ RETVAL=$? -+ echo -+} -+ -+restart() { -+ stop -+ start -+} -+ -+force_reload() { -+ restart -+} -+ -+rh_status() { -+ status -p $PID_FILE gsissh-daemon -+} -+ -+rh_status_q() { -+ rh_status >/dev/null 2>&1 -+} -+ -+case "$1" in -+ start) -+ rh_status_q && exit 0 -+ start -+ ;; -+ stop) -+ if ! rh_status_q; then -+ rm -f $lockfile -+ exit 0 -+ fi -+ stop -+ ;; -+ restart) -+ restart -+ ;; -+ reload) -+ rh_status_q || exit 7 -+ reload -+ ;; -+ force-reload) -+ force_reload -+ ;; -+ condrestart|try-restart) -+ rh_status_q || exit 0 -+ if [ -f $lockfile ] ; then -+ do_restart_sanity_check -+ if [ $RETVAL -eq 0 ] ; then -+ stop -+ # avoid race -+ sleep 3 -+ start -+ else -+ RETVAL=6 -+ fi -+ fi -+ ;; -+ status) -+ rh_status -+ RETVAL=$? -+ if [ $RETVAL -eq 3 -a -f $lockfile ] ; then -+ RETVAL=2 -+ fi -+ ;; -+ *) -+ echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}" -+ RETVAL=2 -+esac -+exit $RETVAL -diff -Nur openssh-7.5p1/contrib/redhat/gsisshd.pam gsi-openssh/contrib/redhat/gsisshd.pam ---- openssh-7.5p1/contrib/redhat/gsisshd.pam 1970-01-01 01:00:00.000000000 +0100 -+++ gsi-openssh/contrib/redhat/gsisshd.pam 2018-12-20 11:49:17.616000000 +0100 -@@ -0,0 +1,13 @@ -+#%PAM-1.0 -+auth required pam_sepermit.so -+auth include password-auth -+account required pam_nologin.so -+account include password-auth -+password include password-auth -+# pam_selinux.so close should be the first session rule -+session required pam_selinux.so close -+session required pam_loginuid.so -+# pam_selinux.so open should only be followed by sessions to be executed in the user context -+session required pam_selinux.so open env_params -+session optional pam_keyinit.so force revoke -+session include password-auth -diff -Nur openssh-7.5p1/gss-genr.c gsi-openssh/gss-genr.c ---- openssh-7.5p1/gss-genr.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/gss-genr.c 2018-12-20 11:49:17.616000000 +0100 -@@ -1,7 +1,7 @@ - /* $OpenBSD: gss-genr.c,v 1.24 2016/09/12 01:22:38 deraadt Exp $ */ - - /* -- * Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved. -+ * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions -@@ -39,13 +39,196 @@ - #include "xmalloc.h" - #include "buffer.h" - #include "log.h" -+#include "canohost.h" - #include "ssh2.h" -+#include "cipher.h" -+#include "key.h" -+#include "kex.h" -+#include - - #include "ssh-gss.h" - - extern u_char *session_id2; - extern u_int session_id2_len; - -+typedef struct { -+ char *encoded; -+ gss_OID oid; -+} ssh_gss_kex_mapping; -+ -+/* -+ * XXX - It would be nice to find a more elegant way of handling the -+ * XXX passing of the key exchange context to the userauth routines -+ */ -+ -+Gssctxt *gss_kex_context = NULL; -+ -+static ssh_gss_kex_mapping *gss_enc2oid = NULL; -+ -+int -+ssh_gssapi_oid_table_ok() { -+ return (gss_enc2oid != NULL); -+} -+ -+/* -+ * Return a list of the gss-group1-sha1 mechanisms supported by this program -+ * -+ * We test mechanisms to ensure that we can use them, to avoid starting -+ * a key exchange with a bad mechanism -+ */ -+ -+char * -+ssh_gssapi_client_mechanisms(const char *host, const char *client) { -+ gss_OID_set gss_supported; -+ OM_uint32 min_status; -+ -+ if (GSS_ERROR(gss_indicate_mechs(&min_status, &gss_supported))) -+ return NULL; -+ -+ return(ssh_gssapi_kex_mechs(gss_supported, ssh_gssapi_check_mechanism, -+ host, client)); -+} -+ -+char * -+ssh_gssapi_kex_mechs(gss_OID_set gss_supported, ssh_gssapi_check_fn *check, -+ const char *host, const char *client) { -+ Buffer buf; -+ size_t i; -+ int oidpos, enclen; -+ char *mechs, *encoded; -+ u_char digest[EVP_MAX_MD_SIZE]; -+ char deroid[2]; -+ const EVP_MD *evp_md = EVP_md5(); -+ EVP_MD_CTX md; -+ -+ if (gss_enc2oid != NULL) { -+ for (i = 0; gss_enc2oid[i].encoded != NULL; i++) -+ free(gss_enc2oid[i].encoded); -+ free(gss_enc2oid); -+ } -+ -+ gss_enc2oid = xmalloc(sizeof(ssh_gss_kex_mapping) * -+ (gss_supported->count + 1)); -+ -+ buffer_init(&buf); -+ -+ oidpos = 0; -+ for (i = 0; i < gss_supported->count; i++) { -+ if (gss_supported->elements[i].length < 128 && -+ (*check)(NULL, &(gss_supported->elements[i]), host, client)) { -+ -+ deroid[0] = SSH_GSS_OIDTYPE; -+ deroid[1] = gss_supported->elements[i].length; -+ -+ EVP_DigestInit(&md, evp_md); -+ EVP_DigestUpdate(&md, deroid, 2); -+ EVP_DigestUpdate(&md, -+ gss_supported->elements[i].elements, -+ gss_supported->elements[i].length); -+ EVP_DigestFinal(&md, digest, NULL); -+ -+ encoded = xmalloc(EVP_MD_size(evp_md) * 2); -+ enclen = __b64_ntop(digest, EVP_MD_size(evp_md), -+ encoded, EVP_MD_size(evp_md) * 2); -+ -+ if (oidpos != 0) -+ buffer_put_char(&buf, ','); -+ -+ buffer_append(&buf, KEX_GSS_GRP16_SHA512_ID, -+ sizeof(KEX_GSS_GRP16_SHA512_ID) - 1); -+ buffer_append(&buf, encoded, enclen); -+ buffer_put_char(&buf, ','); -+ buffer_append(&buf, KEX_GSS_GRP18_SHA512_ID, -+ sizeof(KEX_GSS_GRP18_SHA512_ID) - 1); -+ buffer_append(&buf, encoded, enclen); -+ buffer_put_char(&buf, ','); -+ buffer_append(&buf, KEX_GSS_GEX_SHA1_ID, -+ sizeof(KEX_GSS_GEX_SHA1_ID) - 1); -+ buffer_append(&buf, encoded, enclen); -+ buffer_put_char(&buf, ','); -+ buffer_append(&buf, KEX_GSS_GRP14_SHA256_ID, -+ sizeof(KEX_GSS_GRP14_SHA256_ID) - 1); -+ buffer_append(&buf, encoded, enclen); -+ buffer_put_char(&buf, ','); -+ buffer_append(&buf, KEX_GSS_GRP14_SHA1_ID, -+ sizeof(KEX_GSS_GRP14_SHA1_ID) - 1); -+ buffer_append(&buf, encoded, enclen); -+ buffer_put_char(&buf, ','); -+ buffer_append(&buf, KEX_GSS_GRP1_SHA1_ID, -+ sizeof(KEX_GSS_GRP1_SHA1_ID) - 1); -+ buffer_append(&buf, encoded, enclen); -+ -+ gss_enc2oid[oidpos].oid = &(gss_supported->elements[i]); -+ gss_enc2oid[oidpos].encoded = encoded; -+ oidpos++; -+ } -+ } -+ gss_enc2oid[oidpos].oid = NULL; -+ gss_enc2oid[oidpos].encoded = NULL; -+ -+ buffer_put_char(&buf, '\0'); -+ -+ mechs = xmalloc(buffer_len(&buf)); -+ buffer_get(&buf, mechs, buffer_len(&buf)); -+ buffer_free(&buf); -+ -+ if (strlen(mechs) == 0) { -+ free(mechs); -+ mechs = NULL; -+ } -+ -+ return (mechs); -+} -+ -+gss_OID -+ssh_gssapi_id_kex(Gssctxt *ctx, char *name, int kex_type) { -+ int i = 0; -+ -+ switch (kex_type) { -+ case KEX_GSS_GRP1_SHA1: -+ if (strlen(name) < sizeof(KEX_GSS_GRP1_SHA1_ID)) -+ return GSS_C_NO_OID; -+ name += sizeof(KEX_GSS_GRP1_SHA1_ID) - 1; -+ break; -+ case KEX_GSS_GRP14_SHA1: -+ if (strlen(name) < sizeof(KEX_GSS_GRP14_SHA1_ID)) -+ return GSS_C_NO_OID; -+ name += sizeof(KEX_GSS_GRP14_SHA1_ID) - 1; -+ break; -+ case KEX_GSS_GRP14_SHA256: -+ if (strlen(name) < sizeof(KEX_GSS_GRP14_SHA256_ID)) -+ return GSS_C_NO_OID; -+ name += sizeof(KEX_GSS_GRP14_SHA256_ID) - 1; -+ break; -+ case KEX_GSS_GRP16_SHA512: -+ if (strlen(name) < sizeof(KEX_GSS_GRP16_SHA512_ID)) -+ return GSS_C_NO_OID; -+ name += sizeof(KEX_GSS_GRP16_SHA512_ID) - 1; -+ break; -+ case KEX_GSS_GRP18_SHA512: -+ if (strlen(name) < sizeof(KEX_GSS_GRP18_SHA512_ID)) -+ return GSS_C_NO_OID; -+ name += sizeof(KEX_GSS_GRP18_SHA512_ID) - 1; -+ break; -+ case KEX_GSS_GEX_SHA1: -+ if (strlen(name) < sizeof(KEX_GSS_GEX_SHA1_ID)) -+ return GSS_C_NO_OID; -+ name += sizeof(KEX_GSS_GEX_SHA1_ID) - 1; -+ break; -+ default: -+ return GSS_C_NO_OID; -+ } -+ -+ while (gss_enc2oid[i].encoded != NULL && -+ strcmp(name, gss_enc2oid[i].encoded) != 0) -+ i++; -+ -+ if (gss_enc2oid[i].oid != NULL && ctx != NULL) -+ ssh_gssapi_set_oid(ctx, gss_enc2oid[i].oid); -+ -+ return gss_enc2oid[i].oid; -+} -+ - /* Check that the OID in a data stream matches that in the context */ - int - ssh_gssapi_check_oid(Gssctxt *ctx, void *data, size_t len) -@@ -156,10 +339,13 @@ - void - ssh_gssapi_delete_ctx(Gssctxt **ctx) - { -+#if !defined(MECHGLUE) - OM_uint32 ms; -+#endif - - if ((*ctx) == NULL) - return; -+#if !defined(MECHGLUE) /* mechglue has some memory management issues */ - if ((*ctx)->context != GSS_C_NO_CONTEXT) - gss_delete_sec_context(&ms, &(*ctx)->context, GSS_C_NO_BUFFER); - if ((*ctx)->name != GSS_C_NO_NAME) -@@ -175,6 +361,7 @@ - gss_release_name(&ms, &(*ctx)->client); - if ((*ctx)->client_creds != GSS_C_NO_CREDENTIAL) - gss_release_cred(&ms, &(*ctx)->client_creds); -+#endif - - free(*ctx); - *ctx = NULL; -@@ -191,15 +378,23 @@ - gss_buffer_desc* send_tok, OM_uint32 *flags) - { - int deleg_flag = 0; -+ int conf_flag = 0; - - if (deleg_creds) { - deleg_flag = GSS_C_DELEG_FLAG; - debug("Delegating credentials"); - } - -+ /* Setting GSS_C_CONF_FLAG to get around the issue of SSL_export_keying_material -+ * not returning correct key material on CentOS6 with OpenSSL 1.0.1e build 48. -+ * See: https://github.com/globus/globus-toolkit/issues/92 -+ */ -+ if (getenv("GSISSH_FORCE_CONF_FLAG") != NULL) -+ conf_flag = GSS_C_CONF_FLAG; -+ - ctx->major = gss_init_sec_context(&ctx->minor, -- GSS_C_NO_CREDENTIAL, &ctx->context, ctx->name, ctx->oid, -- GSS_C_MUTUAL_FLAG | GSS_C_INTEG_FLAG | deleg_flag, -+ ctx->client_creds, &ctx->context, ctx->name, ctx->oid, -+ GSS_C_MUTUAL_FLAG | GSS_C_INTEG_FLAG | conf_flag | deleg_flag, - 0, NULL, recv_tok, NULL, send_tok, flags, NULL); - - if (GSS_ERROR(ctx->major)) -@@ -213,9 +408,18 @@ - ssh_gssapi_import_name(Gssctxt *ctx, const char *host) - { - gss_buffer_desc gssbuf; -+ char *xhost; - char *val; - -- xasprintf(&val, "host@%s", host); -+ /* Make a copy of the host name, in case it was returned by a -+ * previous call to gethostbyname(). */ -+ xhost = xstrdup(host); -+ -+ /* Make sure we have the FQDN. Some GSSAPI implementations don't do -+ * this for us themselves */ -+ resolve_localhost(&xhost); -+ -+ xasprintf(&val, "host@%s", xhost); - gssbuf.value = val; - gssbuf.length = strlen(gssbuf.value); - -@@ -223,13 +427,48 @@ - &gssbuf, GSS_C_NT_HOSTBASED_SERVICE, &ctx->name))) - ssh_gssapi_error(ctx); - -+ free(xhost); - free(gssbuf.value); - return (ctx->major); - } - - OM_uint32 -+ssh_gssapi_client_identity(Gssctxt *ctx, const char *name) -+{ -+ gss_buffer_desc gssbuf; -+ gss_name_t gssname; -+ OM_uint32 status; -+ gss_OID_set oidset; -+ -+ gssbuf.value = (void *) name; -+ gssbuf.length = strlen(gssbuf.value); -+ -+ gss_create_empty_oid_set(&status, &oidset); -+ gss_add_oid_set_member(&status, ctx->oid, &oidset); -+ -+ ctx->major = gss_import_name(&ctx->minor, &gssbuf, -+ GSS_C_NT_USER_NAME, &gssname); -+ -+ if (!ctx->major) -+ ctx->major = gss_acquire_cred(&ctx->minor, -+ gssname, 0, oidset, GSS_C_INITIATE, -+ &ctx->client_creds, NULL, NULL); -+ -+ gss_release_name(&status, &gssname); -+ gss_release_oid_set(&status, &oidset); -+ -+ if (ctx->major) -+ ssh_gssapi_error(ctx); -+ -+ return(ctx->major); -+} -+ -+OM_uint32 - ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_t buffer, gss_buffer_t hash) - { -+ if (ctx == NULL) -+ return -1; -+ - if ((ctx->major = gss_get_mic(&ctx->minor, ctx->context, - GSS_C_QOP_DEFAULT, buffer, hash))) - ssh_gssapi_error(ctx); -@@ -237,6 +476,19 @@ - return (ctx->major); - } - -+/* Priviledged when used by server */ -+OM_uint32 -+ssh_gssapi_checkmic(Gssctxt *ctx, gss_buffer_t gssbuf, gss_buffer_t gssmic) -+{ -+ if (ctx == NULL) -+ return -1; -+ -+ ctx->major = gss_verify_mic(&ctx->minor, ctx->context, -+ gssbuf, gssmic, NULL); -+ -+ return (ctx->major); -+} -+ - void - ssh_gssapi_buildmic(Buffer *b, const char *user, const char *service, - const char *context) -@@ -250,11 +502,16 @@ - } - - int --ssh_gssapi_check_mechanism(Gssctxt **ctx, gss_OID oid, const char *host) -+ssh_gssapi_check_mechanism(Gssctxt **ctx, gss_OID oid, const char *host, -+ const char *client) - { - gss_buffer_desc token = GSS_C_EMPTY_BUFFER; - OM_uint32 major, minor; - gss_OID_desc spnego_oid = {6, (void *)"\x2B\x06\x01\x05\x05\x02"}; -+ Gssctxt *intctx = NULL; -+ -+ if (ctx == NULL) -+ ctx = &intctx; - - /* RFC 4462 says we MUST NOT do SPNEGO */ - if (oid->length == spnego_oid.length && -@@ -264,6 +521,10 @@ - ssh_gssapi_build_ctx(ctx); - ssh_gssapi_set_oid(*ctx, oid); - major = ssh_gssapi_import_name(*ctx, host); -+ -+ if (!GSS_ERROR(major) && client) -+ major = ssh_gssapi_client_identity(*ctx, client); -+ - if (!GSS_ERROR(major)) { - major = ssh_gssapi_init_ctx(*ctx, 0, GSS_C_NO_BUFFER, &token, - NULL); -@@ -273,10 +534,66 @@ - GSS_C_NO_BUFFER); - } - -- if (GSS_ERROR(major)) -+ if (GSS_ERROR(major) || intctx != NULL) - ssh_gssapi_delete_ctx(ctx); - - return (!GSS_ERROR(major)); - } - -+int -+ssh_gssapi_credentials_updated(Gssctxt *ctxt) { -+ static gss_name_t saved_name = GSS_C_NO_NAME; -+ static OM_uint32 saved_lifetime = 0; -+ static gss_OID saved_mech = GSS_C_NO_OID; -+ static gss_name_t name; -+ static OM_uint32 last_call = 0; -+ OM_uint32 lifetime, now, major, minor; -+ int equal; -+ -+ now = time(NULL); -+ -+ if (ctxt) { -+ debug("Rekey has happened - updating saved versions"); -+ -+ if (saved_name != GSS_C_NO_NAME) -+ gss_release_name(&minor, &saved_name); -+ -+ major = gss_inquire_cred(&minor, GSS_C_NO_CREDENTIAL, -+ &saved_name, &saved_lifetime, NULL, NULL); -+ -+ if (!GSS_ERROR(major)) { -+ saved_mech = ctxt->oid; -+ saved_lifetime+= now; -+ } else { -+ /* Handle the error */ -+ } -+ return 0; -+ } -+ -+ if (now - last_call < 10) -+ return 0; -+ -+ last_call = now; -+ -+ if (saved_mech == GSS_C_NO_OID) -+ return 0; -+ -+ major = gss_inquire_cred(&minor, GSS_C_NO_CREDENTIAL, -+ &name, &lifetime, NULL, NULL); -+ if (major == GSS_S_CREDENTIALS_EXPIRED) -+ return 0; -+ else if (GSS_ERROR(major)) -+ return 0; -+ -+ major = gss_compare_name(&minor, saved_name, name, &equal); -+ gss_release_name(&minor, &name); -+ if (GSS_ERROR(major)) -+ return 0; -+ -+ if (equal && (saved_lifetime < lifetime + now - 10)) -+ return 1; -+ -+ return 0; -+} -+ - #endif /* GSSAPI */ -diff -Nur openssh-7.5p1/gss-serv.c gsi-openssh/gss-serv.c ---- openssh-7.5p1/gss-serv.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/gss-serv.c 2019-01-10 10:01:08.408000000 +0100 -@@ -1,7 +1,7 @@ - /* $OpenBSD: gss-serv.c,v 1.29 2015/05/22 03:50:02 djm Exp $ */ - - /* -- * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. -+ * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions -@@ -45,29 +45,103 @@ - #include "session.h" - #include "misc.h" - #include "servconf.h" -+#include "uidswap.h" - -+#include "xmalloc.h" - #include "ssh-gss.h" -+#include "monitor_wrap.h" -+ -+extern ServerOptions options; -+extern Authctxt *the_authctxt; - - extern ServerOptions options; - - static ssh_gssapi_client gssapi_client = -- { GSS_C_EMPTY_BUFFER, GSS_C_EMPTY_BUFFER, -- GSS_C_NO_CREDENTIAL, NULL, {NULL, NULL, NULL, NULL}}; -+ { {0, NULL}, GSS_C_EMPTY_BUFFER, GSS_C_EMPTY_BUFFER, GSS_C_NO_CREDENTIAL, -+ GSS_C_NO_NAME, GSS_C_NO_NAME, NULL, {NULL, NULL, NULL, NULL, NULL}, -+ GSS_C_NO_CONTEXT, 0, 0}; - - ssh_gssapi_mech gssapi_null_mech = -- { NULL, NULL, {0, NULL}, NULL, NULL, NULL, NULL}; -+ { NULL, NULL, {0, NULL}, NULL, NULL, NULL, NULL, NULL}; -+ -+/* Generic GSS-API support*/ -+#ifdef HAVE_GSS_USEROK -+static int ssh_gssapi_generic_userok( -+ ssh_gssapi_client *client, char *user) { -+ if (gss_userok(client->ctx_name, user)) { -+ debug("userok succeded for %s", user); -+ return 1; -+ } else { -+ debug("userok failed for %s", user); -+ return 0; -+ } -+} -+#endif -+ -+#ifdef HAVE_GSS_USEROK -+static int -+ssh_gssapi_generic_localname(ssh_gssapi_client *client, -+ char **localname) { -+ #ifdef HAVE_GSS_LOCALNAME -+ gss_buffer_desc lbuffer; -+ OM_uint32 major, minor; -+ *localname = NULL; -+ major = gss_localname(&minor, client->cred_name, NULL, &lbuffer); -+ if (GSS_ERROR(major)) -+ return 0; -+ if (lbuffer.value == NULL) -+ return 0; -+ *localname = xmalloc(lbuffer.length+1); -+ if (*localname) { -+ memcpy(*localname, lbuffer.value, lbuffer.length); -+ *localname[lbuffer.length] = '\0'; -+ } -+ gss_release_buffer(&minor, &lbuffer); -+ if (*localname) -+ return 1; -+ return 0; -+ #else -+ debug("No generic gss_localname"); -+ return 0; -+ #endif -+ } -+ -+static ssh_gssapi_mech ssh_gssapi_generic_mech = { -+ NULL, NULL, -+ {0, NULL}, -+ NULL, /* dochild */ -+ ssh_gssapi_generic_userok, -+ ssh_gssapi_generic_localname, -+ NULL, -+ NULL}; -+static const ssh_gssapi_mech *ssh_gssapi_generic_mech_ptr = &ssh_gssapi_generic_mech; -+#else /*HAVE_GSS_USEROK*/ -+static const ssh_gssapi_mech *ssh_gssapi_generic_mech_ptr = NULL; -+#endif - - #ifdef KRB5 - extern ssh_gssapi_mech gssapi_kerberos_mech; - #endif -+#ifdef GSI -+extern ssh_gssapi_mech gssapi_gsi_mech; -+extern ssh_gssapi_mech gssapi_gsi_mech_micv2; -+#endif - - ssh_gssapi_mech* supported_mechs[]= { - #ifdef KRB5 - &gssapi_kerberos_mech, - #endif -+#ifdef GSI -+ &gssapi_gsi_mech_micv2, -+ &gssapi_gsi_mech, -+#endif - &gssapi_null_mech, - }; - -+#ifdef GSS_C_GLOBUS_LIMITED_PROXY_FLAG -+static int limited = 0; -+#endif -+ - /* - * ssh_gssapi_supported_oids() can cause sandbox violations, so prepare the - * list of supported mechanisms before privsep is set up. -@@ -142,6 +216,29 @@ - } - - /* Unprivileged */ -+char * -+ssh_gssapi_server_mechanisms() { -+ gss_OID_set supported; -+ -+ ssh_gssapi_supported_oids(&supported); -+ return (ssh_gssapi_kex_mechs(supported, &ssh_gssapi_server_check_mech, -+ NULL, NULL)); -+} -+ -+/* Unprivileged */ -+int -+ssh_gssapi_server_check_mech(Gssctxt **dum, gss_OID oid, const char *data, -+ const char *dummy) { -+ Gssctxt *ctx = NULL; -+ int res; -+ -+ res = !GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctx, oid))); -+ ssh_gssapi_delete_ctx(&ctx); -+ -+ return (res); -+} -+ -+/* Unprivileged */ - void - ssh_gssapi_supported_oids(gss_OID_set *oidset) - { -@@ -150,6 +247,27 @@ - int present; - gss_OID_set supported; - -+#ifdef HAVE_GSS_INDICATE_MECHS_BY_ATTRS -+ /* If we have a generic mechanism all OIDs supported */ -+ if (ssh_gssapi_generic_mech_ptr) { -+ gss_OID_desc except_oids[3]; -+ gss_OID_set_desc except_attrs; -+ except_oids[0] = *GSS_C_MA_MECH_NEGO; -+ except_oids[1] = *GSS_C_MA_NOT_MECH; -+ except_oids[2] = *GSS_C_MA_DEPRECATED; -+ -+ except_attrs.count = sizeof(except_oids)/sizeof(except_oids[0]); -+ except_attrs.elements = except_oids; -+ -+ if (!GSS_ERROR(gss_indicate_mechs_by_attrs(&min_status, -+ GSS_C_NO_OID_SET, -+ &except_attrs, -+ GSS_C_NO_OID_SET, -+ oidset))) -+ return; -+ } -+#endif -+ - gss_create_empty_oid_set(&min_status, oidset); - gss_indicate_mechs(&min_status, &supported); - -@@ -203,6 +321,10 @@ - (*flags & GSS_C_INTEG_FLAG))) && (ctx->major == GSS_S_COMPLETE)) { - if (ssh_gssapi_getclient(ctx, &gssapi_client)) - fatal("Couldn't convert client name"); -+#ifdef GSS_C_GLOBUS_LIMITED_PROXY_FLAG -+ if (flags && (*flags & GSS_C_GLOBUS_LIMITED_PROXY_FLAG)) -+ limited=1; -+#endif - } - - return (status); -@@ -222,6 +344,20 @@ - - tok = ename->value; - -+#ifdef GSI /* GSI gss_export_name() is broken. */ -+ if (((ctx->oid->length == gssapi_gsi_mech.oid.length) && -+ (memcmp(ctx->oid->elements, gssapi_gsi_mech.oid.elements, -+ gssapi_gsi_mech.oid.length) == 0)) || -+ ((ctx->oid->length == gssapi_gsi_mech_micv2.oid.length) && -+ (memcmp(ctx->oid->elements, gssapi_gsi_mech_micv2.oid.elements, -+ gssapi_gsi_mech_micv2.oid.length) == 0))) { -+ name->length = ename->length; -+ name->value = xmalloc(ename->length+1); -+ memcpy(name->value, ename->value, ename->length); -+ return GSS_S_COMPLETE; -+ } -+#endif -+ - /* - * Check that ename is long enough for all of the fixed length - * header, and that the initial ID bytes are correct -@@ -277,8 +413,51 @@ - ssh_gssapi_getclient(Gssctxt *ctx, ssh_gssapi_client *client) - { - int i = 0; -+ int equal = 0; -+ gss_name_t new_name = GSS_C_NO_NAME; -+ gss_buffer_desc ename = GSS_C_EMPTY_BUFFER; -+ -+ if (options.gss_store_rekey && client->used && ctx->client_creds) { -+ if (client->oid.length != ctx->oid->length || -+ (memcmp(client->oid.elements, -+ ctx->oid->elements, ctx->oid->length) !=0)) { -+ debug("Rekeyed credentials have different mechanism"); -+ return GSS_S_COMPLETE; -+ } -+ -+ /* Call gss_inquire_cred rather than gss_inquire_cred_by_mech -+ because GSI doesn't support the latter. -jbasney */ -+ -+ if ((ctx->major = gss_inquire_cred(&ctx->minor, -+ ctx->client_creds, &new_name, -+ NULL, NULL, NULL))) { -+ ssh_gssapi_error(ctx); -+ return (ctx->major); -+ } - -- gss_buffer_desc ename; -+ ctx->major = gss_compare_name(&ctx->minor, client->cred_name, -+ new_name, &equal); -+ -+ if (GSS_ERROR(ctx->major)) { -+ ssh_gssapi_error(ctx); -+ return (ctx->major); -+ } -+ -+ if (!equal) { -+ debug("Rekeyed credentials have different name"); -+ return GSS_S_COMPLETE; -+ } -+ -+ debug("Marking rekeyed credentials for export"); -+ -+ gss_release_name(&ctx->minor, &client->cred_name); -+ gss_release_cred(&ctx->minor, &client->creds); -+ client->cred_name = new_name; -+ client->creds = ctx->client_creds; -+ ctx->client_creds = GSS_C_NO_CREDENTIAL; -+ client->updated = 1; -+ return GSS_S_COMPLETE; -+ } - - client->mech = NULL; - -@@ -290,8 +469,23 @@ - i++; - } - -- if (client->mech == NULL) -- return GSS_S_FAILURE; -+ if (client->oid.elements == NULL) -+ client->oid = *ctx->oid; -+ if (client->mech == NULL) { -+ if (ssh_gssapi_generic_mech_ptr) -+ client->mech = (ssh_gssapi_mech *) ssh_gssapi_generic_mech_ptr; -+ else return GSS_S_FAILURE; -+ } -+ -+ /* Call gss_inquire_cred rather than gss_inquire_cred_by_mech -+ because GSI doesn't support the latter. -jbasney */ -+ -+ if (ctx->client_creds && -+ (ctx->major = gss_inquire_cred(&ctx->minor, -+ ctx->client_creds, &client->cred_name, NULL, NULL, NULL))) { -+ ssh_gssapi_error(ctx); -+ return (ctx->major); -+ } - - if ((ctx->major = gss_display_name(&ctx->minor, ctx->client, - &client->displayname, NULL))) { -@@ -305,14 +499,32 @@ - return (ctx->major); - } - -- if ((ctx->major = ssh_gssapi_parse_ename(ctx,&ename, -+ if ((client->mech->oid.elements != NULL) && -+ (ctx->major = ssh_gssapi_parse_ename(ctx,&ename, - &client->exportedname))) { - return (ctx->major); - } - -+#ifndef MECHGLUE -+ if ((ctx->major = gss_duplicate_name(&ctx->minor, ctx->client, -+ &client->ctx_name))) -+#else -+ // MechGlue library doesn't define gss_duplicate_name -+ if ((ctx->major = gss_import_name(&ctx->minor, &ename, -+ GSS_C_NT_USER_NAME, -+ &client->ctx_name))) -+#endif -+ return ctx->major; -+ -+ gss_release_buffer(&ctx->minor, &ename); -+ - /* We can't copy this structure, so we just move the pointer to it */ - client->creds = ctx->client_creds; - ctx->client_creds = GSS_C_NO_CREDENTIAL; -+ -+ /* needed for globus_gss_assist_map_and_authorize() */ -+ client->context = ctx->context; -+ - return (ctx->major); - } - -@@ -333,6 +545,11 @@ - ssh_gssapi_storecreds(void) - { - if (gssapi_client.mech && gssapi_client.mech->storecreds) { -+ if (options.gss_creds_path) { -+ gssapi_client.store.filename = -+ expand_authorized_keys(options.gss_creds_path, -+ the_authctxt->pw); -+ } - (*gssapi_client.mech->storecreds)(&gssapi_client); - } else - debug("ssh_gssapi_storecreds: Not a GSSAPI mechanism"); -@@ -357,23 +574,28 @@ - - /* Privileged */ - int --ssh_gssapi_userok(char *user) -+ssh_gssapi_userok(char *user, struct passwd *pw, int gssapi_keyex) - { - OM_uint32 lmin; - -- if (gssapi_client.exportedname.length == 0 || -- gssapi_client.exportedname.value == NULL) { -- debug("No suitable client data"); -+#ifdef GSS_C_GLOBUS_LIMITED_PROXY_FLAG -+ if (limited && options.gsi_allow_limited_proxy != 1) { -+ debug("limited proxy not acceptable for remote login"); - return 0; - } -+#endif -+ - if (gssapi_client.mech && gssapi_client.mech->userok) -- if ((*gssapi_client.mech->userok)(&gssapi_client, user)) -+ if ((*gssapi_client.mech->userok)(&gssapi_client, user)) { -+ gssapi_client.used = 1; -+ gssapi_client.store.owner = pw; - return 1; -- else { -+ } else { - /* Destroy delegated credentials if userok fails */ - gss_release_buffer(&lmin, &gssapi_client.displayname); - gss_release_buffer(&lmin, &gssapi_client.exportedname); - gss_release_cred(&lmin, &gssapi_client.creds); -+ gss_release_name(&lmin, &gssapi_client.ctx_name); - explicit_bzero(&gssapi_client, - sizeof(ssh_gssapi_client)); - return 0; -@@ -383,14 +605,124 @@ - return (0); - } - --/* Privileged */ --OM_uint32 --ssh_gssapi_checkmic(Gssctxt *ctx, gss_buffer_t gssbuf, gss_buffer_t gssmic) -+/* ssh_gssapi_checkmic() moved to gss-genr.c so it can be called by -+ kexgss_client(). */ -+ -+/* Priviledged */ -+int -+ssh_gssapi_localname(char **user) - { -- ctx->major = gss_verify_mic(&ctx->minor, ctx->context, -- gssbuf, gssmic, NULL); -+ *user = NULL; -+ if (gssapi_client.displayname.length==0 || -+ gssapi_client.displayname.value==NULL) { -+ debug("No suitable client data"); -+ return(0);; -+ } -+ if (gssapi_client.mech && gssapi_client.mech->localname) { -+ return((*gssapi_client.mech->localname)(&gssapi_client,user)); -+ } else { -+ debug("Unknown client authentication type"); -+ } -+ return(0); -+} - -- return (ctx->major); -+/* These bits are only used for rekeying. The unpriviledged child is running -+ * as the user, the monitor is root. -+ * -+ * In the child, we want to : -+ * *) Ask the monitor to store our credentials into the store we specify -+ * *) If it succeeds, maybe do a PAM update -+ */ -+ -+/* Stuff for PAM */ -+ -+#ifdef USE_PAM -+static int ssh_gssapi_simple_conv(int n, const struct pam_message **msg, -+ struct pam_response **resp, void *data) -+{ -+ return (PAM_CONV_ERR); -+} -+#endif -+ -+void -+ssh_gssapi_rekey_creds() { -+ int ok; -+#ifdef USE_PAM -+ int ret; -+ pam_handle_t *pamh = NULL; -+ struct pam_conv pamconv = {ssh_gssapi_simple_conv, NULL}; -+ char *envstr; -+ char **p;char **pw; -+#endif -+ -+ if (gssapi_client.store.filename == NULL && -+ gssapi_client.store.envval == NULL && -+ gssapi_client.store.envvar == NULL) -+ return; -+ -+ ok = PRIVSEP(ssh_gssapi_update_creds(&gssapi_client.store)); -+ -+ if (!ok) -+ return; -+ -+ debug("Rekeyed credentials stored successfully"); -+ -+ /* Actually managing to play with the ssh pam stack from here will -+ * be next to impossible. In any case, we may want different options -+ * for rekeying. So, use our own :) -+ */ -+#ifdef USE_PAM -+ if (!use_privsep) { -+ debug("Not even going to try and do PAM with privsep disabled"); -+ return; -+ } -+ -+ ret = pam_start("sshd-rekey", gssapi_client.store.owner->pw_name, -+ &pamconv, &pamh); -+ if (ret) -+ return; -+ -+ /* Put ssh pam stack env variables in this new pam stack env -+ * Using pam-pkinit, KRB5CCNAME is set during do_pam_session -+ * this addition enables pam-pkinit to access KRB5CCNAME if used -+ * in sshd-rekey stack too -+ */ -+ pw = p = fetch_pam_environment(); -+ while ( *pw != NULL ) { -+ pam_putenv(pamh,*pw); -+ pw++; -+ } -+ free_pam_environment(p); -+ -+ xasprintf(&envstr, "%s=%s", gssapi_client.store.envvar, -+ gssapi_client.store.envval); -+ -+ ret = pam_putenv(pamh, envstr); -+ if (!ret) -+ pam_setcred(pamh, PAM_REINITIALIZE_CRED); -+ pam_end(pamh, PAM_SUCCESS); -+#endif -+} -+ -+int -+ssh_gssapi_update_creds(ssh_gssapi_ccache *store) { -+ int ok = 0; -+ -+ /* Check we've got credentials to store */ -+ if (!gssapi_client.updated) -+ return 0; -+ -+ gssapi_client.updated = 0; -+ -+ temporarily_use_uid(gssapi_client.store.owner); -+ if (gssapi_client.mech && gssapi_client.mech->updatecreds) -+ ok = (*gssapi_client.mech->updatecreds)(store, &gssapi_client); -+ else -+ debug("No update function for this mechanism"); -+ -+ restore_uid(); -+ -+ return ok; - } - - #endif -diff -Nur openssh-7.5p1/gss-serv-gsi.c gsi-openssh/gss-serv-gsi.c ---- openssh-7.5p1/gss-serv-gsi.c 1970-01-01 01:00:00.000000000 +0100 -+++ gsi-openssh/gss-serv-gsi.c 2019-01-10 11:06:41.728000000 +0100 -@@ -0,0 +1,329 @@ -+/* -+ * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR -+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include "includes.h" -+ -+#ifdef GSSAPI -+#ifdef GSI -+ -+#include -+ -+#include -+#include -+ -+#include "xmalloc.h" -+#include "key.h" -+#include "hostfile.h" -+#include "auth.h" -+#include "log.h" -+#include "misc.h" -+#include "servconf.h" -+ -+#include "buffer.h" -+#include "ssh-gss.h" -+ -+extern ServerOptions options; -+ -+#include -+ -+static int ssh_gssapi_gsi_userok(ssh_gssapi_client *client, char *name); -+static int ssh_gssapi_gsi_localname(ssh_gssapi_client *client, char **user); -+static void ssh_gssapi_gsi_storecreds(ssh_gssapi_client *client); -+static void ssh_gssapi_gsi_storecreds_micv2(ssh_gssapi_client *client); -+static int ssh_gssapi_gsi_updatecreds(ssh_gssapi_ccache *store, -+ ssh_gssapi_client *client); -+static int ssh_gssapi_gsi_updatecreds_micv2(ssh_gssapi_ccache *store, -+ ssh_gssapi_client *client); -+ -+ssh_gssapi_mech gssapi_gsi_mech = { -+ "dZuIebMjgUqaxvbF7hDbAw==", -+ "GSI", -+ {9, "\x2B\x06\x01\x04\x01\x9B\x50\x01\x01"}, -+ NULL, -+ &ssh_gssapi_gsi_userok, -+ &ssh_gssapi_gsi_localname, -+ &ssh_gssapi_gsi_storecreds, -+ &ssh_gssapi_gsi_updatecreds -+}; -+ -+ssh_gssapi_mech gssapi_gsi_mech_micv2 = { -+ "vz8J1E9PzLr8b1K+0remTg==", -+ "GSI", -+ {10, "\x2b\x06\x01\x04\x01\x9b\x50\x01\x01\x01"}, -+ NULL, -+ &ssh_gssapi_gsi_userok, -+ &ssh_gssapi_gsi_localname, -+ &ssh_gssapi_gsi_storecreds_micv2, -+ &ssh_gssapi_gsi_updatecreds_micv2 -+}; -+ -+/* -+ * Check if this user is OK to login under GSI. User has been authenticated -+ * as identity in global 'client_name.value' and is trying to log in as passed -+ * username in 'name'. -+ * -+ * Returns non-zero if user is authorized, 0 otherwise. -+ */ -+static int -+ssh_gssapi_gsi_userok(ssh_gssapi_client *client, char *name) -+{ -+ int authorized = 0; -+ globus_result_t res; -+#ifdef HAVE_GLOBUS_GSS_ASSIST_MAP_AND_AUTHORIZE -+ char lname[256] = ""; -+#endif -+ -+#ifdef GLOBUS_GSI_GSS_ASSIST_MODULE -+ if (globus_module_activate(GLOBUS_GSI_GSS_ASSIST_MODULE) != 0) { -+ return 0; -+ } -+#endif -+ -+/* use new globus_gss_assist_map_and_authorize() interface if available */ -+#ifdef HAVE_GLOBUS_GSS_ASSIST_MAP_AND_AUTHORIZE -+ debug("calling globus_gss_assist_map_and_authorize()"); -+ if (GLOBUS_SUCCESS != -+ (res = globus_gss_assist_map_and_authorize(client->context, "ssh", -+ name, lname, 256))) { -+ debug("%s", globus_error_print_chain(globus_error_get(res))); -+ } else if (lname[0] && strcmp(name, lname) != 0) { -+ debug("GSI user maps to %s, not %s", lname, name); -+ } else { -+ authorized = 1; -+ } -+#else -+ debug("calling globus_gss_assist_userok()"); -+ if (GLOBUS_SUCCESS != -+ (res = (globus_gss_assist_userok(client->displayname.value, -+ name)))) { -+ debug("%s", globus_error_print_chain(globus_error_get(res))); -+ } else { -+ authorized = 1; -+ } -+#endif -+ -+ logit("GSI user %s is%s authorized as target user %s", -+ (char *) client->displayname.value, (authorized ? "" : " not"), name); -+ -+ return authorized; -+} -+ -+/* -+ * Return the local username associated with the GSI credentials. -+ */ -+int -+ssh_gssapi_gsi_localname(ssh_gssapi_client *client, char **user) -+{ -+ globus_result_t res; -+#ifdef HAVE_GLOBUS_GSS_ASSIST_MAP_AND_AUTHORIZE -+ char lname[256] = ""; -+#endif -+ -+#ifdef GLOBUS_GSI_GSS_ASSIST_MODULE -+ if (globus_module_activate(GLOBUS_GSI_GSS_ASSIST_MODULE) != 0) { -+ return 0; -+ } -+#endif -+ -+/* use new globus_gss_assist_map_and_authorize() interface if available */ -+#ifdef HAVE_GLOBUS_GSS_ASSIST_MAP_AND_AUTHORIZE -+ debug("calling globus_gss_assist_map_and_authorize()"); -+ if (GLOBUS_SUCCESS != -+ (res = globus_gss_assist_map_and_authorize(client->context, "ssh", -+ NULL, lname, 256))) { -+ debug("%s", globus_error_print_chain(globus_error_get(res))); -+ logit("failed to map GSI user %s", (char *)client->displayname.value); -+ return 0; -+ } -+ *user = strdup(lname); -+#else -+ debug("calling globus_gss_assist_gridmap()"); -+ if (GLOBUS_SUCCESS != -+ (res = globus_gss_assist_gridmap(client->displayname.value, user))) { -+ debug("%s", globus_error_print_chain(globus_error_get(res))); -+ logit("failed to map GSI user %s", (char *)client->displayname.value); -+ return 0; -+ } -+#endif -+ -+ logit("GSI user %s mapped to target user %s", -+ (char *) client->displayname.value, *user); -+ -+ return 1; -+} -+ -+/* -+ * Export GSI credentials to disk. -+ */ -+static void -+ssh_gssapi_gsi_storecreds(ssh_gssapi_client *client) -+{ -+ OM_uint32 major_status; -+ OM_uint32 minor_status; -+ gss_buffer_desc export_cred = GSS_C_EMPTY_BUFFER; -+ char * p; -+ -+ if (!client || !client->creds) { -+ return; -+ } -+ -+ major_status = gss_export_cred(&minor_status, -+ client->creds, -+ GSS_C_NO_OID, -+ 1, -+ &export_cred); -+ if (GSS_ERROR(major_status) && major_status != GSS_S_UNAVAILABLE) { -+ Gssctxt *ctx; -+ ssh_gssapi_build_ctx(&ctx); -+ ctx->major = major_status; -+ ctx->minor = minor_status; -+ ssh_gssapi_set_oid(ctx, &gssapi_gsi_mech.oid); -+ ssh_gssapi_error(ctx); -+ ssh_gssapi_delete_ctx(&ctx); -+ return; -+ } -+ -+ p = strchr((char *) export_cred.value, '='); -+ if (p == NULL) { -+ logit("Failed to parse exported credentials string '%.100s'", -+ (char *)export_cred.value); -+ gss_release_buffer(&minor_status, &export_cred); -+ return; -+ } -+ *p++ = '\0'; -+ if (strcmp((char *)export_cred.value,"X509_USER_DELEG_PROXY") == 0) { -+ client->store.envvar = strdup("X509_USER_PROXY"); -+ } else { -+ client->store.envvar = strdup((char *)export_cred.value); -+ } -+ if (access(p, R_OK) == 0) { -+ if (client->store.filename) { -+ if (rename(p, client->store.filename) < 0) { -+ logit("Failed to rename %s to %s: %s", p, -+ client->store.filename, strerror(errno)); -+ free(client->store.filename); -+ client->store.filename = strdup(p); -+ } else { -+ p = client->store.filename; -+ } -+ } else { -+ client->store.filename = strdup(p); -+ } -+ } -+ client->store.envval = strdup(p); -+#ifdef USE_PAM -+ if (options.use_pam) -+ do_pam_putenv(client->store.envvar, client->store.envval); -+#endif -+ gss_release_buffer(&minor_status, &export_cred); -+} -+ -+/* -+ * Export GSI credentials to disk. -+ */ -+static void -+ssh_gssapi_gsi_storecreds_micv2(ssh_gssapi_client *client) -+{ -+ OM_uint32 major_status; -+ OM_uint32 minor_status; -+ gss_buffer_desc export_cred = GSS_C_EMPTY_BUFFER; -+ char * p; -+ -+ if (!client || !client->creds) { -+ return; -+ } -+ -+ major_status = gss_export_cred(&minor_status, -+ client->creds, -+ GSS_C_NO_OID, -+ 1, -+ &export_cred); -+ if (GSS_ERROR(major_status) && major_status != GSS_S_UNAVAILABLE) { -+ Gssctxt *ctx; -+ ssh_gssapi_build_ctx(&ctx); -+ ctx->major = major_status; -+ ctx->minor = minor_status; -+ ssh_gssapi_set_oid(ctx, &gssapi_gsi_mech_micv2.oid); -+ ssh_gssapi_error(ctx); -+ ssh_gssapi_delete_ctx(&ctx); -+ return; -+ } -+ -+ p = strchr((char *) export_cred.value, '='); -+ if (p == NULL) { -+ logit("Failed to parse exported credentials string '%.100s'", -+ (char *)export_cred.value); -+ gss_release_buffer(&minor_status, &export_cred); -+ return; -+ } -+ *p++ = '\0'; -+ if (strcmp((char *)export_cred.value,"X509_USER_DELEG_PROXY") == 0) { -+ client->store.envvar = strdup("X509_USER_PROXY"); -+ } else { -+ client->store.envvar = strdup((char *)export_cred.value); -+ } -+ if (access(p, R_OK) == 0) { -+ if (client->store.filename) { -+ if (rename(p, client->store.filename) < 0) { -+ logit("Failed to rename %s to %s: %s", p, -+ client->store.filename, strerror(errno)); -+ free(client->store.filename); -+ client->store.filename = strdup(p); -+ } else { -+ p = client->store.filename; -+ } -+ } else { -+ client->store.filename = strdup(p); -+ } -+ } -+ client->store.envval = strdup(p); -+#ifdef USE_PAM -+ if (options.use_pam) -+ do_pam_putenv(client->store.envvar, client->store.envval); -+#endif -+ gss_release_buffer(&minor_status, &export_cred); -+} -+ -+/* -+ * Export updated GSI credentials to disk. -+ */ -+static int -+ssh_gssapi_gsi_updatecreds(ssh_gssapi_ccache *store,ssh_gssapi_client *client) -+{ -+ ssh_gssapi_gsi_storecreds(client); -+ return 1; -+} -+ -+/* -+ * Export updated GSI credentials to disk. -+ */ -+static int -+ssh_gssapi_gsi_updatecreds_micv2(ssh_gssapi_ccache *store,ssh_gssapi_client *client) -+{ -+ ssh_gssapi_gsi_storecreds_micv2(client); -+ return 1; -+} -+ -+#endif /* GSI */ -+#endif /* GSSAPI */ -diff -Nur openssh-7.5p1/gss-serv-krb5.c gsi-openssh/gss-serv-krb5.c ---- openssh-7.5p1/gss-serv-krb5.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/gss-serv-krb5.c 2019-01-10 10:51:29.676000000 +0100 -@@ -1,7 +1,7 @@ - /* $OpenBSD: gss-serv-krb5.c,v 1.8 2013/07/20 01:55:13 djm Exp $ */ - - /* -- * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. -+ * Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions -@@ -49,14 +49,32 @@ - - #ifdef HEIMDAL - # include --#endif --#ifdef HAVE_GSSAPI_KRB5_H --# include --#elif HAVE_GSSAPI_GSSAPI_KRB5_H --# include -+#elif !defined(MECHGLUE) -+# ifdef HAVE_GSSAPI_KRB5_H -+# include -+# elif HAVE_GSSAPI_GSSAPI_KRB5_H -+# include -+# endif - #endif - - static krb5_context krb_context = NULL; -+static int ssh_gssapi_krb5_init(); -+static int ssh_gssapi_krb5_userok(ssh_gssapi_client *client, char *name); -+static int ssh_gssapi_krb5_localname(ssh_gssapi_client *client, char **user); -+static void ssh_gssapi_krb5_storecreds(ssh_gssapi_client *client); -+static int ssh_gssapi_krb5_updatecreds(ssh_gssapi_ccache *store, -+ ssh_gssapi_client *client); -+ -+ssh_gssapi_mech gssapi_kerberos_mech = { -+ "toWM5Slw5Ew8Mqkay+al2g==", -+ "Kerberos", -+ {9, "\x2A\x86\x48\x86\xF7\x12\x01\x02\x02"}, -+ NULL, -+ &ssh_gssapi_krb5_userok, -+ &ssh_gssapi_krb5_localname, -+ &ssh_gssapi_krb5_storecreds, -+ &ssh_gssapi_krb5_updatecreds -+}; - - /* Initialise the krb5 library, for the stuff that GSSAPI won't do */ - -@@ -111,6 +129,35 @@ - } - - -+/* Retrieve the local username associated with a set of Kerberos -+ * credentials. Hopefully we can use this for the 'empty' username -+ * logins discussed in the draft */ -+static int -+ssh_gssapi_krb5_localname(ssh_gssapi_client *client, char **user) { -+ krb5_principal princ; -+ int retval; -+ -+ if (ssh_gssapi_krb5_init() == 0) -+ return 0; -+ -+ if ((retval=krb5_parse_name(krb_context, client->displayname.value, -+ &princ))) { -+ logit("krb5_parse_name(): %.100s", -+ krb5_get_err_text(krb_context,retval)); -+ return 0; -+ } -+ -+ /* We've got to return a malloc'd string */ -+ *user = (char *)xmalloc(256); -+ if (krb5_aname_to_localname(krb_context, princ, 256, *user)) { -+ free(*user); -+ *user = NULL; -+ return(0); -+ } -+ -+ return(1); -+} -+ - /* This writes out any forwarded credentials from the structure populated - * during userauth. Called after we have setuid to the user */ - -@@ -121,7 +168,9 @@ - krb5_error_code problem; - krb5_principal princ; - OM_uint32 maj_status, min_status; -+ gss_cred_id_t krb5_cred_handle; - int len; -+ const char *new_ccname; - const char *errmsg; - - if (client->creds == NULL) { -@@ -174,18 +223,31 @@ - - krb5_free_principal(krb_context, princ); - -+#ifdef MECHGLUE -+ krb5_cred_handle = -+ __gss_get_mechanism_cred(client->creds, -+ &(gssapi_kerberos_mech.oid)); -+#else -+ krb5_cred_handle = client->creds; -+#endif -+ - if ((maj_status = gss_krb5_copy_ccache(&min_status, -- client->creds, ccache))) { -+ krb5_cred_handle, ccache))) { - logit("gss_krb5_copy_ccache() failed"); - krb5_cc_destroy(krb_context, ccache); - return; - } - -- client->store.filename = xstrdup(krb5_cc_get_name(krb_context, ccache)); -+ new_ccname = krb5_cc_get_name(krb_context, ccache); -+ - client->store.envvar = "KRB5CCNAME"; -- len = strlen(client->store.filename) + 6; -- client->store.envval = xmalloc(len); -- snprintf(client->store.envval, len, "FILE:%s", client->store.filename); -+#ifdef USE_CCAPI -+ xasprintf(&client->store.envval, "API:%s", new_ccname); -+ client->store.filename = NULL; -+#else -+ xasprintf(&client->store.envval, "FILE:%s", new_ccname); -+ client->store.filename = xstrdup(new_ccname); -+#endif - - #ifdef USE_PAM - if (options.use_pam) -@@ -197,15 +259,70 @@ - return; - } - --ssh_gssapi_mech gssapi_kerberos_mech = { -- "toWM5Slw5Ew8Mqkay+al2g==", -- "Kerberos", -- {9, "\x2A\x86\x48\x86\xF7\x12\x01\x02\x02"}, -- NULL, -- &ssh_gssapi_krb5_userok, -- NULL, -- &ssh_gssapi_krb5_storecreds --}; -+static int -+ssh_gssapi_krb5_updatecreds(ssh_gssapi_ccache *store, -+ ssh_gssapi_client *client) -+{ -+ krb5_ccache ccache = NULL; -+ krb5_principal principal = NULL; -+ char *name = NULL; -+ krb5_error_code problem; -+ OM_uint32 maj_status, min_status; -+ -+ if ((problem = krb5_cc_resolve(krb_context, store->envval, &ccache))) { -+ logit("krb5_cc_resolve(): %.100s", -+ krb5_get_err_text(krb_context, problem)); -+ return 0; -+ } -+ -+ /* Find out who the principal in this cache is */ -+ if ((problem = krb5_cc_get_principal(krb_context, ccache, -+ &principal))) { -+ logit("krb5_cc_get_principal(): %.100s", -+ krb5_get_err_text(krb_context, problem)); -+ krb5_cc_close(krb_context, ccache); -+ return 0; -+ } -+ -+ if ((problem = krb5_unparse_name(krb_context, principal, &name))) { -+ logit("krb5_unparse_name(): %.100s", -+ krb5_get_err_text(krb_context, problem)); -+ krb5_free_principal(krb_context, principal); -+ krb5_cc_close(krb_context, ccache); -+ return 0; -+ } -+ -+ -+ if (strcmp(name,client->exportedname.value)!=0) { -+ debug("Name in local credentials cache differs. Not storing"); -+ krb5_free_principal(krb_context, principal); -+ krb5_cc_close(krb_context, ccache); -+ krb5_free_unparsed_name(krb_context, name); -+ return 0; -+ } -+ krb5_free_unparsed_name(krb_context, name); -+ -+ /* Name matches, so lets get on with it! */ -+ -+ if ((problem = krb5_cc_initialize(krb_context, ccache, principal))) { -+ logit("krb5_cc_initialize(): %.100s", -+ krb5_get_err_text(krb_context, problem)); -+ krb5_free_principal(krb_context, principal); -+ krb5_cc_close(krb_context, ccache); -+ return 0; -+ } -+ -+ krb5_free_principal(krb_context, principal); -+ -+ if ((maj_status = gss_krb5_copy_ccache(&min_status, client->creds, -+ ccache))) { -+ logit("gss_krb5_copy_ccache() failed. Sorry!"); -+ krb5_cc_close(krb_context, ccache); -+ return 0; -+ } -+ -+ return 1; -+} - - #endif /* KRB5 */ - -diff -Nur openssh-7.5p1/kex.c gsi-openssh/kex.c ---- openssh-7.5p1/kex.c 2018-12-20 11:48:40.816000000 +0100 -+++ gsi-openssh/kex.c 2018-12-20 11:49:17.624000000 +0100 -@@ -59,6 +59,10 @@ - extern int client_session_id; - #endif - -+#ifdef GSSAPI -+#include "ssh-gss.h" -+#endif -+ - #if OPENSSL_VERSION_NUMBER >= 0x00907000L - # if defined(HAVE_EVP_SHA256) - # define evp_ssh_sha256 EVP_sha256 -@@ -246,6 +250,7 @@ - } - - /* put algorithm proposal into buffer */ -+/* used in sshconnect.c as well as kex.c */ - int - kex_prop2buf(struct sshbuf *b, char *proposal[PROPOSAL_MAX]) - { -@@ -724,6 +729,44 @@ - debug("kex: algorithm: %s", k->name ? k->name : "(no match)"); - if (k->name == NULL) - return SSH_ERR_NO_KEX_ALG_MATCH; -+#ifdef GSSAPI /* substring matching for the GSSAPI methods */ -+ if (strncmp(k->name, KEX_GSS_GEX_SHA1_ID, -+ sizeof(KEX_GSS_GEX_SHA1_ID) - 1) == 0) { -+ k->kex_type = KEX_GSS_GEX_SHA1; -+ k->hash_alg = SSH_DIGEST_SHA1; -+ return 0; /* gss-gex-sha1-* */ -+ } -+ if (strncmp(k->name, KEX_GSS_GRP1_SHA1_ID, -+ sizeof(KEX_GSS_GRP1_SHA1_ID) - 1) == 0) { -+ k->kex_type = KEX_GSS_GRP1_SHA1; -+ k->hash_alg = SSH_DIGEST_SHA1; -+ return 0; /* gss-group1-sha1-* */ -+ } -+ if (strncmp(k->name, KEX_GSS_GRP14_SHA1_ID, -+ sizeof(KEX_GSS_GRP14_SHA1_ID) - 1) == 0) { -+ k->kex_type = KEX_GSS_GRP14_SHA1; -+ k->hash_alg = SSH_DIGEST_SHA1; -+ return 0; /* gss-group14-sha1-* */ -+ } -+ if (strncmp(k->name, KEX_GSS_GRP14_SHA256_ID, -+ sizeof(KEX_GSS_GRP14_SHA256_ID) - 1) == 0) { -+ k->kex_type = KEX_GSS_GRP14_SHA256; -+ k->hash_alg = SSH_DIGEST_SHA256; -+ return 0; /* gss-group14-sha256-* */ -+ } -+ if (strncmp(k->name, KEX_GSS_GRP16_SHA512_ID, -+ sizeof(KEX_GSS_GRP16_SHA512_ID) - 1) == 0) { -+ k->kex_type = KEX_GSS_GRP16_SHA512; -+ k->hash_alg = SSH_DIGEST_SHA512; -+ return 0; /* gss-group16-sha512-* */ -+ } -+ if (strncmp(k->name, KEX_GSS_GRP18_SHA512_ID, -+ sizeof(KEX_GSS_GRP18_SHA512_ID) - 1) == 0) { -+ k->kex_type = KEX_GSS_GRP18_SHA512; -+ k->hash_alg = SSH_DIGEST_SHA512; -+ return 0; /* gss-group18-sha512-* */ -+ } -+#endif - if ((kexalg = kex_alg_by_name(k->name)) == NULL) - return SSH_ERR_INTERNAL_ERROR; - k->kex_type = kexalg->type; -diff -Nur openssh-7.5p1/kexgssc.c gsi-openssh/kexgssc.c ---- openssh-7.5p1/kexgssc.c 1970-01-01 01:00:00.000000000 +0100 -+++ gsi-openssh/kexgssc.c 2018-12-20 11:49:17.624000000 +0100 -@@ -0,0 +1,354 @@ -+/* -+ * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR -+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include "includes.h" -+ -+#ifdef GSSAPI -+ -+#include "includes.h" -+ -+#include -+#include -+ -+#include -+#include -+ -+#include "xmalloc.h" -+#include "buffer.h" -+#include "ssh2.h" -+#include "key.h" -+#include "cipher.h" -+#include "digest.h" -+#include "kex.h" -+#include "log.h" -+#include "packet.h" -+#include "dh.h" -+ -+#include "ssh-gss.h" -+ -+int -+kexgss_client(struct ssh *ssh) { -+ struct kex *kex = ssh->kex; -+ gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; -+ gss_buffer_desc recv_tok, gssbuf, msg_tok, *token_ptr; -+ Gssctxt *ctxt = NULL; -+ OM_uint32 maj_status, min_status, ret_flags; -+ u_int klen, slen = 0, strlen; -+ size_t hashlen; -+ int kout; -+ DH *dh = NULL; -+ BIGNUM *dh_server_pub = NULL; -+ BIGNUM *shared_secret = NULL; -+ BIGNUM *p = NULL; -+ BIGNUM *g = NULL; -+ u_char *kbuf = NULL; -+ u_char hash[SSH_DIGEST_MAX_LENGTH]; -+ u_char *serverhostkey = NULL; -+ u_char *empty = ""; -+ char *msg = NULL; -+ char *lang = NULL; -+ int type = 0; -+ int first = 1; -+ int nbits = 0, min = DH_GRP_MIN, max = DH_GRP_MAX; -+ -+ /* Initialise our GSSAPI world */ -+ ssh_gssapi_build_ctx(&ctxt); -+ if (ssh_gssapi_id_kex(ctxt, kex->name, kex->kex_type) -+ == GSS_C_NO_OID) -+ fatal("Couldn't identify host exchange"); -+ -+ if (ssh_gssapi_import_name(ctxt, kex->gss_host)) -+ fatal("Couldn't import hostname"); -+ -+ if (kex->gss_client && -+ ssh_gssapi_client_identity(ctxt, kex->gss_client)) -+ fatal("Couldn't acquire client credentials"); -+ -+ switch (kex->kex_type) { -+ case KEX_GSS_GRP1_SHA1: -+ dh = dh_new_group1(); -+ break; -+ case KEX_GSS_GRP14_SHA1: -+ dh = dh_new_group14(); -+ break; -+ case KEX_GSS_GRP14_SHA256: -+ dh = dh_new_group14(); -+ break; -+ case KEX_GSS_GRP16_SHA512: -+ dh = dh_new_group16(); -+ break; -+ case KEX_GSS_GRP18_SHA512: -+ dh = dh_new_group18(); -+ break; -+ case KEX_GSS_GEX_SHA1: -+ debug("Doing group exchange\n"); -+ nbits = dh_estimate(kex->we_need * 8); -+ packet_start(SSH2_MSG_KEXGSS_GROUPREQ); -+ packet_put_int(min); -+ packet_put_int(nbits); -+ packet_put_int(max); -+ -+ packet_send(); -+ -+ packet_read_expect(SSH2_MSG_KEXGSS_GROUP); -+ -+ if ((p = BN_new()) == NULL) -+ fatal("BN_new() failed"); -+ packet_get_bignum2(p); -+ if ((g = BN_new()) == NULL) -+ fatal("BN_new() failed"); -+ packet_get_bignum2(g); -+ packet_check_eom(); -+ -+ if (BN_num_bits(p) < min || BN_num_bits(p) > max) -+ fatal("GSSGRP_GEX group out of range: %d !< %d !< %d", -+ min, BN_num_bits(p), max); -+ -+ dh = dh_new_group(g, p); -+ break; -+ default: -+ fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); -+ } -+ -+ /* Step 1 - e is dh->pub_key */ -+ dh_gen_key(dh, kex->we_need * 8); -+ -+ /* This is f, we initialise it now to make life easier */ -+ dh_server_pub = BN_new(); -+ if (dh_server_pub == NULL) -+ fatal("dh_server_pub == NULL"); -+ -+ token_ptr = GSS_C_NO_BUFFER; -+ -+ do { -+ debug("Calling gss_init_sec_context"); -+ -+ maj_status = ssh_gssapi_init_ctx(ctxt, -+ kex->gss_deleg_creds, token_ptr, &send_tok, -+ &ret_flags); -+ -+ if (GSS_ERROR(maj_status)) { -+ if (send_tok.length != 0) { -+ packet_start(SSH2_MSG_KEXGSS_CONTINUE); -+ packet_put_string(send_tok.value, -+ send_tok.length); -+ } -+ fatal("gss_init_context failed"); -+ } -+ -+ /* If we've got an old receive buffer get rid of it */ -+ if (token_ptr != GSS_C_NO_BUFFER) -+ free(recv_tok.value); -+ -+ if (maj_status == GSS_S_COMPLETE) { -+ /* If mutual state flag is not true, kex fails */ -+ if (!(ret_flags & GSS_C_MUTUAL_FLAG)) -+ fatal("Mutual authentication failed"); -+ -+ /* If integ avail flag is not true kex fails */ -+ if (!(ret_flags & GSS_C_INTEG_FLAG)) -+ fatal("Integrity check failed"); -+ } -+ -+ /* -+ * If we have data to send, then the last message that we -+ * received cannot have been a 'complete'. -+ */ -+ if (send_tok.length != 0) { -+ if (first) { -+ packet_start(SSH2_MSG_KEXGSS_INIT); -+ packet_put_string(send_tok.value, -+ send_tok.length); -+ packet_put_bignum2(dh->pub_key); -+ first = 0; -+ } else { -+ packet_start(SSH2_MSG_KEXGSS_CONTINUE); -+ packet_put_string(send_tok.value, -+ send_tok.length); -+ } -+ packet_send(); -+ gss_release_buffer(&min_status, &send_tok); -+ -+ /* If we've sent them data, they should reply */ -+ do { -+ type = packet_read(); -+ if (type == SSH2_MSG_KEXGSS_HOSTKEY) { -+ debug("Received KEXGSS_HOSTKEY"); -+ if (serverhostkey) -+ fatal("Server host key received more than once"); -+ serverhostkey = -+ packet_get_string(&slen); -+ } -+ } while (type == SSH2_MSG_KEXGSS_HOSTKEY); -+ -+ switch (type) { -+ case SSH2_MSG_KEXGSS_CONTINUE: -+ debug("Received GSSAPI_CONTINUE"); -+ if (maj_status == GSS_S_COMPLETE) -+ fatal("GSSAPI Continue received from server when complete"); -+ recv_tok.value = packet_get_string(&strlen); -+ recv_tok.length = strlen; -+ break; -+ case SSH2_MSG_KEXGSS_COMPLETE: -+ debug("Received GSSAPI_COMPLETE"); -+ packet_get_bignum2(dh_server_pub); -+ msg_tok.value = packet_get_string(&strlen); -+ msg_tok.length = strlen; -+ -+ /* Is there a token included? */ -+ if (packet_get_char()) { -+ recv_tok.value= -+ packet_get_string(&strlen); -+ recv_tok.length = strlen; -+ /* If we're already complete - protocol error */ -+ if (maj_status == GSS_S_COMPLETE) -+ packet_disconnect("Protocol error: received token when complete"); -+ } else { -+ /* No token included */ -+ if (maj_status != GSS_S_COMPLETE) -+ packet_disconnect("Protocol error: did not receive final token"); -+ } -+ break; -+ case SSH2_MSG_KEXGSS_ERROR: -+ debug("Received Error"); -+ maj_status = packet_get_int(); -+ min_status = packet_get_int(); -+ msg = packet_get_string(NULL); -+ lang = packet_get_string(NULL); -+ fatal("GSSAPI Error: \n%.400s",msg); -+ default: -+ packet_disconnect("Protocol error: didn't expect packet type %d", -+ type); -+ } -+ token_ptr = &recv_tok; -+ } else { -+ /* No data, and not complete */ -+ if (maj_status != GSS_S_COMPLETE) -+ fatal("Not complete, and no token output"); -+ } -+ } while (maj_status & GSS_S_CONTINUE_NEEDED); -+ -+ /* -+ * We _must_ have received a COMPLETE message in reply from the -+ * server, which will have set dh_server_pub and msg_tok -+ */ -+ -+ if (type != SSH2_MSG_KEXGSS_COMPLETE) -+ fatal("Didn't receive a SSH2_MSG_KEXGSS_COMPLETE when I expected it"); -+ -+ /* Check f in range [1, p-1] */ -+ if (!dh_pub_is_valid(dh, dh_server_pub)) -+ packet_disconnect("bad server public DH value"); -+ -+ /* compute K=f^x mod p */ -+ klen = DH_size(dh); -+ kbuf = xmalloc(klen); -+ kout = DH_compute_key(kbuf, dh_server_pub, dh); -+ if (kout < 0) -+ fatal("DH_compute_key: failed"); -+ -+ shared_secret = BN_new(); -+ if (shared_secret == NULL) -+ fatal("kexgss_client: BN_new failed"); -+ -+ if (BN_bin2bn(kbuf, kout, shared_secret) == NULL) -+ fatal("kexdh_client: BN_bin2bn failed"); -+ -+ memset(kbuf, 0, klen); -+ free(kbuf); -+ -+ hashlen = sizeof(hash); -+ switch (kex->kex_type) { -+ case KEX_GSS_GRP1_SHA1: -+ case KEX_GSS_GRP14_SHA1: -+ case KEX_GSS_GRP14_SHA256: -+ case KEX_GSS_GRP16_SHA512: -+ case KEX_GSS_GRP18_SHA512: -+ kex_dh_hash( kex->hash_alg, kex->client_version_string, -+ kex->server_version_string, -+ buffer_ptr(kex->my), buffer_len(kex->my), -+ buffer_ptr(kex->peer), buffer_len(kex->peer), -+ (serverhostkey ? serverhostkey : empty), slen, -+ dh->pub_key, /* e */ -+ dh_server_pub, /* f */ -+ shared_secret, /* K */ -+ hash, &hashlen -+ ); -+ break; -+ case KEX_GSS_GEX_SHA1: -+ kexgex_hash( -+ kex->hash_alg, -+ kex->client_version_string, -+ kex->server_version_string, -+ buffer_ptr(kex->my), buffer_len(kex->my), -+ buffer_ptr(kex->peer), buffer_len(kex->peer), -+ (serverhostkey ? serverhostkey : empty), slen, -+ min, nbits, max, -+ dh->p, dh->g, -+ dh->pub_key, -+ dh_server_pub, -+ shared_secret, -+ hash, &hashlen -+ ); -+ break; -+ default: -+ fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); -+ } -+ -+ gssbuf.value = hash; -+ gssbuf.length = hashlen; -+ -+ /* Verify that the hash matches the MIC we just got. */ -+ if (GSS_ERROR(ssh_gssapi_checkmic(ctxt, &gssbuf, &msg_tok))) -+ packet_disconnect("Hash's MIC didn't verify"); -+ -+ free(msg_tok.value); -+ -+ DH_free(dh); -+ if (serverhostkey) -+ free(serverhostkey); -+ BN_clear_free(dh_server_pub); -+ -+ /* save session id */ -+ if (kex->session_id == NULL) { -+ kex->session_id_len = hashlen; -+ kex->session_id = xmalloc(kex->session_id_len); -+ memcpy(kex->session_id, hash, kex->session_id_len); -+ } -+ -+ if (kex->gss_deleg_creds) -+ ssh_gssapi_credentials_updated(ctxt); -+ -+ if (gss_kex_context == NULL) -+ gss_kex_context = ctxt; -+ else -+ ssh_gssapi_delete_ctx(&ctxt); -+ -+ kex_derive_keys_bn(ssh, hash, hashlen, shared_secret); -+ BN_clear_free(shared_secret); -+ kex_send_newkeys(ssh); -+ return 0; -+} -+ -+#endif /* GSSAPI */ -diff -Nur openssh-7.5p1/kexgsss.c gsi-openssh/kexgsss.c ---- openssh-7.5p1/kexgsss.c 1970-01-01 01:00:00.000000000 +0100 -+++ gsi-openssh/kexgsss.c 2018-12-20 11:49:17.624000000 +0100 -@@ -0,0 +1,335 @@ -+/* -+ * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR -+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include "includes.h" -+ -+#ifdef GSSAPI -+ -+#include -+#include -+ -+#include -+#include -+ -+#include "xmalloc.h" -+#include "buffer.h" -+#include "ssh2.h" -+#include "key.h" -+#include "cipher.h" -+#include "digest.h" -+#include "kex.h" -+#include "log.h" -+#include "packet.h" -+#include "dh.h" -+#include "ssh-gss.h" -+#include "monitor_wrap.h" -+#include "misc.h" -+#include "servconf.h" -+ -+static void kex_gss_send_error(Gssctxt *ctxt); -+extern ServerOptions options; -+ -+int -+kexgss_server(struct ssh *ssh) -+{ -+ struct kex *kex = ssh->kex; -+ OM_uint32 maj_status, min_status; -+ -+ /* -+ * Some GSSAPI implementations use the input value of ret_flags (an -+ * output variable) as a means of triggering mechanism specific -+ * features. Initializing it to zero avoids inadvertently -+ * activating this non-standard behaviour. -+ */ -+ -+ OM_uint32 ret_flags = 0; -+ gss_buffer_desc gssbuf, recv_tok, msg_tok; -+ gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; -+ Gssctxt *ctxt = NULL; -+ u_int slen, klen; -+ size_t hashlen; -+ int kout; -+ u_char *kbuf = NULL; -+ u_char hash[SSH_DIGEST_MAX_LENGTH]; -+ DH *dh = NULL; -+ int min = -1, max = -1, nbits = -1; -+ int cmin = -1, cmax = -1; /* client proposal */ -+ BIGNUM *shared_secret = NULL; -+ BIGNUM *dh_client_pub = NULL; -+ int type = 0; -+ gss_OID oid; -+ char *mechs = NULL; -+ -+ /* Initialise GSSAPI */ -+ -+ /* If we're rekeying, privsep means that some of the private structures -+ * in the GSSAPI code are no longer available. This kludges them back -+ * into life -+ */ -+ if (!ssh_gssapi_oid_table_ok()) -+ if ((mechs = ssh_gssapi_server_mechanisms())) -+ free(mechs); -+ -+ debug2("%s: Identifying %s", __func__, kex->name); -+ oid = ssh_gssapi_id_kex(NULL, kex->name, kex->kex_type); -+ if (oid == GSS_C_NO_OID) -+ fatal("Unknown gssapi mechanism"); -+ -+ debug2("%s: Acquiring credentials", __func__); -+ -+ if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, oid)))) { -+ kex_gss_send_error(ctxt); -+ fatal("Unable to acquire credentials for the server"); -+ } -+ -+ switch (kex->kex_type) { -+ case KEX_GSS_GRP1_SHA1: -+ dh = dh_new_group1(); -+ break; -+ case KEX_GSS_GRP14_SHA1: -+ dh = dh_new_group14(); -+ break; -+ case KEX_GSS_GRP14_SHA256: -+ dh = dh_new_group14(); -+ break; -+ case KEX_GSS_GRP16_SHA512: -+ dh = dh_new_group16(); -+ break; -+ case KEX_GSS_GRP18_SHA512: -+ dh = dh_new_group18(); -+ break; -+ case KEX_GSS_GEX_SHA1: -+ debug("Doing group exchange"); -+ packet_read_expect(SSH2_MSG_KEXGSS_GROUPREQ); -+ /* store client proposal to provide valid signature */ -+ cmin = packet_get_int(); -+ nbits = packet_get_int(); -+ cmax = packet_get_int(); -+ min = MAX(DH_GRP_MIN, cmin); -+ max = MIN(DH_GRP_MAX, cmax); -+ packet_check_eom(); -+ if (max < min || nbits < min || max < nbits) -+ fatal("GSS_GEX, bad parameters: %d !< %d !< %d", -+ min, nbits, max); -+ dh = PRIVSEP(choose_dh(min, nbits, max)); -+ if (dh == NULL) -+ packet_disconnect("Protocol error: no matching group found"); -+ -+ packet_start(SSH2_MSG_KEXGSS_GROUP); -+ packet_put_bignum2(dh->p); -+ packet_put_bignum2(dh->g); -+ packet_send(); -+ -+ packet_write_wait(); -+ break; -+ default: -+ fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); -+ } -+ -+ dh_gen_key(dh, kex->we_need * 8); -+ -+ do { -+ debug("Wait SSH2_MSG_GSSAPI_INIT"); -+ type = packet_read(); -+ switch(type) { -+ case SSH2_MSG_KEXGSS_INIT: -+ if (dh_client_pub != NULL) -+ fatal("Received KEXGSS_INIT after initialising"); -+ recv_tok.value = packet_get_string(&slen); -+ recv_tok.length = slen; -+ -+ if ((dh_client_pub = BN_new()) == NULL) -+ fatal("dh_client_pub == NULL"); -+ -+ packet_get_bignum2(dh_client_pub); -+ -+ /* Send SSH_MSG_KEXGSS_HOSTKEY here, if we want */ -+ break; -+ case SSH2_MSG_KEXGSS_CONTINUE: -+ recv_tok.value = packet_get_string(&slen); -+ recv_tok.length = slen; -+ break; -+ default: -+ packet_disconnect( -+ "Protocol error: didn't expect packet type %d", -+ type); -+ } -+ -+ maj_status = PRIVSEP(ssh_gssapi_accept_ctx(ctxt, &recv_tok, -+ &send_tok, &ret_flags)); -+ -+ free(recv_tok.value); -+ -+ if (maj_status != GSS_S_COMPLETE && send_tok.length == 0) -+ fatal("Zero length token output when incomplete"); -+ -+ if (dh_client_pub == NULL) -+ fatal("No client public key"); -+ -+ if (maj_status & GSS_S_CONTINUE_NEEDED) { -+ debug("Sending GSSAPI_CONTINUE"); -+ packet_start(SSH2_MSG_KEXGSS_CONTINUE); -+ packet_put_string((char *)send_tok.value, send_tok.length); -+ packet_send(); -+ gss_release_buffer(&min_status, &send_tok); -+ } -+ } while (maj_status & GSS_S_CONTINUE_NEEDED); -+ -+ if (GSS_ERROR(maj_status)) { -+ kex_gss_send_error(ctxt); -+ if (send_tok.length > 0) { -+ packet_start(SSH2_MSG_KEXGSS_CONTINUE); -+ packet_put_string((char *)send_tok.value, send_tok.length); -+ packet_send(); -+ } -+ packet_disconnect("GSSAPI Key Exchange handshake failed"); -+ } -+ -+ if (!(ret_flags & GSS_C_MUTUAL_FLAG)) -+ fatal("Mutual Authentication flag wasn't set"); -+ -+ if (!(ret_flags & GSS_C_INTEG_FLAG)) -+ fatal("Integrity flag wasn't set"); -+ -+ if (!dh_pub_is_valid(dh, dh_client_pub)) -+ packet_disconnect("bad client public DH value"); -+ -+ klen = DH_size(dh); -+ kbuf = xmalloc(klen); -+ kout = DH_compute_key(kbuf, dh_client_pub, dh); -+ if (kout < 0) -+ fatal("DH_compute_key: failed"); -+ -+ shared_secret = BN_new(); -+ if (shared_secret == NULL) -+ fatal("kexgss_server: BN_new failed"); -+ -+ if (BN_bin2bn(kbuf, kout, shared_secret) == NULL) -+ fatal("kexgss_server: BN_bin2bn failed"); -+ -+ memset(kbuf, 0, klen); -+ free(kbuf); -+ -+ hashlen = sizeof(hash); -+ switch (kex->kex_type) { -+ case KEX_GSS_GRP1_SHA1: -+ case KEX_GSS_GRP14_SHA1: -+ case KEX_GSS_GRP14_SHA256: -+ case KEX_GSS_GRP16_SHA512: -+ case KEX_GSS_GRP18_SHA512: -+ kex_dh_hash(kex->hash_alg, -+ kex->client_version_string, kex->server_version_string, -+ buffer_ptr(kex->peer), buffer_len(kex->peer), -+ buffer_ptr(kex->my), buffer_len(kex->my), -+ NULL, 0, /* Change this if we start sending host keys */ -+ dh_client_pub, dh->pub_key, shared_secret, -+ hash, &hashlen -+ ); -+ break; -+ case KEX_GSS_GEX_SHA1: -+ kexgex_hash( -+ kex->hash_alg, -+ kex->client_version_string, kex->server_version_string, -+ buffer_ptr(kex->peer), buffer_len(kex->peer), -+ buffer_ptr(kex->my), buffer_len(kex->my), -+ NULL, 0, -+ cmin, nbits, cmax, -+ dh->p, dh->g, -+ dh_client_pub, -+ dh->pub_key, -+ shared_secret, -+ hash, &hashlen -+ ); -+ break; -+ default: -+ fatal("%s: Unexpected KEX type %d", __func__, kex->kex_type); -+ } -+ -+ BN_clear_free(dh_client_pub); -+ -+ if (kex->session_id == NULL) { -+ kex->session_id_len = hashlen; -+ kex->session_id = xmalloc(kex->session_id_len); -+ memcpy(kex->session_id, hash, kex->session_id_len); -+ } -+ -+ gssbuf.value = hash; -+ gssbuf.length = hashlen; -+ -+ if (GSS_ERROR(PRIVSEP(ssh_gssapi_sign(ctxt,&gssbuf,&msg_tok)))) -+ fatal("Couldn't get MIC"); -+ -+ packet_start(SSH2_MSG_KEXGSS_COMPLETE); -+ packet_put_bignum2(dh->pub_key); -+ packet_put_string((char *)msg_tok.value,msg_tok.length); -+ -+ if (send_tok.length != 0) { -+ packet_put_char(1); /* true */ -+ packet_put_string((char *)send_tok.value, send_tok.length); -+ } else { -+ packet_put_char(0); /* false */ -+ } -+ packet_send(); -+ -+ gss_release_buffer(&min_status, &send_tok); -+ gss_release_buffer(&min_status, &msg_tok); -+ -+ if (gss_kex_context == NULL) -+ gss_kex_context = ctxt; -+ else -+ ssh_gssapi_delete_ctx(&ctxt); -+ -+ DH_free(dh); -+ -+ kex_derive_keys_bn(ssh, hash, hashlen, shared_secret); -+ BN_clear_free(shared_secret); -+ kex_send_newkeys(ssh); -+ -+ /* If this was a rekey, then save out any delegated credentials we -+ * just exchanged. */ -+ if (options.gss_store_rekey) -+ ssh_gssapi_rekey_creds(); -+ -+ return 0; -+} -+ -+static void -+kex_gss_send_error(Gssctxt *ctxt) { -+ char *errstr; -+ OM_uint32 maj,min; -+ -+ errstr=PRIVSEP(ssh_gssapi_last_error(ctxt,&maj,&min)); -+ if (errstr) { -+ packet_start(SSH2_MSG_KEXGSS_ERROR); -+ packet_put_int(maj); -+ packet_put_int(min); -+ packet_put_cstring(errstr); -+ packet_put_cstring(""); -+ packet_send(); -+ packet_write_wait(); -+ /* XXX - We should probably log the error locally here */ -+ free(errstr); -+ } -+} -+#endif /* GSSAPI */ -diff -Nur openssh-7.5p1/kex.h gsi-openssh/kex.h ---- openssh-7.5p1/kex.h 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/kex.h 2018-12-20 11:49:17.624000000 +0100 -@@ -98,6 +98,12 @@ - KEX_DH_GEX_SHA1, - KEX_DH_GEX_SHA256, - KEX_ECDH_SHA2, -+ KEX_GSS_GRP1_SHA1, -+ KEX_GSS_GRP14_SHA1, -+ KEX_GSS_GRP14_SHA256, -+ KEX_GSS_GRP16_SHA512, -+ KEX_GSS_GRP18_SHA512, -+ KEX_GSS_GEX_SHA1, - KEX_C25519_SHA256, - KEX_MAX - }; -@@ -145,6 +151,12 @@ - struct sshbuf *peer; - sig_atomic_t done; - u_int flags; -+#ifdef GSSAPI -+ int gss_deleg_creds; -+ int gss_trust_dns; -+ char *gss_host; -+ char *gss_client; -+#endif - int hash_alg; - int ec_nid; - char *client_version_string; -@@ -197,6 +209,11 @@ - int kexc25519_client(struct ssh *); - int kexc25519_server(struct ssh *); - -+#ifdef GSSAPI -+int kexgss_client(struct ssh *); -+int kexgss_server(struct ssh *); -+#endif -+ - int kex_dh_hash(int, const char *, const char *, - const u_char *, size_t, const u_char *, size_t, const u_char *, size_t, - const BIGNUM *, const BIGNUM *, const BIGNUM *, u_char *, size_t *); -diff -Nur openssh-7.5p1/logintest.c gsi-openssh/logintest.c ---- openssh-7.5p1/logintest.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/logintest.c 2018-12-20 11:49:17.628000000 +0100 -@@ -286,6 +286,7 @@ - printf("Platform-independent login recording test driver\n"); - - __progname = ssh_get_progname(argv[0]); -+ init_pathnames(); - if (argc == 2) { - if (strncmp(argv[1], "-i", 3) == 0) - compile_opts_only = 1; -diff -Nur openssh-7.5p1/Makefile.in gsi-openssh/Makefile.in ---- openssh-7.5p1/Makefile.in 2018-12-20 11:48:40.808000000 +0100 -+++ gsi-openssh/Makefile.in 2019-01-11 15:25:24.396000000 +0100 -@@ -1,7 +1,7 @@ - # $Id: Makefile.in,v 1.365 2014/08/30 06:23:07 djm Exp $ - - # uncomment if you run a non bourne compatable shell. Ie. csh --#SHELL = @SH@ -+SHELL = @SHELL@ - - AUTORECONF=autoreconf - -@@ -18,10 +18,12 @@ - piddir=@piddir@ - srcdir=@srcdir@ - top_srcdir=@top_srcdir@ -+top_builddir=@top_builddir@ -+program_prefix=@program_prefix@ - - DESTDIR= - VPATH=@srcdir@ --SSH_PROGRAM=@bindir@/ssh -+SSH_PROGRAM=@bindir@/@program_prefix@ssh - ASKPASS_PROGRAM=$(libexecdir)/ssh-askpass - SFTP_SERVER=$(libexecdir)/sftp-server - SSH_KEYSIGN=$(libexecdir)/ssh-keysign -@@ -31,20 +33,17 @@ - STRIP_OPT=@STRIP_OPT@ - TEST_SHELL=@TEST_SHELL@ - --PATHS= -DSSHDIR=\"$(sysconfdir)\" \ -- -D_PATH_SSH_PROGRAM=\"$(SSH_PROGRAM)\" \ -- -D_PATH_SSH_ASKPASS_DEFAULT=\"$(ASKPASS_PROGRAM)\" \ -- -D_PATH_SFTP_SERVER=\"$(SFTP_SERVER)\" \ -- -D_PATH_SSH_KEY_SIGN=\"$(SSH_KEYSIGN)\" \ -- -D_PATH_SSH_PKCS11_HELPER=\"$(SSH_PKCS11_HELPER)\" \ -+PATHS= -D_PATH_SSH_ASKPASS_DEFAULT=\"$(ASKPASS_PROGRAM)\" \ -+ -DGSISSHDIR="\"$(sysconfdir)\"" \ - -D_PATH_SSH_PIDDIR=\"$(piddir)\" \ - -D_PATH_PRIVSEP_CHROOT_DIR=\"$(PRIVSEP_PATH)\" - - CC=@CC@ -+LIBTOOL=$(SHELL) $(top_builddir)/libtool - LD=@LD@ --CFLAGS=@CFLAGS@ -+CFLAGS=@CFLAGS@ @GLOBUS_CFLAGS@ - CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@ --LIBS=@LIBS@ -lpthread -+LIBS=@GLOBUS_LIBS@ @LIBS@ -lpthread - K5LIBS=@K5LIBS@ - GSSLIBS=@GSSLIBS@ - SSHLIBS=@SSHLIBS@ -@@ -84,6 +83,8 @@ - readpass.o rsa.o ttymodes.o xmalloc.o addrmatch.o \ - atomicio.o key.o dispatch.o mac.o uidswap.o uuencode.o misc.o utf8.o \ - monitor_fdpass.o rijndael.o ssh-dss.o ssh-ecdsa.o ssh-rsa.o dh.o \ -+ pathnames.o \ -+ kexgssc.o \ - msg.o progressmeter.o dns.o entropy.o gss-genr.o umac.o umac128.o \ - ssh-pkcs11.o smult_curve25519_ref.o \ - poly1305.o chacha.o cipher-chachapoly.o \ -@@ -96,7 +97,7 @@ - - SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \ - sshconnect.o sshconnect1.o sshconnect2.o mux.o \ -- modp_burl.o nersc.o -+ modp_burl.o nersc.o auth-compat.o - - SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o \ - audit.o audit-bsm.o audit-linux.o platform.o \ -@@ -106,6 +107,8 @@ - auth-skey.o auth-bsdauth.o auth2-hostbased.o auth2-kbdint.o \ - auth2-none.o auth2-passwd.o auth2-pubkey.o \ - monitor.o monitor_wrap.o auth-krb5.o \ -+ kexgsss.o \ -+ gss-serv-gsi.o \ - auth2-gss.o gss-serv.o gss-serv-krb5.o \ - loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \ - sftp-server.o sftp-common.o \ -@@ -183,10 +186,10 @@ - $(LD) -o $@ ssh-keysign.o readconf.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) - - ssh-pkcs11-helper$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-pkcs11-helper.o ssh-pkcs11.o -- $(LD) -o $@ ssh-pkcs11-helper.o ssh-pkcs11.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) -+ $(LD) -o $@ ssh-pkcs11-helper.o ssh-pkcs11.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) - - ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o -- $(LD) -o $@ ssh-keyscan.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS) -+ $(LD) -o $@ ssh-keyscan.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) - - sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o sftp-server-main.o - $(LD) -o $@ sftp-server.o sftp-common.o sftp-server-main.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) -@@ -301,13 +304,36 @@ - distprep: catman-do - $(AUTORECONF) - -rm -rf autom4te.cache -+distdir=gsi-openssh-7.5p1c -+distsubdirs=$(srcdir)/openbsd-compat $(srcdir)/contrib $(srcdir)/regress -+ -+distdir: -+ rm -rf "$(distdir)" -+ mkdir -p "$(distdir)" -+ (find "$(srcdir)" -maxdepth 1 -type f \( -name $(distdir).tar.gz -o -print \); \ -+ find ${distsubdirs} ) | \ -+ while read fullpath; do \ -+ f="$${fullpath#$(srcdir)/}"; \ -+ if [ -d "$(srcdir)/$$f" ]; then \ -+ mkdir -p "$(distdir)/$$f"; \ -+ else \ -+ cp "$(srcdir)/$${f}" "$(distdir)/$${f}"; \ -+ fi; \ -+ done -+ if [ -f $(distdir)/Makefile ]; then \ -+ $(MAKE) -C $(distdir) distclean; \ -+ fi -+ -+dist: distdir -+ tar cf - "$(distdir)" | gzip -9 > "$(distdir).tar.gz" -+ rm -rf "$(distdir)" - - install: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf host-key check-config - install-nokeys: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf - install-nosysconf: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files - - check-config: -- -$(DESTDIR)$(sbindir)/sshd -t -f $(DESTDIR)$(sysconfdir)/sshd_config -+ -$(DESTDIR)$(sbindir)/$(program_prefix)sshd -t -f $(DESTDIR)$(sysconfdir)/sshd_config - - install-files: - $(srcdir)/mkinstalldirs $(DESTDIR)$(bindir) -@@ -318,31 +344,31 @@ - $(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)8 - $(srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir) - (umask 022 ; $(srcdir)/mkinstalldirs $(DESTDIR)$(PRIVSEP_PATH)) -- $(INSTALL) -m 0755 $(STRIP_OPT) ssh$(EXEEXT) $(DESTDIR)$(bindir)/ssh$(EXEEXT) -- $(INSTALL) -m 0755 $(STRIP_OPT) scp$(EXEEXT) $(DESTDIR)$(bindir)/scp$(EXEEXT) -- $(INSTALL) -m 0755 $(STRIP_OPT) ssh-add$(EXEEXT) $(DESTDIR)$(bindir)/ssh-add$(EXEEXT) -- $(INSTALL) -m 0755 $(STRIP_OPT) ssh-agent$(EXEEXT) $(DESTDIR)$(bindir)/ssh-agent$(EXEEXT) -- $(INSTALL) -m 0755 $(STRIP_OPT) ssh-keygen$(EXEEXT) $(DESTDIR)$(bindir)/ssh-keygen$(EXEEXT) -- $(INSTALL) -m 0755 $(STRIP_OPT) ssh-keyscan$(EXEEXT) $(DESTDIR)$(bindir)/ssh-keyscan$(EXEEXT) -- $(INSTALL) -m 0755 $(STRIP_OPT) sshd$(EXEEXT) $(DESTDIR)$(sbindir)/sshd$(EXEEXT) -- $(INSTALL) -m 4711 $(STRIP_OPT) ssh-keysign$(EXEEXT) $(DESTDIR)$(SSH_KEYSIGN)$(EXEEXT) -- $(INSTALL) -m 0755 $(STRIP_OPT) ssh-pkcs11-helper$(EXEEXT) $(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT) -- $(INSTALL) -m 0755 $(STRIP_OPT) sftp$(EXEEXT) $(DESTDIR)$(bindir)/sftp$(EXEEXT) -- $(INSTALL) -m 0755 $(STRIP_OPT) sftp-server$(EXEEXT) $(DESTDIR)$(SFTP_SERVER)$(EXEEXT) -- $(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1 -- $(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1 -- $(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1 -- $(INSTALL) -m 644 ssh-agent.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1 -- $(INSTALL) -m 644 ssh-keygen.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1 -- $(INSTALL) -m 644 ssh-keyscan.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1 -- $(INSTALL) -m 644 moduli.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/moduli.5 -- $(INSTALL) -m 644 sshd_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/sshd_config.5 -- $(INSTALL) -m 644 ssh_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/ssh_config.5 -- $(INSTALL) -m 644 sshd.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8 -- $(INSTALL) -m 644 sftp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1 -- $(INSTALL) -m 644 sftp-server.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8 -- $(INSTALL) -m 644 ssh-keysign.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8 -- $(INSTALL) -m 644 ssh-pkcs11-helper.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8 -+ $(LIBTOOL) --mode=install $(INSTALL) -m 0755 $(STRIP_OPT) ssh$(EXEEXT) $(DESTDIR)$(bindir)/$(program_prefix)ssh$(EXEEXT) -+ $(LIBTOOL) --mode=install $(INSTALL) -m 0755 $(STRIP_OPT) scp$(EXEEXT) $(DESTDIR)$(bindir)/$(program_prefix)scp$(EXEEXT) -+ $(LIBTOOL) --mode=install $(INSTALL) -m 0755 $(STRIP_OPT) ssh-add$(EXEEXT) $(DESTDIR)$(bindir)/$(program_prefix)ssh-add$(EXEEXT) -+ $(LIBTOOL) --mode=install $(INSTALL) -m 0755 $(STRIP_OPT) ssh-agent$(EXEEXT) $(DESTDIR)$(bindir)/$(program_prefix)ssh-agent$(EXEEXT) -+ $(LIBTOOL) --mode=install $(INSTALL) -m 0755 $(STRIP_OPT) ssh-keygen$(EXEEXT) $(DESTDIR)$(bindir)/$(program_prefix)ssh-keygen$(EXEEXT) -+ $(LIBTOOL) --mode=install $(INSTALL) -m 0755 $(STRIP_OPT) ssh-keyscan$(EXEEXT) $(DESTDIR)$(bindir)/$(program_prefix)ssh-keyscan$(EXEEXT) -+ $(LIBTOOL) --mode=install $(INSTALL) -m 0755 $(STRIP_OPT) sshd$(EXEEXT) $(DESTDIR)$(sbindir)/$(program_prefix)sshd$(EXEEXT) -+ $(LIBTOOL) --mode=install $(INSTALL) -m 4711 $(STRIP_OPT) ssh-keysign$(EXEEXT) $(DESTDIR)$(SSH_KEYSIGN)$(EXEEXT) -+ $(LIBTOOL) --mode=install $(INSTALL) -m 0755 $(STRIP_OPT) ssh-pkcs11-helper$(EXEEXT) $(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT) -+ $(LIBTOOL) --mode=install $(INSTALL) -m 0755 $(STRIP_OPT) sftp$(EXEEXT) $(DESTDIR)$(bindir)/$(program_prefix)sftp$(EXEEXT) -+ $(LIBTOOL) --mode=install $(INSTALL) -m 0755 $(STRIP_OPT) sftp-server$(EXEEXT) $(DESTDIR)$(SFTP_SERVER)$(EXEEXT) -+ $(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/$(program_prefix)ssh.1 -+ $(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/$(program_prefix)scp.1 -+ $(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/$(program_prefix)ssh-add.1 -+ $(INSTALL) -m 644 ssh-agent.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/$(program_prefix)ssh-agent.1 -+ $(INSTALL) -m 644 ssh-keygen.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/$(program_prefix)ssh-keygen.1 -+ $(INSTALL) -m 644 ssh-keyscan.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/$(program_prefix)ssh-keyscan.1 -+ $(INSTALL) -m 644 moduli.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/$(program_prefix)moduli.5 -+ $(INSTALL) -m 644 sshd_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/$(program_prefix)sshd_config.5 -+ $(INSTALL) -m 644 ssh_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/$(program_prefix)ssh_config.5 -+ $(INSTALL) -m 644 sshd.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/$(program_prefix)sshd.8 -+ $(INSTALL) -m 644 sftp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/$(program_prefix)sftp.1 -+ $(INSTALL) -m 644 sftp-server.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/$(program_prefix)sftp-server.8 -+ $(INSTALL) -m 644 ssh-keysign.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/$(program_prefix)ssh-keysign.8 -+ $(INSTALL) -m 644 ssh-pkcs11-helper.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/$(program_prefix)ssh-pkcs11-helper.8 - - install-sysconf: - if [ ! -d $(DESTDIR)$(sysconfdir) ]; then \ -@@ -397,28 +423,28 @@ - -rmdir $(DESTDIR)$(libexecdir) - - uninstall: -- -rm -f $(DESTDIR)$(bindir)/ssh$(EXEEXT) -- -rm -f $(DESTDIR)$(bindir)/scp$(EXEEXT) -- -rm -f $(DESTDIR)$(bindir)/ssh-add$(EXEEXT) -- -rm -f $(DESTDIR)$(bindir)/ssh-agent$(EXEEXT) -- -rm -f $(DESTDIR)$(bindir)/ssh-keygen$(EXEEXT) -- -rm -f $(DESTDIR)$(bindir)/ssh-keyscan$(EXEEXT) -- -rm -f $(DESTDIR)$(bindir)/sftp$(EXEEXT) -- -rm -f $(DESTDIR)$(sbindir)/sshd$(EXEEXT) -+ -rm -f $(DESTDIR)$(bindir)/$(program_prefix)ssh$(EXEEXT) -+ -rm -f $(DESTDIR)$(bindir)/$(program_prefix)scp$(EXEEXT) -+ -rm -f $(DESTDIR)$(bindir)/$(program_prefix)ssh-add$(EXEEXT) -+ -rm -f $(DESTDIR)$(bindir)/$(program_prefix)ssh-agent$(EXEEXT) -+ -rm -f $(DESTDIR)$(bindir)/$(program_prefix)ssh-keygen$(EXEEXT) -+ -rm -f $(DESTDIR)$(bindir)/$(program_prefix)ssh-keyscan$(EXEEXT) -+ -rm -f $(DESTDIR)$(bindir)/$(program_prefix)sftp$(EXEEXT) -+ -rm -f $(DESTDIR)$(sbindir)/$(program_prefix)sshd$(EXEEXT) - -rm -r $(DESTDIR)$(SFTP_SERVER)$(EXEEXT) - -rm -f $(DESTDIR)$(SSH_KEYSIGN)$(EXEEXT) - -rm -f $(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT) -- -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1 -- -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1 -- -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1 -- -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1 -- -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1 -- -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1 -- -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1 -- -rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8 -- -rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8 -- -rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8 -- -rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8 -+ -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/$(program_prefix)ssh.1 -+ -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/$(program_prefix)scp.1 -+ -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/$(program_prefix)ssh-add.1 -+ -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/$(program_prefix)ssh-agent.1 -+ -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/$(program_prefix)ssh-keygen.1 -+ -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/$(program_prefix)sftp.1 -+ -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/$(program_prefix)ssh-keyscan.1 -+ -rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/$(program_prefix)sshd.8 -+ -rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/$(program_prefix)sftp-server.8 -+ -rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/$(program_prefix)ssh-keysign.8 -+ -rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/$(program_prefix)ssh-pkcs11-helper.8 - - regress-prep: - [ -d `pwd`/regress ] || mkdir -p `pwd`/regress -diff -Nur openssh-7.5p1/misc.c gsi-openssh/misc.c ---- openssh-7.5p1/misc.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/misc.c 2018-12-20 11:49:17.640000000 +0100 -@@ -161,11 +161,14 @@ - #define WHITESPACE " \t\r\n" - #define QUOTE "\"" - -+/* Characters considered as quotations. */ -+#define QUOTES "'\"" -+ - /* return next token in configuration line */ - char * - strdelim(char **s) - { -- char *old; -+ char *old, *p, *q; - int wspace = 0; - - if (*s == NULL) -@@ -173,6 +176,21 @@ - - old = *s; - -+ if ((q=strchr(QUOTES, (int) *old)) && *q) -+ { -+ /* find next quote character, point old to start of quoted -+ * string */ -+ for (p = ++old;*p && *p!=*q; p++) -+ ; -+ -+ /* find start of next token */ -+ *s = (*p) ? p + strspn(p + 1, WHITESPACE) + 1 : NULL; -+ -+ /* terminate 'old' token */ -+ *p = '\0'; -+ return (old); -+ } -+ - *s = strpbrk(*s, WHITESPACE QUOTE "="); - if (*s == NULL) - return (old); -@@ -228,6 +246,20 @@ - return copy; - } - -+void -+pwfree(struct passwd *pw) -+{ -+ free(pw->pw_name); -+ free(pw->pw_passwd); -+ free(pw->pw_gecos); -+#ifdef HAVE_PW_CLASS_IN_PASSWD -+ free(pw->pw_class); -+#endif -+ free(pw->pw_dir); -+ free(pw->pw_shell); -+ free(pw); -+} -+ - /* - * Convert ASCII string to TCP/IP port number. - * Port must be >=0 and <=65535. -diff -Nur openssh-7.5p1/misc.h gsi-openssh/misc.h ---- openssh-7.5p1/misc.h 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/misc.h 2018-12-20 11:49:17.640000000 +0100 -@@ -69,6 +69,7 @@ - void sock_set_v6only(int); - - struct passwd *pwcopy(struct passwd *); -+void pwfree(struct passwd *); - const char *ssh_gai_strerror(int); - - typedef struct arglist arglist; -diff -Nur openssh-7.5p1/monitor.c gsi-openssh/monitor.c ---- openssh-7.5p1/monitor.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/monitor.c 2018-12-20 11:49:17.640000000 +0100 -@@ -157,6 +157,11 @@ - int mm_answer_gss_accept_ctx(int, Buffer *); - int mm_answer_gss_userok(int, Buffer *); - int mm_answer_gss_checkmic(int, Buffer *); -+int mm_answer_gss_sign(int, Buffer *); -+int mm_answer_gss_error(int, Buffer *); -+int mm_answer_gss_indicate_mechs(int, Buffer *); -+int mm_answer_gss_localname(int, Buffer *); -+int mm_answer_gss_updatecreds(int, Buffer *); - #endif - - #ifdef SSH_AUDIT_EVENTS -@@ -200,12 +205,12 @@ - {MONITOR_REQ_MODULI, MON_ONCE, mm_answer_moduli}, - #endif - {MONITOR_REQ_SIGN, MON_ONCE, mm_answer_sign}, -- {MONITOR_REQ_PWNAM, MON_ONCE, mm_answer_pwnamallow}, -+ {MONITOR_REQ_PWNAM, MON_AUTH, mm_answer_pwnamallow}, - {MONITOR_REQ_AUTHSERV, MON_ONCE, mm_answer_authserv}, - {MONITOR_REQ_AUTH2_READ_BANNER, MON_ONCE, mm_answer_auth2_read_banner}, - {MONITOR_REQ_AUTHPASSWORD, MON_AUTH, mm_answer_authpassword}, - #ifdef USE_PAM -- {MONITOR_REQ_PAM_START, MON_ONCE, mm_answer_pam_start}, -+ {MONITOR_REQ_PAM_START, MON_ISAUTH, mm_answer_pam_start}, - {MONITOR_REQ_PAM_ACCOUNT, 0, mm_answer_pam_account}, - {MONITOR_REQ_PAM_INIT_CTX, MON_ONCE, mm_answer_pam_init_ctx}, - {MONITOR_REQ_PAM_QUERY, 0, mm_answer_pam_query}, -@@ -229,12 +234,24 @@ - {MONITOR_REQ_GSSSETUP, MON_ISAUTH, mm_answer_gss_setup_ctx}, - {MONITOR_REQ_GSSSTEP, 0, mm_answer_gss_accept_ctx}, - {MONITOR_REQ_GSSUSEROK, MON_ONCE|MON_AUTHDECIDE, mm_answer_gss_userok}, -- {MONITOR_REQ_GSSCHECKMIC, MON_ONCE, mm_answer_gss_checkmic}, -+ {MONITOR_REQ_GSSCHECKMIC, MON_ISAUTH, mm_answer_gss_checkmic}, -+ {MONITOR_REQ_GSSSIGN, MON_ONCE, mm_answer_gss_sign}, -+ {MONITOR_REQ_GSSERR, MON_ISAUTH | MON_ONCE, mm_answer_gss_error}, -+ {MONITOR_REQ_GSSMECHS, MON_ISAUTH, mm_answer_gss_indicate_mechs}, -+ {MONITOR_REQ_GSSLOCALNAME, MON_ISAUTH, mm_answer_gss_localname}, - #endif - {0, 0, NULL} - }; - - struct mon_table mon_dispatch_postauth20[] = { -+#ifdef GSSAPI -+ {MONITOR_REQ_GSSSETUP, 0, mm_answer_gss_setup_ctx}, -+ {MONITOR_REQ_GSSSTEP, 0, mm_answer_gss_accept_ctx}, -+ {MONITOR_REQ_GSSSIGN, 0, mm_answer_gss_sign}, -+ {MONITOR_REQ_GSSERR, 0, mm_answer_gss_error}, -+ {MONITOR_REQ_GSSMECHS, 0, mm_answer_gss_indicate_mechs}, -+ {MONITOR_REQ_GSSUPCREDS, 0, mm_answer_gss_updatecreds}, -+#endif - #ifdef WITH_OPENSSL - {MONITOR_REQ_MODULI, 0, mm_answer_moduli}, - #endif -@@ -302,6 +319,12 @@ - /* Permit requests for moduli and signatures */ - monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1); - monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1); -+#ifdef GSSAPI -+ /* and for the GSSAPI key exchange */ -+ monitor_permit(mon_dispatch, MONITOR_REQ_GSSSETUP, 1); -+ monitor_permit(mon_dispatch, MONITOR_REQ_GSSERR, 1); -+ monitor_permit(mon_dispatch, MONITOR_REQ_GSSMECHS, 1); -+#endif - - /* The first few requests do not require asynchronous access */ - while (!authenticated) { -@@ -403,6 +426,12 @@ - monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1); - monitor_permit(mon_dispatch, MONITOR_REQ_TERM, 1); - -+#ifdef GSSAPI -+ /* and for the GSSAPI key exchange */ -+ monitor_permit(mon_dispatch, MONITOR_REQ_GSSMECHS,1); -+ monitor_permit(mon_dispatch, MONITOR_REQ_GSSSETUP,1); -+ monitor_permit(mon_dispatch, MONITOR_REQ_GSSERR,1); -+#endif - if (!no_pty_flag) { - monitor_permit(mon_dispatch, MONITOR_REQ_PTY, 1); - monitor_permit(mon_dispatch, MONITOR_REQ_PTYCLEANUP, 1); -@@ -705,14 +734,17 @@ - - debug3("%s", __func__); - -- if (authctxt->attempt++ != 0) -- fatal("%s: multiple attempts for getpwnam", __func__); -- - username = buffer_get_string(m, NULL); - - pwent = getpwnamallow(username); - -+ if (authctxt->user) free(authctxt->user); - authctxt->user = xstrdup(username); -+#ifdef USE_PAM -+ if (options.permit_pam_user_change) -+ setproctitle("%s [priv]", pwent ? "[pam]" : "unknown"); -+ else -+#endif - setproctitle("%s [priv]", pwent ? username : "unknown"); - free(username); - -@@ -1604,6 +1636,16 @@ - # ifdef OPENSSL_HAS_ECC - kex->kex[KEX_ECDH_SHA2] = kexecdh_server; - # endif -+#ifdef GSSAPI -+ if (options.gss_keyex) { -+ kex->kex[KEX_GSS_GRP1_SHA1] = kexgss_server; -+ kex->kex[KEX_GSS_GRP14_SHA1] = kexgss_server; -+ kex->kex[KEX_GSS_GRP14_SHA256] = kexgss_server; -+ kex->kex[KEX_GSS_GRP16_SHA512] = kexgss_server; -+ kex->kex[KEX_GSS_GRP18_SHA512] = kexgss_server; -+ kex->kex[KEX_GSS_GEX_SHA1] = kexgss_server; -+ } -+#endif - #endif /* WITH_OPENSSL */ - kex->kex[KEX_C25519_SHA256] = kexc25519_server; - kex->load_host_public_key=&get_hostkey_public_by_type; -@@ -1685,8 +1727,9 @@ - OM_uint32 major; - u_int len; - -- if (!options.gss_authentication) -- fatal("%s: GSSAPI authentication not enabled", __func__); -+ if (!options.gss_authentication && !options.gss_keyex) -+ fatal("%s: In GSSAPI monitor when GSSAPI authentication" -+ " and keyex are disabled", __func__); - - goid.elements = buffer_get_string(m, &len); - goid.length = len; -@@ -1715,8 +1758,11 @@ - OM_uint32 flags = 0; /* GSI needs this */ - u_int len; - -- if (!options.gss_authentication) -- fatal("%s: GSSAPI authentication not enabled", __func__); -+ if (!options.gss_authentication && !options.gss_keyex) -+ fatal("In GSSAPI monitor when GSSAPI is disabled"); -+ if (!options.gss_authentication && !options.gss_keyex) -+ fatal("%s: In GSSAPI monitor when GSSAPI authentication" -+ " and keyex are disabled", __func__); - - in.value = buffer_get_string(m, &len); - in.length = len; -@@ -1734,7 +1780,9 @@ - if (major == GSS_S_COMPLETE) { - monitor_permit(mon_dispatch, MONITOR_REQ_GSSSTEP, 0); - monitor_permit(mon_dispatch, MONITOR_REQ_GSSUSEROK, 1); -+ monitor_permit(mon_dispatch, MONITOR_REQ_GSSSIGN, 1); - monitor_permit(mon_dispatch, MONITOR_REQ_GSSCHECKMIC, 1); -+ monitor_permit(mon_dispatch, MONITOR_REQ_GSSSIGN, 1); - } - return (0); - } -@@ -1746,8 +1794,11 @@ - OM_uint32 ret; - u_int len; - -- if (!options.gss_authentication) -- fatal("%s: GSSAPI authentication not enabled", __func__); -+ if (!options.gss_authentication && !options.gss_keyex) -+ fatal("In GSSAPI monitor when GSSAPI is disabled"); -+ if (!options.gss_authentication && !options.gss_keyex) -+ fatal("%s: In GSSAPI monitor when GSSAPI authentication" -+ " and keyex are disabled", __func__); - - gssbuf.value = buffer_get_string(m, &len); - gssbuf.length = len; -@@ -1774,11 +1825,16 @@ - mm_answer_gss_userok(int sock, Buffer *m) - { - int authenticated; -+ int gssapi_keyex; -+ -+ if (!options.gss_authentication && !options.gss_keyex) -+ fatal("%s: In GSSAPI monitor when GSSAPI authentication" -+ " and keyex are disabled", __func__); - -- if (!options.gss_authentication) -- fatal("%s: GSSAPI authentication not enabled", __func__); -+ gssapi_keyex = buffer_get_int(m); - -- authenticated = authctxt->valid && ssh_gssapi_userok(authctxt->user); -+ authenticated = authctxt->valid && -+ ssh_gssapi_userok(authctxt->user, authctxt->pw, gssapi_keyex); - - buffer_clear(m); - buffer_put_int(m, authenticated); -@@ -1786,10 +1842,149 @@ - debug3("%s: sending result %d", __func__, authenticated); - mm_request_send(sock, MONITOR_ANS_GSSUSEROK, m); - -- auth_method = "gssapi-with-mic"; -+ if (gssapi_keyex) -+ auth_method = "gssapi-keyex"; -+ else -+ auth_method = "gssapi-with-mic"; - - /* Monitor loop will terminate if authenticated */ - return (authenticated); - } -+ -+int -+mm_answer_gss_error(int socket, Buffer *m) { -+ OM_uint32 major,minor; -+ char *msg; -+ -+ msg=ssh_gssapi_last_error(gsscontext,&major,&minor); -+ buffer_clear(m); -+ buffer_put_int(m,major); -+ buffer_put_int(m,minor); -+ buffer_put_cstring(m,msg); -+ -+ mm_request_send(socket,MONITOR_ANS_GSSERR,m); -+ -+ free(msg); -+ -+ return(0); -+} -+ -+int -+mm_answer_gss_indicate_mechs(int socket, Buffer *m) { -+ OM_uint32 major,minor; -+ gss_OID_set mech_set; -+ size_t i; -+ -+ major=gss_indicate_mechs(&minor, &mech_set); -+ -+ buffer_clear(m); -+ buffer_put_int(m, major); -+ buffer_put_int(m, mech_set->count); -+ for (i=0; i < mech_set->count; i++) { -+ buffer_put_string(m, mech_set->elements[i].elements, -+ mech_set->elements[i].length); -+ } -+ -+#if !defined(MECHGLUE) /* mechglue memory management bug ??? */ -+ gss_release_oid_set(&minor,&mech_set); -+#endif -+ -+ mm_request_send(socket,MONITOR_ANS_GSSMECHS,m); -+ -+ return(0); -+} -+ -+int -+mm_answer_gss_localname(int socket, Buffer *m) { -+ char *name; -+ -+ ssh_gssapi_localname(&name); -+ -+ buffer_clear(m); -+ if (name) { -+ buffer_put_cstring(m, name); -+ debug3("%s: sending result %s", __func__, name); -+ free(name); -+ } else { -+ buffer_put_cstring(m, ""); -+ debug3("%s: sending result \"\"", __func__); -+ } -+ -+ mm_request_send(socket, MONITOR_ANS_GSSLOCALNAME, m); -+ -+ return(0); -+} -+ -+int -+mm_answer_gss_sign(int socket, Buffer *m) -+{ -+ gss_buffer_desc data; -+ gss_buffer_desc hash = GSS_C_EMPTY_BUFFER; -+ OM_uint32 major, minor; -+ u_int len; -+ -+ if (!options.gss_authentication && !options.gss_keyex) -+ fatal("In GSSAPI monitor when GSSAPI is disabled"); -+ -+ data.value = buffer_get_string(m, &len); -+ data.length = len; -+ /* -+ * Supported KEX types use SHA1 (20 bytes), SHA256 (32 bytes), -+ * SHA384 (48 bytes) and SHA512 (64 bytes). -+ */ -+ if (data.length != 20 && data.length != 32 && data.length != 48 && data.length != 64) -+ fatal("%s: data length incorrect: %d", __func__, -+ (int) data.length); -+ -+ /* Save the session ID on the first time around */ -+ if (session_id2_len == 0) { -+ session_id2_len = data.length; -+ session_id2 = xmalloc(session_id2_len); -+ memcpy(session_id2, data.value, session_id2_len); -+ } -+ major = ssh_gssapi_sign(gsscontext, &data, &hash); -+ -+ free(data.value); -+ -+ buffer_clear(m); -+ buffer_put_int(m, major); -+ buffer_put_string(m, hash.value, hash.length); -+ -+ mm_request_send(socket, MONITOR_ANS_GSSSIGN, m); -+ -+ gss_release_buffer(&minor, &hash); -+ -+ /* Turn on getpwnam permissions */ -+ monitor_permit(mon_dispatch, MONITOR_REQ_PWNAM, 1); -+ -+ /* And credential updating, for when rekeying */ -+ monitor_permit(mon_dispatch, MONITOR_REQ_GSSUPCREDS, 1); -+ -+ return (0); -+} -+ -+int -+mm_answer_gss_updatecreds(int socket, Buffer *m) { -+ ssh_gssapi_ccache store; -+ int ok; -+ -+ store.filename = buffer_get_string(m, NULL); -+ store.envvar = buffer_get_string(m, NULL); -+ store.envval = buffer_get_string(m, NULL); -+ -+ ok = ssh_gssapi_update_creds(&store); -+ -+ free(store.filename); -+ free(store.envvar); -+ free(store.envval); -+ -+ buffer_clear(m); -+ buffer_put_int(m, ok); -+ -+ mm_request_send(socket, MONITOR_ANS_GSSUPCREDS, m); -+ -+ return(0); -+} -+ - #endif /* GSSAPI */ - -diff -Nur openssh-7.5p1/monitor.h gsi-openssh/monitor.h ---- openssh-7.5p1/monitor.h 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/monitor.h 2018-12-20 11:49:17.640000000 +0100 -@@ -65,6 +65,12 @@ - MONITOR_REQ_PAM_FREE_CTX = 110, MONITOR_ANS_PAM_FREE_CTX = 111, - MONITOR_REQ_AUDIT_EVENT = 112, MONITOR_REQ_AUDIT_COMMAND = 113, - -+ MONITOR_REQ_GSSMECHS = 200, MONITOR_ANS_GSSMECHS = 201, -+ MONITOR_REQ_GSSLOCALNAME = 202, MONITOR_ANS_GSSLOCALNAME = 203, -+ MONITOR_REQ_GSSERR = 204, MONITOR_ANS_GSSERR = 205, -+ MONITOR_REQ_GSSSIGN = 206, MONITOR_ANS_GSSSIGN = 207, -+ MONITOR_REQ_GSSUPCREDS = 208, MONITOR_ANS_GSSUPCREDS = 209, -+ - }; - - struct monitor { -diff -Nur openssh-7.5p1/monitor_wrap.c gsi-openssh/monitor_wrap.c ---- openssh-7.5p1/monitor_wrap.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/monitor_wrap.c 2018-12-20 11:49:17.644000000 +0100 -@@ -924,12 +924,13 @@ - } - - int --mm_ssh_gssapi_userok(char *user) -+mm_ssh_gssapi_userok(char *user, struct passwd *pw, int gssapi_keyex) - { - Buffer m; - int authenticated = 0; - - buffer_init(&m); -+ buffer_put_int(&m, gssapi_keyex); - - mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSUSEROK, &m); - mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSUSEROK, -@@ -941,5 +942,127 @@ - debug3("%s: user %sauthenticated",__func__, authenticated ? "" : "not "); - return (authenticated); - } -+ -+char * -+mm_ssh_gssapi_last_error(Gssctxt *ctx, OM_uint32 *major, OM_uint32 *minor) { -+ Buffer m; -+ OM_uint32 maj,min; -+ char *errstr; -+ -+ buffer_init(&m); -+ -+ mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSERR, &m); -+ mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSERR, &m); -+ -+ maj = buffer_get_int(&m); -+ min = buffer_get_int(&m); -+ -+ if (major) *major=maj; -+ if (minor) *minor=min; -+ -+ errstr=buffer_get_string(&m,NULL); -+ -+ buffer_free(&m); -+ -+ return(errstr); -+} -+ -+OM_uint32 -+mm_gss_indicate_mechs(OM_uint32 *minor_status, gss_OID_set *mech_set) -+{ -+ Buffer m; -+ OM_uint32 major,minor; -+ int count; -+ gss_OID_desc oid; -+ u_int length; -+ -+ buffer_init(&m); -+ -+ mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSMECHS, &m); -+ mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSMECHS, -+ &m); -+ major=buffer_get_int(&m); -+ count=buffer_get_int(&m); -+ -+ gss_create_empty_oid_set(&minor,mech_set); -+ while(count-->0) { -+ oid.elements=buffer_get_string(&m,&length); -+ oid.length=length; -+ gss_add_oid_set_member(&minor,&oid,mech_set); -+ } -+ -+ buffer_free(&m); -+ -+ return(major); -+} -+ -+int -+mm_ssh_gssapi_localname(char **lname) -+{ -+ Buffer m; -+ -+ buffer_init(&m); -+ mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSLOCALNAME, &m); -+ -+ debug3("%s: waiting for MONITOR_ANS_GSSLOCALNAME", __func__); -+ mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSLOCALNAME, -+ &m); -+ -+ *lname = buffer_get_string(&m, NULL); -+ -+ buffer_free(&m); -+ if (lname[0] == '\0') { -+ debug3("%s: gssapi identity mapping failed", __func__); -+ } else { -+ debug3("%s: gssapi identity mapped to %s", __func__, *lname); -+ } -+ -+ return(0); -+} -+ -+OM_uint32 -+mm_ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_desc *data, gss_buffer_desc *hash) -+{ -+ Buffer m; -+ OM_uint32 major; -+ u_int len; -+ -+ buffer_init(&m); -+ buffer_put_string(&m, data->value, data->length); -+ -+ mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSSIGN, &m); -+ mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSSIGN, &m); -+ -+ major = buffer_get_int(&m); -+ hash->value = buffer_get_string(&m, &len); -+ hash->length = len; -+ -+ buffer_free(&m); -+ -+ return(major); -+} -+ -+int -+mm_ssh_gssapi_update_creds(ssh_gssapi_ccache *store) -+{ -+ Buffer m; -+ int ok; -+ -+ buffer_init(&m); -+ -+ buffer_put_cstring(&m, store->filename ? store->filename : ""); -+ buffer_put_cstring(&m, store->envvar ? store->envvar : ""); -+ buffer_put_cstring(&m, store->envval ? store->envval : ""); -+ -+ mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSUPCREDS, &m); -+ mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSUPCREDS, &m); -+ -+ ok = buffer_get_int(&m); -+ -+ buffer_free(&m); -+ -+ return (ok); -+} -+ - #endif /* GSSAPI */ - -diff -Nur openssh-7.5p1/monitor_wrap.h gsi-openssh/monitor_wrap.h ---- openssh-7.5p1/monitor_wrap.h 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/monitor_wrap.h 2018-12-20 11:49:17.644000000 +0100 -@@ -55,8 +55,14 @@ - OM_uint32 mm_ssh_gssapi_server_ctx(Gssctxt **, gss_OID); - OM_uint32 mm_ssh_gssapi_accept_ctx(Gssctxt *, - gss_buffer_desc *, gss_buffer_desc *, OM_uint32 *); --int mm_ssh_gssapi_userok(char *user); -+int mm_ssh_gssapi_userok(char *user, struct passwd *, int gssapi_keyex); - OM_uint32 mm_ssh_gssapi_checkmic(Gssctxt *, gss_buffer_t, gss_buffer_t); -+OM_uint32 mm_ssh_gssapi_sign(Gssctxt *, gss_buffer_t, gss_buffer_t); -+int mm_ssh_gssapi_localname(char **user); -+OM_uint32 mm_gss_indicate_mechs(OM_uint32 *minor_status, -+ gss_OID_set *mech_set); -+char *mm_ssh_gssapi_last_error(Gssctxt *ctxt, OM_uint32 *maj, OM_uint32 *min); -+int mm_ssh_gssapi_update_creds(ssh_gssapi_ccache *); - #endif - - #ifdef USE_PAM -diff -Nur openssh-7.5p1/myproposal.h gsi-openssh/myproposal.h ---- openssh-7.5p1/myproposal.h 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/myproposal.h 2018-12-20 11:49:17.644000000 +0100 -@@ -124,6 +124,9 @@ - #define KEX_CLIENT_ENCRYPT KEX_SERVER_ENCRYPT "," \ - "aes128-cbc,aes192-cbc,aes256-cbc" - -+#define KEX_ENCRYPT_INCLUDE_NONE KEX_SERVER_ENCRYPT \ -+ ",none" -+ - #define KEX_SERVER_MAC \ - "umac-64-etm@openssh.com," \ - "umac-128-etm@openssh.com," \ -@@ -170,6 +173,8 @@ - #define KEX_DEFAULT_COMP "none,zlib@openssh.com" - #define KEX_DEFAULT_LANG "" - -+#define KEX_ENCRYPT_INCLUDE_NONE KEX_SERVER_ENCRYPT ",none" -+ - #define KEX_CLIENT \ - KEX_CLIENT_KEX, \ - KEX_DEFAULT_PK_ALG, \ -diff -Nur openssh-7.5p1/nersc.c gsi-openssh/nersc.c ---- openssh-7.5p1/nersc.c 2018-12-20 11:48:40.816000000 +0100 -+++ gsi-openssh/nersc.c 2018-12-20 11:49:17.644000000 +0100 -@@ -150,7 +150,7 @@ - #include "modp_burl_data.h" - - /* import */ --int audit_disabled; -+int audit_disabled = 1; /* Disabled by default so client paths don't try to audit */ - extern char *__progname; - - int client_session_id; -diff -Nur openssh-7.5p1/openbsd-compat/port-aix.c gsi-openssh/openbsd-compat/port-aix.c ---- openssh-7.5p1/openbsd-compat/port-aix.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/openbsd-compat/port-aix.c 2018-12-20 11:49:17.644000000 +0100 -@@ -50,6 +50,7 @@ - # include - # include - # if defined(HAVE_SYS_AUDIT_H) && defined(AIX_LOGINFAILED_4ARG) -+# undef T_NULL - # include - # endif - # include -diff -Nur openssh-7.5p1/pathnames.c gsi-openssh/pathnames.c ---- openssh-7.5p1/pathnames.c 1970-01-01 01:00:00.000000000 +0100 -+++ gsi-openssh/pathnames.c 2018-12-20 11:49:17.644000000 +0100 -@@ -0,0 +1,168 @@ -+#include "includes.h" -+#include "xmalloc.h" -+#include "log.h" -+ -+#include -+#include -+#include -+ -+#define USRDIR "/usr" -+#define BINDIR "/bin" -+#define LIBEXEC "/libexec" -+#define DEFAULT_GSISSHDIR "/etc/gsissh" -+#define SSHDIR "/etc/ssh" -+#define VARDIR "/var" -+#define VARRUN "/var/run" -+ -+#define STRINIT "init_pathnames() not called!" -+ -+char *_PATH_SSHDIR = STRINIT; -+char *_PATH_SSH_SYSTEM_HOSTFILE = STRINIT; -+char *_PATH_SSH_SYSTEM_HOSTFILE2 = STRINIT; -+char *_PATH_SERVER_CONFIG_FILE = STRINIT; -+char *_PATH_HOST_CONFIG_FILE = STRINIT; -+char *_PATH_HOST_KEY_FILE = STRINIT; -+char *_PATH_HOST_DSA_KEY_FILE = STRINIT; -+char *_PATH_HOST_ECDSA_KEY_FILE = STRINIT; -+char *_PATH_HOST_ED25519_KEY_FILE = STRINIT; -+char *_PATH_HOST_RSA_KEY_FILE = STRINIT; -+char *_PATH_DH_MODULI = STRINIT; -+char *_PATH_DH_PRIMES = STRINIT; -+char *_PATH_SSH_PROGRAM = STRINIT; -+char *_PATH_SSH_DAEMON_PID_FILE = STRINIT; -+char *_PATH_SSH_SYSTEM_RC = STRINIT; -+char *_PATH_SSH_HOSTS_EQUIV = STRINIT; -+char *_PATH_SSH_KEY_SIGN = STRINIT; -+char *_PATH_SSH_PKCS11_HELPER = STRINIT; -+char *_PATH_SFTP_SERVER = STRINIT; -+char *_PATH_STDPATH_WITH_SCP = STRINIT; -+ -+static char * -+compose2(const char str1[], const char str2[]) -+{ -+ int len; -+ char *result; -+ -+ len = strlen(str1) + strlen(str2) + 1; -+ result = xmalloc(len); -+ snprintf(result, len, "%s%s", str1, str2); -+ -+ return result; -+} -+ -+static char * -+compose3(const char str1[], const char str2[], const char str3[]) -+{ -+ int len; -+ char *result; -+ -+ len = strlen(str1) + strlen(str2) + strlen(str3) + 1; -+ result = xmalloc(len); -+ snprintf(result, len, "%s%s%s", str1, str2, str3); -+ -+ return result; -+} -+ -+void -+init_pathnames() -+{ -+ char *gl=NULL, *bindir=NULL, *libexec=NULL, *sshdir=NULL, *piddir=NULL; -+ -+ gl = (char *)getenv("GLOBUS_LOCATION"); -+ -+ if (gl) { -+ bindir = compose2(gl, BINDIR); -+ libexec = compose2(gl, LIBEXEC); -+ piddir = compose2(gl, VARDIR); -+ } else { -+ bindir = compose2(USRDIR, BINDIR); -+ libexec = compose2(USRDIR, LIBEXEC); -+ piddir = strdup(VARRUN); -+ } -+ -+ if (gl) { -+ sshdir = compose2(gl, SSHDIR); -+ if (access(sshdir, X_OK) < 0) { -+ logit("%s not found.", sshdir); -+ free(sshdir); -+ sshdir = NULL; -+ } -+ } -+ if (!sshdir) { -+ sshdir = strdup(GSISSHDIR); -+ if (access(sshdir, X_OK) < 0) { -+ logit("%s not found.", sshdir); -+ free(sshdir); -+ sshdir = NULL; -+ } -+ } -+ if ((!sshdir) && gl) { -+ sshdir = compose2(gl, GSISSHDIR); -+ if (access(sshdir, X_OK) < 0) { -+ logit("%s not found.", sshdir); -+ free(sshdir); -+ sshdir = NULL; -+ } -+ } -+ if (!sshdir) { -+ sshdir = strdup(DEFAULT_GSISSHDIR); -+ if (access(sshdir, X_OK) < 0) { -+ logit("%s not found.", sshdir); -+ free(sshdir); -+ sshdir = NULL; -+ } -+ } -+ if ((!sshdir) && gl) { -+ sshdir = compose2(gl, DEFAULT_GSISSHDIR); -+ if (access(sshdir, X_OK) < 0) { -+ logit("%s not found.", sshdir); -+ free(sshdir); -+ sshdir = NULL; -+ } -+ } -+#if defined(__APPLE__) && defined(__MACH__) -+ if (!sshdir) -+ { -+ char * home = getenv("HOME"); -+ if (home) -+ { -+ sshdir = compose2(home, GSISSHDIR); -+ if (access(sshdir, X_OK) < 0) { -+ logit("%s not found.", sshdir); -+ free(sshdir); -+ sshdir = NULL; -+ } -+ } -+ } -+#endif /* APPLE && __MACH__ */ -+ if (!sshdir) { -+ fatal("sshdir not found. Check your installation or set GLOBUS_LOCATION"); -+ } -+ -+ /* lots of one time memory leaks here */ -+ _PATH_SSHDIR = strdup(sshdir); -+ _PATH_SSH_SYSTEM_HOSTFILE = compose2(sshdir, "/ssh_known_hosts"); -+ _PATH_SSH_SYSTEM_HOSTFILE2 = compose2(sshdir, "/ssh_known_hosts2"); -+ _PATH_SERVER_CONFIG_FILE = compose2(sshdir, "/sshd_config"); -+ _PATH_HOST_CONFIG_FILE = compose2(sshdir, "/ssh_config"); -+ _PATH_HOST_KEY_FILE = compose2(sshdir, "/ssh_host_key"); -+ _PATH_HOST_DSA_KEY_FILE = compose2(sshdir, "/ssh_host_dsa_key"); -+ _PATH_HOST_ECDSA_KEY_FILE = compose2(sshdir, "/ssh_host_ecdsa_key"); -+ _PATH_HOST_ED25519_KEY_FILE = compose2(sshdir, "/ssh_host_ed25519_key"); -+ _PATH_HOST_RSA_KEY_FILE = compose2(sshdir, "/ssh_host_rsa_key"); -+ _PATH_DH_MODULI = compose2(sshdir, "/moduli"); -+ _PATH_DH_PRIMES = compose2(sshdir, "/primes"); -+ _PATH_SSH_PROGRAM = compose2(bindir, "/gsissh"); -+ _PATH_SSH_DAEMON_PID_FILE = compose2(piddir, "/gsisshd.pid"); -+ _PATH_SSH_SYSTEM_RC = compose2(sshdir, "/sshrc"); -+ _PATH_SSH_HOSTS_EQUIV = compose2(sshdir, "/shosts.equiv"); -+ _PATH_SSH_KEY_SIGN = compose2(libexec, "/ssh-keysign"); -+ _PATH_SSH_PKCS11_HELPER = compose2(libexec, "/ssh-pkcs11-helper"); -+ _PATH_SFTP_SERVER = compose2(libexec, "/sftp-server"); -+ _PATH_STDPATH_WITH_SCP = compose3(_PATH_STDPATH, ":", bindir); -+ -+ if (bindir) free(bindir); -+ if (libexec) free(libexec); -+ if (sshdir) free(sshdir); -+ if (piddir) free(piddir); -+} -diff -Nur openssh-7.5p1/pathnames.h gsi-openssh/pathnames.h ---- openssh-7.5p1/pathnames.h 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/pathnames.h 2018-12-20 11:49:17.648000000 +0100 -@@ -12,46 +12,42 @@ - * called by a name other than "ssh" or "Secure Shell". - */ - --#define ETCDIR "/etc" -- --#ifndef SSHDIR --#define SSHDIR ETCDIR "/ssh" --#endif -- --#ifndef _PATH_SSH_PIDDIR --#define _PATH_SSH_PIDDIR "/var/run" --#endif -+/* -+ * Some of these pathnames are generated at run-time for binary -+ * relocatability. They are initialized by init_pathnames() -+ * in pathnames.c. -+ */ -+void init_pathnames(); - - /* - * System-wide file containing host keys of known hosts. This file should be - * world-readable. - */ --#define _PATH_SSH_SYSTEM_HOSTFILE SSHDIR "/ssh_known_hosts" -+extern char *_PATH_SSH_SYSTEM_HOSTFILE; - /* backward compat for protocol 2 */ --#define _PATH_SSH_SYSTEM_HOSTFILE2 SSHDIR "/ssh_known_hosts2" -+extern char *_PATH_SSH_SYSTEM_HOSTFILE2; - - /* - * Of these, ssh_host_key must be readable only by root, whereas ssh_config - * should be world-readable. - */ --#define _PATH_SERVER_CONFIG_FILE SSHDIR "/sshd_config" --#define _PATH_HOST_CONFIG_FILE SSHDIR "/ssh_config" --#define _PATH_HOST_KEY_FILE SSHDIR "/ssh_host_key" --#define _PATH_HOST_DSA_KEY_FILE SSHDIR "/ssh_host_dsa_key" --#define _PATH_HOST_ECDSA_KEY_FILE SSHDIR "/ssh_host_ecdsa_key" --#define _PATH_HOST_ED25519_KEY_FILE SSHDIR "/ssh_host_ed25519_key" --#define _PATH_HOST_RSA_KEY_FILE SSHDIR "/ssh_host_rsa_key" --#define _PATH_DH_MODULI SSHDIR "/moduli" -- --#ifndef _PATH_SSH_PROGRAM --#define _PATH_SSH_PROGRAM "/usr/bin/ssh" --#endif -- -+extern char *_PATH_SERVER_CONFIG_FILE; -+extern char *_PATH_HOST_CONFIG_FILE; -+extern char *_PATH_HOST_KEY_FILE; -+extern char *_PATH_HOST_DSA_KEY_FILE; -+extern char *_PATH_HOST_ECDSA_KEY_FILE; -+extern char *_PATH_HOST_ED25519_KEY_FILE; -+extern char *_PATH_HOST_RSA_KEY_FILE; -+extern char *_PATH_DH_MODULI; -+ -+extern char *_PATH_SSHDIR; -+extern char *_PATH_SSH_PROGRAM; -+ - /* - * The process id of the daemon listening for connections is saved here to - * make it easier to kill the correct daemon when necessary. - */ --#define _PATH_SSH_DAEMON_PID_FILE _PATH_SSH_PIDDIR "/sshd.pid" -+extern char *_PATH_SSH_DAEMON_PID_FILE; - - /* - * The directory in user's home directory in which the files reside. The -@@ -106,13 +102,13 @@ - * use. xauth will be run if neither of these exists. - */ - #define _PATH_SSH_USER_RC _PATH_SSH_USER_DIR "/rc" --#define _PATH_SSH_SYSTEM_RC SSHDIR "/sshrc" -+extern char *_PATH_SSH_SYSTEM_RC; - - /* - * Ssh-only version of /etc/hosts.equiv. Additionally, the daemon may use - * ~/.rhosts and /etc/hosts.equiv if rhosts authentication is enabled. - */ --#define _PATH_SSH_HOSTS_EQUIV SSHDIR "/shosts.equiv" -+extern char *_PATH_SSH_HOSTS_EQUIV; - #define _PATH_RHOSTS_EQUIV "/etc/hosts.equiv" - - /* -@@ -123,9 +119,7 @@ - #endif - - /* Location of ssh-keysign for hostbased authentication */ --#ifndef _PATH_SSH_KEY_SIGN --#define _PATH_SSH_KEY_SIGN "/usr/libexec/ssh-keysign" --#endif -+extern char *_PATH_SSH_KEY_SIGN; - - /* Location of ssh-pkcs11-helper to support keys in tokens */ - #ifndef _PATH_SSH_PKCS11_HELPER -@@ -148,9 +142,7 @@ - #endif - - /* for sftp */ --#ifndef _PATH_SFTP_SERVER --#define _PATH_SFTP_SERVER "/usr/libexec/sftp-server" --#endif -+extern char *_PATH_SFTP_SERVER; - - /* chroot directory for unprivileged user when UsePrivilegeSeparation=yes */ - #ifndef _PATH_PRIVSEP_CHROOT_DIR -@@ -170,3 +162,9 @@ - #ifndef ASKPASS_PROGRAM - #define ASKPASS_PROGRAM "/usr/lib/ssh/ssh-askpass" - #endif /* ASKPASS_PROGRAM */ -+ -+/* Path to rand helper */ -+extern char *SSH_RAND_HELPER; -+ -+/* Default user path that includes location of scp. */ -+extern char *_PATH_STDPATH_WITH_SCP; -diff -Nur openssh-7.5p1/readconf.c gsi-openssh/readconf.c ---- openssh-7.5p1/readconf.c 2018-12-20 11:48:40.820000000 +0100 -+++ gsi-openssh/readconf.c 2018-12-20 11:49:17.648000000 +0100 -@@ -161,6 +161,8 @@ - oClearAllForwardings, oNoHostAuthenticationForLocalhost, - oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout, - oAddressFamily, oGssAuthentication, oGssDelegateCreds, -+ oGssTrustDns, oGssKeyEx, oGssClientIdentity, oGssRenewalRekey, -+ oGssServerIdentity, - oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, - oSendEnv, oControlPath, oControlMaster, oControlPersist, - oHashKnownHosts, -@@ -239,6 +241,22 @@ - { "challengeresponseauthentication", oChallengeResponseAuthentication }, - { "skeyauthentication", oChallengeResponseAuthentication }, /* alias */ - { "tisauthentication", oChallengeResponseAuthentication }, /* alias */ -+#if defined(GSSAPI) -+ { "gssapiauthentication", oGssAuthentication }, -+ { "gssapikeyexchange", oGssKeyEx }, -+ { "gssapidelegatecredentials", oGssDelegateCreds }, -+ { "gssapitrustdns", oGssTrustDns }, -+ { "gssapiclientidentity", oGssClientIdentity }, -+ { "gssapiserveridentity", oGssServerIdentity }, -+ { "gssapirenewalforcesrekey", oGssRenewalRekey }, -+#else -+ { "gssapiauthentication", oUnsupported }, -+ { "gssapikeyexchange", oUnsupported }, -+ { "gssapidelegatecredentials", oUnsupported }, -+ { "gssapitrustdns", oUnsupported }, -+ { "gssapiclientidentity", oUnsupported }, -+ { "gssapirenewalforcesrekey", oUnsupported }, -+#endif - { "identityfile", oIdentityFile }, - { "identityfile2", oIdentityFile }, /* obsolete */ - { "identitiesonly", oIdentitiesOnly }, -@@ -986,10 +1004,30 @@ - intptr = &options->gss_authentication; - goto parse_flag; - -+ case oGssKeyEx: -+ intptr = &options->gss_keyex; -+ goto parse_flag; -+ - case oGssDelegateCreds: - intptr = &options->gss_deleg_creds; - goto parse_flag; - -+ case oGssTrustDns: -+ intptr = &options->gss_trust_dns; -+ goto parse_flag; -+ -+ case oGssClientIdentity: -+ charptr = &options->gss_client_identity; -+ goto parse_string; -+ -+ case oGssServerIdentity: -+ charptr = &options->gss_server_identity; -+ goto parse_string; -+ -+ case oGssRenewalRekey: -+ intptr = &options->gss_renewal_rekey; -+ goto parse_flag; -+ - case oBatchMode: - intptr = &options->batch_mode; - goto parse_flag; -@@ -1549,7 +1587,7 @@ - if (*arg != '/' && *arg != '~') { - xasprintf(&arg2, "%s/%s", - (flags & SSHCONF_USERCONF) ? -- "~/" _PATH_SSH_USER_DIR : SSHDIR, arg); -+ "~/" _PATH_SSH_USER_DIR : _PATH_SSHDIR, arg); - } else - arg2 = xstrdup(arg); - memset(&gl, 0, sizeof(gl)); -@@ -1855,7 +1893,12 @@ - options->pubkey_authentication = -1; - options->challenge_response_authentication = -1; - options->gss_authentication = -1; -+ options->gss_keyex = -1; - options->gss_deleg_creds = -1; -+ options->gss_trust_dns = -1; -+ options->gss_renewal_rekey = -1; -+ options->gss_client_identity = NULL; -+ options->gss_server_identity = NULL; - options->password_authentication = -1; - options->kbd_interactive_authentication = -1; - options->kbd_interactive_devices = NULL; -@@ -1944,6 +1987,12 @@ - options->update_hostkeys = -1; - options->hostbased_key_types = NULL; - options->pubkey_key_types = NULL; -+ options->none_switch = -1; -+ options->none_enabled = -1; -+ options->hpn_disabled = -1; -+ options->hpn_buffer_size = -1; -+ options->tcp_rcv_buf_poll = -1; -+ options->tcp_rcv_buf = -1; - } - - /* -@@ -2006,9 +2055,15 @@ - if (options->challenge_response_authentication == -1) - options->challenge_response_authentication = 1; - if (options->gss_authentication == -1) -- options->gss_authentication = 0; -+ options->gss_authentication = 1; -+ if (options->gss_keyex == -1) -+ options->gss_keyex = 1; - if (options->gss_deleg_creds == -1) -- options->gss_deleg_creds = 0; -+ options->gss_deleg_creds = 1; -+ if (options->gss_trust_dns == -1) -+ options->gss_trust_dns = 0; -+ if (options->gss_renewal_rekey == -1) -+ options->gss_renewal_rekey = 0; - if (options->password_authentication == -1) - options->password_authentication = 1; - if (options->kbd_interactive_authentication == -1) -@@ -2104,7 +2159,8 @@ - if (options->hpn_disabled == -1) - options->hpn_disabled = 0; - if (options->audit_disabled == -1) -- options->audit_disabled = 0; -+ // Auditing disabled by default for GSI-OpenSSH -+ options->audit_disabled = 1; - if (options->hpn_buffer_size > -1) { - /* if a user tries to set the size to 0 set it to 1KB */ - if (options->hpn_buffer_size == 0) -diff -Nur openssh-7.5p1/readconf.h gsi-openssh/readconf.h ---- openssh-7.5p1/readconf.h 2018-12-20 11:48:40.820000000 +0100 -+++ gsi-openssh/readconf.h 2018-12-20 11:49:17.648000000 +0100 -@@ -45,7 +45,12 @@ - int challenge_response_authentication; - /* Try S/Key or TIS, authentication. */ - int gss_authentication; /* Try GSS authentication */ -+ int gss_keyex; /* Try GSS key exchange */ - int gss_deleg_creds; /* Delegate GSS credentials */ -+ int gss_trust_dns; /* Trust DNS for GSS canonicalization */ -+ int gss_renewal_rekey; /* Credential renewal forces rekey */ -+ char *gss_client_identity; /* Principal to initiate GSSAPI with */ -+ char *gss_server_identity; /* GSSAPI target principal */ - int password_authentication; /* Try password - * authentication. */ - int kbd_interactive_authentication; /* Try keyboard-interactive auth. */ -@@ -84,6 +89,8 @@ - char *host_key_alias; /* hostname alias for .ssh/known_hosts */ - char *proxy_command; /* Proxy command for connecting the host. */ - char *user; /* User to log in as. */ -+ int implicit; /* Login user was not specified. -+ Server may choose based on authctxt. */ - int escape_char; /* Escape character; -2 = none */ - - u_int num_system_hostfiles; /* Paths for /etc/ssh/ssh_known_hosts */ -diff -Nur openssh-7.5p1/scp.c gsi-openssh/scp.c ---- openssh-7.5p1/scp.c 2018-12-20 11:48:23.672000000 +0100 -+++ gsi-openssh/scp.c 2018-12-20 11:49:17.652000000 +0100 -@@ -147,7 +147,7 @@ - int throughlocal = 0; - - /* This is the program to execute for the secured connection. ("ssh" or -S) */ --char *ssh_program = _PATH_SSH_PROGRAM; -+char *ssh_program; - - /* This is used to store the pid of ssh_program */ - pid_t do_cmd_pid = -1; -@@ -388,6 +388,8 @@ - argv = newargv; - - __progname = ssh_get_progname(argv[0]); -+ init_pathnames(); -+ ssh_program = _PATH_SSH_PROGRAM; - - memset(&args, '\0', sizeof(args)); - memset(&remote_remote_args, '\0', sizeof(remote_remote_args)); -@@ -518,8 +520,8 @@ - - remin = remout = -1; - do_cmd_pid = -1; -- /* Command to be executed on remote system using "ssh". */ -- (void) snprintf(cmd, sizeof cmd, "scp%s%s%s%s", -+ /* Command to be executed on remote system using "gsissh". */ -+ (void) snprintf(cmd, sizeof cmd, "gsiscp%s%s%s%s", - verbose_mode ? " -v" : "", - iamrecursive ? " -r" : "", pflag ? " -p" : "", - targetshouldbedirectory ? " -d" : ""); -@@ -1256,7 +1258,7 @@ - usage(void) - { - (void) fprintf(stderr, -- "usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]\n" -+ "usage: gsiscp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]\n" - " [-l limit] [-o ssh_option] [-P port] [-S program]\n" - " [[user@]host1:]file1 ... [[user@]host2:]file2\n"); - exit(1); -diff -Nur openssh-7.5p1/servconf.c gsi-openssh/servconf.c ---- openssh-7.5p1/servconf.c 2018-12-20 11:48:40.820000000 +0100 -+++ gsi-openssh/servconf.c 2018-12-20 12:08:52.948000000 +0100 -@@ -75,6 +75,7 @@ - - /* Portable-specific options */ - options->use_pam = -1; -+ options->permit_pam_user_change = -1; - - /* Standard Options */ - options->num_ports = 0; -@@ -112,10 +113,19 @@ - options->kerberos_authentication = -1; - options->kerberos_or_local_passwd = -1; - options->kerberos_ticket_cleanup = -1; -+#ifdef SESSION_HOOKS -+ options->session_hooks_allow = -1; -+ options->session_hooks_startup_cmd = NULL; -+ options->session_hooks_shutdown_cmd = NULL; -+#endif - options->kerberos_get_afs_token = -1; -- options->gss_authentication=-1; -+ options->gss_authentication = -1; -+ options->gss_deleg_creds = -1; -+ options->gss_keyex = -1; - options->gss_cleanup_creds = -1; - options->gss_strict_acceptor = -1; -+ options->gsi_allow_limited_proxy = -1; -+ options->gss_store_rekey = -1; - options->password_authentication = -1; - options->kbd_interactive_authentication = -1; - options->challenge_response_authentication = -1; -@@ -206,6 +216,8 @@ - /* Portable-specific options */ - if (options->use_pam == -1) - options->use_pam = 0; -+ if (options->permit_pam_user_change == -1) -+ options->permit_pam_user_change = 0; - - /* Standard Options */ - if (options->num_host_key_files == 0) { -@@ -274,14 +286,26 @@ - options->kerberos_or_local_passwd = 1; - if (options->kerberos_ticket_cleanup == -1) - options->kerberos_ticket_cleanup = 1; -+#ifdef SESSION_HOOKS -+ if (options->session_hooks_allow == -1) -+ options->session_hooks_allow = 0; -+#endif - if (options->kerberos_get_afs_token == -1) - options->kerberos_get_afs_token = 0; - if (options->gss_authentication == -1) -- options->gss_authentication = 0; -+ options->gss_authentication = 1; -+ if (options->gss_deleg_creds == -1) -+ options->gss_deleg_creds = 1; -+ if (options->gss_keyex == -1) -+ options->gss_keyex = 1; - if (options->gss_cleanup_creds == -1) - options->gss_cleanup_creds = 1; - if (options->gss_strict_acceptor == -1) - options->gss_strict_acceptor = 1; -+ if (options->gsi_allow_limited_proxy == -1) -+ options->gsi_allow_limited_proxy = 0; -+ if (options->gss_store_rekey == -1) -+ options->gss_store_rekey = 0; - if (options->password_authentication == -1) - options->password_authentication = 1; - if (options->kbd_interactive_authentication == -1) -@@ -337,7 +361,8 @@ - if (options->hpn_disabled == -1) - options->hpn_disabled = 0; - if (options->audit_disabled == -1) -- options->audit_disabled = 0; -+ // Auditing disabled by default for GSI-OpenSSH -+ options->audit_disabled = 1; - - if (options->hpn_buffer_size == -1) { - /* option not explicitly set. Now we have to figure out */ -@@ -436,7 +461,7 @@ - typedef enum { - sBadOption, /* == unknown option */ - /* Portable-specific options */ -- sUsePAM, -+ sUsePAM, sPermitPAMUserChange, - /* Standard Options */ - sPort, sHostKeyFile, sLoginGraceTime, - sPermitRootLogin, sLogFacility, sLogLevel, -@@ -444,6 +469,9 @@ - sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup, - sKerberosGetAFSToken, - sKerberosTgtPassing, sChallengeResponseAuthentication, -+#ifdef SESSION_HOOKS -+ sAllowSessionHooks, sSessionHookStartupCmd, sSessionHookShutdownCmd, -+#endif - sPasswordAuthentication, sKbdInteractiveAuthentication, - sListenAddress, sAddressFamily, - sPrintMotd, sPrintLastLog, sIgnoreRhosts, -@@ -463,6 +491,10 @@ - sClientAliveInterval, sClientAliveCountMax, sAuthorizedKeysFile, - sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor, - sAcceptEnv, sPermitTunnel, -+ sGssDelegateCreds, -+ sGssCredsPath, -+ sGsiAllowLimitedProxy, -+ sGssKeyEx, sGssStoreRekey, - sMatch, sPermitOpen, sForceCommand, sChrootDirectory, - sUsePrivilegeSeparation, sAllowAgentForwarding, - sHostCertificate, -@@ -489,8 +521,10 @@ - /* Portable-specific options */ - #ifdef USE_PAM - { "usepam", sUsePAM, SSHCFG_GLOBAL }, -+ { "permitpamuserchange", sPermitPAMUserChange, SSHCFG_GLOBAL }, - #else - { "usepam", sUnsupported, SSHCFG_GLOBAL }, -+ { "permitpamuserchange", sUnsupported, SSHCFG_GLOBAL }, - #endif - { "pamauthenticationviakbdint", sDeprecated, SSHCFG_GLOBAL }, - /* Standard Options */ -@@ -534,13 +568,36 @@ - { "afstokenpassing", sUnsupported, SSHCFG_GLOBAL }, - #ifdef GSSAPI - { "gssapiauthentication", sGssAuthentication, SSHCFG_ALL }, -+ { "gssapidelegatecredentials", sGssDelegateCreds, SSHCFG_ALL }, - { "gssapicleanupcredentials", sGssCleanupCreds, SSHCFG_GLOBAL }, -+ { "gssapicleanupcreds", sGssCleanupCreds, SSHCFG_GLOBAL }, -+ { "gssapicredentialspath", sGssCredsPath, SSHCFG_GLOBAL }, -+#ifdef GSI -+ { "gsiallowlimitedproxy", sGsiAllowLimitedProxy, SSHCFG_GLOBAL }, -+#endif - { "gssapistrictacceptorcheck", sGssStrictAcceptor, SSHCFG_GLOBAL }, -+ { "gssapikeyexchange", sGssKeyEx, SSHCFG_GLOBAL }, -+ { "gssapistorecredentialsonrekey", sGssStoreRekey, SSHCFG_GLOBAL }, - #else - { "gssapiauthentication", sUnsupported, SSHCFG_ALL }, -+ { "gssapidelegatecredentials", sUnsupported, SSHCFG_ALL }, - { "gssapicleanupcredentials", sUnsupported, SSHCFG_GLOBAL }, -+ { "gssapicleanupcreds", sUnsupported, SSHCFG_GLOBAL }, -+ { "gssapicredentialspath", sUnsupported, SSHCFG_GLOBAL }, -+#ifdef GSI -+ { "gsiallowlimitedproxy", sUnsupported, SSHCFG_GLOBAL }, -+#endif - { "gssapistrictacceptorcheck", sUnsupported, SSHCFG_GLOBAL }, -+ { "gssapikeyexchange", sUnsupported, SSHCFG_GLOBAL }, -+ { "gssapistorecredentialsonrekey", sUnsupported, SSHCFG_GLOBAL }, - #endif -+#ifdef SESSION_HOOKS -+ { "allowsessionhooks", sAllowSessionHooks, SSHCFG_GLOBAL }, -+ { "sessionhookstartupcmd", sSessionHookStartupCmd, SSHCFG_GLOBAL }, -+ { "sessionhookshutdowncmd", sSessionHookShutdownCmd, SSHCFG_GLOBAL }, -+#endif -+ { "gssusesessionccache", sUnsupported, SSHCFG_GLOBAL }, -+ { "gssapiusesessioncredcache", sUnsupported, SSHCFG_GLOBAL }, - { "passwordauthentication", sPasswordAuthentication, SSHCFG_ALL }, - { "kbdinteractiveauthentication", sKbdInteractiveAuthentication, SSHCFG_ALL }, - { "challengeresponseauthentication", sChallengeResponseAuthentication, SSHCFG_GLOBAL }, -@@ -599,6 +656,8 @@ - { "permitopen", sPermitOpen, SSHCFG_ALL }, - { "forcecommand", sForceCommand, SSHCFG_ALL }, - { "chrootdirectory", sChrootDirectory, SSHCFG_ALL }, -+ { "disableusagestats", sUnsupported, SSHCFG_GLOBAL}, -+ { "usagestatstargets", sUnsupported, SSHCFG_GLOBAL}, - { "hostcertificate", sHostCertificate, SSHCFG_GLOBAL }, - { "revokedkeys", sRevokedKeys, SSHCFG_ALL }, - { "trustedusercakeys", sTrustedUserCAKeys, SSHCFG_ALL }, -@@ -1071,6 +1130,10 @@ - intptr = &options->use_pam; - goto parse_flag; - -+ case sPermitPAMUserChange: -+ intptr = &options->permit_pam_user_change; -+ goto parse_flag; -+ - /* Standard Options */ - case sBadOption: - return -1; -@@ -1302,10 +1365,49 @@ - intptr = &options->gss_authentication; - goto parse_flag; - -+ case sGssDelegateCreds: -+ intptr = &options->gss_deleg_creds; -+ goto parse_flag; -+ -+ case sGssKeyEx: -+ intptr = &options->gss_keyex; -+ goto parse_flag; -+ - case sGssCleanupCreds: - intptr = &options->gss_cleanup_creds; - goto parse_flag; - -+ case sGssCredsPath: -+ charptr = &options->gss_creds_path; -+ goto parse_filename; -+ -+ case sGssStoreRekey: -+ intptr = &options->gss_store_rekey; -+ goto parse_flag; -+ -+#ifdef GSI -+ case sGsiAllowLimitedProxy: -+ intptr = &options->gsi_allow_limited_proxy; -+ goto parse_flag; -+#endif -+ -+#ifdef SESSION_HOOKS -+ case sAllowSessionHooks: -+ intptr = &options->session_hooks_allow; -+ goto parse_flag; -+ case sSessionHookStartupCmd: -+ case sSessionHookShutdownCmd: -+ arg = strdelim(&cp); -+ if (!arg || *arg == '\0') -+ fatal("%s line %d: empty session hook command", -+ filename, linenum); -+ if (opcode==sSessionHookStartupCmd) -+ options->session_hooks_startup_cmd = strdup(arg); -+ else -+ options->session_hooks_shutdown_cmd = strdup(arg); -+ break; -+#endif -+ - case sGssStrictAcceptor: - intptr = &options->gss_strict_acceptor; - goto parse_flag; -@@ -2053,6 +2155,7 @@ - - M_CP_INTOPT(password_authentication); - M_CP_INTOPT(gss_authentication); -+ M_CP_INTOPT(gss_deleg_creds); - M_CP_INTOPT(pubkey_authentication); - M_CP_INTOPT(kerberos_authentication); - M_CP_INTOPT(hostbased_authentication); -@@ -2335,7 +2438,10 @@ - #endif - #ifdef GSSAPI - dump_cfg_fmtint(sGssAuthentication, o->gss_authentication); -+ dump_cfg_fmtint(sGssKeyEx, o->gss_keyex); - dump_cfg_fmtint(sGssCleanupCreds, o->gss_cleanup_creds); -+ dump_cfg_fmtint(sGssStrictAcceptor, o->gss_strict_acceptor); -+ dump_cfg_fmtint(sGssStoreRekey, o->gss_store_rekey); - #endif - dump_cfg_fmtint(sPasswordAuthentication, o->password_authentication); - dump_cfg_fmtint(sKbdInteractiveAuthentication, -diff -Nur openssh-7.5p1/servconf.h gsi-openssh/servconf.h ---- openssh-7.5p1/servconf.h 2018-12-20 11:48:40.820000000 +0100 -+++ gsi-openssh/servconf.h 2018-12-20 12:56:24.776000000 +0100 -@@ -109,11 +109,21 @@ - * /etc/passwd */ - int kerberos_ticket_cleanup; /* If true, destroy ticket - * file on logout. */ -+#ifdef SESSION_HOOKS -+ int session_hooks_allow; /* If true, permit user hooks */ -+ char* session_hooks_startup_cmd; /* cmd to be executed before */ -+ char* session_hooks_shutdown_cmd; /* cmd to be executed after */ -+#endif - int kerberos_get_afs_token; /* If true, try to get AFS token if - * authenticated with Kerberos. */ -+ int gsi_allow_limited_proxy; /* If true, accept limited proxies */ - int gss_authentication; /* If true, permit GSSAPI authentication */ -+ int gss_deleg_creds; /* If true, store delegated GSSAPI credentials*/ -+ int gss_keyex; /* If true, permit GSSAPI key exchange */ - int gss_cleanup_creds; /* If true, destroy cred cache on logout */ -+ char* gss_creds_path; /* If true, destroy cred cache on logout */ - int gss_strict_acceptor; /* If true, restrict the GSSAPI acceptor name */ -+ int gss_store_rekey; - int password_authentication; /* If true, permit password - * authentication. */ - int kbd_interactive_authentication; /* If true, permit */ -@@ -167,6 +177,7 @@ - - int use_pam; /* Enable auth via PAM */ - int tcp_rcv_buf_poll; /* poll tcp rcv window in autotuning kernels*/ -+ int permit_pam_user_change; /* Allow PAM to change user name */ - int hpn_disabled; /* disable hpn functionality. false by default */ - int hpn_buffer_size; /* set the hpn buffer size - default 3MB */ - -diff -Nur openssh-7.5p1/session.c gsi-openssh/session.c ---- openssh-7.5p1/session.c 2018-12-20 11:48:40.824000000 +0100 -+++ gsi-openssh/session.c 2018-12-20 11:49:17.652000000 +0100 -@@ -137,6 +137,11 @@ - - static int session_pty_req(Session *); - -+#ifdef SESSION_HOOKS -+static void execute_session_hook(char* prog, Authctxt *authctxt, -+ int startup, int save); -+#endif -+ - /* import */ - extern ServerOptions options; - extern char *__progname; -@@ -273,6 +278,22 @@ - auth_debug_send(); - - do_authenticated2(authctxt); -+ -+#ifdef SESSION_HOOKS -+ if (options.session_hooks_allow && -+ options.session_hooks_shutdown_cmd) -+ { -+ execute_session_hook(options.session_hooks_shutdown_cmd, -+ authctxt, -+ /* startup = */ 0, /* save = */ 0); -+ -+ if (authctxt->session_env_file) -+ { -+ free(authctxt->session_env_file); -+ } -+ } -+#endif -+ - do_cleanup(authctxt); - } - -@@ -692,6 +713,26 @@ - tty += 5; - } - -+#if defined(SESSION_HOOKS) -+ if (options.session_hooks_allow && -+ (options.session_hooks_startup_cmd || -+ options.session_hooks_shutdown_cmd)) -+ { -+ char env_file[1000]; -+ struct stat st; -+ do -+ { -+ snprintf(env_file, -+ sizeof(env_file), -+ "/tmp/ssh_env_%d%d%d", -+ getuid(), -+ getpid(), -+ rand()); -+ } while (stat(env_file, &st)==0); -+ s->authctxt->session_env_file = strdup(env_file); -+ } -+#endif -+ - verbose("Starting session: %s%s%s for %s from %.200s port %d id %d", - session_type, - tty == NULL ? "" : " on ", -@@ -935,6 +976,117 @@ - fclose(f); - } - -+#ifdef SESSION_HOOKS -+#define SSH_SESSION_ENV_FILE "SSH_SESSION_ENV_FILE" -+ -+typedef enum { no_op, execute, clear_env, restore_env, -+ read_env, save_or_rm_env } session_action_t; -+ -+static session_action_t action_order[2][5] = { -+ { clear_env, read_env, execute, save_or_rm_env, restore_env }, /*shutdown*/ -+ { execute, read_env, save_or_rm_env, no_op, no_op } /*startup */ -+}; -+ -+static -+void execute_session_hook(char* prog, Authctxt *authctxt, -+ int startup, int save) -+{ -+ extern char **environ; -+ -+ struct stat st; -+ char **saved_env, **tmpenv; -+ char *env_file = authctxt->session_env_file; -+ int i, status = 0; -+ -+ for (i=0; i<5; i++) -+ { -+ switch (action_order[startup][i]) -+ { -+ case no_op: -+ break; -+ -+ case execute: -+ { -+ FILE* fp; -+ char buf[1000]; -+ -+ snprintf(buf, -+ sizeof(buf), -+ "%s -c '%s'", -+ authctxt->pw->pw_shell, -+ prog); -+ -+ debug("executing session hook: [%s]", buf); -+ setenv(SSH_SESSION_ENV_FILE, env_file, /* overwrite = */ 1); -+ -+ /* flusing is recommended in the popen(3) man page, to avoid -+ intermingling of output */ -+ fflush(stdout); -+ fflush(stderr); -+ if ((fp=popen(buf, "w")) == NULL) -+ { -+ perror("Unable to run session hook"); -+ return; -+ } -+ status = pclose(fp); -+ debug2("session hook executed, status=%d", status); -+ unsetenv(SSH_SESSION_ENV_FILE); -+ } -+ break; -+ -+ case clear_env: -+ saved_env = environ; -+ tmpenv = (char**) malloc(sizeof(char*)); -+ tmpenv[0] = NULL; -+ environ = tmpenv; -+ break; -+ -+ case restore_env: -+ environ = saved_env; -+ free(tmpenv); -+ break; -+ -+ case read_env: -+ if (status==0 && stat(env_file, &st)==0) -+ { -+ int envsize = 0; -+ -+ debug("reading environment from %s", env_file); -+ while (environ[envsize++]) ; -+ read_environment_file(&environ, &envsize, env_file); -+ } -+ break; -+ -+ case save_or_rm_env: -+ if (status==0 && save) -+ { -+ FILE* fp; -+ int envcount=0; -+ -+ debug2("saving environment to %s", env_file); -+ if ((fp = fopen(env_file, "w")) == NULL) /* hmm: file perms? */ -+ { -+ perror("Unable to save session hook info"); -+ } -+ while (environ[envcount]) -+ { -+ fprintf(fp, "%s\n", environ[envcount++]); -+ } -+ fflush(fp); -+ fclose(fp); -+ } -+ else if (stat(env_file, &st)==0) -+ { -+ debug2("removing environment file %s", env_file); -+ remove(env_file); -+ } -+ break; -+ } -+ } -+ -+} -+#endif -+ - #ifdef HAVE_ETC_DEFAULT_LOGIN - /* - * Return named variable from specified environment, or NULL if not present. -@@ -1064,7 +1216,7 @@ - child_set_env(&env, &envsize, "HOME", pw->pw_dir); - #ifdef HAVE_LOGIN_CAP - if (setusercontext(lc, pw, pw->pw_uid, LOGIN_SETPATH) < 0) -- child_set_env(&env, &envsize, "PATH", _PATH_STDPATH); -+ child_set_env(&env, &envsize, "PATH", _PATH_STDPATH_WITH_SCP); - else - child_set_env(&env, &envsize, "PATH", getenv("PATH")); - #else /* HAVE_LOGIN_CAP */ -@@ -1081,7 +1233,7 @@ - # endif /* HAVE_ETC_DEFAULT_LOGIN */ - if (path == NULL || *path == '\0') { - child_set_env(&env, &envsize, "PATH", -- s->pw->pw_uid == 0 ? SUPERUSER_PATH : _PATH_STDPATH); -+ s->pw->pw_uid == 0 ? SUPERUSER_PATH : _PATH_STDPATH_WITH_SCP); - } - # endif /* HAVE_CYGWIN */ - #endif /* HAVE_LOGIN_CAP */ -@@ -1095,6 +1247,25 @@ - if (getenv("TZ")) - child_set_env(&env, &envsize, "TZ", getenv("TZ")); - -+#ifdef GSI /* GSI shared libs typically installed in non-system locations. */ -+ { -+ char *cp; -+ -+ if ((cp = getenv("LD_LIBRARY_PATH")) != NULL) -+ child_set_env(&env, &envsize, "LD_LIBRARY_PATH", cp); -+ if ((cp = getenv("LIBPATH")) != NULL) -+ child_set_env(&env, &envsize, "LIBPATH", cp); -+ if ((cp = getenv("SHLIB_PATH")) != NULL) -+ child_set_env(&env, &envsize, "SHLIB_PATH", cp); -+ if ((cp = getenv("LD_LIBRARYN32_PATH")) != NULL) -+ child_set_env(&env, &envsize, "LD_LIBRARYN32_PATH",cp); -+ if ((cp = getenv("LD_LIBRARY64_PATH")) != NULL) -+ child_set_env(&env, &envsize, "LD_LIBRARY64_PATH",cp); -+ if ((cp = getenv("GLOBUS_LOCATION")) != NULL) -+ child_set_env(&env, &envsize, "GLOBUS_LOCATION",cp); -+ } -+#endif -+ - /* Set custom environment options from RSA authentication. */ - while (custom_environment) { - struct envstring *ce = custom_environment; -@@ -1235,10 +1406,11 @@ - fprintf(stderr, "Could not run %s\n", - _PATH_SSH_USER_RC); - } else if (stat(_PATH_SSH_SYSTEM_RC, &st) >= 0) { -+ snprintf(cmd, sizeof cmd, "%s %s", _PATH_BSHELL, -+ _PATH_SSH_SYSTEM_RC); - if (debug_flag) -- fprintf(stderr, "Running %s %s\n", _PATH_BSHELL, -- _PATH_SSH_SYSTEM_RC); -- f = popen(_PATH_BSHELL " " _PATH_SSH_SYSTEM_RC, "w"); -+ fprintf(stderr, "Running %s\n", cmd); -+ f = popen(cmd, "w"); - if (f) { - if (do_xauth) - fprintf(f, "%s %s\n", s->auth_proto, -@@ -1523,6 +1695,18 @@ - struct passwd *pw = s->pw; - int r = 0; - -+#ifdef AFS_KRB5 -+/* Default place to look for aklog. */ -+#ifdef AKLOG_PATH -+#define KPROGDIR AKLOG_PATH -+#else -+#define KPROGDIR "/usr/bin/aklog" -+#endif /* AKLOG_PATH */ -+ -+ struct stat st; -+ char *aklog_path; -+#endif /* AFS_KRB5 */ -+ - /* remove hostkey from the child's memory */ - destroy_sensitive_data(); - -@@ -1625,6 +1809,41 @@ - } - #endif - -+#ifdef AFS_KRB5 -+ -+ /* User has authenticated, and if a ticket was going to be -+ * passed we would have it. KRB5CCNAME should already be set. -+ * Now try to get an AFS token using aklog. -+ */ -+ if (k_hasafs()) { /* Do we have AFS? */ -+ -+ aklog_path = xstrdup(KPROGDIR); -+ -+ /* -+ * Make sure it exists before we try to run it -+ */ -+ if (stat(aklog_path, &st) == 0) { -+ debug("Running %s to get afs token.",aklog_path); -+ system(aklog_path); -+ } else { -+ debug("%s does not exist.",aklog_path); -+ } -+ -+ free(aklog_path); -+ } -+#endif /* AFS_KRB5 */ -+ -+#ifdef SESSION_HOOKS -+ if (options.session_hooks_allow && -+ options.session_hooks_startup_cmd) -+ { -+ execute_session_hook(options.session_hooks_startup_cmd, -+ s->authctxt, -+ /* startup = */ 1, -+ options.session_hooks_shutdown_cmd != NULL); -+ } -+#endif -+ - /* Change current directory to the user's home directory. */ - if (chdir(pw->pw_dir) < 0) { - /* Suppress missing homedir warning for chroot case */ -@@ -1699,7 +1918,7 @@ - /* Execute the shell. */ - argv[0] = argv0; - argv[1] = NULL; -- execve(shell, argv, env); -+ execve(shell, argv, environ); - - /* Executing the shell failed. */ - perror(shell); -@@ -1713,7 +1932,7 @@ - argv[1] = "-c"; - argv[2] = (char *) command; - argv[3] = NULL; -- execve(shell, argv, env); -+ execve(shell, argv, environ); - perror(shell); - exit(1); - } -diff -Nur openssh-7.5p1/sftp.c gsi-openssh/sftp.c ---- openssh-7.5p1/sftp.c 2018-12-20 11:48:23.676000000 +0100 -+++ gsi-openssh/sftp.c 2018-12-20 11:49:17.656000000 +0100 -@@ -2266,7 +2266,7 @@ - char *host = NULL, *userhost, *cp, *file2 = NULL; - int debug_level = 0, sshver = 2; - char *file1 = NULL, *sftp_server = NULL; -- char *ssh_program = _PATH_SSH_PROGRAM, *sftp_direct = NULL; -+ char *ssh_program = NULL, *sftp_direct = NULL; - const char *errstr; - LogLevel ll = SYSLOG_LEVEL_INFO; - arglist args; -@@ -2283,6 +2283,8 @@ - msetlocale(); - - __progname = ssh_get_progname(argv[0]); -+ init_pathnames(); -+ ssh_program = _PATH_SSH_PROGRAM; - memset(&args, '\0', sizeof(args)); - args.list = NULL; - addargs(&args, "%s", ssh_program); -diff -Nur openssh-7.5p1/sftp-server.c gsi-openssh/sftp-server.c ---- openssh-7.5p1/sftp-server.c 2018-12-20 11:48:40.824000000 +0100 -+++ gsi-openssh/sftp-server.c 2018-12-20 11:49:17.656000000 +0100 -@@ -970,6 +970,13 @@ - status = errno_to_portable(errno); - } - send_status(id, status); -+ -+#ifdef NERSC_MOD -+ char* t1buf = encode_string( name, strlen(name)); -+ s_audit("sftp_process_setstat_3", "count=%i int=%d int=%d uristring=%s", -+ get_client_session_id(), (int)getppid(), id, t1buf); -+ free(t1buf); -+#endif - free(name); - } - -@@ -1632,6 +1639,9 @@ - - ssh_malloc_init(); /* must be called before any mallocs */ - __progname = ssh_get_progname(argv[0]); -+ /* NB: No call to init_pathnames() here. The sftp-server doesn't -+ use any fixed paths, which is good, because GLOBUS_LOCATION -+ isn't defined in our environment. */ - log_init(__progname, log_level, log_facility, log_stderr); - - pw = pwcopy(user_pw); -diff -Nur openssh-7.5p1/ssh.1 gsi-openssh/ssh.1 ---- openssh-7.5p1/ssh.1 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/ssh.1 2018-12-20 11:49:17.660000000 +0100 -@@ -1367,8 +1367,38 @@ - explicitly, as that - will render the X11 connection insecure (and will require the user to - manually copy any required authorization cookies). -+.It Ev GSSAPI_MECH_CONF -+Applies to mechglue used to support both GSI and Kerberos GSSAPI mechanisms. -+Used to specify the location of the mech.conf file that lists the mechanism- -+specific GSSAPI libraries (both Kerberos and GSI versions). If -+.Ev GSSAPI_MECH_CONF -+is not set then /etc/mech.conf is used. This applies to both the clients and -+the server. The NCSA GSSAPI mechglue distribution includes a sample mech.conf -+file. You will need to edit the library paths in that file and install it in -+an appropriate location on your system. If the mech.conf file is not found, -+the GSSAPI mechglue library will not load any GSSAPI mechanisms and GSI-OpenSSH -+will simply skip GSSAPI authentication. - .It Ev HOME - Set to the path of the user's home directory. -+.It LD_LIBRARY_PATH -+The ssh client is typically linked dynamically with Globus -+security libraries, which must be present in the dynamic linker's -+search path. This typically requires -+.Cm $GLOBUS_LOCATION/lib -+to be included in the list in the -+.Ev LD_LIBRARY_PATH -+environment variable, which is set by the -+.Cm $GLOBUS_LOCATION/libexec/globus-script-initializer -+script, which should be called from any -+.Cm ssh -+invocation script. -+Alternatively, to set -+.Ev LD_LIBRARY_PATH -+appropriately for the Globus libraries in an interactive shell, source -+.Cm $GLOBUS_LOCATION/etc/globus-user-env.sh -+(for sh shells) or -+.Cm $GLOBUS_LOCATION/etc/globus-user.env.csh -+(for csh shells). - .It Ev LOGNAME - Synonym for - .Ev USER ; -@@ -1427,6 +1457,18 @@ - on to new connections). - .It Ev USER - Set to the name of the user logging in. -+.It Ev X509_CERT_DIR -+Used for GSI authentication. Specifies a non-standard location for the -+CA certificates directory. -+.It Ev X509_USER_CERT -+Used for GSI authentication. Specifies a non-standard location for the -+certificate to be used for authentication to the server. -+.It Ev X509_USER_KEY -+Used for GSI authentication. Specifies a non-standard location for the -+private key to be used for authentication to the server. -+.It Ev X509_USER_PROXY -+Used for GSI authentication. Specifies a non-standard location for the -+proxy credential to be used for authentication to the server. - .El - .Pp - Additionally, -diff -Nur openssh-7.5p1/ssh-add.c gsi-openssh/ssh-add.c ---- openssh-7.5p1/ssh-add.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/ssh-add.c 2018-12-20 11:49:17.660000000 +0100 -@@ -486,6 +486,7 @@ - sanitise_stdfd(); - - __progname = ssh_get_progname(argv[0]); -+ init_pathnames(); - seed_rng(); - - #ifdef WITH_OPENSSL -diff -Nur openssh-7.5p1/ssh-agent.c gsi-openssh/ssh-agent.c ---- openssh-7.5p1/ssh-agent.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/ssh-agent.c 2018-12-20 11:49:17.664000000 +0100 -@@ -79,6 +79,7 @@ - #include "authfd.h" - #include "compat.h" - #include "log.h" -+#include "pathnames.h" - #include "misc.h" - #include "digest.h" - #include "ssherr.h" -@@ -1238,6 +1239,7 @@ - #endif - - __progname = ssh_get_progname(av[0]); -+ init_pathnames(); - seed_rng(); - - while ((ch = getopt(ac, av, "cDdksE:a:P:t:")) != -1) { -diff -Nur openssh-7.5p1/ssh.c gsi-openssh/ssh.c ---- openssh-7.5p1/ssh.c 2018-12-20 11:48:23.676000000 +0100 -+++ gsi-openssh/ssh.c 2018-12-20 11:49:17.664000000 +0100 -@@ -470,6 +470,32 @@ - fatal("Can't open user config file %.100s: " - "%.100s", config, strerror(errno)); - } else { -+ /* -+ * Since the config file parsing code aborts if it sees -+ * options it doesn't recognize, allow users to put -+ * options specific to compile-time add-ons in alternate -+ * config files so their primary config file will -+ * interoperate SSH versions that don't support those -+ * options. -+ */ -+#ifdef GSSAPI -+ r = snprintf(buf, sizeof buf, "%s/%s.gssapi", pw->pw_dir, -+ _PATH_SSH_USER_CONFFILE); -+ if (r > 0 && (size_t)r < sizeof(buf)) -+ (void)read_config_file(buf, pw, host, host_arg, &options, 1); -+#ifdef GSI -+ r = snprintf(buf, sizeof buf, "%s/%s.gsi", pw->pw_dir, -+ _PATH_SSH_USER_CONFFILE); -+ if (r > 0 && (size_t)r < sizeof(buf)) -+ (void)read_config_file(buf, pw, host, host_arg, &options, 1); -+#endif -+#if defined(KRB5) -+ r = snprintf(buf, sizeof buf, "%s/%s.krb", pw->pw_dir, -+ _PATH_SSH_USER_CONFFILE); -+ if (r > 0 && (size_t)r < sizeof(buf)) -+ (void)read_config_file(buf, pw, host, host_arg, &options, 1); -+#endif -+#endif - r = snprintf(buf, sizeof buf, "%s/%s", pw->pw_dir, - _PATH_SSH_USER_CONFFILE); - if (r > 0 && (size_t)r < sizeof(buf)) -@@ -530,6 +556,7 @@ - sanitise_stdfd(); - - __progname = ssh_get_progname(av[0]); -+ init_pathnames(); - - #ifndef HAVE_SETPROCTITLE - /* Prepare for later setproctitle emulation */ -@@ -1179,8 +1206,11 @@ - - seed_rng(); - -- if (options.user == NULL) -+ if (options.user == NULL) { - options.user = xstrdup(pw->pw_name); -+ options.implicit = 1; -+ } -+ else options.implicit = 0; - - if (gethostname(thishost, sizeof(thishost)) == -1) - fatal("gethostname: %s", strerror(errno)); -diff -Nur openssh-7.5p1/ssh_config gsi-openssh/ssh_config ---- openssh-7.5p1/ssh_config 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/ssh_config 2018-12-20 11:49:17.664000000 +0100 -@@ -24,8 +24,11 @@ - # RSAAuthentication yes - # PasswordAuthentication yes - # HostbasedAuthentication no --# GSSAPIAuthentication no --# GSSAPIDelegateCredentials no -+# GSSAPIAuthentication yes -+# GSSAPIDelegateCredentials yes -+# GSSAPIKeyExchange yes -+# GSSAPITrustDNS no -+# GSSAPIRenewalForcesRekey no - # BatchMode no - # CheckHostIP yes - # AddressFamily any -diff -Nur openssh-7.5p1/ssh_config.5 gsi-openssh/ssh_config.5 ---- openssh-7.5p1/ssh_config.5 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/ssh_config.5 2018-12-20 11:49:17.668000000 +0100 -@@ -55,6 +55,12 @@ - user's configuration file - .Pq Pa ~/.ssh/config - .It -+GSSAPI configuration file -+.Pq Pa $HOME/.ssh/config.gssapi -+.It -+Kerberos configuration file -+.Pq Pa $HOME/.ssh/config.krb -+.It - system-wide configuration file - .Pq Pa /etc/ssh/ssh_config - .El -@@ -751,11 +757,45 @@ - .It Cm GSSAPIAuthentication - Specifies whether user authentication based on GSSAPI is allowed. - The default is --.Cm no . -+.Cm yes . -+Note that this option applies to protocol version 2 only. - .It Cm GSSAPIDelegateCredentials - Forward (delegate) credentials to the server. - The default is -+.Cm yes . -+Note that this option applies to protocol version 2 connections using GSSAPI. -+.It Cm GSSAPIKeyExchange -+Specifies whether key exchange based on GSSAPI may be used. When using -+GSSAPI key exchange the server need not have a host key. -+The default is -+.Cm yes . -+Note that this option applies to protocol version 2 only. -+.It Cm GSSAPIClientIdentity -+If set, specifies the GSSAPI client identity that ssh should use when -+connecting to the server. The default is unset, which means that the default -+identity will be used. -+.It Cm GSSAPIServerIdentity -+If set, specifies the GSSAPI server identity that ssh should expect when -+connecting to the server. The default is unset, which means that the -+expected GSSAPI server identity will be determined from the target -+hostname. -+.It Cm GSSAPIRenewalForcesRekey -+If set to -+.Cm yes -+then renewal of the client's GSSAPI credentials will force the rekeying of the -+ssh connection. With a compatible server, this can delegate the renewed -+credentials to a session on the server. -+The default is - .Cm no . -+.It Cm GSSAPITrustDNS -+Set to -+.Cm yes to indicate that the DNS is trusted to securely canonicalize -+the name of the host being connected to. If -+.Cm no, the hostname entered on the -+command line will be passed untouched to the GSSAPI library. -+The default is -+.Cm no . -+This option only applies to protocol version 2 connections using GSSAPI. - .It Cm HashKnownHosts - Indicates that - .Xr ssh 1 -@@ -1189,7 +1229,7 @@ - .Cm password ) . - The default is: - .Bd -literal -offset indent --gssapi-with-mic,hostbased,publickey, -+gssapi-keyex,gssapi-with-mic,hostbased,publickey, - keyboard-interactive,password - .Ed - .It Cm Protocol -diff -Nur openssh-7.5p1/sshconnect2.c gsi-openssh/sshconnect2.c ---- openssh-7.5p1/sshconnect2.c 2018-12-20 11:48:23.680000000 +0100 -+++ gsi-openssh/sshconnect2.c 2018-12-20 11:49:17.668000000 +0100 -@@ -75,12 +75,14 @@ - - #ifdef GSSAPI - #include "ssh-gss.h" -+#include "auth-compat.h" - #endif - - /* import */ - extern char *client_version_string; - extern char *server_version_string; - extern Options options; -+struct kex *xxx_kex; - - /* - * tty_flag is set in ssh.c. Use this in ssh_userauth2: -@@ -172,6 +174,10 @@ - int r; - - memcpy(&myproposal, &myproposal_default, sizeof(myproposal)); -+#ifdef GSSAPI -+ char *orig = NULL, *gss = NULL; -+ char *gss_host = NULL; -+#endif - - xxx_host = host; - xxx_hostaddr = hostaddr; -@@ -179,6 +185,27 @@ - if ((s = kex_names_cat(options.kex_algorithms, "ext-info-c")) == NULL) - fatal("%s: kex_names_cat", __func__); - myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal(s); -+ -+#ifdef GSSAPI -+ if (options.gss_keyex) { -+ /* Add the GSSAPI mechanisms currently supported on this -+ * client to the key exchange algorithm proposal */ -+ orig = myproposal[PROPOSAL_KEX_ALGS]; -+ -+ if (options.gss_trust_dns) -+ gss_host = (char *)get_canonical_hostname(active_state, 1); -+ else -+ gss_host = host; -+ -+ gss = ssh_gssapi_client_mechanisms(gss_host, options.gss_client_identity); -+ if (gss) { -+ debug("Offering GSSAPI proposal: %s", gss); -+ xasprintf(&myproposal[PROPOSAL_KEX_ALGS], -+ "%s,%s", gss, orig); -+ } -+ } -+#endif -+ - myproposal[PROPOSAL_ENC_ALGS_CTOS] = - compat_cipher_proposal(options.ciphers); - myproposal[PROPOSAL_ENC_ALGS_STOC] = -@@ -203,6 +230,17 @@ - order_hostkeyalgs(host, hostaddr, port)); - } - -+#ifdef GSSAPI -+ /* If we've got GSSAPI algorithms, then we also support the -+ * 'null' hostkey, as a last resort */ -+ if (options.gss_keyex && gss) { -+ orig = myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS]; -+ xasprintf(&myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS], -+ "%s,null", orig); -+ free(gss); -+ } -+#endif -+ - if (options.rekey_limit || options.rekey_interval) - packet_set_rekey_limits(options.rekey_limit, - options.rekey_interval); -@@ -222,12 +260,37 @@ - # ifdef OPENSSL_HAS_ECC - kex->kex[KEX_ECDH_SHA2] = kexecdh_client; - # endif -+#ifdef GSSAPI -+ if (options.gss_keyex) { -+ kex->kex[KEX_GSS_GRP1_SHA1] = kexgss_client; -+ kex->kex[KEX_GSS_GRP14_SHA1] = kexgss_client; -+ kex->kex[KEX_GSS_GRP14_SHA256] = kexgss_client; -+ kex->kex[KEX_GSS_GRP16_SHA512] = kexgss_client; -+ kex->kex[KEX_GSS_GRP18_SHA512] = kexgss_client; -+ kex->kex[KEX_GSS_GEX_SHA1] = kexgss_client; -+ } -+#endif - #endif - kex->kex[KEX_C25519_SHA256] = kexc25519_client; - kex->client_version_string=client_version_string; - kex->server_version_string=server_version_string; - kex->verify_host_key=&verify_host_key_callback; - -+#ifdef GSSAPI -+ if (options.gss_keyex) { -+ kex->gss_deleg_creds = options.gss_deleg_creds; -+ kex->gss_trust_dns = options.gss_trust_dns; -+ kex->gss_client = options.gss_client_identity; -+ if (options.gss_server_identity) { -+ kex->gss_host = options.gss_server_identity; -+ } else { -+ kex->gss_host = gss_host; -+ } -+ } -+#endif -+ -+ xxx_kex = kex; -+ - dispatch_run(DISPATCH_BLOCK, &kex->done, active_state); - - /* remove ext-info from the KEX proposals for rekeying */ -@@ -322,6 +385,7 @@ - int input_gssapi_hash(int type, u_int32_t, void *); - int input_gssapi_error(int, u_int32_t, void *); - int input_gssapi_errtok(int, u_int32_t, void *); -+int userauth_gsskeyex(Authctxt *authctxt); - #endif - - void userauth(Authctxt *, char *); -@@ -338,6 +402,11 @@ - - Authmethod authmethods[] = { - #ifdef GSSAPI -+ {"gssapi-keyex", -+ userauth_gsskeyex, -+ NULL, -+ &options.gss_authentication, -+ NULL}, - {"gssapi-with-mic", - userauth_gssapi, - NULL, -@@ -704,19 +773,36 @@ - static u_int mech = 0; - OM_uint32 min; - int ok = 0; -+ char *gss_host = NULL; -+ -+ if (!options.gss_authentication) { -+ verbose("GSSAPI authentication disabled."); -+ return 0; -+ } -+ -+ if (options.gss_server_identity) -+ gss_host = (char *)options.gss_server_identity; -+ else if (options.gss_trust_dns) -+ gss_host = (char *)get_canonical_hostname(active_state, 1); -+ else -+ gss_host = (char *)authctxt->host; - - /* Try one GSSAPI method at a time, rather than sending them all at - * once. */ - - if (gss_supported == NULL) -- gss_indicate_mechs(&min, &gss_supported); -+ if (GSS_ERROR(gss_indicate_mechs(&min, &gss_supported))) { -+ gss_supported = NULL; -+ return 0; -+ } - - /* Check to see if the mechanism is usable before we offer it */ - while (mech < gss_supported->count && !ok) { - /* My DER encoding requires length<128 */ - if (gss_supported->elements[mech].length < 128 && - ssh_gssapi_check_mechanism(&gssctxt, -- &gss_supported->elements[mech], authctxt->host)) { -+ &gss_supported->elements[mech], gss_host, -+ options.gss_client_identity)) { - ok = 1; /* Mechanism works */ - } else { - mech++; -@@ -780,7 +866,8 @@ - - if (status == GSS_S_COMPLETE) { - /* send either complete or MIC, depending on mechanism */ -- if (!(flags & GSS_C_INTEG_FLAG)) { -+ if (strcmp(authctxt->method->name,"gssapi")==0 || -+ (!(flags & GSS_C_INTEG_FLAG))) { - packet_start(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE); - packet_send(); - } else { -@@ -813,8 +900,8 @@ - { - Authctxt *authctxt = ctxt; - Gssctxt *gssctxt; -- int oidlen; -- char *oidv; -+ u_int oidlen; -+ u_char *oidv; - - if (authctxt == NULL) - fatal("input_gssapi_response: no authentication context"); -@@ -927,6 +1014,78 @@ - free(lang); - return 0; - } -+ -+#ifdef GSI -+extern -+const gss_OID_desc * const gss_mech_globus_gssapi_openssl; -+extern -+const gss_OID_desc * const gss_mech_globus_gssapi_openssl_micv2; -+#define is_gsi_oid(oid) \ -+ ((oid->length == gss_mech_globus_gssapi_openssl->length && \ -+ (memcmp(oid->elements, gss_mech_globus_gssapi_openssl->elements, \ -+ oid->length) == 0)) || \ -+ (oid->length == gss_mech_globus_gssapi_openssl_micv2->length && \ -+ (memcmp(oid->elements, gss_mech_globus_gssapi_openssl_micv2->elements, \ -+ oid->length) == 0))) -+#endif -+ -+int -+userauth_gsskeyex(Authctxt *authctxt) -+{ -+ Buffer b; -+ gss_buffer_desc gssbuf; -+ gss_buffer_desc mic = GSS_C_EMPTY_BUFFER; -+ OM_uint32 ms; -+ -+ static int attempt = 0; -+ if (attempt++ >= 1) -+ return (0); -+ -+ if (gss_kex_context == NULL) { -+ debug("No valid Key exchange context"); -+ return (0); -+ } -+ -+#ifdef GSI -+ if (options.implicit && is_gsi_oid(gss_kex_context->oid)) { -+ ssh_gssapi_buildmic(&b, "", authctxt->service, "gssapi-keyex"); -+ } else { -+#endif -+ ssh_gssapi_buildmic(&b, authctxt->server_user, authctxt->service, -+ "gssapi-keyex"); -+#ifdef GSI -+ } -+#endif -+ -+ gssbuf.value = buffer_ptr(&b); -+ gssbuf.length = buffer_len(&b); -+ -+ if (GSS_ERROR(ssh_gssapi_sign(gss_kex_context, &gssbuf, &mic))) { -+ buffer_free(&b); -+ return (0); -+ } -+ -+ packet_start(SSH2_MSG_USERAUTH_REQUEST); -+#ifdef GSI -+ if (options.implicit && is_gsi_oid(gss_kex_context->oid)) { -+ packet_put_cstring(""); -+ } else { -+#endif -+ packet_put_cstring(authctxt->server_user); -+#ifdef GSI -+ } -+#endif -+ packet_put_cstring(authctxt->service); -+ packet_put_cstring(authctxt->method->name); -+ packet_put_string(mic.value, mic.length); -+ packet_send(); -+ -+ buffer_free(&b); -+ gss_release_buffer(&ms, &mic); -+ -+ return (1); -+} -+ - #endif /* GSSAPI */ - - int -diff -Nur openssh-7.5p1/sshd.8 gsi-openssh/sshd.8 ---- openssh-7.5p1/sshd.8 2018-12-20 11:48:40.824000000 +0100 -+++ gsi-openssh/sshd.8 2019-01-10 15:03:02.472000000 +0100 -@@ -739,6 +739,59 @@ - # A CA key, accepted for any host in *.mydomain.com or *.mydomain.org - @cert-authority *.mydomain.org,*.mydomain.com ssh-rsa AAAAB5W... - .Ed -+.Sh ENVIRONMENT -+.Nm -+will normally set the following environment variables: -+.Bl -tag -width "SSH_ORIGINAL_COMMAND" -+.It Ev GRIDMAP -+Applies to GSI authentication/authorization. Specifies the location of the -+gridmapfile. If not specified, the gridmap file is assumed to be available at -+/etc/grid-security/grid-mapfile for services running as root and at -+HOME/.gridmap for services running as non-root where HOME is the home directory -+of the effective user from the password file entry. -+.It Ev GSSAPI_MECH_CONF -+Applies to mechglue used to support both GSI and Kerberos GSSAPI mechanisms. -+Used to specify the location of the mech.conf file that lists the mechanism- -+specific GSSAPI libraries (both Kerberos and GSI versions). If -+.Ev GSSAPI_MECH_CONF -+is not set then /etc/mech.conf is used. This applies to both the clients and -+the server. The NCSA GSSAPI mechglue distribution includes a sample mech.conf -+file. You will need to edit the library paths in that file and install it in -+an appropriate location on your system. If the mech.conf file is not found, -+the GSSAPI mechglue library will not load any GSSAPI mechanisms and GSI-OpenSSH -+will simply skip GSSAPI authentication. -+.It LD_LIBRARY_PATH -+The sshd server is typically linked dynamically with Globus -+security libraries, which must be present in the dynamic linker's -+search path. This typically requires -+.Cm $GLOBUS_LOCATION/lib -+to be included in the list in the -+.Ev LD_LIBRARY_PATH -+environment variable, which is set by the -+.Cm $GLOBUS_LOCATION/libexec/globus-script-initializer -+script, which should be called from any -+.Cm sshd -+startup script. -+Alternatively, to set -+.Ev LD_LIBRARY_PATH -+appropriately for the Globus libraries in an interactive shell, source -+.Cm $GLOBUS_LOCATION/etc/globus-user-env.sh -+(for sh shells) or -+.Cm $GLOBUS_LOCATION/etc/globus-user.env.csh -+(for csh shells). -+.It Ev X509_CERT_DIR -+Used for GSI authentication. Specifies a non-standard location for the -+CA certificates directory. -+.It Ev X509_USER_CERT -+Used for GSI authentication. Specifies a non-standard location for the -+certificate to be used for authentication to the client. -+.It Ev X509_USER_KEY -+Used for GSI authentication. Specifies a non-standard location for the -+private key to be used for authentication to the client. -+.It Ev X509_USER_PROXY -+Used for GSI authentication. Specifies a non-standard location for the -+proxy credential to be used for authentication to the client. -+.El - .Sh FILES - .Bl -tag -width Ds -compact - .It Pa ~/.hushlogin -diff -Nur openssh-7.5p1/sshd.c gsi-openssh/sshd.c ---- openssh-7.5p1/sshd.c 2018-12-20 11:48:40.828000000 +0100 -+++ gsi-openssh/sshd.c 2018-12-20 11:59:46.172000000 +0100 -@@ -121,6 +121,10 @@ - #include "monitor_wrap.h" - #include "ssh-sandbox.h" - #include "version.h" -+ -+#ifdef USE_SECURITY_SESSION_API -+#include -+#endif - #include "ssherr.h" - - #ifdef LIBWRAP -@@ -146,7 +150,7 @@ - extern char n_port[NI_MAXHOST]; - extern int client_session_id; - extern char interface_list[256]; --extern int audit_disabled = 0; -+extern int audit_disabled; - #endif - - extern char *__progname; -@@ -155,7 +159,7 @@ - ServerOptions options; - - /* Name of the server configuration file. */ --char *config_file_name = _PATH_SERVER_CONFIG_FILE; -+char *config_file_name; - - /* - * Debug mode flag. This can be set on the command line. If debug -@@ -901,8 +905,12 @@ - } - debug3("%s: sent %d hostkeys", __func__, nkeys); - if (nkeys == 0) -+#ifdef GSI -+ logit("%s: no hostkeys, but continuing since GSI is enabled", __func__); -+#else - fatal("%s: no hostkeys", __func__); - packet_send(); -+#endif - sshbuf_free(buf); - } - -@@ -1470,6 +1478,8 @@ - (void)set_auth_parameters(ac, av); - #endif - __progname = ssh_get_progname(av[0]); -+ init_pathnames(); -+ config_file_name = _PATH_SERVER_CONFIG_FILE; - - /* Save argv. Duplicate so setproctitle emulation doesn't clobber it */ - saved_argc = ac; -@@ -1738,7 +1748,9 @@ - /* To avoid linking issues, we just set a variable here based on the running configuration - * not my favorite - */ -- if ( options.audit_disabled ) -+ if ( options.audit_disabled == 0) -+ audit_disabled = 0; -+ else - audit_disabled = 1; - - #endif -@@ -1831,10 +1843,13 @@ - key ? "private" : "agent", i, sshkey_ssh_name(pubkey), fp); - free(fp); - } -+#ifndef GSSAPI -+ /* The GSSAPI key exchange can run without a host key */ - if (!sensitive_data.have_ssh2_key) { - logit("sshd: no hostkeys available -- exiting."); - exit(1); - } -+#endif - - /* - * Load certificates. They are stored in an array at identical -@@ -2139,6 +2154,60 @@ - remote_ip, remote_port, laddr, ssh_local_port(ssh)); - free(laddr); - -+#ifdef USE_SECURITY_SESSION_API -+ /* -+ * Create a new security session for use by the new user login if -+ * the current session is the root session or we are not launched -+ * by inetd (eg: debugging mode or server mode). We do not -+ * necessarily need to create a session if we are launched from -+ * inetd because Panther xinetd will create a session for us. -+ * -+ * The only case where this logic will fail is if there is an -+ * inetd running in a non-root session which is not creating -+ * new sessions for us. Then all the users will end up in the -+ * same session (bad). -+ * -+ * When the client exits, the session will be destroyed for us -+ * automatically. -+ * -+ * We must create the session before any credentials are stored -+ * (including AFS pags, which happens a few lines below). -+ */ -+ { -+ OSStatus err = 0; -+ SecuritySessionId sid = 0; -+ SessionAttributeBits sattrs = 0; -+ -+ err = SessionGetInfo(callerSecuritySession, &sid, &sattrs); -+ if (err) -+ error("SessionGetInfo() failed with error %.8X", -+ (unsigned) err); -+ else -+ debug("Current Session ID is %.8X / Session Attributes are %.8X", -+ (unsigned) sid, (unsigned) sattrs); -+ -+ if (inetd_flag && !(sattrs & sessionIsRoot)) -+ debug("Running in inetd mode in a non-root session... " -+ "assuming inetd created the session for us."); -+ else { -+ debug("Creating new security session..."); -+ err = SessionCreate(0, sessionHasTTY | sessionIsRemote); -+ if (err) -+ error("SessionCreate() failed with error %.8X", -+ (unsigned) err); -+ -+ err = SessionGetInfo(callerSecuritySession, &sid, -+ &sattrs); -+ if (err) -+ error("SessionGetInfo() failed with error %.8X", -+ (unsigned) err); -+ else -+ debug("New Session ID is %.8X / Session Attributes are %.8X", -+ (unsigned) sid, (unsigned) sattrs); -+ } -+ } -+#endif -+ - /* set the HPN options for the child */ - channel_set_hpn(options.hpn_disabled, options.hpn_buffer_size); - -@@ -2155,6 +2224,14 @@ - alarm(options.login_grace_time); - - sshd_exchange_identification(ssh, sock_in, sock_out); -+#if defined(AFS_KRB5) -+ /* If machine has AFS, set process authentication group. */ -+ if (k_hasafs()) { -+ k_setpag(); -+ k_unlog(); -+ } -+#endif /* AFS || AFS_KRB5 */ -+ - packet_set_nonblocking(); - - /* allocate authentication context */ -@@ -2211,7 +2288,7 @@ - #endif - - #ifdef GSSAPI -- if (options.gss_authentication) { -+ if (options.gss_authentication && options.gss_deleg_creds) { - temporarily_use_uid(authctxt->pw); - ssh_gssapi_storecreds(); - restore_uid(); -@@ -2350,6 +2427,48 @@ - myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = compat_pkalg_proposal( - list_hostkey_types()); - -+#ifdef GSSAPI -+ { -+ char *orig; -+ char *gss = NULL; -+ char *newstr = NULL; -+ orig = myproposal[PROPOSAL_KEX_ALGS]; -+ -+ /* -+ * If we don't have a host key, then there's no point advertising -+ * the other key exchange algorithms -+ */ -+ -+ if (strlen(myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS]) == 0) -+ orig = NULL; -+ -+ if (options.gss_keyex) -+ gss = ssh_gssapi_server_mechanisms(); -+ else -+ gss = NULL; -+ -+ if (gss && orig) -+ xasprintf(&newstr, "%s,%s", gss, orig); -+ else if (gss) -+ newstr = gss; -+ else if (orig) -+ newstr = orig; -+ -+ /* -+ * If we've got GSSAPI mechanisms, then we've got the 'null' host -+ * key alg, but we can't tell people about it unless its the only -+ * host key algorithm we support -+ */ -+ if (gss && (strlen(myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS])) == 0) -+ myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = "null"; -+ -+ if (newstr) -+ myproposal[PROPOSAL_KEX_ALGS] = newstr; -+ else -+ fatal("No supported key exchange algorithms"); -+ } -+#endif -+ - /* start key exchange */ - if ((r = kex_setup(active_state, myproposal)) != 0) - fatal("kex_setup: %s", ssh_err(r)); -@@ -2365,6 +2484,16 @@ - # ifdef OPENSSL_HAS_ECC - kex->kex[KEX_ECDH_SHA2] = kexecdh_server; - # endif -+#ifdef GSSAPI -+ if (options.gss_keyex) { -+ kex->kex[KEX_GSS_GRP1_SHA1] = kexgss_server; -+ kex->kex[KEX_GSS_GRP14_SHA1] = kexgss_server; -+ kex->kex[KEX_GSS_GRP14_SHA256] = kexgss_server; -+ kex->kex[KEX_GSS_GRP16_SHA512] = kexgss_server; -+ kex->kex[KEX_GSS_GRP18_SHA512] = kexgss_server; -+ kex->kex[KEX_GSS_GEX_SHA1] = kexgss_server; -+ } -+#endif - #endif - kex->kex[KEX_C25519_SHA256] = kexc25519_server; - kex->server = 1; -diff -Nur openssh-7.5p1/sshd_config gsi-openssh/sshd_config ---- openssh-7.5p1/sshd_config 2018-12-20 11:48:40.828000000 +0100 -+++ gsi-openssh/sshd_config 2018-12-21 11:45:24.296000000 +0100 -@@ -67,9 +67,17 @@ - #KerberosTicketCleanup yes - #KerberosGetAFSToken no - -+# Session hooks: if allowed, specify the commands to execute -+#AllowSessionHooks no -+#SessionHookStartupCmd /bin/true -+#SessionHookShutdownCmd /bin/true -+ - # GSSAPI options --#GSSAPIAuthentication no -+#GSSAPIAuthentication yes -+#GSSAPIDelegateCredentials yes - #GSSAPICleanupCredentials yes -+#GSSAPIStrictAcceptorCheck yes -+#GSSAPIKeyExchange yes - - # Set this to 'yes' to enable PAM authentication, account processing, - # and session processing. If this is enabled, PAM authentication will -@@ -82,6 +90,10 @@ - # and ChallengeResponseAuthentication to 'no'. - #UsePAM no - -+# Set to 'yes' to allow the PAM stack to change the user name during -+# calls to authentication -+#PermitPAMUserChange no -+ - #AllowAgentForwarding yes - #AllowTcpForwarding yes - #GatewayPorts no -@@ -116,6 +128,7 @@ - - # disable hpn performance boosts - #HPNDisabled no -+DisableMTAES yes - - # buffer size for hpn to non-hpn connections - #HPNBufferSize 2048 -@@ -124,7 +137,7 @@ - #NoneEnabled no - - # Disable sshd auditing --#AuditDisabled no -+#AuditDisabled yes - - # Example of overriding settings on a per-user basis - #Match User anoncvs -diff -Nur openssh-7.5p1/sshd_config.5 gsi-openssh/sshd_config.5 ---- openssh-7.5p1/sshd_config.5 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/sshd_config.5 2018-12-20 12:04:55.196000000 +0100 -@@ -626,26 +626,62 @@ - .It Cm GSSAPIAuthentication - Specifies whether user authentication based on GSSAPI is allowed. - The default is --.Cm no . -+.Cm yes . -+Note that this option applies to protocol version 2 only. -+.It Cm GSSAPIDelegateCredentials -+Specifies whether delegated credentials are stored in the user's environment. -+The default is -+.Cm yes . -+.It Cm GSSAPIKeyExchange -+Specifies whether key exchange based on GSSAPI is allowed. GSSAPI key exchange -+doesn't rely on ssh keys to verify host identity. -+The default is -+.Cm yes . -+Note that this option applies to protocol version 2 only. - .It Cm GSSAPICleanupCredentials - Specifies whether to automatically destroy the user's credentials cache - on logout. - The default is - .Cm yes . -+Note that this option applies to protocol version 2 only. -+.It Cm GSSAPICredentialsPath -+If specified, the delegated GSSAPI credential is stored in the -+given path, overwriting any existing credentials. -+Paths can be specified with syntax similar to the AuthorizedKeysFile -+option (i.e., accepting %h and %u tokens). -+When using this option, -+setting 'GssapiCleanupCredentials no' is recommended, -+so logging out of one session -+doesn't remove the credentials in use by another session of -+the same user. -+Currently only implemented for the GSI mechanism. -+.It Cm GSIAllowLimitedProxy -+Specifies whether to accept limited proxy credentials for -+authentication. -+The default is -+.Cm no . - .It Cm GSSAPIStrictAcceptorCheck --Determines whether to be strict about the identity of the GSSAPI acceptor --a client authenticates against. --If set to -+Determines whether to be strict about the identity of the GSSAPI acceptor -+a client authenticates against. If - .Cm yes --then the client must authenticate against the host --service on the current hostname. --If set to -+then the client must authenticate against the -+.Pa host -+service on the current hostname. If - .Cm no --then the client may authenticate against any service key stored in the --machine's default store. --This facility is provided to assist with operation on multi homed machines. -+then the client may authenticate against any service key stored in the -+machine's default store. This facility is provided to assist with operation -+on multi homed machines. - The default is - .Cm yes . -+Note that this option applies only to protocol version 2 GSSAPI connections, -+and setting it to -+.Cm no -+may only work with recent Kerberos GSSAPI libraries. -+.It Cm GSSAPIStoreCredentialsOnRekey -+Controls whether the user's GSSAPI credentials should be updated following a -+successful connection rekeying. This option can be used to accepted renewed -+or updated credentials from a compatible client. The default is -+.Cm no . - .It Cm HostbasedAcceptedKeyTypes - Specifies the key types that will be accepted for hostbased authentication - as a comma-separated pattern list. -@@ -1494,6 +1530,34 @@ - as a non-root user. - The default is - .Cm no . -+.It Cm PermitPAMUserChange -+If set to -+.Cm yes -+this will enable PAM authentication to change the name of the user being -+authenticated. The default is -+.Cm no . -+.It Cm UsePrivilegeSeparation -+Specifies whether -+.Xr sshd 8 -+separates privileges by creating an unprivileged child process -+to deal with incoming network traffic. -+After successful authentication, another process will be created that has -+the privilege of the authenticated user. -+The goal of privilege separation is to prevent privilege -+escalation by containing any corruption within the unprivileged processes. -+The argument must be -+.Cm yes , -+.Cm no , -+or -+.Cm sandbox . -+If -+.Cm UsePrivilegeSeparation -+is set to -+.Cm sandbox -+then the pre-authentication unprivileged process is subject to additional -+restrictions. -+The default is -+.Cm sandbox . - .It Cm VersionAddendum - Optionally specifies additional text to append to the SSH protocol banner - sent by the server upon connection. -diff -Nur openssh-7.5p1/ssh-gss.h gsi-openssh/ssh-gss.h ---- openssh-7.5p1/ssh-gss.h 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/ssh-gss.h 2019-01-10 00:44:01.920000000 +0100 -@@ -1,6 +1,6 @@ - /* $OpenBSD: ssh-gss.h,v 1.11 2014/02/26 20:28:44 djm Exp $ */ - /* -- * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. -+ * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions -@@ -33,7 +33,11 @@ - #elif defined(HAVE_GSSAPI_GSSAPI_H) - #include - #endif -+#ifdef HAVE_GSSAPI_GSSAPI_EXT_H -+#include -+#endif - -+#ifndef MECHGLUE - #ifdef KRB5 - # ifndef HEIMDAL - # ifdef HAVE_GSSAPI_GENERIC_H -@@ -50,6 +54,7 @@ - - # endif /* !HEIMDAL */ - #endif /* KRB5 */ -+#endif /* !MECHGLUE */ - - /* draft-ietf-secsh-gsskeyex-06 */ - #define SSH2_MSG_USERAUTH_GSSAPI_RESPONSE 60 -@@ -61,19 +66,39 @@ - - #define SSH_GSS_OIDTYPE 0x06 - -+#define SSH2_MSG_KEXGSS_INIT 30 -+#define SSH2_MSG_KEXGSS_CONTINUE 31 -+#define SSH2_MSG_KEXGSS_COMPLETE 32 -+#define SSH2_MSG_KEXGSS_HOSTKEY 33 -+#define SSH2_MSG_KEXGSS_ERROR 34 -+#define SSH2_MSG_KEXGSS_GROUPREQ 40 -+#define SSH2_MSG_KEXGSS_GROUP 41 -+#define KEX_GSS_GRP1_SHA1_ID "gss-group1-sha1-" -+#define KEX_GSS_GRP14_SHA1_ID "gss-group14-sha1-" -+#define KEX_GSS_GRP14_SHA256_ID "gss-group14-sha256-" -+#define KEX_GSS_GRP16_SHA512_ID "gss-group16-sha512-" -+#define KEX_GSS_GRP18_SHA512_ID "gss-group18-sha512-" -+#define KEX_GSS_GEX_SHA1_ID "gss-gex-sha1-" -+ - typedef struct { - char *filename; - char *envvar; - char *envval; -+ struct passwd *owner; - void *data; - } ssh_gssapi_ccache; - - typedef struct { -+ gss_OID_desc oid; - gss_buffer_desc displayname; - gss_buffer_desc exportedname; - gss_cred_id_t creds; -+ gss_name_t cred_name, ctx_name; - struct ssh_gssapi_mech_struct *mech; - ssh_gssapi_ccache store; -+ gss_ctx_id_t context; /* needed for globus_gss_assist_map_and_authorize() */ -+ int used; -+ int updated; - } ssh_gssapi_client; - - typedef struct ssh_gssapi_mech_struct { -@@ -84,6 +109,7 @@ - int (*userok) (ssh_gssapi_client *, char *); - int (*localname) (ssh_gssapi_client *, char **); - void (*storecreds) (ssh_gssapi_client *); -+ int (*updatecreds) (ssh_gssapi_ccache *, ssh_gssapi_client *); - } ssh_gssapi_mech; - - typedef struct { -@@ -91,13 +117,14 @@ - OM_uint32 minor; /* both */ - gss_ctx_id_t context; /* both */ - gss_name_t name; /* both */ -- gss_OID oid; /* client */ -+ gss_OID oid; /* both */ - gss_cred_id_t creds; /* server */ - gss_name_t client; /* server */ -- gss_cred_id_t client_creds; /* server */ -+ gss_cred_id_t client_creds; /* both */ - } Gssctxt; - - extern ssh_gssapi_mech *supported_mechs[]; -+extern Gssctxt *gss_kex_context; - - int ssh_gssapi_check_oid(Gssctxt *, void *, size_t); - void ssh_gssapi_set_oid_data(Gssctxt *, void *, size_t); -@@ -119,16 +146,40 @@ - void ssh_gssapi_delete_ctx(Gssctxt **); - OM_uint32 ssh_gssapi_sign(Gssctxt *, gss_buffer_t, gss_buffer_t); - void ssh_gssapi_buildmic(Buffer *, const char *, const char *, const char *); --int ssh_gssapi_check_mechanism(Gssctxt **, gss_OID, const char *); -+int ssh_gssapi_check_mechanism(Gssctxt **, gss_OID, const char *, const char *); -+OM_uint32 ssh_gssapi_client_identity(Gssctxt *, const char *); -+int ssh_gssapi_credentials_updated(Gssctxt *); -+ -+int ssh_gssapi_localname(char **name); -+void ssh_gssapi_rekey_creds(); - - /* In the server */ -+typedef int ssh_gssapi_check_fn(Gssctxt **, gss_OID, const char *, -+ const char *); -+char *ssh_gssapi_client_mechanisms(const char *, const char *); -+char *ssh_gssapi_kex_mechs(gss_OID_set, ssh_gssapi_check_fn *, const char *, -+ const char *); -+gss_OID ssh_gssapi_id_kex(Gssctxt *, char *, int); -+int ssh_gssapi_server_check_mech(Gssctxt **,gss_OID, const char *, -+ const char *); - OM_uint32 ssh_gssapi_server_ctx(Gssctxt **, gss_OID); --int ssh_gssapi_userok(char *name); -+int ssh_gssapi_userok(char *name, struct passwd *, int gssapi_keyex); - OM_uint32 ssh_gssapi_checkmic(Gssctxt *, gss_buffer_t, gss_buffer_t); - void ssh_gssapi_do_child(char ***, u_int *); - void ssh_gssapi_cleanup_creds(void); - void ssh_gssapi_storecreds(void); - -+#ifdef MECHGLUE -+gss_cred_id_t __gss_get_mechanism_cred -+ (gss_cred_id_t, /* union_cred */ -+ gss_OID /* mech_type */ -+ ); -+#endif -+ -+char *ssh_gssapi_server_mechanisms(void); -+int ssh_gssapi_oid_table_ok(); -+ -+int ssh_gssapi_update_creds(ssh_gssapi_ccache *store); - #endif /* GSSAPI */ - - #endif /* _SSH_GSS_H */ -diff -Nur openssh-7.5p1/sshkey.c gsi-openssh/sshkey.c ---- openssh-7.5p1/sshkey.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/sshkey.c 2018-12-20 11:49:17.680000000 +0100 -@@ -96,6 +96,9 @@ - { "rsa-sha2-256", "RSA", KEY_RSA, 0, 0, 1 }, - { "rsa-sha2-512", "RSA", KEY_RSA, 0, 0, 1 }, - { "ssh-dss", "DSA", KEY_DSA, 0, 0, 0 }, -+#ifdef GSSAPI -+ { "null", "null", KEY_NULL, 0, 0, 0 }, /* 'null' host key alg for GSSAPI */ -+#endif - # ifdef OPENSSL_HAS_ECC - { "ecdsa-sha2-nistp256", "ECDSA", KEY_ECDSA, NID_X9_62_prime256v1, 0, 0 }, - { "ecdsa-sha2-nistp384", "ECDSA", KEY_ECDSA, NID_secp384r1, 0, 0 }, -diff -Nur openssh-7.5p1/ssh-keygen.c gsi-openssh/ssh-keygen.c ---- openssh-7.5p1/ssh-keygen.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/ssh-keygen.c 2018-12-20 11:49:17.680000000 +0100 -@@ -2284,6 +2284,7 @@ - sanitise_stdfd(); - - __progname = ssh_get_progname(argv[0]); -+ init_pathnames(); - - #ifdef WITH_OPENSSL - OpenSSL_add_all_algorithms(); -diff -Nur openssh-7.5p1/sshkey.h gsi-openssh/sshkey.h ---- openssh-7.5p1/sshkey.h 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/sshkey.h 2018-12-20 11:49:17.680000000 +0100 -@@ -62,6 +62,9 @@ - KEY_DSA_CERT, - KEY_ECDSA_CERT, - KEY_ED25519_CERT, -+#ifdef GSSAPI -+ KEY_NULL, /* 'null' host key alg for GSSAPI mechs */ -+#endif - KEY_UNSPEC - }; - -diff -Nur openssh-7.5p1/ssh-keyscan.c gsi-openssh/ssh-keyscan.c ---- openssh-7.5p1/ssh-keyscan.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/ssh-keyscan.c 2018-12-20 11:49:17.684000000 +0100 -@@ -44,6 +44,7 @@ - #include "log.h" - #include "atomicio.h" - #include "misc.h" -+#include "pathnames.h" - #include "hostfile.h" - #include "ssherr.h" - #include "ssh_api.h" -@@ -703,6 +704,7 @@ - - ssh_malloc_init(); /* must be called before any mallocs */ - __progname = ssh_get_progname(argv[0]); -+ init_pathnames(); - seed_rng(); - TAILQ_INIT(&tq); - -diff -Nur openssh-7.5p1/ssh-keysign.c gsi-openssh/ssh-keysign.c ---- openssh-7.5p1/ssh-keysign.c 2017-03-20 03:39:27.000000000 +0100 -+++ gsi-openssh/ssh-keysign.c 2018-12-20 11:49:17.684000000 +0100 -@@ -185,6 +185,7 @@ - ssh_malloc_init(); /* must be called before any mallocs */ - if (pledge("stdio rpath getpw dns id", NULL) != 0) - fatal("%s: pledge: %s", __progname, strerror(errno)); -+ init_pathnames(); - - /* Ensure that stdin and stdout are connected */ - if ((fd = open(_PATH_DEVNULL, O_RDWR)) < 2) -diff -Nur openssh-7.5p1/version.h gsi-openssh/version.h ---- openssh-7.5p1/version.h 2018-12-20 11:48:40.828000000 +0100 -+++ gsi-openssh/version.h 2018-12-20 11:49:17.684000000 +0100 -@@ -1,8 +1,26 @@ - /* $OpenBSD: version.h,v 1.79 2017/03/20 01:18:59 djm Exp $ */ - - #define SSH_VERSION "OpenSSH_7.5" -+#ifdef GSI -+#define GSI_VERSION " GSI" -+#else -+#define GSI_VERSION "" -+#endif -+ -+#ifdef KRB5 -+#define KRB5_VERSION " KRB5" -+#else -+#define KRB5_VERSION "" -+#endif -+ -+#ifdef MECHGLUE -+#define MGLUE_VERSION " MECHGLUE" -+#else -+#define MGLUE_VERSION "" -+#endif - - #define SSH_PORTABLE "p1" -+#define GSI_PORTABLE "c-GSI" - #define SSH_HPN "-hpn14v13" - #define SSH_RELEASE SSH_VERSION SSH_PORTABLE SSH_HPN - -@@ -10,4 +28,10 @@ - #undef SSH_RELEASE - #define SSH_AUDITING "NMOD_3.19" - #define SSH_RELEASE SSH_VERSION SSH_PORTABLE SSH_HPN SSH_AUDITING -+#else -+#define SSH_AUDITING "" - #endif /* NERSC_MOD */ -+ -+#undef SSH_RELEASE -+#define SSH_RELEASE SSH_VERSION SSH_PORTABLE GSI_PORTABLE " " SSH_AUDITING SSH_HPN \ -+ GSI_VERSION KRB5_VERSION MGLUE_VERSION diff --git a/packaging/debian/gsi-openssh/debian/patches/hpn_isshd-gsi_ossl.7.5p1c.patch b/packaging/debian/gsi-openssh/debian/patches/hpn_isshd-gsi_ossl.7.5p1c.patch deleted file mode 100644 index 6c5a7d20a2..0000000000 --- a/packaging/debian/gsi-openssh/debian/patches/hpn_isshd-gsi_ossl.7.5p1c.patch +++ /dev/null @@ -1,3791 +0,0 @@ -diff --git a/Makefile.in b/Makefile.in -index c25a31b..af73157 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -93,7 +93,7 @@ LIBSSH_OBJS=${LIBOPENSSH_OBJS} \ - kex.o kexdh.o kexgex.o kexecdh.o kexc25519.o \ - kexdhc.o kexgexc.o kexecdhc.o kexc25519c.o \ - kexdhs.o kexgexs.o kexecdhs.o kexc25519s.o \ -- platform-pledge.o platform-tracing.o modp_burl.o nersc.o -+ platform-pledge.o platform-tracing.o modp_burl.o nersc.o libcrypto-compat.o - - SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \ - sshconnect.o sshconnect1.o sshconnect2.o mux.o \ -diff --git a/auth-pam.c b/auth-pam.c -index ed02ae3..079fa13 100644 ---- a/auth-pam.c -+++ b/auth-pam.c -@@ -128,11 +128,11 @@ extern u_int utmp_len; - */ - typedef pthread_t sp_pthread_t; - #else --#define pthread_create openssh_pthread_create --#define pthread_exit openssh_pthread_exit --#define pthread_cancel openssh_pthread_cancel --#define pthread_join openssh_pthread_join - typedef pid_t sp_pthread_t; -+# define pthread_create(a, b, c, d) _ssh_compat_pthread_create(a, b, c, d) -+# define pthread_exit(a) _ssh_compat_pthread_exit(a) -+# define pthread_cancel(a) _ssh_compat_pthread_cancel(a) -+# define pthread_join(a, b) _ssh_compat_pthread_join(a, b) - #endif - - struct pam_ctxt { -diff --git a/auth2-passwd.c b/auth2-passwd.c -index ba38dc7..eb4858b 100644 ---- a/auth2-passwd.c -+++ b/auth2-passwd.c -@@ -81,15 +81,15 @@ userauth_passwd(Authctxt *authctxt) - - #ifdef NERSC_MOD - const EVP_MD *evp_md = EVP_sha1(); -- EVP_MD_CTX ctx; -+ EVP_MD_CTX *ctx = EVP_MD_CTX_new(); - u_char digest[EVP_MAX_MD_SIZE]; - u_int dlen; - - char* t1buf = encode_string(authctxt->user, strlen(authctxt->user)); - -- EVP_DigestInit(&ctx, evp_md); -- EVP_DigestUpdate(&ctx, password, strlen(password)); -- EVP_DigestFinal(&ctx, digest, &dlen); -+ EVP_DigestInit(ctx, evp_md); -+ EVP_DigestUpdate(ctx, password, strlen(password)); -+ EVP_DigestFinal(ctx, digest, &dlen); - - #ifdef PASSWD_REC - char* t2buf = encode_string(password, strlen(password)); -diff --git a/authfd.c b/authfd.c -index a634bcb..e5d3e72 100644 ---- a/authfd.c -+++ b/authfd.c -@@ -207,15 +207,22 @@ deserialise_identity1(struct sshbuf *ids, struct sshkey **keyp, char **commentp) - int r, keybits; - u_int32_t bits; - char *comment = NULL; -+ BIGNUM *e = NULL, *n = NULL; - - if ((key = sshkey_new(KEY_RSA1)) == NULL) - return SSH_ERR_ALLOC_FAIL; -- if ((r = sshbuf_get_u32(ids, &bits)) != 0 || -- (r = sshbuf_get_bignum1(ids, key->rsa->e)) != 0 || -- (r = sshbuf_get_bignum1(ids, key->rsa->n)) != 0 || -- (r = sshbuf_get_cstring(ids, &comment, NULL)) != 0) -+ if ((e = BN_new()) == NULL || -+ (n = BN_new()) == NULL || -+ (r = sshbuf_get_u32(ids, &bits)) != 0 || -+ (r = sshbuf_get_bignum1(ids, e)) != 0 || -+ (r = sshbuf_get_bignum1(ids, n)) != 0 || -+ (r = sshbuf_get_cstring(ids, &comment, NULL)) != 0 || -+ (RSA_set0_key(key->rsa, n, e, NULL) == 0)) { -+ BN_free(n); -+ BN_free(e); - goto out; -- keybits = BN_num_bits(key->rsa->n); -+ } -+ keybits = BN_num_bits(n); - /* XXX previously we just warned here. I think we should be strict */ - if (keybits < 0 || bits != (u_int)keybits) { - r = SSH_ERR_KEY_BITS_MISMATCH; -@@ -393,15 +400,17 @@ ssh_decrypt_challenge(int sock, struct sshkey* key, BIGNUM *challenge, - struct sshbuf *msg; - int r; - u_char type; -+ const BIGNUM *e, *n; - - if (key->type != KEY_RSA1) - return SSH_ERR_INVALID_ARGUMENT; - if ((msg = sshbuf_new()) == NULL) - return SSH_ERR_ALLOC_FAIL; -+ RSA_get0_key(key->rsa, &n, &e, NULL); - if ((r = sshbuf_put_u8(msg, SSH_AGENTC_RSA_CHALLENGE)) != 0 || -- (r = sshbuf_put_u32(msg, BN_num_bits(key->rsa->n))) != 0 || -- (r = sshbuf_put_bignum1(msg, key->rsa->e)) != 0 || -- (r = sshbuf_put_bignum1(msg, key->rsa->n)) != 0 || -+ (r = sshbuf_put_u32(msg, BN_num_bits(n))) != 0 || -+ (r = sshbuf_put_bignum1(msg, e)) != 0 || -+ (r = sshbuf_put_bignum1(msg, n)) != 0 || - (r = sshbuf_put_bignum1(msg, challenge)) != 0 || - (r = sshbuf_put(msg, session_id, 16)) != 0 || - (r = sshbuf_put_u32(msg, 1)) != 0) /* Response type for proto 1.1 */ -@@ -499,15 +508,19 @@ static int - ssh_encode_identity_rsa1(struct sshbuf *b, RSA *key, const char *comment) - { - int r; -+ const BIGNUM *n, *e, *d, *q, *p, *iqmp; - -+ RSA_get0_key(key, &n, &e, &d); -+ RSA_get0_factors(key, &p, &q); -+ RSA_get0_crt_params(key, NULL, NULL, &iqmp); - /* To keep within the protocol: p < q for ssh. in SSL p > q */ -- if ((r = sshbuf_put_u32(b, BN_num_bits(key->n))) != 0 || -- (r = sshbuf_put_bignum1(b, key->n)) != 0 || -- (r = sshbuf_put_bignum1(b, key->e)) != 0 || -- (r = sshbuf_put_bignum1(b, key->d)) != 0 || -- (r = sshbuf_put_bignum1(b, key->iqmp)) != 0 || -- (r = sshbuf_put_bignum1(b, key->q)) != 0 || -- (r = sshbuf_put_bignum1(b, key->p)) != 0 || -+ if ((r = sshbuf_put_u32(b, BN_num_bits(n))) != 0 || -+ (r = sshbuf_put_bignum1(b, n)) != 0 || -+ (r = sshbuf_put_bignum1(b, e)) != 0 || -+ (r = sshbuf_put_bignum1(b, d)) != 0 || -+ (r = sshbuf_put_bignum1(b, iqmp)) != 0 || -+ (r = sshbuf_put_bignum1(b, q)) != 0 || -+ (r = sshbuf_put_bignum1(b, p)) != 0 || - (r = sshbuf_put_cstring(b, comment)) != 0) - return r; - return 0; -@@ -622,11 +635,13 @@ ssh_remove_identity(int sock, struct sshkey *key) - - #ifdef WITH_SSH1 - if (key->type == KEY_RSA1) { -+ const BIGNUM *e, *n; -+ RSA_get0_key(key->rsa, &n, &e, NULL); - if ((r = sshbuf_put_u8(msg, - SSH_AGENTC_REMOVE_RSA_IDENTITY)) != 0 || -- (r = sshbuf_put_u32(msg, BN_num_bits(key->rsa->n))) != 0 || -- (r = sshbuf_put_bignum1(msg, key->rsa->e)) != 0 || -- (r = sshbuf_put_bignum1(msg, key->rsa->n)) != 0) -+ (r = sshbuf_put_u32(msg, BN_num_bits(n))) != 0 || -+ (r = sshbuf_put_bignum1(msg, e)) != 0 || -+ (r = sshbuf_put_bignum1(msg, n)) != 0) - goto out; - } else - #endif -diff --git a/cipher-3des1.c b/cipher-3des1.c -index 9fcc278..2051030 100644 ---- a/cipher-3des1.c -+++ b/cipher-3des1.c -@@ -44,7 +44,7 @@ - */ - struct ssh1_3des_ctx - { -- EVP_CIPHER_CTX k1, k2, k3; -+ EVP_CIPHER_CTX *k1, *k2, *k3; - }; - - const EVP_CIPHER * evp_ssh1_3des(void); -@@ -65,7 +65,7 @@ ssh1_3des_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv, - if (key == NULL) - return 1; - if (enc == -1) -- enc = ctx->encrypt; -+ enc = EVP_CIPHER_CTX_encrypting(ctx); - k1 = k2 = k3 = (u_char *) key; - k2 += 8; - if (EVP_CIPHER_CTX_key_length(ctx) >= 16+8) { -@@ -74,12 +74,19 @@ ssh1_3des_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv, - else - k1 += 16; - } -- EVP_CIPHER_CTX_init(&c->k1); -- EVP_CIPHER_CTX_init(&c->k2); -- EVP_CIPHER_CTX_init(&c->k3); -- if (EVP_CipherInit(&c->k1, EVP_des_cbc(), k1, NULL, enc) == 0 || -- EVP_CipherInit(&c->k2, EVP_des_cbc(), k2, NULL, !enc) == 0 || -- EVP_CipherInit(&c->k3, EVP_des_cbc(), k3, NULL, enc) == 0) { -+ c->k1 = EVP_CIPHER_CTX_new(); -+ c->k2 = EVP_CIPHER_CTX_new(); -+ c->k3 = EVP_CIPHER_CTX_new(); -+ if (c->k1 == NULL || c->k2 == NULL || c->k3 == NULL) { -+ EVP_CIPHER_CTX_free(c->k1); -+ EVP_CIPHER_CTX_free(c->k2); -+ EVP_CIPHER_CTX_free(c->k3); -+ free(c); -+ return 0; -+ } -+ if (EVP_CipherInit(c->k1, EVP_des_cbc(), k1, NULL, enc) == 0 || -+ EVP_CipherInit(c->k2, EVP_des_cbc(), k2, NULL, !enc) == 0 || -+ EVP_CipherInit(c->k3, EVP_des_cbc(), k3, NULL, enc) == 0) { - explicit_bzero(c, sizeof(*c)); - free(c); - EVP_CIPHER_CTX_set_app_data(ctx, NULL); -@@ -95,9 +102,9 @@ ssh1_3des_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, size_t len) - - if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) == NULL) - return 0; -- if (EVP_Cipher(&c->k1, dest, (u_char *)src, len) == 0 || -- EVP_Cipher(&c->k2, dest, dest, len) == 0 || -- EVP_Cipher(&c->k3, dest, dest, len) == 0) -+ if (EVP_Cipher(c->k1, dest, (u_char *)src, len) == 0 || -+ EVP_Cipher(c->k2, dest, dest, len) == 0 || -+ EVP_Cipher(c->k3, dest, dest, len) == 0) - return 0; - return 1; - } -@@ -108,9 +115,9 @@ ssh1_3des_cleanup(EVP_CIPHER_CTX *ctx) - struct ssh1_3des_ctx *c; - - if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) != NULL) { -- EVP_CIPHER_CTX_cleanup(&c->k1); -- EVP_CIPHER_CTX_cleanup(&c->k2); -- EVP_CIPHER_CTX_cleanup(&c->k3); -+ EVP_CIPHER_CTX_free(c->k1); -+ EVP_CIPHER_CTX_free(c->k2); -+ EVP_CIPHER_CTX_free(c->k3); - explicit_bzero(c, sizeof(*c)); - free(c); - EVP_CIPHER_CTX_set_app_data(ctx, NULL); -@@ -128,13 +135,13 @@ ssh1_3des_iv(EVP_CIPHER_CTX *evp, int doset, u_char *iv, int len) - if ((c = EVP_CIPHER_CTX_get_app_data(evp)) == NULL) - return SSH_ERR_INTERNAL_ERROR; - if (doset) { -- memcpy(c->k1.iv, iv, 8); -- memcpy(c->k2.iv, iv + 8, 8); -- memcpy(c->k3.iv, iv + 16, 8); -+ memcpy(EVP_CIPHER_CTX_iv_noconst(c->k1), iv, 8); -+ memcpy(EVP_CIPHER_CTX_iv_noconst(c->k2), iv + 8, 8); -+ memcpy(EVP_CIPHER_CTX_iv_noconst(c->k3), iv + 16, 8); - } else { -- memcpy(iv, c->k1.iv, 8); -- memcpy(iv + 8, c->k2.iv, 8); -- memcpy(iv + 16, c->k3.iv, 8); -+ memcpy(iv, EVP_CIPHER_CTX_iv(c->k1), 8); -+ memcpy(iv + 8, EVP_CIPHER_CTX_iv(c->k2), 8); -+ memcpy(iv + 16, EVP_CIPHER_CTX_iv(c->k3), 8); - } - return 0; - } -@@ -142,17 +149,14 @@ ssh1_3des_iv(EVP_CIPHER_CTX *evp, int doset, u_char *iv, int len) - const EVP_CIPHER * - evp_ssh1_3des(void) - { -- static EVP_CIPHER ssh1_3des; -- -- memset(&ssh1_3des, 0, sizeof(ssh1_3des)); -- ssh1_3des.nid = NID_undef; -- ssh1_3des.block_size = 8; -- ssh1_3des.iv_len = 0; -- ssh1_3des.key_len = 16; -- ssh1_3des.init = ssh1_3des_init; -- ssh1_3des.cleanup = ssh1_3des_cleanup; -- ssh1_3des.do_cipher = ssh1_3des_cbc; -- ssh1_3des.flags = EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH; -- return &ssh1_3des; -+ EVP_CIPHER *ssh1_3des; -+ -+ ssh1_3des = EVP_CIPHER_meth_new(NID_undef, 8, 16); -+ EVP_CIPHER_meth_set_iv_length(ssh1_3des, 0); -+ EVP_CIPHER_meth_set_init(ssh1_3des, ssh1_3des_init); -+ EVP_CIPHER_meth_set_cleanup(ssh1_3des, ssh1_3des_cleanup); -+ EVP_CIPHER_meth_set_do_cipher(ssh1_3des, ssh1_3des_cbc); -+ EVP_CIPHER_meth_set_flags(ssh1_3des, EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH); -+ return ssh1_3des; - } - #endif /* WITH_SSH1 */ -diff --git a/cipher-bf1.c b/cipher-bf1.c -index c205b07..b23bda7 100644 ---- a/cipher-bf1.c -+++ b/cipher-bf1.c -@@ -89,17 +89,28 @@ bf_ssh1_cipher(EVP_CIPHER_CTX *ctx, u_char *out, const u_char *in, - const EVP_CIPHER * - evp_ssh1_bf(void) - { -- static EVP_CIPHER ssh1_bf; -+ EVP_CIPHER *ssh1_bf; - -- memcpy(&ssh1_bf, EVP_bf_cbc(), sizeof(EVP_CIPHER)); -- orig_bf = ssh1_bf.do_cipher; -- ssh1_bf.nid = NID_undef; -+ orig_bf = EVP_CIPHER_meth_get_do_cipher(EVP_bf_cbc()); -+ /* block_size, length, flags from openssl/crypto/engine/eng_cryptodev.c:638 */ -+ ssh1_bf = EVP_CIPHER_meth_new(NID_undef, 8, 32); -+ EVP_CIPHER_meth_set_iv_length(ssh1_bf, 8); -+ EVP_CIPHER_meth_set_flags(ssh1_bf, EVP_CIPH_CBC_MODE); - #ifdef SSH_OLD_EVP -- ssh1_bf.init = bf_ssh1_init; -+ EVP_CIPHER_meth_set_init(ssh1_bf, ssh1_bf_init); -+#else -+ EVP_CIPHER_meth_set_init(ssh1_bf, -+ EVP_CIPHER_meth_get_init(EVP_bf_cbc())); - #endif -- ssh1_bf.do_cipher = bf_ssh1_cipher; -- ssh1_bf.key_len = 32; -- return (&ssh1_bf); -+ /* copy methods and parameters from old EVP_BF_cbc() -+ * meth_dup does not allow to change type and key_len */ -+ EVP_CIPHER_meth_set_cleanup(ssh1_bf, -+ EVP_CIPHER_meth_get_cleanup(EVP_bf_cbc())); -+ EVP_CIPHER_meth_set_ctrl(ssh1_bf, -+ EVP_CIPHER_meth_get_ctrl(EVP_bf_cbc())); -+ /* ASN1 params??? */ -+ EVP_CIPHER_meth_set_do_cipher(ssh1_bf, bf_ssh1_cipher); -+ return ssh1_bf; - } - #endif /* defined(WITH_OPENSSL) && !defined(OPENSSL_NO_BF) */ - -diff --git a/cipher-ctr-mt.c b/cipher-ctr-mt.c -index 300cd90..79349da 100644 ---- a/cipher-ctr-mt.c -+++ b/cipher-ctr-mt.c -@@ -422,7 +422,7 @@ ssh_aes_ctr(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, - destp.u += AES_BLOCK_SIZE; - srcp.u += AES_BLOCK_SIZE; - len -= AES_BLOCK_SIZE; -- ssh_ctr_inc(ctx->iv, AES_BLOCK_SIZE); -+ ssh_ctr_inc(EVP_CIPHER_CTX_iv_noconst(ctx), AES_BLOCK_SIZE); - - /* Increment read index, switch queues on rollover */ - if ((ridx = (ridx + 1) % KQLEN) == 0) { -@@ -500,16 +500,16 @@ ssh_aes_ctr_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv, - } - - if (iv != NULL) { -- memcpy(ctx->iv, iv, AES_BLOCK_SIZE); -+ memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), iv, AES_BLOCK_SIZE); - c->state |= HAVE_IV; - } - - if (c->state == (HAVE_KEY | HAVE_IV)) { - /* Clear queues */ -- memcpy(c->q[0].ctr, ctx->iv, AES_BLOCK_SIZE); -+ memcpy(c->q[0].ctr, EVP_CIPHER_CTX_iv(ctx), AES_BLOCK_SIZE); - c->q[0].qstate = KQINIT; - for (i = 1; i < NUMKQ; i++) { -- memcpy(c->q[i].ctr, ctx->iv, AES_BLOCK_SIZE); -+ memcpy(c->q[i].ctr, EVP_CIPHER_CTX_iv(ctx), AES_BLOCK_SIZE); - ssh_ctr_add(c->q[i].ctr, i * KQLEN, AES_BLOCK_SIZE); - c->q[i].qstate = KQEMPTY; - } -@@ -582,21 +582,18 @@ ssh_aes_ctr_cleanup(EVP_CIPHER_CTX *ctx) - const EVP_CIPHER * - evp_aes_ctr_mt(void) - { -- static EVP_CIPHER aes_ctr; -- -- memset(&aes_ctr, 0, sizeof(EVP_CIPHER)); -- aes_ctr.nid = NID_undef; -- aes_ctr.block_size = AES_BLOCK_SIZE; -- aes_ctr.iv_len = AES_BLOCK_SIZE; -- aes_ctr.key_len = 16; -- aes_ctr.init = ssh_aes_ctr_init; -- aes_ctr.cleanup = ssh_aes_ctr_cleanup; -- aes_ctr.do_cipher = ssh_aes_ctr; -+ EVP_CIPHER *aes_ctr; -+ -+ aes_ctr = EVP_CIPHER_meth_new(NID_undef, AES_BLOCK_SIZE, 16); -+ EVP_CIPHER_meth_set_iv_length(aes_ctr, AES_BLOCK_SIZE); -+ EVP_CIPHER_meth_set_init(aes_ctr, ssh_aes_ctr_init); -+ EVP_CIPHER_meth_set_cleanup(aes_ctr, ssh_aes_ctr_cleanup); -+ EVP_CIPHER_meth_set_do_cipher(aes_ctr, ssh_aes_ctr); - #ifndef SSH_OLD_EVP -- aes_ctr.flags = EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | -- EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CUSTOM_IV; -+ EVP_CIPHER_meth_set_flags(aes_ctr, EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | -+ EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CUSTOM_IV); - #endif -- return &aes_ctr; -+ return aes_ctr; - } - - #endif /* defined(WITH_OPENSSL) */ -diff --git a/cipher.c b/cipher.c -index a4d924a..81d9181 100644 ---- a/cipher.c -+++ b/cipher.c -@@ -403,7 +403,7 @@ cipher_init(struct sshcipher_ctx **ccp, const struct sshcipher *cipher, - ret = SSH_ERR_ALLOC_FAIL; - goto out; - } -- if (EVP_CipherInit(cc->evp, type, NULL, (u_char *)iv, -+ if (EVP_CipherInit(cc->evp, type, (u_char *)key, (u_char *)iv, - (do_encrypt == CIPHER_ENCRYPT)) == 0) { - ret = SSH_ERR_LIBCRYPTO_ERROR; - goto out; -@@ -421,10 +421,6 @@ cipher_init(struct sshcipher_ctx **ccp, const struct sshcipher *cipher, - goto out; - } - } -- if (EVP_CipherInit(cc->evp, NULL, (u_char *)key, NULL, -1) == 0) { -- ret = SSH_ERR_LIBCRYPTO_ERROR; -- goto out; -- } - - if (cipher->discard_len > 0) { - if ((junk = malloc(cipher->discard_len)) == NULL || -@@ -657,7 +653,7 @@ cipher_get_keyiv(struct sshcipher_ctx *cc, u_char *iv, u_int len) - len, iv)) - return SSH_ERR_LIBCRYPTO_ERROR; - } else -- memcpy(iv, cc->evp->iv, len); -+ memcpy(iv, EVP_CIPHER_CTX_iv(cc->evp), len); - break; - #endif - #ifdef WITH_SSH1 -@@ -704,7 +700,7 @@ cipher_set_keyiv(struct sshcipher_ctx *cc, const u_char *iv) - EVP_CTRL_GCM_SET_IV_FIXED, -1, (void *)iv)) - return SSH_ERR_LIBCRYPTO_ERROR; - } else -- memcpy(cc->evp->iv, iv, evplen); -+ memcpy(EVP_CIPHER_CTX_iv_noconst(cc->evp), iv, evplen); - break; - #endif - #ifdef WITH_SSH1 -@@ -718,8 +714,8 @@ cipher_set_keyiv(struct sshcipher_ctx *cc, const u_char *iv) - } - - #ifdef WITH_OPENSSL --#define EVP_X_STATE(evp) (evp)->cipher_data --#define EVP_X_STATE_LEN(evp) (evp)->cipher->ctx_size -+#define EVP_X_STATE(evp) EVP_CIPHER_CTX_get_cipher_data(evp) -+#define EVP_X_STATE_LEN(evp) EVP_CIPHER_impl_ctx_size(EVP_CIPHER_CTX_cipher(evp)) - #endif - - int -diff --git a/dh.c b/dh.c -index 4753124..db192f6 100644 ---- a/dh.c -+++ b/dh.c -@@ -212,14 +212,15 @@ choose_dh(int min, int wantbits, int max) - /* diffie-hellman-groupN-sha1 */ - - int --dh_pub_is_valid(DH *dh, BIGNUM *dh_pub) -+dh_pub_is_valid(const DH *dh, const BIGNUM *dh_pub) - { - int i; - int n = BN_num_bits(dh_pub); - int bits_set = 0; - BIGNUM *tmp; -+ const BIGNUM *p; - -- if (dh_pub->neg) { -+ if (BN_is_negative(dh_pub)) { - logit("invalid public DH value: negative"); - return 0; - } -@@ -232,7 +233,8 @@ dh_pub_is_valid(DH *dh, BIGNUM *dh_pub) - error("%s: BN_new failed", __func__); - return 0; - } -- if (!BN_sub(tmp, dh->p, BN_value_one()) || -+ DH_get0_pqg(dh, &p, NULL, NULL); -+ if (!BN_sub(tmp, p, BN_value_one()) || - BN_cmp(dh_pub, tmp) != -1) { /* pub_exp > p-2 */ - BN_clear_free(tmp); - logit("invalid public DH value: >= p-1"); -@@ -243,14 +245,14 @@ dh_pub_is_valid(DH *dh, BIGNUM *dh_pub) - for (i = 0; i <= n; i++) - if (BN_is_bit_set(dh_pub, i)) - bits_set++; -- debug2("bits set: %d/%d", bits_set, BN_num_bits(dh->p)); -+ debug2("bits set: %d/%d", bits_set, BN_num_bits(p)); - - /* - * if g==2 and bits_set==1 then computing log_g(dh_pub) is trivial - */ - if (bits_set < 4) { - logit("invalid public DH value (%d/%d)", -- bits_set, BN_num_bits(dh->p)); -+ bits_set, BN_num_bits(p)); - return 0; - } - return 1; -@@ -260,9 +262,11 @@ int - dh_gen_key(DH *dh, int need) - { - int pbits; -+ const BIGNUM *p, *pub_key; - -- if (need < 0 || dh->p == NULL || -- (pbits = BN_num_bits(dh->p)) <= 0 || -+ DH_get0_pqg(dh, &p, NULL, NULL); -+ if (need < 0 || p == NULL || -+ (pbits = BN_num_bits(p)) <= 0 || - need > INT_MAX / 2 || 2 * need > pbits) - return SSH_ERR_INVALID_ARGUMENT; - if (need < 256) -@@ -271,10 +275,11 @@ dh_gen_key(DH *dh, int need) - * Pollard Rho, Big step/Little Step attacks are O(sqrt(n)), - * so double requested need here. - */ -- dh->length = MINIMUM(need * 2, pbits - 1); -- if (DH_generate_key(dh) == 0 || -- !dh_pub_is_valid(dh, dh->pub_key)) { -- BN_clear_free(dh->priv_key); -+ DH_set_length(dh, MINIMUM(need * 2, pbits - 1)); -+ if (DH_generate_key(dh) == 0) -+ return SSH_ERR_LIBCRYPTO_ERROR; -+ DH_get0_key(dh, &pub_key, NULL); -+ if (!dh_pub_is_valid(dh, pub_key)) { - return SSH_ERR_LIBCRYPTO_ERROR; - } - return 0; -@@ -284,15 +289,22 @@ DH * - dh_new_group_asc(const char *gen, const char *modulus) - { - DH *dh; -- -- if ((dh = DH_new()) == NULL) -- return NULL; -- if (BN_hex2bn(&dh->p, modulus) == 0 || -- BN_hex2bn(&dh->g, gen) == 0) { -- DH_free(dh); -- return NULL; -- } -+ BIGNUM *p, *g; -+ -+ if ((dh = DH_new()) == NULL || -+ (p = BN_new()) == NULL || -+ (g = BN_new()) == NULL) -+ goto err; -+ if (BN_hex2bn(&p, modulus) == 0 || -+ BN_hex2bn(&g, gen) == 0 || -+ DH_set0_pqg(dh, p, NULL, g) == 0) -+ goto err; - return (dh); -+err: -+ DH_free(dh); -+ BN_free(p); -+ BN_free(g); -+ return NULL; - } - - /* -@@ -307,8 +319,7 @@ dh_new_group(BIGNUM *gen, BIGNUM *modulus) - - if ((dh = DH_new()) == NULL) - return NULL; -- dh->p = modulus; -- dh->g = gen; -+ DH_set0_pqg(dh, modulus, NULL, gen); - - return (dh); - } -diff --git a/dh.h b/dh.h -index bcd485c..344b29e 100644 ---- a/dh.h -+++ b/dh.h -@@ -42,7 +42,7 @@ DH *dh_new_group18(void); - DH *dh_new_group_fallback(int); - - int dh_gen_key(DH *, int); --int dh_pub_is_valid(DH *, BIGNUM *); -+int dh_pub_is_valid(const DH *, const BIGNUM *); - - u_int dh_estimate(int); - -diff --git a/digest-openssl.c b/digest-openssl.c -index c55ceb9..b94045b 100644 ---- a/digest-openssl.c -+++ b/digest-openssl.c -@@ -43,7 +43,7 @@ - - struct ssh_digest_ctx { - int alg; -- EVP_MD_CTX mdctx; -+ EVP_MD_CTX *mdctx; - }; - - struct ssh_digest { -@@ -107,7 +107,7 @@ ssh_digest_bytes(int alg) - size_t - ssh_digest_blocksize(struct ssh_digest_ctx *ctx) - { -- return EVP_MD_CTX_block_size(&ctx->mdctx); -+ return EVP_MD_CTX_block_size(ctx->mdctx); - } - - struct ssh_digest_ctx * -@@ -119,8 +119,9 @@ ssh_digest_start(int alg) - if (digest == NULL || ((ret = calloc(1, sizeof(*ret))) == NULL)) - return NULL; - ret->alg = alg; -- EVP_MD_CTX_init(&ret->mdctx); -- if (EVP_DigestInit_ex(&ret->mdctx, digest->mdfunc(), NULL) != 1) { -+ ret->mdctx = EVP_MD_CTX_new(); -+ if (ret->mdctx == NULL || -+ EVP_DigestInit_ex(ret->mdctx, digest->mdfunc(), NULL) != 1) { - free(ret); - return NULL; - } -@@ -133,7 +134,7 @@ ssh_digest_copy_state(struct ssh_digest_ctx *from, struct ssh_digest_ctx *to) - if (from->alg != to->alg) - return SSH_ERR_INVALID_ARGUMENT; - /* we have bcopy-style order while openssl has memcpy-style */ -- if (!EVP_MD_CTX_copy_ex(&to->mdctx, &from->mdctx)) -+ if (!EVP_MD_CTX_copy_ex(to->mdctx, from->mdctx)) - return SSH_ERR_LIBCRYPTO_ERROR; - return 0; - } -@@ -141,7 +142,7 @@ ssh_digest_copy_state(struct ssh_digest_ctx *from, struct ssh_digest_ctx *to) - int - ssh_digest_update(struct ssh_digest_ctx *ctx, const void *m, size_t mlen) - { -- if (EVP_DigestUpdate(&ctx->mdctx, m, mlen) != 1) -+ if (EVP_DigestUpdate(ctx->mdctx, m, mlen) != 1) - return SSH_ERR_LIBCRYPTO_ERROR; - return 0; - } -@@ -162,7 +163,7 @@ ssh_digest_final(struct ssh_digest_ctx *ctx, u_char *d, size_t dlen) - return SSH_ERR_INVALID_ARGUMENT; - if (dlen < digest->digest_len) /* No truncation allowed */ - return SSH_ERR_INVALID_ARGUMENT; -- if (EVP_DigestFinal_ex(&ctx->mdctx, d, &l) != 1) -+ if (EVP_DigestFinal_ex(ctx->mdctx, d, &l) != 1) - return SSH_ERR_LIBCRYPTO_ERROR; - if (l != digest->digest_len) /* sanity */ - return SSH_ERR_INTERNAL_ERROR; -@@ -173,7 +174,7 @@ void - ssh_digest_free(struct ssh_digest_ctx *ctx) - { - if (ctx != NULL) { -- EVP_MD_CTX_cleanup(&ctx->mdctx); -+ EVP_MD_CTX_free(ctx->mdctx); - explicit_bzero(ctx, sizeof(*ctx)); - free(ctx); - } -diff --git a/entropy.c b/entropy.c -index 9305f89..952573f 100644 ---- a/entropy.c -+++ b/entropy.c -@@ -217,6 +217,10 @@ seed_rng(void) - fatal("OpenSSL version mismatch. Built against %lx, you " - "have %lx", (u_long)OPENSSL_VERSION_NUMBER, SSLeay()); - -+#if OPENSSL_VERSION_NUMBER < 0x10100000L -+ atexit(RAND_cleanup); -+#endif -+ - #ifndef OPENSSL_PRNG_ONLY - if (RAND_status() == 1) { - debug3("RNG is ready, skipping seeding"); -diff --git a/gss-genr.c b/gss-genr.c -index 5456251..06ce085 100644 ---- a/gss-genr.c -+++ b/gss-genr.c -@@ -99,7 +99,7 @@ ssh_gssapi_kex_mechs(gss_OID_set gss_supported, ssh_gssapi_check_fn *check, - u_char digest[EVP_MAX_MD_SIZE]; - char deroid[2]; - const EVP_MD *evp_md = EVP_md5(); -- EVP_MD_CTX md; -+ EVP_MD_CTX *md; - - if (gss_enc2oid != NULL) { - for (i = 0; gss_enc2oid[i].encoded != NULL; i++) -@@ -112,6 +112,7 @@ ssh_gssapi_kex_mechs(gss_OID_set gss_supported, ssh_gssapi_check_fn *check, - - buffer_init(&buf); - -+ md = EVP_MD_CTX_new(); - oidpos = 0; - for (i = 0; i < gss_supported->count; i++) { - if (gss_supported->elements[i].length < 128 && -@@ -120,12 +121,13 @@ ssh_gssapi_kex_mechs(gss_OID_set gss_supported, ssh_gssapi_check_fn *check, - deroid[0] = SSH_GSS_OIDTYPE; - deroid[1] = gss_supported->elements[i].length; - -- EVP_DigestInit(&md, evp_md); -- EVP_DigestUpdate(&md, deroid, 2); -- EVP_DigestUpdate(&md, -+ EVP_MD_CTX_reset(md); -+ EVP_DigestInit(md, evp_md); -+ EVP_DigestUpdate(md, deroid, 2); -+ EVP_DigestUpdate(md, - gss_supported->elements[i].elements, - gss_supported->elements[i].length); -- EVP_DigestFinal(&md, digest, NULL); -+ EVP_DigestFinal(md, digest, NULL); - - encoded = xmalloc(EVP_MD_size(evp_md) * 2); - enclen = __b64_ntop(digest, EVP_MD_size(evp_md), -@@ -163,6 +165,7 @@ ssh_gssapi_kex_mechs(gss_OID_set gss_supported, ssh_gssapi_check_fn *check, - oidpos++; - } - } -+ EVP_MD_CTX_free(md); - gss_enc2oid[oidpos].oid = NULL; - gss_enc2oid[oidpos].encoded = NULL; - -diff --git a/includes.h b/includes.h -index 497a038..7e602f5 100644 ---- a/includes.h -+++ b/includes.h -@@ -163,6 +163,7 @@ - - #ifdef WITH_OPENSSL - #include /* For OPENSSL_VERSION_NUMBER */ -+#include "libcrypto-compat.h" - #endif - - #include "defines.h" -diff --git a/kexdhc.c b/kexdhc.c -index ad3975f..0a55092 100644 ---- a/kexdhc.c -+++ b/kexdhc.c -@@ -56,6 +56,7 @@ kexdh_client(struct ssh *ssh) - { - struct kex *kex = ssh->kex; - int r; -+ const BIGNUM *pub_key; - - /* generate and send 'e', client DH public key */ - switch (kex->kex_type) { -@@ -81,21 +82,27 @@ kexdh_client(struct ssh *ssh) - goto out; - } - debug("sending SSH2_MSG_KEXDH_INIT"); -- if ((r = dh_gen_key(kex->dh, kex->we_need * 8)) != 0 || -- (r = sshpkt_start(ssh, SSH2_MSG_KEXDH_INIT)) != 0 || -- (r = sshpkt_put_bignum2(ssh, kex->dh->pub_key)) != 0 || -+ if ((r = dh_gen_key(kex->dh, kex->we_need * 8)) != 0) -+ goto out; -+ DH_get0_key(kex->dh, &pub_key, NULL); -+ if ((r = sshpkt_start(ssh, SSH2_MSG_KEXDH_INIT)) != 0 || -+ (r = sshpkt_put_bignum2(ssh, pub_key)) != 0 || - (r = sshpkt_send(ssh)) != 0) - goto out; - #ifdef DEBUG_KEXDH - DHparams_print_fp(stderr, kex->dh); - fprintf(stderr, "pub= "); -- BN_print_fp(stderr, kex->dh->pub_key); -+ BN_print_fp(stderr, pub_key); - fprintf(stderr, "\n"); - #endif - debug("expecting SSH2_MSG_KEXDH_REPLY"); - ssh_dispatch_set(ssh, SSH2_MSG_KEXDH_REPLY, &input_kex_dh); - r = 0; - out: -+ if (r != 0) { -+ DH_free(kex->dh); -+ kex->dh = NULL; -+ } - return r; - } - -@@ -110,6 +117,7 @@ input_kex_dh(int type, u_int32_t seq, void *ctxt) - u_char hash[SSH_DIGEST_MAX_LENGTH]; - size_t klen = 0, slen, sbloblen, hashlen; - int kout, r; -+ const BIGNUM *pub_key; - - if (kex->verify_host_key == NULL) { - r = SSH_ERR_INVALID_ARGUMENT; -@@ -169,6 +177,7 @@ input_kex_dh(int type, u_int32_t seq, void *ctxt) - #endif - - /* calc and verify H */ -+ DH_get0_key(kex->dh, &pub_key, NULL); - hashlen = sizeof(hash); - if ((r = kex_dh_hash( - kex->hash_alg, -@@ -177,7 +186,7 @@ input_kex_dh(int type, u_int32_t seq, void *ctxt) - sshbuf_ptr(kex->my), sshbuf_len(kex->my), - sshbuf_ptr(kex->peer), sshbuf_len(kex->peer), - server_host_key_blob, sbloblen, -- kex->dh->pub_key, -+ pub_key, - dh_server_pub, - shared_secret, - hash, &hashlen)) != 0) -diff --git a/kexdhs.c b/kexdhs.c -index 108f664..8d0906e 100644 ---- a/kexdhs.c -+++ b/kexdhs.c -@@ -87,6 +87,10 @@ kexdh_server(struct ssh *ssh) - ssh_dispatch_set(ssh, SSH2_MSG_KEXDH_INIT, &input_kex_dh_init); - r = 0; - out: -+ if (r != 0) { -+ DH_free(kex->dh); -+ kex->dh = NULL; -+ } - return r; - } - -@@ -102,6 +106,7 @@ input_kex_dh_init(int type, u_int32_t seq, void *ctxt) - size_t sbloblen, slen; - size_t klen = 0, hashlen; - int kout, r; -+ const BIGNUM *pub_key; - - if (kex->load_host_public_key == NULL || - kex->load_host_private_key == NULL) { -@@ -164,6 +169,7 @@ input_kex_dh_init(int type, u_int32_t seq, void *ctxt) - goto out; - /* calc H */ - hashlen = sizeof(hash); -+ DH_get0_key(kex->dh, &pub_key, NULL); - if ((r = kex_dh_hash( - kex->hash_alg, - kex->client_version_string, -@@ -172,7 +178,7 @@ input_kex_dh_init(int type, u_int32_t seq, void *ctxt) - sshbuf_ptr(kex->my), sshbuf_len(kex->my), - server_host_key_blob, sbloblen, - dh_client_pub, -- kex->dh->pub_key, -+ pub_key, - shared_secret, - hash, &hashlen)) != 0) - goto out; -@@ -198,7 +204,7 @@ input_kex_dh_init(int type, u_int32_t seq, void *ctxt) - /* send server hostkey, DH pubkey 'f' and singed H */ - if ((r = sshpkt_start(ssh, SSH2_MSG_KEXDH_REPLY)) != 0 || - (r = sshpkt_put_string(ssh, server_host_key_blob, sbloblen)) != 0 || -- (r = sshpkt_put_bignum2(ssh, kex->dh->pub_key)) != 0 || /* f */ -+ (r = sshpkt_put_bignum2(ssh, pub_key)) != 0 || /* f */ - (r = sshpkt_put_string(ssh, signature, slen)) != 0 || - (r = sshpkt_send(ssh)) != 0) - goto out; -diff --git a/kexgexc.c b/kexgexc.c -index ad0d1c8..da17c49 100644 ---- a/kexgexc.c -+++ b/kexgexc.c -@@ -95,6 +95,7 @@ input_kex_dh_gex_group(int type, u_int32_t seq, void *ctxt) - struct kex *kex = ssh->kex; - BIGNUM *p = NULL, *g = NULL; - int r, bits; -+ const BIGNUM *pub_key; - - debug("got SSH2_MSG_KEX_DH_GEX_GROUP"); - -@@ -119,26 +120,30 @@ input_kex_dh_gex_group(int type, u_int32_t seq, void *ctxt) - p = g = NULL; /* belong to kex->dh now */ - - /* generate and send 'e', client DH public key */ -- if ((r = dh_gen_key(kex->dh, kex->we_need * 8)) != 0 || -- (r = sshpkt_start(ssh, SSH2_MSG_KEX_DH_GEX_INIT)) != 0 || -- (r = sshpkt_put_bignum2(ssh, kex->dh->pub_key)) != 0 || -+ if ((r = dh_gen_key(kex->dh, kex->we_need * 8)) != 0) -+ goto out; -+ DH_get0_key(kex->dh, &pub_key, NULL); -+ if ((r = sshpkt_start(ssh, SSH2_MSG_KEX_DH_GEX_INIT)) != 0 || -+ (r = sshpkt_put_bignum2(ssh, pub_key)) != 0 || - (r = sshpkt_send(ssh)) != 0) - goto out; - debug("SSH2_MSG_KEX_DH_GEX_INIT sent"); - #ifdef DEBUG_KEXDH - DHparams_print_fp(stderr, kex->dh); - fprintf(stderr, "pub= "); -- BN_print_fp(stderr, kex->dh->pub_key); -+ BN_print_fp(stderr, pub_key); - fprintf(stderr, "\n"); - #endif - ssh_dispatch_set(ssh, SSH2_MSG_KEX_DH_GEX_GROUP, NULL); - ssh_dispatch_set(ssh, SSH2_MSG_KEX_DH_GEX_REPLY, &input_kex_dh_gex_reply); - r = 0; - out: -- if (p) -- BN_clear_free(p); -- if (g) -- BN_clear_free(g); -+ BN_clear_free(p); -+ BN_clear_free(g); -+ if (r != 0) { -+ DH_free(kex->dh); -+ kex->dh = NULL; -+ } - return r; - } - -@@ -153,6 +158,7 @@ input_kex_dh_gex_reply(int type, u_int32_t seq, void *ctxt) - u_char hash[SSH_DIGEST_MAX_LENGTH]; - size_t klen = 0, slen, sbloblen, hashlen; - int kout, r; -+ const BIGNUM *p, *g, *pub_key; - - debug("got SSH2_MSG_KEX_DH_GEX_REPLY"); - if (kex->verify_host_key == NULL) { -@@ -219,6 +225,8 @@ input_kex_dh_gex_reply(int type, u_int32_t seq, void *ctxt) - kex->min = kex->max = -1; - - /* calc and verify H */ -+ DH_get0_pqg(kex->dh, &p, NULL, &g); -+ DH_get0_key(kex->dh, &pub_key, NULL); - hashlen = sizeof(hash); - if ((r = kexgex_hash( - kex->hash_alg, -@@ -228,8 +236,8 @@ input_kex_dh_gex_reply(int type, u_int32_t seq, void *ctxt) - sshbuf_ptr(kex->peer), sshbuf_len(kex->peer), - server_host_key_blob, sbloblen, - kex->min, kex->nbits, kex->max, -- kex->dh->p, kex->dh->g, -- kex->dh->pub_key, -+ p, g, -+ pub_key, - dh_server_pub, - shared_secret, - hash, &hashlen)) != 0) -diff --git a/kexgexs.c b/kexgexs.c -index 4496035..7cd8c7e 100644 ---- a/kexgexs.c -+++ b/kexgexs.c -@@ -73,6 +73,7 @@ input_kex_dh_gex_request(int type, u_int32_t seq, void *ctxt) - struct kex *kex = ssh->kex; - int r; - u_int min = 0, max = 0, nbits = 0; -+ const BIGNUM *p, *g; - - debug("SSH2_MSG_KEX_DH_GEX_REQUEST received"); - if ((r = sshpkt_get_u32(ssh, &min)) != 0 || -@@ -102,9 +103,10 @@ input_kex_dh_gex_request(int type, u_int32_t seq, void *ctxt) - goto out; - } - debug("SSH2_MSG_KEX_DH_GEX_GROUP sent"); -+ DH_get0_pqg(kex->dh, &p, NULL, &g); - if ((r = sshpkt_start(ssh, SSH2_MSG_KEX_DH_GEX_GROUP)) != 0 || -- (r = sshpkt_put_bignum2(ssh, kex->dh->p)) != 0 || -- (r = sshpkt_put_bignum2(ssh, kex->dh->g)) != 0 || -+ (r = sshpkt_put_bignum2(ssh, p)) != 0 || -+ (r = sshpkt_put_bignum2(ssh, g)) != 0 || - (r = sshpkt_send(ssh)) != 0) - goto out; - -@@ -116,6 +118,10 @@ input_kex_dh_gex_request(int type, u_int32_t seq, void *ctxt) - ssh_dispatch_set(ssh, SSH2_MSG_KEX_DH_GEX_INIT, &input_kex_dh_gex_init); - r = 0; - out: -+ if (r != 0) { -+ DH_free(kex->dh); -+ kex->dh = NULL; -+ } - return r; - } - -@@ -131,6 +137,7 @@ input_kex_dh_gex_init(int type, u_int32_t seq, void *ctxt) - size_t sbloblen, slen; - size_t klen = 0, hashlen; - int kout, r; -+ const BIGNUM *p, *g, *pub_key; - - if (kex->load_host_public_key == NULL || - kex->load_host_private_key == NULL) { -@@ -193,6 +200,8 @@ input_kex_dh_gex_init(int type, u_int32_t seq, void *ctxt) - goto out; - /* calc H */ - hashlen = sizeof(hash); -+ DH_get0_pqg(kex->dh, &p, NULL, &g); -+ DH_get0_key(kex->dh, &pub_key, NULL); - if ((r = kexgex_hash( - kex->hash_alg, - kex->client_version_string, -@@ -201,9 +210,9 @@ input_kex_dh_gex_init(int type, u_int32_t seq, void *ctxt) - sshbuf_ptr(kex->my), sshbuf_len(kex->my), - server_host_key_blob, sbloblen, - kex->min, kex->nbits, kex->max, -- kex->dh->p, kex->dh->g, -+ p, g, - dh_client_pub, -- kex->dh->pub_key, -+ pub_key, - shared_secret, - hash, &hashlen)) != 0) - goto out; -@@ -229,7 +238,7 @@ input_kex_dh_gex_init(int type, u_int32_t seq, void *ctxt) - /* send server hostkey, DH pubkey 'f' and singed H */ - if ((r = sshpkt_start(ssh, SSH2_MSG_KEX_DH_GEX_REPLY)) != 0 || - (r = sshpkt_put_string(ssh, server_host_key_blob, sbloblen)) != 0 || -- (r = sshpkt_put_bignum2(ssh, kex->dh->pub_key)) != 0 || /* f */ -+ (r = sshpkt_put_bignum2(ssh, pub_key)) != 0 || /* f */ - (r = sshpkt_put_string(ssh, signature, slen)) != 0 || - (r = sshpkt_send(ssh)) != 0) - goto out; -diff --git a/kexgssc.c b/kexgssc.c -index b735e96..785fb67 100644 ---- a/kexgssc.c -+++ b/kexgssc.c -@@ -63,6 +63,7 @@ kexgss_client(struct ssh *ssh) { - BIGNUM *p = NULL; - BIGNUM *g = NULL; - u_char *kbuf = NULL; -+ const BIGNUM *pub_key, *p1, *g1; - u_char hash[SSH_DIGEST_MAX_LENGTH]; - u_char *serverhostkey = NULL; - u_char *empty = ""; -@@ -133,6 +134,7 @@ kexgss_client(struct ssh *ssh) { - - /* Step 1 - e is dh->pub_key */ - dh_gen_key(dh, kex->we_need * 8); -+ DH_get0_key(dh, &pub_key, NULL); - - /* This is f, we initialise it now to make life easier */ - dh_server_pub = BN_new(); -@@ -180,7 +182,7 @@ kexgss_client(struct ssh *ssh) { - packet_start(SSH2_MSG_KEXGSS_INIT); - packet_put_string(send_tok.value, - send_tok.length); -- packet_put_bignum2(dh->pub_key); -+ packet_put_bignum2((BIGNUM *)pub_key); - first = 0; - } else { - packet_start(SSH2_MSG_KEXGSS_CONTINUE); -@@ -290,13 +292,14 @@ kexgss_client(struct ssh *ssh) { - buffer_ptr(kex->my), buffer_len(kex->my), - buffer_ptr(kex->peer), buffer_len(kex->peer), - (serverhostkey ? serverhostkey : empty), slen, -- dh->pub_key, /* e */ -+ pub_key, /* e */ - dh_server_pub, /* f */ - shared_secret, /* K */ - hash, &hashlen - ); - break; - case KEX_GSS_GEX_SHA1: -+ DH_get0_pqg(dh, &p1, NULL, &g1); - kexgex_hash( - kex->hash_alg, - kex->client_version_string, -@@ -305,8 +308,8 @@ kexgss_client(struct ssh *ssh) { - buffer_ptr(kex->peer), buffer_len(kex->peer), - (serverhostkey ? serverhostkey : empty), slen, - min, nbits, max, -- dh->p, dh->g, -- dh->pub_key, -+ p1, g1, -+ pub_key, - dh_server_pub, - shared_secret, - hash, &hashlen -diff --git a/kexgsss.c b/kexgsss.c -index 0dc76a6..0194c45 100644 ---- a/kexgsss.c -+++ b/kexgsss.c -@@ -80,6 +80,7 @@ kexgss_server(struct ssh *ssh) - int type = 0; - gss_OID oid; - char *mechs = NULL; -+ const BIGNUM *p, *g, *pub_key; - - /* Initialise GSSAPI */ - -@@ -136,9 +137,10 @@ kexgss_server(struct ssh *ssh) - if (dh == NULL) - packet_disconnect("Protocol error: no matching group found"); - -+ DH_get0_pqg(dh, &p, NULL, &g); - packet_start(SSH2_MSG_KEXGSS_GROUP); -- packet_put_bignum2(dh->p); -- packet_put_bignum2(dh->g); -+ packet_put_bignum2((BIGNUM *)p); -+ packet_put_bignum2((BIGNUM *)g); - packet_send(); - - packet_write_wait(); -@@ -231,6 +233,7 @@ kexgss_server(struct ssh *ssh) - memset(kbuf, 0, klen); - free(kbuf); - -+ DH_get0_key(dh, &pub_key, NULL); - hashlen = sizeof(hash); - switch (kex->kex_type) { - case KEX_GSS_GRP1_SHA1: -@@ -243,7 +246,7 @@ kexgss_server(struct ssh *ssh) - buffer_ptr(kex->peer), buffer_len(kex->peer), - buffer_ptr(kex->my), buffer_len(kex->my), - NULL, 0, /* Change this if we start sending host keys */ -- dh_client_pub, dh->pub_key, shared_secret, -+ dh_client_pub, pub_key, shared_secret, - hash, &hashlen - ); - break; -@@ -255,9 +258,9 @@ kexgss_server(struct ssh *ssh) - buffer_ptr(kex->my), buffer_len(kex->my), - NULL, 0, - cmin, nbits, cmax, -- dh->p, dh->g, -+ p, g, - dh_client_pub, -- dh->pub_key, -+ pub_key, - shared_secret, - hash, &hashlen - ); -@@ -281,7 +284,7 @@ kexgss_server(struct ssh *ssh) - fatal("Couldn't get MIC"); - - packet_start(SSH2_MSG_KEXGSS_COMPLETE); -- packet_put_bignum2(dh->pub_key); -+ packet_put_bignum2((BIGNUM *)pub_key); - packet_put_string((char *)msg_tok.value,msg_tok.length); - - if (send_tok.length != 0) { -diff --git a/libcrypto-compat.c b/libcrypto-compat.c -new file mode 100644 -index 0000000..1e17fec ---- /dev/null -+++ b/libcrypto-compat.c -@@ -0,0 +1,546 @@ -+/* -+ * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. -+ * -+ * Licensed under the OpenSSL license (the "License"). You may not use -+ * this file except in compliance with the License. You can obtain a copy -+ * in the file LICENSE in the source distribution or at -+ * https://www.openssl.org/source/license.html -+ */ -+ -+#include "includes.h" -+ -+#if OPENSSL_VERSION_NUMBER < 0x10100000L -+ -+#include -+#include -+ -+static void *OPENSSL_zalloc(size_t num) -+{ -+ void *ret = OPENSSL_malloc(num); -+ -+ if (ret != NULL) -+ memset(ret, 0, num); -+ return ret; -+} -+ -+int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d) -+{ -+ /* If the fields n and e in r are NULL, the corresponding input -+ * parameters MUST be non-NULL for n and e. d may be -+ * left NULL (in case only the public key is used). -+ */ -+ if ((r->n == NULL && n == NULL) -+ || (r->e == NULL && e == NULL)) -+ return 0; -+ -+ if (n != NULL) { -+ BN_free(r->n); -+ r->n = n; -+ } -+ if (e != NULL) { -+ BN_free(r->e); -+ r->e = e; -+ } -+ if (d != NULL) { -+ BN_free(r->d); -+ r->d = d; -+ } -+ -+ return 1; -+} -+ -+int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q) -+{ -+ /* If the fields p and q in r are NULL, the corresponding input -+ * parameters MUST be non-NULL. -+ */ -+ if ((r->p == NULL && p == NULL) -+ || (r->q == NULL && q == NULL)) -+ return 0; -+ -+ if (p != NULL) { -+ BN_free(r->p); -+ r->p = p; -+ } -+ if (q != NULL) { -+ BN_free(r->q); -+ r->q = q; -+ } -+ -+ return 1; -+} -+ -+int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp) -+{ -+ /* If the fields dmp1, dmq1 and iqmp in r are NULL, the corresponding input -+ * parameters MUST be non-NULL. -+ */ -+ if ((r->dmp1 == NULL && dmp1 == NULL) -+ || (r->dmq1 == NULL && dmq1 == NULL) -+ || (r->iqmp == NULL && iqmp == NULL)) -+ return 0; -+ -+ if (dmp1 != NULL) { -+ BN_free(r->dmp1); -+ r->dmp1 = dmp1; -+ } -+ if (dmq1 != NULL) { -+ BN_free(r->dmq1); -+ r->dmq1 = dmq1; -+ } -+ if (iqmp != NULL) { -+ BN_free(r->iqmp); -+ r->iqmp = iqmp; -+ } -+ -+ return 1; -+} -+ -+void RSA_get0_key(const RSA *r, -+ const BIGNUM **n, const BIGNUM **e, const BIGNUM **d) -+{ -+ if (n != NULL) -+ *n = r->n; -+ if (e != NULL) -+ *e = r->e; -+ if (d != NULL) -+ *d = r->d; -+} -+ -+void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q) -+{ -+ if (p != NULL) -+ *p = r->p; -+ if (q != NULL) -+ *q = r->q; -+} -+ -+void RSA_get0_crt_params(const RSA *r, -+ const BIGNUM **dmp1, const BIGNUM **dmq1, -+ const BIGNUM **iqmp) -+{ -+ if (dmp1 != NULL) -+ *dmp1 = r->dmp1; -+ if (dmq1 != NULL) -+ *dmq1 = r->dmq1; -+ if (iqmp != NULL) -+ *iqmp = r->iqmp; -+} -+ -+void DSA_get0_pqg(const DSA *d, -+ const BIGNUM **p, const BIGNUM **q, const BIGNUM **g) -+{ -+ if (p != NULL) -+ *p = d->p; -+ if (q != NULL) -+ *q = d->q; -+ if (g != NULL) -+ *g = d->g; -+} -+ -+int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g) -+{ -+ /* If the fields p, q and g in d are NULL, the corresponding input -+ * parameters MUST be non-NULL. -+ */ -+ if ((d->p == NULL && p == NULL) -+ || (d->q == NULL && q == NULL) -+ || (d->g == NULL && g == NULL)) -+ return 0; -+ -+ if (p != NULL) { -+ BN_free(d->p); -+ d->p = p; -+ } -+ if (q != NULL) { -+ BN_free(d->q); -+ d->q = q; -+ } -+ if (g != NULL) { -+ BN_free(d->g); -+ d->g = g; -+ } -+ -+ return 1; -+} -+ -+void DSA_get0_key(const DSA *d, -+ const BIGNUM **pub_key, const BIGNUM **priv_key) -+{ -+ if (pub_key != NULL) -+ *pub_key = d->pub_key; -+ if (priv_key != NULL) -+ *priv_key = d->priv_key; -+} -+ -+int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key) -+{ -+ /* If the field pub_key in d is NULL, the corresponding input -+ * parameters MUST be non-NULL. The priv_key field may -+ * be left NULL. -+ */ -+ if (d->pub_key == NULL && pub_key == NULL) -+ return 0; -+ -+ if (pub_key != NULL) { -+ BN_free(d->pub_key); -+ d->pub_key = pub_key; -+ } -+ if (priv_key != NULL) { -+ BN_free(d->priv_key); -+ d->priv_key = priv_key; -+ } -+ -+ return 1; -+} -+ -+void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps) -+{ -+ if (pr != NULL) -+ *pr = sig->r; -+ if (ps != NULL) -+ *ps = sig->s; -+} -+ -+int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s) -+{ -+ if (r == NULL || s == NULL) -+ return 0; -+ BN_clear_free(sig->r); -+ BN_clear_free(sig->s); -+ sig->r = r; -+ sig->s = s; -+ return 1; -+} -+ -+void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps) -+{ -+ if (pr != NULL) -+ *pr = sig->r; -+ if (ps != NULL) -+ *ps = sig->s; -+} -+ -+int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s) -+{ -+ if (r == NULL || s == NULL) -+ return 0; -+ BN_clear_free(sig->r); -+ BN_clear_free(sig->s); -+ sig->r = r; -+ sig->s = s; -+ return 1; -+} -+ -+void DH_get0_pqg(const DH *dh, -+ const BIGNUM **p, const BIGNUM **q, const BIGNUM **g) -+{ -+ if (p != NULL) -+ *p = dh->p; -+ if (q != NULL) -+ *q = dh->q; -+ if (g != NULL) -+ *g = dh->g; -+} -+ -+int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g) -+{ -+ /* If the fields p and g in d are NULL, the corresponding input -+ * parameters MUST be non-NULL. q may remain NULL. -+ */ -+ if ((dh->p == NULL && p == NULL) -+ || (dh->g == NULL && g == NULL)) -+ return 0; -+ -+ if (p != NULL) { -+ BN_free(dh->p); -+ dh->p = p; -+ } -+ if (q != NULL) { -+ BN_free(dh->q); -+ dh->q = q; -+ } -+ if (g != NULL) { -+ BN_free(dh->g); -+ dh->g = g; -+ } -+ -+ if (q != NULL) { -+ dh->length = BN_num_bits(q); -+ } -+ -+ return 1; -+} -+ -+void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key) -+{ -+ if (pub_key != NULL) -+ *pub_key = dh->pub_key; -+ if (priv_key != NULL) -+ *priv_key = dh->priv_key; -+} -+ -+int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key) -+{ -+ /* If the field pub_key in dh is NULL, the corresponding input -+ * parameters MUST be non-NULL. The priv_key field may -+ * be left NULL. -+ */ -+ if (dh->pub_key == NULL && pub_key == NULL) -+ return 0; -+ -+ if (pub_key != NULL) { -+ BN_free(dh->pub_key); -+ dh->pub_key = pub_key; -+ } -+ if (priv_key != NULL) { -+ BN_free(dh->priv_key); -+ dh->priv_key = priv_key; -+ } -+ -+ return 1; -+} -+ -+int DH_set_length(DH *dh, long length) -+{ -+ dh->length = length; -+ return 1; -+} -+ -+const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx) -+{ -+ return ctx->iv; -+} -+ -+unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx) -+{ -+ return ctx->iv; -+} -+ -+EVP_MD_CTX *EVP_MD_CTX_new(void) -+{ -+ return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); -+} -+ -+static void OPENSSL_clear_free(void *str, size_t num) -+{ -+ if (str == NULL) -+ return; -+ if (num) -+ OPENSSL_cleanse(str, num); -+ OPENSSL_free(str); -+} -+ -+/* This call frees resources associated with the context */ -+int EVP_MD_CTX_reset(EVP_MD_CTX *ctx) -+{ -+ if (ctx == NULL) -+ return 1; -+ -+ /* -+ * Don't assume ctx->md_data was cleaned in EVP_Digest_Final, because -+ * sometimes only copies of the context are ever finalised. -+ */ -+ if (ctx->digest && ctx->digest->cleanup -+ && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_CLEANED)) -+ ctx->digest->cleanup(ctx); -+ if (ctx->digest && ctx->digest->ctx_size && ctx->md_data -+ && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) { -+ OPENSSL_clear_free(ctx->md_data, ctx->digest->ctx_size); -+ } -+ EVP_PKEY_CTX_free(ctx->pctx); -+#ifndef OPENSSL_NO_ENGINE -+ ENGINE_finish(ctx->engine); -+#endif -+ OPENSSL_cleanse(ctx, sizeof(*ctx)); -+ -+ return 1; -+} -+ -+void EVP_MD_CTX_free(EVP_MD_CTX *ctx) -+{ -+ EVP_MD_CTX_reset(ctx); -+ OPENSSL_free(ctx); -+} -+ -+RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth) -+{ -+ RSA_METHOD *ret; -+ -+ ret = OPENSSL_malloc(sizeof(RSA_METHOD)); -+ -+ if (ret != NULL) { -+ memcpy(ret, meth, sizeof(*meth)); -+ ret->name = OPENSSL_strdup(meth->name); -+ if (ret->name == NULL) { -+ OPENSSL_free(ret); -+ return NULL; -+ } -+ } -+ -+ return ret; -+} -+ -+int RSA_meth_set1_name(RSA_METHOD *meth, const char *name) -+{ -+ char *tmpname; -+ -+ tmpname = OPENSSL_strdup(name); -+ if (tmpname == NULL) { -+ return 0; -+ } -+ -+ OPENSSL_free((char *)meth->name); -+ meth->name = tmpname; -+ -+ return 1; -+} -+ -+int RSA_meth_set_priv_enc(RSA_METHOD *meth, -+ int (*priv_enc) (int flen, const unsigned char *from, -+ unsigned char *to, RSA *rsa, -+ int padding)) -+{ -+ meth->rsa_priv_enc = priv_enc; -+ return 1; -+} -+ -+int RSA_meth_set_priv_dec(RSA_METHOD *meth, -+ int (*priv_dec) (int flen, const unsigned char *from, -+ unsigned char *to, RSA *rsa, -+ int padding)) -+{ -+ meth->rsa_priv_dec = priv_dec; -+ return 1; -+} -+ -+int RSA_meth_set_finish(RSA_METHOD *meth, int (*finish) (RSA *rsa)) -+{ -+ meth->finish = finish; -+ return 1; -+} -+ -+void RSA_meth_free(RSA_METHOD *meth) -+{ -+ if (meth != NULL) { -+ OPENSSL_free((char *)meth->name); -+ OPENSSL_free(meth); -+ } -+} -+ -+int RSA_bits(const RSA *r) -+{ -+ return (BN_num_bits(r->n)); -+} -+ -+int DSA_bits(const DSA *dsa) -+{ -+ return BN_num_bits(dsa->p); -+} -+ -+RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey) -+{ -+ if (pkey->type != EVP_PKEY_RSA) { -+ return NULL; -+ } -+ return pkey->pkey.rsa; -+} -+ -+EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len) -+{ -+ EVP_CIPHER *cipher = OPENSSL_zalloc(sizeof(EVP_CIPHER)); -+ -+ if (cipher != NULL) { -+ cipher->nid = cipher_type; -+ cipher->block_size = block_size; -+ cipher->key_len = key_len; -+ } -+ return cipher; -+} -+ -+void EVP_CIPHER_meth_free(EVP_CIPHER *cipher) -+{ -+ OPENSSL_free(cipher); -+} -+ -+int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len) -+{ -+ cipher->iv_len = iv_len; -+ return 1; -+} -+ -+int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags) -+{ -+ cipher->flags = flags; -+ return 1; -+} -+ -+int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher, -+ int (*init) (EVP_CIPHER_CTX *ctx, -+ const unsigned char *key, -+ const unsigned char *iv, -+ int enc)) -+{ -+ cipher->init = init; -+ return 1; -+} -+ -+int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher, -+ int (*do_cipher) (EVP_CIPHER_CTX *ctx, -+ unsigned char *out, -+ const unsigned char *in, -+ size_t inl)) -+{ -+ cipher->do_cipher = do_cipher; -+ return 1; -+} -+ -+int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher, -+ int (*cleanup) (EVP_CIPHER_CTX *)) -+{ -+ cipher->cleanup = cleanup; -+ return 1; -+} -+ -+int EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher, -+ int (*ctrl) (EVP_CIPHER_CTX *, int type, -+ int arg, void *ptr)) -+{ -+ cipher->ctrl = ctrl; -+ return 1; -+} -+ -+int (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, -+ const unsigned char *key, -+ const unsigned char *iv, -+ int enc) -+{ -+ return cipher->init; -+} -+ -+int (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, -+ unsigned char *out, -+ const unsigned char *in, -+ size_t inl) -+{ -+ return cipher->do_cipher; -+} -+ -+int (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *) -+{ -+ return cipher->cleanup; -+} -+ -+int (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, -+ int type, int arg, -+ void *ptr) -+{ -+ return cipher->ctrl; -+} -+ -+int EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx) -+{ -+ return ctx->encrypt; -+} -+ -+#endif /* OPENSSL_VERSION_NUMBER */ -diff --git a/libcrypto-compat.h b/libcrypto-compat.h -new file mode 100644 -index 0000000..5ef87a6 ---- /dev/null -+++ b/libcrypto-compat.h -@@ -0,0 +1,98 @@ -+#ifndef LIBCRYPTO_COMPAT_H -+#define LIBCRYPTO_COMPAT_H -+ -+#if OPENSSL_VERSION_NUMBER < 0x10100000L -+ -+#include -+#include -+#include -+#include -+#include -+ -+int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d); -+int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q); -+int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp); -+void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d); -+void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q); -+void RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1, const BIGNUM **iqmp); -+ -+void DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); -+int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g); -+void DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key); -+int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key); -+ -+void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); -+int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s); -+ -+void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); -+int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s); -+ -+void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); -+int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g); -+void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key); -+int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key); -+int DH_set_length(DH *dh, long length); -+ -+const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx); -+unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx); -+int EVP_MD_CTX_reset(EVP_MD_CTX *ctx); -+EVP_MD_CTX *EVP_MD_CTX_new(void); -+void EVP_MD_CTX_free(EVP_MD_CTX *ctx); -+#define EVP_CIPHER_impl_ctx_size(e) e->ctx_size -+#define EVP_CIPHER_CTX_get_cipher_data(ctx) ctx->cipher_data -+ -+RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth); -+int RSA_meth_set1_name(RSA_METHOD *meth, const char *name); -+#define RSA_meth_get_finish(meth) meth->finish -+int RSA_meth_set_priv_enc(RSA_METHOD *meth, int (*priv_enc) (int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding)); -+int RSA_meth_set_priv_dec(RSA_METHOD *meth, int (*priv_dec) (int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding)); -+int RSA_meth_set_finish(RSA_METHOD *meth, int (*finish) (RSA *rsa)); -+void RSA_meth_free(RSA_METHOD *meth); -+ -+int RSA_bits(const RSA *r); -+int DSA_bits(const DSA *d); -+ -+RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey); -+ -+EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len); -+void EVP_CIPHER_meth_free(EVP_CIPHER *cipher); -+ -+int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len); -+int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags); -+int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher, -+ int (*init) (EVP_CIPHER_CTX *ctx, -+ const unsigned char *key, -+ const unsigned char *iv, -+ int enc)); -+int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher, -+ int (*do_cipher) (EVP_CIPHER_CTX *ctx, -+ unsigned char *out, -+ const unsigned char *in, -+ size_t inl)); -+int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher, -+ int (*cleanup) (EVP_CIPHER_CTX *)); -+int EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher, -+ int (*ctrl) (EVP_CIPHER_CTX *, int type, -+ int arg, void *ptr)); -+ -+int (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, -+ const unsigned char *key, -+ const unsigned char *iv, -+ int enc); -+int (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, -+ unsigned char *out, -+ const unsigned char *in, -+ size_t inl); -+int (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *); -+int (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, -+ int type, int arg, -+ void *ptr); -+ -+#define EVP_CIPHER_CTX_reset(c) EVP_CIPHER_CTX_init(c) -+ -+int EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx); -+ -+#endif /* OPENSSL_VERSION_NUMBER */ -+ -+#endif /* LIBCRYPTO_COMPAT_H */ -+ -diff --git a/misc.h b/misc.h -index 70d5fd1..09b90ab 100644 ---- a/misc.h -+++ b/misc.h -@@ -146,6 +146,6 @@ int read_keyfile_line(FILE *, const char *, char *, size_t, u_long *); - - #define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) - #define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) --#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y)) -+#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y)) - - #endif /* _MISC_H */ -diff --git a/monitor.c b/monitor.c -index 0ffc5c7..90e493a 100644 ---- a/monitor.c -+++ b/monitor.c -@@ -610,9 +610,12 @@ mm_answer_moduli(int sock, Buffer *m) - return (0); - } else { - /* Send first bignum */ -+ const BIGNUM *p, *g; -+ -+ DH_get0_pqg(dh, &p, NULL, &g); - buffer_put_char(m, 1); -- buffer_put_bignum2(m, dh->p); -- buffer_put_bignum2(m, dh->g); -+ buffer_put_bignum2(m, p); -+ buffer_put_bignum2(m, g); - - DH_free(dh); - } -diff --git a/openbsd-compat/openssl-compat.c b/openbsd-compat/openssl-compat.c -index 259fccb..74f65f8 100644 ---- a/openbsd-compat/openssl-compat.c -+++ b/openbsd-compat/openssl-compat.c -@@ -70,12 +70,19 @@ ssh_compatible_openssl(long headerver, long libver) - void - ssh_OpenSSL_add_all_algorithms(void) - { -+#if OPENSSL_VERSION_NUMBER < 0x10100000L - OpenSSL_add_all_algorithms(); - - /* Enable use of crypto hardware */ - ENGINE_load_builtin_engines(); -+#if OPENSSL_VERSION_NUMBER < 0x10001000L - ENGINE_register_all_complete(); -+#endif - OPENSSL_config(NULL); -+#else -+ OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS | -+ OPENSSL_INIT_ADD_ALL_DIGESTS | OPENSSL_INIT_LOAD_CONFIG, NULL); -+#endif - } - #endif - -diff --git a/regress/unittests/sshkey/test_file.c b/regress/unittests/sshkey/test_file.c -index 906491f..ec270de 100644 ---- a/regress/unittests/sshkey/test_file.c -+++ b/regress/unittests/sshkey/test_file.c -@@ -46,6 +46,7 @@ sshkey_file_tests(void) - struct sshbuf *buf, *pw; - BIGNUM *a, *b, *c; - char *cp; -+ const BIGNUM *n, *p, *q, *g, *pub_key, *priv_key; - - TEST_START("load passphrase"); - pw = load_text_file("pw"); -@@ -58,7 +59,8 @@ sshkey_file_tests(void) - sshbuf_free(buf); - ASSERT_PTR_NE(k1, NULL); - a = load_bignum("rsa1_1.param.n"); -- ASSERT_BIGNUM_EQ(k1->rsa->n, a); -+ RSA_get0_key(k1->rsa, &n, NULL, NULL); -+ ASSERT_BIGNUM_EQ(n, a); - BN_free(a); - TEST_DONE(); - -@@ -109,9 +111,11 @@ sshkey_file_tests(void) - a = load_bignum("rsa_1.param.n"); - b = load_bignum("rsa_1.param.p"); - c = load_bignum("rsa_1.param.q"); -- ASSERT_BIGNUM_EQ(k1->rsa->n, a); -- ASSERT_BIGNUM_EQ(k1->rsa->p, b); -- ASSERT_BIGNUM_EQ(k1->rsa->q, c); -+ RSA_get0_key(k1->rsa, &n, NULL, NULL); -+ RSA_get0_factors(k1->rsa, &p, &q); -+ ASSERT_BIGNUM_EQ(n, a); -+ ASSERT_BIGNUM_EQ(p, b); -+ ASSERT_BIGNUM_EQ(q, c); - BN_free(a); - BN_free(b); - BN_free(c); -@@ -200,9 +204,11 @@ sshkey_file_tests(void) - a = load_bignum("dsa_1.param.g"); - b = load_bignum("dsa_1.param.priv"); - c = load_bignum("dsa_1.param.pub"); -- ASSERT_BIGNUM_EQ(k1->dsa->g, a); -- ASSERT_BIGNUM_EQ(k1->dsa->priv_key, b); -- ASSERT_BIGNUM_EQ(k1->dsa->pub_key, c); -+ DSA_get0_pqg(k1->dsa, NULL, NULL, &g); -+ DSA_get0_key(k1->dsa, &pub_key, &priv_key); -+ ASSERT_BIGNUM_EQ(g, a); -+ ASSERT_BIGNUM_EQ(priv_key, b); -+ ASSERT_BIGNUM_EQ(pub_key, c); - BN_free(a); - BN_free(b); - BN_free(c); -diff --git a/regress/unittests/sshkey/test_sshkey.c b/regress/unittests/sshkey/test_sshkey.c -index 1476dc2..c0f94ee 100644 ---- a/regress/unittests/sshkey/test_sshkey.c -+++ b/regress/unittests/sshkey/test_sshkey.c -@@ -197,9 +197,6 @@ sshkey_tests(void) - k1 = sshkey_new(KEY_RSA1); - ASSERT_PTR_NE(k1, NULL); - ASSERT_PTR_NE(k1->rsa, NULL); -- ASSERT_PTR_NE(k1->rsa->n, NULL); -- ASSERT_PTR_NE(k1->rsa->e, NULL); -- ASSERT_PTR_EQ(k1->rsa->p, NULL); - sshkey_free(k1); - TEST_DONE(); - -@@ -207,9 +204,6 @@ sshkey_tests(void) - k1 = sshkey_new(KEY_RSA); - ASSERT_PTR_NE(k1, NULL); - ASSERT_PTR_NE(k1->rsa, NULL); -- ASSERT_PTR_NE(k1->rsa->n, NULL); -- ASSERT_PTR_NE(k1->rsa->e, NULL); -- ASSERT_PTR_EQ(k1->rsa->p, NULL); - sshkey_free(k1); - TEST_DONE(); - -@@ -217,8 +211,6 @@ sshkey_tests(void) - k1 = sshkey_new(KEY_DSA); - ASSERT_PTR_NE(k1, NULL); - ASSERT_PTR_NE(k1->dsa, NULL); -- ASSERT_PTR_NE(k1->dsa->g, NULL); -- ASSERT_PTR_EQ(k1->dsa->priv_key, NULL); - sshkey_free(k1); - TEST_DONE(); - -@@ -244,9 +236,6 @@ sshkey_tests(void) - k1 = sshkey_new_private(KEY_RSA); - ASSERT_PTR_NE(k1, NULL); - ASSERT_PTR_NE(k1->rsa, NULL); -- ASSERT_PTR_NE(k1->rsa->n, NULL); -- ASSERT_PTR_NE(k1->rsa->e, NULL); -- ASSERT_PTR_NE(k1->rsa->p, NULL); - ASSERT_INT_EQ(sshkey_add_private(k1), 0); - sshkey_free(k1); - TEST_DONE(); -@@ -255,8 +244,6 @@ sshkey_tests(void) - k1 = sshkey_new_private(KEY_DSA); - ASSERT_PTR_NE(k1, NULL); - ASSERT_PTR_NE(k1->dsa, NULL); -- ASSERT_PTR_NE(k1->dsa->g, NULL); -- ASSERT_PTR_NE(k1->dsa->priv_key, NULL); - ASSERT_INT_EQ(sshkey_add_private(k1), 0); - sshkey_free(k1); - TEST_DONE(); -@@ -295,18 +282,13 @@ sshkey_tests(void) - ASSERT_INT_EQ(sshkey_generate(KEY_RSA, 1024, &kr), 0); - ASSERT_PTR_NE(kr, NULL); - ASSERT_PTR_NE(kr->rsa, NULL); -- ASSERT_PTR_NE(kr->rsa->n, NULL); -- ASSERT_PTR_NE(kr->rsa->e, NULL); -- ASSERT_PTR_NE(kr->rsa->p, NULL); -- ASSERT_INT_EQ(BN_num_bits(kr->rsa->n), 1024); -+ ASSERT_INT_EQ(RSA_bits(kr->rsa), 1024); - TEST_DONE(); - - TEST_START("generate KEY_DSA"); - ASSERT_INT_EQ(sshkey_generate(KEY_DSA, 1024, &kd), 0); - ASSERT_PTR_NE(kd, NULL); - ASSERT_PTR_NE(kd->dsa, NULL); -- ASSERT_PTR_NE(kd->dsa->g, NULL); -- ASSERT_PTR_NE(kd->dsa->priv_key, NULL); - TEST_DONE(); - - #ifdef OPENSSL_HAS_ECC -@@ -333,9 +315,6 @@ sshkey_tests(void) - ASSERT_PTR_NE(kr, k1); - ASSERT_INT_EQ(k1->type, KEY_RSA); - ASSERT_PTR_NE(k1->rsa, NULL); -- ASSERT_PTR_NE(k1->rsa->n, NULL); -- ASSERT_PTR_NE(k1->rsa->e, NULL); -- ASSERT_PTR_EQ(k1->rsa->p, NULL); - TEST_DONE(); - - TEST_START("equal KEY_RSA/demoted KEY_RSA"); -@@ -349,8 +328,6 @@ sshkey_tests(void) - ASSERT_PTR_NE(kd, k1); - ASSERT_INT_EQ(k1->type, KEY_DSA); - ASSERT_PTR_NE(k1->dsa, NULL); -- ASSERT_PTR_NE(k1->dsa->g, NULL); -- ASSERT_PTR_EQ(k1->dsa->priv_key, NULL); - TEST_DONE(); - - TEST_START("equal KEY_DSA/demoted KEY_DSA"); -diff --git a/rsa.c b/rsa.c -index 5ecacef..6ff9947 100644 ---- a/rsa.c -+++ b/rsa.c -@@ -76,11 +76,14 @@ rsa_public_encrypt(BIGNUM *out, BIGNUM *in, RSA *key) - { - u_char *inbuf = NULL, *outbuf = NULL; - int len, ilen, olen, r = SSH_ERR_INTERNAL_ERROR; -+ const BIGNUM *e, *n; - -- if (BN_num_bits(key->e) < 2 || !BN_is_odd(key->e)) -+ RSA_get0_key(key, &n, &e, NULL); -+ -+ if (BN_num_bits(e) < 2 || !BN_is_odd(e)) - return SSH_ERR_INVALID_ARGUMENT; - -- olen = BN_num_bytes(key->n); -+ olen = BN_num_bytes(n); - if ((outbuf = malloc(olen)) == NULL) { - r = SSH_ERR_ALLOC_FAIL; - goto out; -@@ -122,8 +125,11 @@ rsa_private_decrypt(BIGNUM *out, BIGNUM *in, RSA *key) - { - u_char *inbuf = NULL, *outbuf = NULL; - int len, ilen, olen, r = SSH_ERR_INTERNAL_ERROR; -+ const BIGNUM *n; -+ -+ RSA_get0_key(key, &n, NULL, NULL); - -- olen = BN_num_bytes(key->n); -+ olen = BN_num_bytes(n); - if ((outbuf = malloc(olen)) == NULL) { - r = SSH_ERR_ALLOC_FAIL; - goto out; -@@ -157,31 +163,42 @@ rsa_private_decrypt(BIGNUM *out, BIGNUM *in, RSA *key) - return r; - } - --/* calculate p-1 and q-1 */ -+/* calculate d mod p-1 and d mod q-1 */ - int --rsa_generate_additional_parameters(RSA *rsa) -+rsa_generate_additional_parameters(RSA *rsa, BIGNUM *iqmp) - { - BIGNUM *aux = NULL; - BN_CTX *ctx = NULL; - int r; -+ const BIGNUM *p, *q, *d; -+ BIGNUM *dmp1 = NULL, *dmq1 = NULL; -+ -+ RSA_get0_factors(rsa, &p, &q); -+ RSA_get0_key(rsa, NULL, NULL, &d); - -- if ((ctx = BN_CTX_new()) == NULL) -- return SSH_ERR_ALLOC_FAIL; -- if ((aux = BN_new()) == NULL) { -+ if ((ctx = BN_CTX_new()) == NULL || -+ (aux = BN_new()) == NULL || -+ (dmp1 = BN_new()) == NULL || -+ (dmq1 = BN_new()) == NULL) { - r = SSH_ERR_ALLOC_FAIL; - goto out; - } - -- if ((BN_sub(aux, rsa->q, BN_value_one()) == 0) || -- (BN_mod(rsa->dmq1, rsa->d, aux, ctx) == 0) || -- (BN_sub(aux, rsa->p, BN_value_one()) == 0) || -- (BN_mod(rsa->dmp1, rsa->d, aux, ctx) == 0)) { -+ if ((BN_sub(aux, q, BN_value_one()) == 0) || -+ (BN_mod(dmq1, d, aux, ctx) == 0) || -+ (BN_sub(aux, p, BN_value_one()) == 0) || -+ (BN_mod(dmp1, d, aux, ctx) == 0) || -+ (RSA_set0_crt_params(rsa, dmp1, dmq1, iqmp) == 0)) { - r = SSH_ERR_LIBCRYPTO_ERROR; - goto out; - } -+ dmp1 = NULL; -+ dmq1 = NULL; - r = 0; - out: - BN_clear_free(aux); -+ BN_clear_free(dmp1); -+ BN_clear_free(dmq1); - BN_CTX_free(ctx); - return r; - } -diff --git a/rsa.h b/rsa.h -index c476707..4da6936 100644 ---- a/rsa.h -+++ b/rsa.h -@@ -21,6 +21,6 @@ - - int rsa_public_encrypt(BIGNUM *, BIGNUM *, RSA *); - int rsa_private_decrypt(BIGNUM *, BIGNUM *, RSA *); --int rsa_generate_additional_parameters(RSA *); -+int rsa_generate_additional_parameters(RSA *, BIGNUM *); - - #endif /* RSA_H */ -diff --git a/ssh-agent.c b/ssh-agent.c -index 98dafd7..a3a5606 100644 ---- a/ssh-agent.c -+++ b/ssh-agent.c -@@ -259,12 +259,12 @@ process_request_identities(SocketEntry *e, int version) - TAILQ_FOREACH(id, &tab->idlist, next) { - if (id->key->type == KEY_RSA1) { - #ifdef WITH_SSH1 -+ const BIGNUM *r_n, *r_e; -+ RSA_get0_key(id->key->rsa, &r_n, &r_e, NULL); - if ((r = sshbuf_put_u32(msg, -- BN_num_bits(id->key->rsa->n))) != 0 || -- (r = sshbuf_put_bignum1(msg, -- id->key->rsa->e)) != 0 || -- (r = sshbuf_put_bignum1(msg, -- id->key->rsa->n)) != 0) -+ BN_num_bits(r_n))) != 0 || -+ (r = sshbuf_put_bignum1(msg, r_e)) != 0 || -+ (r = sshbuf_put_bignum1(msg, r_n)) != 0) - fatal("%s: buffer error: %s", - __func__, ssh_err(r)); - #endif -@@ -303,6 +303,7 @@ process_authentication_challenge1(SocketEntry *e) - struct sshbuf *msg; - struct ssh_digest_ctx *md; - struct sshkey *key; -+ BIGNUM *r_n = NULL, *r_e = NULL; - - if ((msg = sshbuf_new()) == NULL) - fatal("%s: sshbuf_new failed", __func__); -@@ -311,11 +312,16 @@ process_authentication_challenge1(SocketEntry *e) - if ((challenge = BN_new()) == NULL) - fatal("%s: BN_new failed", __func__); - -- if ((r = sshbuf_get_u32(e->request, NULL)) != 0 || /* ignored */ -- (r = sshbuf_get_bignum1(e->request, key->rsa->e)) != 0 || -- (r = sshbuf_get_bignum1(e->request, key->rsa->n)) != 0 || -- (r = sshbuf_get_bignum1(e->request, challenge))) -+ if ((r_n = BN_new()) == NULL || (r_e = BN_new()) == NULL || -+ (r = sshbuf_get_u32(e->request, NULL)) != 0 || /* ignored */ -+ (r = sshbuf_get_bignum1(e->request, r_e)) != 0 || -+ (r = sshbuf_get_bignum1(e->request, r_n)) != 0 || -+ (r = sshbuf_get_bignum1(e->request, challenge)) || -+ RSA_set0_key(key->rsa, r_n, r_e, NULL) == 0) { -+ BN_free(r_n); -+ BN_free(r_e); - fatal("%s: buffer error: %s", __func__, ssh_err(r)); -+ } - - /* Only protocol 1.1 is supported */ - if (sshbuf_len(e->request) == 0) -@@ -451,6 +457,7 @@ process_remove_identity(SocketEntry *e, int version) - u_char *blob; - #ifdef WITH_SSH1 - u_int bits; -+ BIGNUM *r_n = NULL, *r_e = NULL; - #endif /* WITH_SSH1 */ - - switch (version) { -@@ -460,10 +467,15 @@ process_remove_identity(SocketEntry *e, int version) - error("%s: sshkey_new failed", __func__); - return; - } -- if ((r = sshbuf_get_u32(e->request, &bits)) != 0 || -- (r = sshbuf_get_bignum1(e->request, key->rsa->e)) != 0 || -- (r = sshbuf_get_bignum1(e->request, key->rsa->n)) != 0) -+ if ((r_n = BN_new()) == NULL || (r_e = BN_new()) == NULL || -+ (r = sshbuf_get_u32(e->request, &bits)) != 0 || -+ (r = sshbuf_get_bignum1(e->request, r_e)) != 0 || -+ (r = sshbuf_get_bignum1(e->request, r_n)) != 0 || -+ RSA_set0_key(key->rsa, r_n, r_e, NULL) == 0) { -+ BN_free(r_n); -+ BN_free(r_e); - fatal("%s: buffer error: %s", __func__, ssh_err(r)); -+ } - - if (bits != sshkey_size(key)) - logit("Warning: identity keysize mismatch: " -@@ -566,23 +578,46 @@ agent_decode_rsa1(struct sshbuf *m, struct sshkey **kp) - { - struct sshkey *k = NULL; - int r = SSH_ERR_INTERNAL_ERROR; -+ BIGNUM *n = NULL, *e = NULL, *d = NULL, -+ *iqmp = NULL, *q = NULL, *p = NULL; - - *kp = NULL; - if ((k = sshkey_new_private(KEY_RSA1)) == NULL) - return SSH_ERR_ALLOC_FAIL; - -- if ((r = sshbuf_get_u32(m, NULL)) != 0 || /* ignored */ -- (r = sshbuf_get_bignum1(m, k->rsa->n)) != 0 || -- (r = sshbuf_get_bignum1(m, k->rsa->e)) != 0 || -- (r = sshbuf_get_bignum1(m, k->rsa->d)) != 0 || -- (r = sshbuf_get_bignum1(m, k->rsa->iqmp)) != 0 || -+ if ((n = BN_new()) == NULL || (e = BN_new()) == NULL || -+ (d = BN_new()) == NULL || (iqmp = BN_new()) == NULL || -+ (q = BN_new()) == NULL || (p = BN_new()) == NULL || -+ (r = sshbuf_get_u32(m, NULL)) != 0 || /* ignored */ -+ (r = sshbuf_get_bignum1(m, n)) != 0 || -+ (r = sshbuf_get_bignum1(m, e)) != 0 || -+ (r = sshbuf_get_bignum1(m, d)) != 0 || -+ (r = sshbuf_get_bignum1(m, iqmp)) != 0 || - /* SSH1 and SSL have p and q swapped */ -- (r = sshbuf_get_bignum1(m, k->rsa->q)) != 0 || /* p */ -- (r = sshbuf_get_bignum1(m, k->rsa->p)) != 0) /* q */ -+ (r = sshbuf_get_bignum1(m, q)) != 0 || /* p */ -+ (r = sshbuf_get_bignum1(m, p)) != 0 || /* q */ -+ RSA_set0_key(k->rsa, n, e, d) == 0) { -+ BN_free(n); -+ BN_free(e); -+ BN_free(d); -+ BN_free(p); -+ BN_free(q); -+ BN_free(iqmp); -+ goto out; -+ } -+ if (RSA_set0_factors(k->rsa, p, q) == 0) { -+ BN_free(p); -+ BN_free(q); -+ BN_free(iqmp); -+ goto out; -+ } -+ if (RSA_set0_crt_params(k->rsa, NULL, NULL, iqmp) == 0) { -+ BN_free(iqmp); - goto out; -+ } - - /* Generate additional parameters */ -- if ((r = rsa_generate_additional_parameters(k->rsa)) != 0) -+ if ((r = rsa_generate_additional_parameters(k->rsa, NULL)) != 0) - goto out; - /* enable blinding */ - if (RSA_blinding_on(k->rsa, NULL) != 1) { -diff --git a/ssh-dss.c b/ssh-dss.c -index 7af59fa..e36751e 100644 ---- a/ssh-dss.c -+++ b/ssh-dss.c -@@ -55,6 +55,7 @@ ssh_dss_sign(const struct sshkey *key, u_char **sigp, size_t *lenp, - size_t rlen, slen, len, dlen = ssh_digest_bytes(SSH_DIGEST_SHA1); - struct sshbuf *b = NULL; - int ret = SSH_ERR_INVALID_ARGUMENT; -+ const BIGNUM *r, *s; - - if (lenp != NULL) - *lenp = 0; -@@ -76,15 +77,16 @@ ssh_dss_sign(const struct sshkey *key, u_char **sigp, size_t *lenp, - goto out; - } - -- rlen = BN_num_bytes(sig->r); -- slen = BN_num_bytes(sig->s); -+ DSA_SIG_get0(sig, &r, &s); -+ rlen = BN_num_bytes(r); -+ slen = BN_num_bytes(s); - if (rlen > INTBLOB_LEN || slen > INTBLOB_LEN) { - ret = SSH_ERR_INTERNAL_ERROR; - goto out; - } - explicit_bzero(sigblob, SIGBLOB_LEN); -- BN_bn2bin(sig->r, sigblob + SIGBLOB_LEN - INTBLOB_LEN - rlen); -- BN_bn2bin(sig->s, sigblob + SIGBLOB_LEN - slen); -+ BN_bn2bin(r, sigblob + SIGBLOB_LEN - INTBLOB_LEN - rlen); -+ BN_bn2bin(s, sigblob + SIGBLOB_LEN - slen); - - if (compat & SSH_BUG_SIGBLOB) { - if (sigp != NULL) { -@@ -137,6 +139,7 @@ ssh_dss_verify(const struct sshkey *key, - int ret = SSH_ERR_INTERNAL_ERROR; - struct sshbuf *b = NULL; - char *ktype = NULL; -+ BIGNUM *r = NULL, *s = NULL; - - if (key == NULL || key->dsa == NULL || - sshkey_type_plain(key->type) != KEY_DSA || -@@ -177,16 +180,19 @@ ssh_dss_verify(const struct sshkey *key, - - /* parse signature */ - if ((sig = DSA_SIG_new()) == NULL || -- (sig->r = BN_new()) == NULL || -- (sig->s = BN_new()) == NULL) { -+ (r = BN_new()) == NULL || -+ (s = BN_new()) == NULL) { - ret = SSH_ERR_ALLOC_FAIL; - goto out; - } -- if ((BN_bin2bn(sigblob, INTBLOB_LEN, sig->r) == NULL) || -- (BN_bin2bn(sigblob+ INTBLOB_LEN, INTBLOB_LEN, sig->s) == NULL)) { -+ if ((BN_bin2bn(sigblob, INTBLOB_LEN, r) == NULL) || -+ (BN_bin2bn(sigblob+ INTBLOB_LEN, INTBLOB_LEN, s) == NULL) || -+ (DSA_SIG_set0(sig, r, s) == 0)) { - ret = SSH_ERR_LIBCRYPTO_ERROR; - goto out; - } -+ r = NULL; -+ s = NULL; - - /* sha1 the data */ - if ((ret = ssh_digest_memory(SSH_DIGEST_SHA1, data, datalen, -@@ -207,8 +213,9 @@ ssh_dss_verify(const struct sshkey *key, - - out: - explicit_bzero(digest, sizeof(digest)); -- if (sig != NULL) -- DSA_SIG_free(sig); -+ BN_free(r); -+ BN_free(s); -+ DSA_SIG_free(sig); - sshbuf_free(b); - free(ktype); - if (sigblob != NULL) { -diff --git a/ssh-ecdsa.c b/ssh-ecdsa.c -index d7bf3c6..985b7e5 100644 ---- a/ssh-ecdsa.c -+++ b/ssh-ecdsa.c -@@ -54,6 +54,7 @@ ssh_ecdsa_sign(const struct sshkey *key, u_char **sigp, size_t *lenp, - size_t len, dlen; - struct sshbuf *b = NULL, *bb = NULL; - int ret = SSH_ERR_INTERNAL_ERROR; -+ const BIGNUM *r, *s; - - if (lenp != NULL) - *lenp = 0; -@@ -80,8 +81,9 @@ ssh_ecdsa_sign(const struct sshkey *key, u_char **sigp, size_t *lenp, - ret = SSH_ERR_ALLOC_FAIL; - goto out; - } -- if ((ret = sshbuf_put_bignum2(bb, sig->r)) != 0 || -- (ret = sshbuf_put_bignum2(bb, sig->s)) != 0) -+ ECDSA_SIG_get0(sig, &r, &s); -+ if ((ret = sshbuf_put_bignum2(bb, r)) != 0 || -+ (ret = sshbuf_put_bignum2(bb, s)) != 0) - goto out; - if ((ret = sshbuf_put_cstring(b, sshkey_ssh_name_plain(key))) != 0 || - (ret = sshbuf_put_stringb(b, bb)) != 0) -@@ -119,6 +121,7 @@ ssh_ecdsa_verify(const struct sshkey *key, - int ret = SSH_ERR_INTERNAL_ERROR; - struct sshbuf *b = NULL, *sigbuf = NULL; - char *ktype = NULL; -+ BIGNUM *r = NULL, *s = NULL; - - if (key == NULL || key->ecdsa == NULL || - sshkey_type_plain(key->type) != KEY_ECDSA || -@@ -147,15 +150,23 @@ ssh_ecdsa_verify(const struct sshkey *key, - } - - /* parse signature */ -- if ((sig = ECDSA_SIG_new()) == NULL) { -+ if ((sig = ECDSA_SIG_new()) == NULL || -+ (r = BN_new()) == NULL || -+ (s = BN_new()) == NULL) { - ret = SSH_ERR_ALLOC_FAIL; - goto out; - } -- if (sshbuf_get_bignum2(sigbuf, sig->r) != 0 || -- sshbuf_get_bignum2(sigbuf, sig->s) != 0) { -+ if (sshbuf_get_bignum2(sigbuf, r) != 0 || -+ sshbuf_get_bignum2(sigbuf, s) != 0) { - ret = SSH_ERR_INVALID_FORMAT; - goto out; - } -+ if (ECDSA_SIG_set0(sig, r, s) == 0) { -+ ret = SSH_ERR_LIBCRYPTO_ERROR; -+ goto out; -+ } -+ r = NULL; -+ s = NULL; - if (sshbuf_len(sigbuf) != 0) { - ret = SSH_ERR_UNEXPECTED_TRAILING_DATA; - goto out; -@@ -180,8 +191,9 @@ ssh_ecdsa_verify(const struct sshkey *key, - explicit_bzero(digest, sizeof(digest)); - sshbuf_free(sigbuf); - sshbuf_free(b); -- if (sig != NULL) -- ECDSA_SIG_free(sig); -+ BN_free(r); -+ BN_free(s); -+ ECDSA_SIG_free(sig); - free(ktype); - return ret; - } -diff --git a/ssh-keygen.c b/ssh-keygen.c -index 236422c..106a518 100644 ---- a/ssh-keygen.c -+++ b/ssh-keygen.c -@@ -482,40 +482,67 @@ do_convert_private_ssh2_from_blob(u_char *blob, u_int blen) - free(type); - - switch (key->type) { -- case KEY_DSA: -- buffer_get_bignum_bits(b, key->dsa->p); -- buffer_get_bignum_bits(b, key->dsa->g); -- buffer_get_bignum_bits(b, key->dsa->q); -- buffer_get_bignum_bits(b, key->dsa->pub_key); -- buffer_get_bignum_bits(b, key->dsa->priv_key); -+ case KEY_DSA: { -+ BIGNUM *p = NULL, *g = NULL, *q = NULL, *pub_key = NULL, *priv_key = NULL; -+ -+ if ((p = BN_new()) == NULL || -+ (g = BN_new()) == NULL || -+ (q = BN_new()) == NULL || -+ (pub_key = BN_new()) == NULL || -+ (priv_key = BN_new()) == NULL) -+ fatal("BN_new() failed"); -+ buffer_get_bignum_bits(b, p); -+ buffer_get_bignum_bits(b, g); -+ buffer_get_bignum_bits(b, q); -+ buffer_get_bignum_bits(b, pub_key); -+ buffer_get_bignum_bits(b, priv_key); -+ if (DSA_set0_pqg(key->dsa, p, q, g) == 0 || -+ DSA_set0_key(key->dsa, pub_key, priv_key) == 0) { -+ fatal("failed to set DSA key"); -+ } -+ } - break; -- case KEY_RSA: -- if ((r = sshbuf_get_u8(b, &e1)) != 0 || -- (e1 < 30 && (r = sshbuf_get_u8(b, &e2)) != 0) || -- (e1 < 30 && (r = sshbuf_get_u8(b, &e3)) != 0)) -- fatal("%s: buffer error: %s", __func__, ssh_err(r)); -- e = e1; -- debug("e %lx", e); -- if (e < 30) { -- e <<= 8; -- e += e2; -+ case KEY_RSA: { -+ BIGNUM *bn_e = NULL, *bn_d = NULL, *bn_n = NULL, *bn_iqmp = NULL, *bn_p = NULL, *bn_q = NULL; -+ -+ if ((bn_e = BN_new()) == NULL || -+ (bn_d = BN_new()) == NULL || -+ (bn_n = BN_new()) == NULL || -+ (bn_iqmp = BN_new()) == NULL || -+ (bn_p = BN_new()) == NULL || -+ (bn_q = BN_new()) == NULL) -+ fatal("BN_new() failed"); -+ -+ if ((r = sshbuf_get_u8(b, &e1)) != 0 || -+ (e1 < 30 && (r = sshbuf_get_u8(b, &e2)) != 0) || -+ (e1 < 30 && (r = sshbuf_get_u8(b, &e3)) != 0)) -+ fatal("%s: buffer error: %s", __func__, ssh_err(r)); -+ e = e1; - debug("e %lx", e); -- e <<= 8; -- e += e3; -- debug("e %lx", e); -- } -- if (!BN_set_word(key->rsa->e, e)) { -- sshbuf_free(b); -- sshkey_free(key); -- return NULL; -+ if (e < 30) { -+ e <<= 8; -+ e += e2; -+ debug("e %lx", e); -+ e <<= 8; -+ e += e3; -+ debug("e %lx", e); -+ } -+ if (!BN_set_word(bn_e, e)) { -+ sshbuf_free(b); -+ sshkey_free(key); -+ return NULL; -+ } -+ buffer_get_bignum_bits(b, bn_d); -+ buffer_get_bignum_bits(b, bn_n); -+ buffer_get_bignum_bits(b, bn_iqmp); -+ buffer_get_bignum_bits(b, bn_q); -+ buffer_get_bignum_bits(b, bn_p); -+ if (RSA_set0_key(key->rsa, bn_n, bn_e, bn_d) == 0 || -+ RSA_set0_factors(key->rsa, bn_p, bn_q) == 0) -+ fatal("Failed to set RSA parameters"); -+ if ((r = rsa_generate_additional_parameters(key->rsa, bn_iqmp)) != 0) -+ fatal("generate RSA parameters failed: %s", ssh_err(r)); - } -- buffer_get_bignum_bits(b, key->rsa->d); -- buffer_get_bignum_bits(b, key->rsa->n); -- buffer_get_bignum_bits(b, key->rsa->iqmp); -- buffer_get_bignum_bits(b, key->rsa->q); -- buffer_get_bignum_bits(b, key->rsa->p); -- if ((r = rsa_generate_additional_parameters(key->rsa)) != 0) -- fatal("generate RSA parameters failed: %s", ssh_err(r)); - break; - } - rlen = sshbuf_len(b); -@@ -623,7 +650,7 @@ do_convert_from_pkcs8(struct sshkey **k, int *private) - identity_file); - } - fclose(fp); -- switch (EVP_PKEY_type(pubkey->type)) { -+ switch (EVP_PKEY_base_id(pubkey)) { - case EVP_PKEY_RSA: - if ((*k = sshkey_new(KEY_UNSPEC)) == NULL) - fatal("sshkey_new failed"); -@@ -647,7 +674,7 @@ do_convert_from_pkcs8(struct sshkey **k, int *private) - #endif - default: - fatal("%s: unsupported pubkey type %d", __func__, -- EVP_PKEY_type(pubkey->type)); -+ EVP_PKEY_base_id(pubkey)); - } - EVP_PKEY_free(pubkey); - return; -@@ -1689,6 +1716,7 @@ do_ca_sign(struct passwd *pw, int argc, char **argv) - #ifdef ENABLE_PKCS11 - pkcs11_terminate(); - #endif -+ free(ca); - exit(0); - } - -diff --git a/ssh-keyscan.c b/ssh-keyscan.c -index e5f277d..08599e6 100644 ---- a/ssh-keyscan.c -+++ b/ssh-keyscan.c -@@ -196,6 +196,7 @@ keygrab_ssh1(con *c) - static struct sshbuf *msg; - int r; - u_char type; -+ BIGNUM *n = NULL, *e = NULL; - - if (rsa == NULL) { - if ((rsa = sshkey_new(KEY_RSA1)) == NULL) { -@@ -214,16 +215,20 @@ keygrab_ssh1(con *c) - sshbuf_reset(msg); - return NULL; - } -- if ((r = sshbuf_consume(msg, 8)) != 0 || /* cookie */ -+ if ((n = BN_new()) == NULL || (e = BN_new()) == NULL || -+ (r = sshbuf_consume(msg, 8)) != 0 || /* cookie */ - /* server key */ - (r = sshbuf_get_u32(msg, NULL)) != 0 || - (r = sshbuf_get_bignum1(msg, NULL)) != 0 || - (r = sshbuf_get_bignum1(msg, NULL)) != 0 || - /* host key */ - (r = sshbuf_get_u32(msg, NULL)) != 0 || -- (r = sshbuf_get_bignum1(msg, rsa->rsa->e)) != 0 || -- (r = sshbuf_get_bignum1(msg, rsa->rsa->n)) != 0) { -+ (r = sshbuf_get_bignum1(msg, e)) != 0 || -+ (r = sshbuf_get_bignum1(msg, n)) != 0 || -+ RSA_set0_key(rsa->rsa, n, e, NULL) == 0) { - buf_err: -+ BN_free(n); -+ BN_free(e); - error("%s: buffer error: %s", __func__, ssh_err(r)); - sshbuf_reset(msg); - return NULL; -diff --git a/ssh-pkcs11-client.c b/ssh-pkcs11-client.c -index fac0167..b82deec 100644 ---- a/ssh-pkcs11-client.c -+++ b/ssh-pkcs11-client.c -@@ -143,12 +143,14 @@ pkcs11_rsa_private_encrypt(int flen, const u_char *from, u_char *to, RSA *rsa, - static int - wrap_key(RSA *rsa) - { -- static RSA_METHOD helper_rsa; -+ static RSA_METHOD *helper_rsa; - -- memcpy(&helper_rsa, RSA_get_default_method(), sizeof(helper_rsa)); -- helper_rsa.name = "ssh-pkcs11-helper"; -- helper_rsa.rsa_priv_enc = pkcs11_rsa_private_encrypt; -- RSA_set_method(rsa, &helper_rsa); -+ if (helper_rsa == NULL) { -+ helper_rsa = RSA_meth_dup(RSA_get_default_method()); -+ RSA_meth_set1_name(helper_rsa, "ssh-pkcs11-helper"); -+ RSA_meth_set_priv_enc(helper_rsa, pkcs11_rsa_private_encrypt); -+ } -+ RSA_set_method(rsa, helper_rsa); - return (0); - } - -diff --git a/ssh-pkcs11.c b/ssh-pkcs11.c -index aaf712d..6cbd22e 100644 ---- a/ssh-pkcs11.c -+++ b/ssh-pkcs11.c -@@ -67,7 +67,7 @@ struct pkcs11_key { - struct pkcs11_provider *provider; - CK_ULONG slotidx; - int (*orig_finish)(RSA *rsa); -- RSA_METHOD rsa_method; -+ RSA_METHOD *rsa_method; - char *keyid; - int keyid_len; - }; -@@ -326,13 +326,21 @@ pkcs11_rsa_wrap(struct pkcs11_provider *provider, CK_ULONG slotidx, - k11->keyid = xmalloc(k11->keyid_len); - memcpy(k11->keyid, keyid_attrib->pValue, k11->keyid_len); - } -- k11->orig_finish = def->finish; -- memcpy(&k11->rsa_method, def, sizeof(k11->rsa_method)); -- k11->rsa_method.name = "pkcs11"; -- k11->rsa_method.rsa_priv_enc = pkcs11_rsa_private_encrypt; -- k11->rsa_method.rsa_priv_dec = pkcs11_rsa_private_decrypt; -- k11->rsa_method.finish = pkcs11_rsa_finish; -- RSA_set_method(rsa, &k11->rsa_method); -+ k11->orig_finish = RSA_meth_get_finish(def); -+ if ((k11->rsa_method = RSA_meth_dup(def)) == NULL || -+ RSA_meth_set1_name(k11->rsa_method, "pkcs11") == 0 || -+ RSA_meth_set_priv_enc(k11->rsa_method, pkcs11_rsa_private_encrypt) == 0 || -+ RSA_meth_set_priv_dec(k11->rsa_method, pkcs11_rsa_private_decrypt) == 0 || -+ RSA_meth_set_finish(k11->rsa_method, pkcs11_rsa_finish) == 0) { -+ RSA_meth_free(k11->rsa_method); -+ k11->rsa_method = NULL; -+ pkcs11_provider_unref(k11->provider); -+ free(k11->keyid); -+ free(k11); -+ return (-1); -+ } -+ -+ RSA_set_method(rsa, k11->rsa_method); - RSA_set_app_data(rsa, k11); - return (0); - } -@@ -460,6 +468,7 @@ pkcs11_fetch_keys_filter(struct pkcs11_provider *p, CK_ULONG slotidx, - CK_ULONG nfound; - CK_SESSION_HANDLE session; - CK_FUNCTION_LIST *f; -+ const BIGNUM *n, *e; - - f = p->function_list; - session = p->slotinfo[slotidx].session; -@@ -512,10 +521,14 @@ pkcs11_fetch_keys_filter(struct pkcs11_provider *p, CK_ULONG slotidx, - if ((rsa = RSA_new()) == NULL) { - error("RSA_new failed"); - } else { -- rsa->n = BN_bin2bn(attribs[1].pValue, -+ BIGNUM *rsa_n, *rsa_e; -+ -+ rsa_n = BN_bin2bn(attribs[1].pValue, - attribs[1].ulValueLen, NULL); -- rsa->e = BN_bin2bn(attribs[2].pValue, -+ rsa_e = BN_bin2bn(attribs[2].pValue, - attribs[2].ulValueLen, NULL); -+ if (RSA_set0_key(rsa, rsa_n, rsa_e, NULL) == 0) -+ error("RSA_set0_key failed"); - } - } else { - cp = attribs[2].pValue; -@@ -525,17 +538,18 @@ pkcs11_fetch_keys_filter(struct pkcs11_provider *p, CK_ULONG slotidx, - == NULL) { - error("d2i_X509 failed"); - } else if ((evp = X509_get_pubkey(x509)) == NULL || -- evp->type != EVP_PKEY_RSA || -- evp->pkey.rsa == NULL) { -+ EVP_PKEY_id(evp) != EVP_PKEY_RSA || -+ EVP_PKEY_get0_RSA(evp) == NULL) { - debug("X509_get_pubkey failed or no rsa"); -- } else if ((rsa = RSAPublicKey_dup(evp->pkey.rsa)) -+ } else if ((rsa = RSAPublicKey_dup(EVP_PKEY_get0_RSA(evp))) - == NULL) { - error("RSAPublicKey_dup"); - } - if (x509) - X509_free(x509); - } -- if (rsa && rsa->n && rsa->e && -+ RSA_get0_key(rsa, &n, &e, NULL); -+ if (rsa && n && e && - pkcs11_rsa_wrap(p, slotidx, &attribs[0], rsa) == 0) { - key = sshkey_new(KEY_UNSPEC); - key->rsa = rsa; -diff --git a/ssh-rsa.c b/ssh-rsa.c -index cde05df..efcda37 100644 ---- a/ssh-rsa.c -+++ b/ssh-rsa.c -@@ -100,7 +100,7 @@ ssh_rsa_sign(const struct sshkey *key, u_char **sigp, size_t *lenp, - hash_alg = rsa_hash_alg_from_ident(alg_ident); - if (key == NULL || key->rsa == NULL || hash_alg == -1 || - sshkey_type_plain(key->type) != KEY_RSA || -- BN_num_bits(key->rsa->n) < SSH_RSA_MINIMUM_MODULUS_SIZE) -+ RSA_bits(key->rsa) < SSH_RSA_MINIMUM_MODULUS_SIZE) - return SSH_ERR_INVALID_ARGUMENT; - slen = RSA_size(key->rsa); - if (slen <= 0 || slen > SSHBUF_MAX_BIGNUM) -@@ -172,7 +172,7 @@ ssh_rsa_verify(const struct sshkey *key, - - if (key == NULL || key->rsa == NULL || - sshkey_type_plain(key->type) != KEY_RSA || -- BN_num_bits(key->rsa->n) < SSH_RSA_MINIMUM_MODULUS_SIZE || -+ RSA_bits(key->rsa) < SSH_RSA_MINIMUM_MODULUS_SIZE || - sig == NULL || siglen == 0) - return SSH_ERR_INVALID_ARGUMENT; - -diff --git a/ssh.c b/ssh.c -index 57341cf..d4c8ee8 100644 ---- a/ssh.c -+++ b/ssh.c -@@ -556,8 +556,12 @@ main(int ac, char **av) - sanitise_stdfd(); - - __progname = ssh_get_progname(av[0]); -+#if OPENSSL_VERSION_NUMBER < 0x10100000L -+ SSLeay_add_all_algorithms(); -+#endif - init_pathnames(); - -+ - #ifndef HAVE_SETPROCTITLE - /* Prepare for later setproctitle emulation */ - /* Save argv so it isn't clobbered by setproctitle() emulation */ -@@ -1265,6 +1269,7 @@ main(int ac, char **av) - free(cp); - } - free(conn_hash_hex); -+ free(host_arg); - - if (config_test) { - dump_client_config(&options, host); -diff --git a/sshconnect.c b/sshconnect.c -index 21b403f..9352b20 100644 ---- a/sshconnect.c -+++ b/sshconnect.c -@@ -1390,6 +1390,7 @@ ssh_login(Sensitive *sensitive, const char *orighost, - char *server_user, *local_user; - - local_user = xstrdup(pw->pw_name); -+ free(pw); - server_user = options.user ? options.user : local_user; - - /* Convert the user-supplied hostname into all lowercase. */ -diff --git a/sshconnect1.c b/sshconnect1.c -index dc00b4c..cf0b4ec 100644 ---- a/sshconnect1.c -+++ b/sshconnect1.c -@@ -70,6 +70,7 @@ try_agent_authentication(void) - u_char response[16]; - size_t i; - BIGNUM *challenge; -+ const BIGNUM *n; - struct ssh_identitylist *idlist = NULL; - - /* Get connection to the agent. */ -@@ -96,8 +97,9 @@ try_agent_authentication(void) - idlist->comments[i]); - - /* Tell the server that we are willing to authenticate using this key. */ -+ RSA_get0_key(idlist->keys[i]->rsa, &n, NULL, NULL); - packet_start(SSH_CMSG_AUTH_RSA); -- packet_put_bignum(idlist->keys[i]->rsa->n); -+ packet_put_bignum((BIGNUM *)n); - packet_send(); - packet_write_wait(); - -@@ -220,6 +222,7 @@ static int - try_rsa_authentication(int idx) - { - BIGNUM *challenge; -+ const BIGNUM *n; - Key *public, *private; - char buf[300], *passphrase = NULL, *comment, *authfile; - int i, perm_ok = 1, type, quit; -@@ -231,8 +234,9 @@ try_rsa_authentication(int idx) - debug("Trying RSA authentication with key '%.100s'", comment); - - /* Tell the server that we are willing to authenticate using this key. */ -+ RSA_get0_key(public->rsa, &n, NULL, NULL); - packet_start(SSH_CMSG_AUTH_RSA); -- packet_put_bignum(public->rsa->n); -+ packet_put_bignum((BIGNUM *)n); - packet_send(); - packet_write_wait(); - -@@ -348,15 +352,17 @@ try_rhosts_rsa_authentication(const char *local_user, Key * host_key) - { - int type; - BIGNUM *challenge; -+ const BIGNUM *n, *e; - - debug("Trying rhosts or /etc/hosts.equiv with RSA host authentication."); - - /* Tell the server that we are willing to authenticate using this key. */ -+ RSA_get0_key(host_key->rsa, &n, &e, NULL); - packet_start(SSH_CMSG_AUTH_RHOSTS_RSA); - packet_put_cstring(local_user); -- packet_put_int(BN_num_bits(host_key->rsa->n)); -- packet_put_bignum(host_key->rsa->e); -- packet_put_bignum(host_key->rsa->n); -+ packet_put_int(BN_num_bits(n)); -+ packet_put_bignum((BIGNUM *)e); -+ packet_put_bignum((BIGNUM *)n); - packet_send(); - packet_write_wait(); - -@@ -502,6 +508,8 @@ ssh_kex(char *host, struct sockaddr *hostaddr) - { - int i; - BIGNUM *key; -+ BIGNUM *server_n = NULL, *server_e = NULL, -+ *host_n = NULL, *host_e = NULL; - Key *host_key, *server_key; - int bits, rbits; - int ssh_cipher_default = SSH_CIPHER_3DES; -@@ -523,10 +531,14 @@ ssh_kex(char *host, struct sockaddr *hostaddr) - if ((server_key = key_new(KEY_RSA1)) == NULL) - fatal("%s: key_new(KEY_RSA1) failed", __func__); - bits = packet_get_int(); -- packet_get_bignum(server_key->rsa->e); -- packet_get_bignum(server_key->rsa->n); -- -- rbits = BN_num_bits(server_key->rsa->n); -+ if ((server_e = BN_new()) == NULL || -+ (server_n = BN_new()) == NULL) -+ fatal("BN_new() failed"); -+ packet_get_bignum(server_e); -+ packet_get_bignum(server_n); -+ RSA_set0_key(server_key->rsa, server_n, server_e, NULL); -+ -+ rbits = BN_num_bits(server_n); - if (bits != rbits) { - logit("Warning: Server lies about size of server public key: " - "actual size is %d bits vs. announced %d.", rbits, bits); -@@ -536,10 +548,14 @@ ssh_kex(char *host, struct sockaddr *hostaddr) - if ((host_key = key_new(KEY_RSA1)) == NULL) - fatal("%s: key_new(KEY_RSA1) failed", __func__); - bits = packet_get_int(); -- packet_get_bignum(host_key->rsa->e); -- packet_get_bignum(host_key->rsa->n); -- -- rbits = BN_num_bits(host_key->rsa->n); -+ if ((host_e = BN_new()) == NULL || -+ (host_n = BN_new()) == NULL) -+ fatal("BN_new() failed"); -+ packet_get_bignum(host_e); -+ packet_get_bignum(host_n); -+ RSA_set0_key(host_key->rsa, host_n, host_e, NULL); -+ -+ rbits = BN_num_bits(host_n); - if (bits != rbits) { - logit("Warning: Server lies about size of server host key: " - "actual size is %d bits vs. announced %d.", rbits, bits); -@@ -555,14 +571,14 @@ ssh_kex(char *host, struct sockaddr *hostaddr) - packet_check_eom(); - - debug("Received server public key (%d bits) and host key (%d bits).", -- BN_num_bits(server_key->rsa->n), BN_num_bits(host_key->rsa->n)); -+ BN_num_bits(server_n), BN_num_bits(host_n)); - - if (verify_host_key(host, hostaddr, host_key) == -1) - fatal("Host key verification failed."); - - client_flags = SSH_PROTOFLAG_SCREEN_NUMBER | SSH_PROTOFLAG_HOST_IN_FWD_OPEN; - -- derive_ssh1_session_id(host_key->rsa->n, server_key->rsa->n, cookie, session_id); -+ derive_ssh1_session_id(host_n, server_n, cookie, session_id); - - /* - * Generate an encryption key for the session. The key is a 256 bit -@@ -597,14 +613,14 @@ ssh_kex(char *host, struct sockaddr *hostaddr) - * Encrypt the integer using the public key and host key of the - * server (key with smaller modulus first). - */ -- if (BN_cmp(server_key->rsa->n, host_key->rsa->n) < 0) { -+ if (BN_cmp(server_n, host_n) < 0) { - /* Public key has smaller modulus. */ -- if (BN_num_bits(host_key->rsa->n) < -- BN_num_bits(server_key->rsa->n) + SSH_KEY_BITS_RESERVED) { -+ if (BN_num_bits(host_n) < -+ BN_num_bits(server_n) + SSH_KEY_BITS_RESERVED) { - fatal("respond_to_rsa_challenge: host_key %d < server_key %d + " - "SSH_KEY_BITS_RESERVED %d", -- BN_num_bits(host_key->rsa->n), -- BN_num_bits(server_key->rsa->n), -+ BN_num_bits(host_n), -+ BN_num_bits(server_n), - SSH_KEY_BITS_RESERVED); - } - if (rsa_public_encrypt(key, key, server_key->rsa) != 0 || -@@ -612,12 +628,12 @@ ssh_kex(char *host, struct sockaddr *hostaddr) - fatal("%s: rsa_public_encrypt failed", __func__); - } else { - /* Host key has smaller modulus (or they are equal). */ -- if (BN_num_bits(server_key->rsa->n) < -- BN_num_bits(host_key->rsa->n) + SSH_KEY_BITS_RESERVED) { -+ if (BN_num_bits(server_n) < -+ BN_num_bits(host_n) + SSH_KEY_BITS_RESERVED) { - fatal("respond_to_rsa_challenge: server_key %d < host_key %d + " - "SSH_KEY_BITS_RESERVED %d", -- BN_num_bits(server_key->rsa->n), -- BN_num_bits(host_key->rsa->n), -+ BN_num_bits(server_n), -+ BN_num_bits(host_n), - SSH_KEY_BITS_RESERVED); - } - if (rsa_public_encrypt(key, key, host_key->rsa) != 0 || -diff --git a/sshconnect2.c b/sshconnect2.c -index 3195b21..034e8b1 100644 ---- a/sshconnect2.c -+++ b/sshconnect2.c -@@ -309,6 +309,7 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port) - packet_send(); - packet_write_wait(); - #endif -+ /* XXX free myproposal ?? */ - } - - /* -diff --git a/sshd.c b/sshd.c -index 10cc69c..19a695b 100644 ---- a/sshd.c -+++ b/sshd.c -@@ -1478,6 +1478,7 @@ main(int ac, char **av) - (void)set_auth_parameters(ac, av); - #endif - __progname = ssh_get_progname(av[0]); -+ OpenSSL_add_all_algorithms(); - init_pathnames(); - config_file_name = _PATH_SERVER_CONFIG_FILE; - -diff --git a/sshkey.c b/sshkey.c -index 9cf2cfe..1efb976 100644 ---- a/sshkey.c -+++ b/sshkey.c -@@ -278,10 +278,10 @@ sshkey_size(const struct sshkey *k) - case KEY_RSA1: - case KEY_RSA: - case KEY_RSA_CERT: -- return BN_num_bits(k->rsa->n); -+ return RSA_bits(k->rsa); - case KEY_DSA: - case KEY_DSA_CERT: -- return BN_num_bits(k->dsa->p); -+ return DSA_bits(k->dsa); - case KEY_ECDSA: - case KEY_ECDSA_CERT: - return sshkey_curve_nid_to_bits(k->ecdsa_nid); -@@ -481,11 +481,7 @@ sshkey_new(int type) - case KEY_RSA1: - case KEY_RSA: - case KEY_RSA_CERT: -- if ((rsa = RSA_new()) == NULL || -- (rsa->n = BN_new()) == NULL || -- (rsa->e = BN_new()) == NULL) { -- if (rsa != NULL) -- RSA_free(rsa); -+ if ((rsa = RSA_new()) == NULL) { - free(k); - return NULL; - } -@@ -493,13 +489,7 @@ sshkey_new(int type) - break; - case KEY_DSA: - case KEY_DSA_CERT: -- if ((dsa = DSA_new()) == NULL || -- (dsa->p = BN_new()) == NULL || -- (dsa->q = BN_new()) == NULL || -- (dsa->g = BN_new()) == NULL || -- (dsa->pub_key = BN_new()) == NULL) { -- if (dsa != NULL) -- DSA_free(dsa); -+ if ((dsa = DSA_new()) == NULL) { - free(k); - return NULL; - } -@@ -539,21 +529,10 @@ sshkey_add_private(struct sshkey *k) - case KEY_RSA1: - case KEY_RSA: - case KEY_RSA_CERT: --#define bn_maybe_alloc_failed(p) (p == NULL && (p = BN_new()) == NULL) -- if (bn_maybe_alloc_failed(k->rsa->d) || -- bn_maybe_alloc_failed(k->rsa->iqmp) || -- bn_maybe_alloc_failed(k->rsa->q) || -- bn_maybe_alloc_failed(k->rsa->p) || -- bn_maybe_alloc_failed(k->rsa->dmq1) || -- bn_maybe_alloc_failed(k->rsa->dmp1)) -- return SSH_ERR_ALLOC_FAIL; - break; - case KEY_DSA: - case KEY_DSA_CERT: -- if (bn_maybe_alloc_failed(k->dsa->priv_key)) -- return SSH_ERR_ALLOC_FAIL; - break; --#undef bn_maybe_alloc_failed - case KEY_ECDSA: - case KEY_ECDSA_CERT: - /* Cannot do anything until we know the group */ -@@ -672,17 +651,31 @@ sshkey_equal_public(const struct sshkey *a, const struct sshkey *b) - #ifdef WITH_OPENSSL - case KEY_RSA1: - case KEY_RSA_CERT: -- case KEY_RSA: -- return a->rsa != NULL && b->rsa != NULL && -- BN_cmp(a->rsa->e, b->rsa->e) == 0 && -- BN_cmp(a->rsa->n, b->rsa->n) == 0; -+ case KEY_RSA: { -+ const BIGNUM *a_e, *a_n, *b_e, *b_n; -+ -+ if (a->rsa == NULL || b->rsa == NULL) -+ return 0; -+ RSA_get0_key(a->rsa, &a_n, &a_e, NULL); -+ RSA_get0_key(b->rsa, &b_n, &b_e, NULL); -+ return BN_cmp(a_e, b_e) == 0 && BN_cmp(a_n, b_n) == 0; -+ } - case KEY_DSA_CERT: -- case KEY_DSA: -- return a->dsa != NULL && b->dsa != NULL && -- BN_cmp(a->dsa->p, b->dsa->p) == 0 && -- BN_cmp(a->dsa->q, b->dsa->q) == 0 && -- BN_cmp(a->dsa->g, b->dsa->g) == 0 && -- BN_cmp(a->dsa->pub_key, b->dsa->pub_key) == 0; -+ case KEY_DSA: { -+ const BIGNUM *a_p, *a_q, *a_g, *a_pub_key; -+ const BIGNUM *b_p, *b_q, *b_g, *b_pub_key; -+ -+ if (a->dsa == NULL || b->dsa == NULL) -+ return 0; -+ DSA_get0_pqg(a->dsa, &a_p, &a_q, &a_g); -+ DSA_get0_key(a->dsa, &a_pub_key, NULL); -+ DSA_get0_pqg(b->dsa, &b_p, &b_q, &b_g); -+ DSA_get0_key(b->dsa, &b_pub_key, NULL); -+ return BN_cmp(a_p, b_p) == 0 && -+ BN_cmp(a_q, b_q) == 0 && -+ BN_cmp(a_g, b_g) == 0 && -+ BN_cmp(a_pub_key, b_pub_key) == 0; -+ } - # ifdef OPENSSL_HAS_ECC - case KEY_ECDSA_CERT: - case KEY_ECDSA: -@@ -757,15 +750,21 @@ to_blob_buf(const struct sshkey *key, struct sshbuf *b, int force_plain) - return ret; - break; - #ifdef WITH_OPENSSL -- case KEY_DSA: -- if (key->dsa == NULL) -- return SSH_ERR_INVALID_ARGUMENT; -- if ((ret = sshbuf_put_cstring(b, typename)) != 0 || -- (ret = sshbuf_put_bignum2(b, key->dsa->p)) != 0 || -- (ret = sshbuf_put_bignum2(b, key->dsa->q)) != 0 || -- (ret = sshbuf_put_bignum2(b, key->dsa->g)) != 0 || -- (ret = sshbuf_put_bignum2(b, key->dsa->pub_key)) != 0) -- return ret; -+ case KEY_DSA: { -+ const BIGNUM *p, *q, *g, *pub_key; -+ -+ if (key->dsa == NULL) -+ return SSH_ERR_INVALID_ARGUMENT; -+ -+ DSA_get0_pqg(key->dsa, &p, &q, &g); -+ DSA_get0_key(key->dsa, &pub_key, NULL); -+ if ((ret = sshbuf_put_cstring(b, typename)) != 0 || -+ (ret = sshbuf_put_bignum2(b, p)) != 0 || -+ (ret = sshbuf_put_bignum2(b, q)) != 0 || -+ (ret = sshbuf_put_bignum2(b, g)) != 0 || -+ (ret = sshbuf_put_bignum2(b, pub_key)) != 0) -+ return ret; -+ } - break; - # ifdef OPENSSL_HAS_ECC - case KEY_ECDSA: -@@ -778,13 +777,18 @@ to_blob_buf(const struct sshkey *key, struct sshbuf *b, int force_plain) - return ret; - break; - # endif -- case KEY_RSA: -- if (key->rsa == NULL) -- return SSH_ERR_INVALID_ARGUMENT; -- if ((ret = sshbuf_put_cstring(b, typename)) != 0 || -- (ret = sshbuf_put_bignum2(b, key->rsa->e)) != 0 || -- (ret = sshbuf_put_bignum2(b, key->rsa->n)) != 0) -- return ret; -+ case KEY_RSA: { -+ const BIGNUM *e, *n; -+ -+ if (key->rsa == NULL) -+ return SSH_ERR_INVALID_ARGUMENT; -+ -+ RSA_get0_key(key->rsa, &n, &e, NULL); -+ if ((ret = sshbuf_put_cstring(b, typename)) != 0 || -+ (ret = sshbuf_put_bignum2(b, e)) != 0 || -+ (ret = sshbuf_put_bignum2(b, n)) != 0) -+ return ret; -+ } - break; - #endif /* WITH_OPENSSL */ - case KEY_ED25519: -@@ -890,8 +894,13 @@ sshkey_fingerprint_raw(const struct sshkey *k, int dgst_alg, - - if (k->type == KEY_RSA1) { - #ifdef WITH_OPENSSL -- int nlen = BN_num_bytes(k->rsa->n); -- int elen = BN_num_bytes(k->rsa->e); -+ const BIGNUM *n, *e; -+ int nlen, elen; -+ -+ RSA_get0_key(k->rsa, &n, &e, NULL); -+ -+ nlen = BN_num_bytes(n); -+ elen = BN_num_bytes(e); - - if (nlen < 0 || elen < 0 || nlen >= INT_MAX - elen) { - r = SSH_ERR_INVALID_FORMAT; -@@ -902,8 +911,8 @@ sshkey_fingerprint_raw(const struct sshkey *k, int dgst_alg, - r = SSH_ERR_ALLOC_FAIL; - goto out; - } -- BN_bn2bin(k->rsa->n, blob); -- BN_bn2bin(k->rsa->e, blob + nlen); -+ BN_bn2bin(n, blob); -+ BN_bn2bin(e, blob + nlen); - #endif /* WITH_OPENSSL */ - } else if ((r = to_blob(k, &blob, &blob_len, 1)) != 0) - goto out; -@@ -1242,6 +1251,7 @@ sshkey_read(struct sshkey *ret, char **cpp) - struct sshbuf *blob; - #ifdef WITH_SSH1 - u_long bits; -+ BIGNUM *e = NULL, *n = NULL; - #endif /* WITH_SSH1 */ - - if (ret == NULL) -@@ -1258,12 +1268,21 @@ sshkey_read(struct sshkey *ret, char **cpp) - bits == 0 || bits > SSHBUF_MAX_BIGNUM * 8) - return SSH_ERR_INVALID_FORMAT; /* Bad bit count... */ - /* Get public exponent, public modulus. */ -- if ((r = read_decimal_bignum(&ep, ret->rsa->e)) < 0) -+ if ((e = BN_new()) == NULL || (n = BN_new()) == NULL) { -+ BN_free(e); -+ return SSH_ERR_ALLOC_FAIL; -+ } -+ if ((r = read_decimal_bignum(&ep, e)) < 0) - return r; -- if ((r = read_decimal_bignum(&ep, ret->rsa->n)) < 0) -+ if ((r = read_decimal_bignum(&ep, n)) < 0) - return r; -+ if (RSA_set0_key(ret->rsa, n, e, NULL) == 0) { -+ BN_free(e); -+ BN_free(n); -+ return -1; -+ } - /* validate the claimed number of bits */ -- if (BN_num_bits(ret->rsa->n) != (int)bits) -+ if (BN_num_bits(n) != (int)bits) - return SSH_ERR_KEY_BITS_MISMATCH; - *cpp = ep; - retval = 0; -@@ -1428,19 +1447,20 @@ sshkey_format_rsa1(const struct sshkey *key, struct sshbuf *b) - #ifdef WITH_SSH1 - u_int bits = 0; - char *dec_e = NULL, *dec_n = NULL; -+ const BIGNUM *e, *n; - -- if (key->rsa == NULL || key->rsa->e == NULL || -- key->rsa->n == NULL) { -+ RSA_get0_key(key->rsa, &n, &e, NULL); -+ if (key->rsa == NULL || e == NULL || n == NULL) { - r = SSH_ERR_INVALID_ARGUMENT; - goto out; - } -- if ((dec_e = BN_bn2dec(key->rsa->e)) == NULL || -- (dec_n = BN_bn2dec(key->rsa->n)) == NULL) { -+ if ((dec_e = BN_bn2dec(e)) == NULL || -+ (dec_n = BN_bn2dec(n)) == NULL) { - r = SSH_ERR_ALLOC_FAIL; - goto out; - } - /* size of modulus 'n' */ -- if ((bits = BN_num_bits(key->rsa->n)) <= 0) { -+ if ((bits = BN_num_bits(n)) <= 0) { - r = SSH_ERR_INVALID_ARGUMENT; - goto out; - } -@@ -1772,15 +1792,32 @@ sshkey_from_private(const struct sshkey *k, struct sshkey **pkp) - switch (k->type) { - #ifdef WITH_OPENSSL - case KEY_DSA: -- case KEY_DSA_CERT: -- if ((n = sshkey_new(k->type)) == NULL) -- return SSH_ERR_ALLOC_FAIL; -- if ((BN_copy(n->dsa->p, k->dsa->p) == NULL) || -- (BN_copy(n->dsa->q, k->dsa->q) == NULL) || -- (BN_copy(n->dsa->g, k->dsa->g) == NULL) || -- (BN_copy(n->dsa->pub_key, k->dsa->pub_key) == NULL)) { -- sshkey_free(n); -- return SSH_ERR_ALLOC_FAIL; -+ case KEY_DSA_CERT: { -+ const BIGNUM *k_p, *k_q, *k_g, *k_pub_key; -+ BIGNUM *n_p = NULL, *n_q = NULL, *n_g = NULL, *n_pub_key = NULL; -+ -+ if ((n = sshkey_new(k->type)) == NULL) -+ return SSH_ERR_ALLOC_FAIL; -+ -+ DSA_get0_pqg(k->dsa, &k_p, &k_q, &k_g); -+ DSA_get0_key(k->dsa, &k_pub_key, NULL); -+ -+ if (((n_p = BN_dup(k_p)) == NULL) || -+ ((n_q = BN_dup(k_q)) == NULL) || -+ ((n_g = BN_dup(k_g)) == NULL) || -+ (DSA_set0_pqg(n->dsa, n_p, n_q, n_g) == 0)) { -+ sshkey_free(n); -+ BN_free(n_p); -+ BN_free(n_q); -+ BN_free(n_g); -+ return SSH_ERR_ALLOC_FAIL; -+ } -+ if (((n_pub_key = BN_dup(k_pub_key)) == NULL) || -+ (DSA_set0_key(n->dsa, n_pub_key, NULL) == 0)) { -+ sshkey_free(n); -+ BN_free(n_pub_key); -+ return SSH_ERR_ALLOC_FAIL; -+ } - } - break; - # ifdef OPENSSL_HAS_ECC -@@ -1803,13 +1840,22 @@ sshkey_from_private(const struct sshkey *k, struct sshkey **pkp) - # endif /* OPENSSL_HAS_ECC */ - case KEY_RSA: - case KEY_RSA1: -- case KEY_RSA_CERT: -- if ((n = sshkey_new(k->type)) == NULL) -- return SSH_ERR_ALLOC_FAIL; -- if ((BN_copy(n->rsa->n, k->rsa->n) == NULL) || -- (BN_copy(n->rsa->e, k->rsa->e) == NULL)) { -- sshkey_free(n); -- return SSH_ERR_ALLOC_FAIL; -+ case KEY_RSA_CERT: { -+ const BIGNUM *k_n, *k_e; -+ BIGNUM *n_n = NULL, *n_e = NULL; -+ -+ if ((n = sshkey_new(k->type)) == NULL) -+ return SSH_ERR_ALLOC_FAIL; -+ -+ RSA_get0_key(k->rsa, &k_n, &k_e, NULL); -+ if (((n_n = BN_dup(k_n)) == NULL) || -+ ((n_e = BN_dup(k_e)) == NULL) || -+ RSA_set0_key(n->rsa, n_n, n_e, NULL) == 0) { -+ sshkey_free(n); -+ BN_free(n_n); -+ BN_free(n_e); -+ return SSH_ERR_ALLOC_FAIL; -+ } - } - break; - #endif /* WITH_OPENSSL */ -@@ -2007,10 +2053,20 @@ sshkey_from_blob_internal(struct sshbuf *b, struct sshkey **keyp, - ret = SSH_ERR_ALLOC_FAIL; - goto out; - } -- if (sshbuf_get_bignum2(b, key->rsa->e) != 0 || -- sshbuf_get_bignum2(b, key->rsa->n) != 0) { -- ret = SSH_ERR_INVALID_FORMAT; -- goto out; -+ { -+ BIGNUM *e, *n; -+ -+ e = BN_new(); -+ n = BN_new(); -+ if (e == NULL || n == NULL || -+ sshbuf_get_bignum2(b, e) != 0 || -+ sshbuf_get_bignum2(b, n) != 0 || -+ RSA_set0_key(key->rsa, n, e, NULL) == 0) { -+ BN_free(e); -+ BN_free(n); -+ ret = SSH_ERR_ALLOC_FAIL; -+ goto out; -+ } - } - #ifdef DEBUG_PK - RSA_print_fp(stderr, key->rsa, 8); -@@ -2028,12 +2084,34 @@ sshkey_from_blob_internal(struct sshbuf *b, struct sshkey **keyp, - ret = SSH_ERR_ALLOC_FAIL; - goto out; - } -- if (sshbuf_get_bignum2(b, key->dsa->p) != 0 || -- sshbuf_get_bignum2(b, key->dsa->q) != 0 || -- sshbuf_get_bignum2(b, key->dsa->g) != 0 || -- sshbuf_get_bignum2(b, key->dsa->pub_key) != 0) { -- ret = SSH_ERR_INVALID_FORMAT; -- goto out; -+ { -+ BIGNUM *p, *q, *g, *pub_key; -+ -+ p = BN_new(); -+ q = BN_new(); -+ g = BN_new(); -+ pub_key = BN_new(); -+ -+ if (p == NULL || q == NULL || g == NULL || -+ pub_key == NULL || -+ sshbuf_get_bignum2(b, p) != 0 || -+ sshbuf_get_bignum2(b, q) != 0 || -+ sshbuf_get_bignum2(b, g) != 0 || -+ sshbuf_get_bignum2(b, pub_key) != 0 || -+ DSA_set0_pqg(key->dsa, p, q, g) == 0) { -+ BN_free(p); -+ BN_free(q); -+ BN_free(g); -+ BN_free(pub_key); -+ ret = SSH_ERR_ALLOC_FAIL; -+ goto out; -+ } -+ -+ if (DSA_set0_key(key->dsa, pub_key, NULL) == 0) { -+ BN_free(pub_key); -+ ret = SSH_ERR_LIBCRYPTO_ERROR; -+ goto out; -+ } - } - #ifdef DEBUG_PK - DSA_print_fp(stderr, key->dsa, 8); -@@ -2273,26 +2351,53 @@ sshkey_demote(const struct sshkey *k, struct sshkey **dkp) - goto fail; - /* FALLTHROUGH */ - case KEY_RSA1: -- case KEY_RSA: -- if ((pk->rsa = RSA_new()) == NULL || -- (pk->rsa->e = BN_dup(k->rsa->e)) == NULL || -- (pk->rsa->n = BN_dup(k->rsa->n)) == NULL) { -- ret = SSH_ERR_ALLOC_FAIL; -- goto fail; -+ case KEY_RSA: { -+ const BIGNUM *k_e, *k_n; -+ BIGNUM *pk_e = NULL, *pk_n = NULL; -+ -+ RSA_get0_key(k->rsa, &k_n, &k_e, NULL); -+ if ((pk->rsa = RSA_new()) == NULL || -+ (pk_e = BN_dup(k_e)) == NULL || -+ (pk_n = BN_dup(k_n)) == NULL || -+ RSA_set0_key(pk->rsa, pk_n, pk_e, NULL) == 0) { -+ BN_free(pk_e); -+ BN_free(pk_n); -+ ret = SSH_ERR_ALLOC_FAIL; -+ goto fail; - } -+ } - break; - case KEY_DSA_CERT: - if ((ret = sshkey_cert_copy(k, pk)) != 0) - goto fail; - /* FALLTHROUGH */ -- case KEY_DSA: -- if ((pk->dsa = DSA_new()) == NULL || -- (pk->dsa->p = BN_dup(k->dsa->p)) == NULL || -- (pk->dsa->q = BN_dup(k->dsa->q)) == NULL || -- (pk->dsa->g = BN_dup(k->dsa->g)) == NULL || -- (pk->dsa->pub_key = BN_dup(k->dsa->pub_key)) == NULL) { -- ret = SSH_ERR_ALLOC_FAIL; -- goto fail; -+ case KEY_DSA: { -+ const BIGNUM *k_p, *k_q, *k_g, *k_pub_key; -+ BIGNUM *pk_p = NULL, *pk_q = NULL, *pk_g = NULL; -+ BIGNUM *pk_pub_key = NULL; -+ -+ DSA_get0_pqg(k->dsa, &k_p, &k_q, &k_g); -+ DSA_get0_key(k->dsa, &k_pub_key, NULL); -+ -+ if ((pk->dsa = DSA_new()) == NULL || -+ (pk_p = BN_dup(k_p)) == NULL || -+ (pk_q = BN_dup(k_q)) == NULL || -+ (pk_g = BN_dup(k_g)) == NULL || -+ (pk_pub_key = BN_dup(k_pub_key)) == NULL || -+ DSA_set0_pqg(pk->dsa, pk_p, pk_q, pk_g) == 0) { -+ BN_free(pk_p); -+ BN_free(pk_q); -+ BN_free(pk_g); -+ BN_free(pk_pub_key); -+ ret = SSH_ERR_ALLOC_FAIL; -+ goto fail; -+ } -+ -+ if (DSA_set0_key(pk->dsa, pk_pub_key, NULL) == 0) { -+ BN_free(pk_pub_key); -+ ret = SSH_ERR_LIBCRYPTO_ERROR; -+ goto fail; -+ } - } - break; - case KEY_ECDSA_CERT: -@@ -2413,12 +2518,17 @@ sshkey_certify(struct sshkey *k, struct sshkey *ca, const char *alg) - /* XXX this substantially duplicates to_blob(); refactor */ - switch (k->type) { - #ifdef WITH_OPENSSL -- case KEY_DSA_CERT: -- if ((ret = sshbuf_put_bignum2(cert, k->dsa->p)) != 0 || -- (ret = sshbuf_put_bignum2(cert, k->dsa->q)) != 0 || -- (ret = sshbuf_put_bignum2(cert, k->dsa->g)) != 0 || -- (ret = sshbuf_put_bignum2(cert, k->dsa->pub_key)) != 0) -- goto out; -+ case KEY_DSA_CERT: { -+ const BIGNUM *p, *q, *g, *pub_key; -+ -+ DSA_get0_pqg(k->dsa, &p, &q, &g); -+ DSA_get0_key(k->dsa, &pub_key, NULL); -+ if ((ret = sshbuf_put_bignum2(cert, p)) != 0 || -+ (ret = sshbuf_put_bignum2(cert, q)) != 0 || -+ (ret = sshbuf_put_bignum2(cert, g)) != 0 || -+ (ret = sshbuf_put_bignum2(cert, pub_key)) != 0) -+ goto out; -+ } - break; - # ifdef OPENSSL_HAS_ECC - case KEY_ECDSA_CERT: -@@ -2430,10 +2540,15 @@ sshkey_certify(struct sshkey *k, struct sshkey *ca, const char *alg) - goto out; - break; - # endif /* OPENSSL_HAS_ECC */ -- case KEY_RSA_CERT: -- if ((ret = sshbuf_put_bignum2(cert, k->rsa->e)) != 0 || -- (ret = sshbuf_put_bignum2(cert, k->rsa->n)) != 0) -- goto out; -+ case KEY_RSA_CERT: { -+ const BIGNUM *e, *n; -+ -+ RSA_get0_key(k->rsa, &n, &e, NULL); -+ if (e == NULL || n == NULL || -+ (ret = sshbuf_put_bignum2(cert, e)) != 0 || -+ (ret = sshbuf_put_bignum2(cert, n)) != 0) -+ goto out; -+ } - break; - #endif /* WITH_OPENSSL */ - case KEY_ED25519_CERT: -@@ -2590,43 +2705,65 @@ sshkey_private_serialize(const struct sshkey *key, struct sshbuf *b) - goto out; - switch (key->type) { - #ifdef WITH_OPENSSL -- case KEY_RSA: -- if ((r = sshbuf_put_bignum2(b, key->rsa->n)) != 0 || -- (r = sshbuf_put_bignum2(b, key->rsa->e)) != 0 || -- (r = sshbuf_put_bignum2(b, key->rsa->d)) != 0 || -- (r = sshbuf_put_bignum2(b, key->rsa->iqmp)) != 0 || -- (r = sshbuf_put_bignum2(b, key->rsa->p)) != 0 || -- (r = sshbuf_put_bignum2(b, key->rsa->q)) != 0) -- goto out; -+ case KEY_RSA: { -+ const BIGNUM *n, *e, *d, *iqmp, *p, *q; -+ RSA_get0_key(key->rsa, &n, &e, &d); -+ RSA_get0_crt_params(key->rsa, NULL, NULL, &iqmp); -+ RSA_get0_factors(key->rsa, &p, &q); -+ if ((r = sshbuf_put_bignum2(b, n)) != 0 || -+ (r = sshbuf_put_bignum2(b, e)) != 0 || -+ (r = sshbuf_put_bignum2(b, d)) != 0 || -+ (r = sshbuf_put_bignum2(b, iqmp)) != 0 || -+ (r = sshbuf_put_bignum2(b, p)) != 0 || -+ (r = sshbuf_put_bignum2(b, q)) != 0) -+ goto out; -+ } - break; - case KEY_RSA_CERT: - if (key->cert == NULL || sshbuf_len(key->cert->certblob) == 0) { - r = SSH_ERR_INVALID_ARGUMENT; - goto out; - } -- if ((r = sshbuf_put_stringb(b, key->cert->certblob)) != 0 || -- (r = sshbuf_put_bignum2(b, key->rsa->d)) != 0 || -- (r = sshbuf_put_bignum2(b, key->rsa->iqmp)) != 0 || -- (r = sshbuf_put_bignum2(b, key->rsa->p)) != 0 || -- (r = sshbuf_put_bignum2(b, key->rsa->q)) != 0) -- goto out; -+ { -+ const BIGNUM *d, *iqmp, *p, *q; -+ -+ RSA_get0_key(key->rsa, NULL, NULL, &d); -+ RSA_get0_factors(key->rsa, &p, &q); -+ RSA_get0_crt_params(key->rsa, NULL, NULL, &iqmp); -+ if ((r = sshbuf_put_stringb(b, key->cert->certblob)) != 0 || -+ (r = sshbuf_put_bignum2(b, d)) != 0 || -+ (r = sshbuf_put_bignum2(b, iqmp)) != 0 || -+ (r = sshbuf_put_bignum2(b, p)) != 0 || -+ (r = sshbuf_put_bignum2(b, q)) != 0) -+ goto out; -+ } - break; -- case KEY_DSA: -- if ((r = sshbuf_put_bignum2(b, key->dsa->p)) != 0 || -- (r = sshbuf_put_bignum2(b, key->dsa->q)) != 0 || -- (r = sshbuf_put_bignum2(b, key->dsa->g)) != 0 || -- (r = sshbuf_put_bignum2(b, key->dsa->pub_key)) != 0 || -- (r = sshbuf_put_bignum2(b, key->dsa->priv_key)) != 0) -- goto out; -+ case KEY_DSA: { -+ const BIGNUM *p, *q, *g, *pub_key, *priv_key; -+ -+ DSA_get0_pqg(key->dsa, &p, &q, &g); -+ DSA_get0_key(key->dsa, &pub_key, &priv_key); -+ if ((r = sshbuf_put_bignum2(b, p)) != 0 || -+ (r = sshbuf_put_bignum2(b, q)) != 0 || -+ (r = sshbuf_put_bignum2(b, g)) != 0 || -+ (r = sshbuf_put_bignum2(b, pub_key)) != 0 || -+ (r = sshbuf_put_bignum2(b, priv_key)) != 0) -+ goto out; -+ } - break; - case KEY_DSA_CERT: - if (key->cert == NULL || sshbuf_len(key->cert->certblob) == 0) { - r = SSH_ERR_INVALID_ARGUMENT; - goto out; - } -- if ((r = sshbuf_put_stringb(b, key->cert->certblob)) != 0 || -- (r = sshbuf_put_bignum2(b, key->dsa->priv_key)) != 0) -- goto out; -+ { -+ const BIGNUM *priv_key; -+ -+ DSA_get0_key(key->dsa, NULL, &priv_key); -+ if ((r = sshbuf_put_stringb(b, key->cert->certblob)) != 0 || -+ (r = sshbuf_put_bignum2(b, priv_key)) != 0) -+ goto out; -+ } - break; - # ifdef OPENSSL_HAS_ECC - case KEY_ECDSA: -@@ -2702,18 +2839,51 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp) - r = SSH_ERR_ALLOC_FAIL; - goto out; - } -- if ((r = sshbuf_get_bignum2(buf, k->dsa->p)) != 0 || -- (r = sshbuf_get_bignum2(buf, k->dsa->q)) != 0 || -- (r = sshbuf_get_bignum2(buf, k->dsa->g)) != 0 || -- (r = sshbuf_get_bignum2(buf, k->dsa->pub_key)) != 0 || -- (r = sshbuf_get_bignum2(buf, k->dsa->priv_key)) != 0) -- goto out; -+ { -+ BIGNUM *p, *q, *g, *pub_key, *priv_key; -+ -+ p = BN_new(); -+ q = BN_new(); -+ g = BN_new(); -+ pub_key = BN_new(); -+ priv_key = BN_new(); -+ if (p == NULL || q == NULL || g == NULL || -+ pub_key == NULL || priv_key == NULL || -+ (r = sshbuf_get_bignum2(buf, p)) != 0 || -+ (r = sshbuf_get_bignum2(buf, q)) != 0 || -+ (r = sshbuf_get_bignum2(buf, g)) != 0 || -+ (r = sshbuf_get_bignum2(buf, pub_key)) != 0 || -+ (r = sshbuf_get_bignum2(buf, priv_key)) != 0 || -+ (r = ((DSA_set0_pqg(k->dsa, p, q, g) == 0) -+ ? SSH_ERR_LIBCRYPTO_ERROR : 0)) != 0) { -+ BN_free(p); -+ BN_free(q); -+ BN_free(g); -+ BN_free(pub_key); -+ BN_free(priv_key); -+ goto out; -+ } -+ if (DSA_set0_key(k->dsa, pub_key, priv_key) == 0) { -+ r = SSH_ERR_LIBCRYPTO_ERROR; -+ BN_free(pub_key); -+ BN_free(priv_key); -+ goto out; -+ } -+ } - break; -- case KEY_DSA_CERT: -- if ((r = sshkey_froms(buf, &k)) != 0 || -- (r = sshkey_add_private(k)) != 0 || -- (r = sshbuf_get_bignum2(buf, k->dsa->priv_key)) != 0) -- goto out; -+ case KEY_DSA_CERT: { -+ BIGNUM *priv_key = BN_new(); -+ -+ if (priv_key == NULL || -+ (r = sshkey_froms(buf, &k)) != 0 || -+ (r = sshkey_add_private(k)) != 0 || -+ (r = sshbuf_get_bignum2(buf, priv_key)) != 0 || -+ (r = ((DSA_set0_key(k->dsa, NULL, priv_key) == 0) -+ ? SSH_ERR_LIBCRYPTO_ERROR : 0)) != 0) { -+ BN_free(priv_key); -+ goto out; -+ } -+ } - break; - # ifdef OPENSSL_HAS_ECC - case KEY_ECDSA: -@@ -2772,24 +2942,84 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp) - r = SSH_ERR_ALLOC_FAIL; - goto out; - } -- if ((r = sshbuf_get_bignum2(buf, k->rsa->n)) != 0 || -- (r = sshbuf_get_bignum2(buf, k->rsa->e)) != 0 || -- (r = sshbuf_get_bignum2(buf, k->rsa->d)) != 0 || -- (r = sshbuf_get_bignum2(buf, k->rsa->iqmp)) != 0 || -- (r = sshbuf_get_bignum2(buf, k->rsa->p)) != 0 || -- (r = sshbuf_get_bignum2(buf, k->rsa->q)) != 0 || -- (r = rsa_generate_additional_parameters(k->rsa)) != 0) -- goto out; -+ { -+ BIGNUM *n, *e, *d, *iqmp, *p, *q; -+ -+ n = BN_new(); -+ e = BN_new(); -+ d = BN_new(); -+ iqmp = BN_new(); -+ p = BN_new(); -+ q = BN_new(); -+ -+ if (n == NULL || e == NULL || d == NULL || -+ iqmp == NULL || p == NULL || q == NULL || -+ (r = sshbuf_get_bignum2(buf, n)) != 0 || -+ (r = sshbuf_get_bignum2(buf, e)) != 0 || -+ (r = sshbuf_get_bignum2(buf, d)) != 0 || -+ (r = sshbuf_get_bignum2(buf, iqmp)) != 0 || -+ (r = sshbuf_get_bignum2(buf, p)) != 0 || -+ (r = sshbuf_get_bignum2(buf, q)) != 0 || -+ (r = ((RSA_set0_key(k->rsa, n, e, d) == 0) -+ ? SSH_ERR_LIBCRYPTO_ERROR : 0)) != 0) { -+ BN_free(n); -+ BN_free(e); -+ BN_free(d); -+ BN_free(iqmp); -+ BN_free(p); -+ BN_free(q); -+ goto out; -+ } -+ if (RSA_set0_factors(k->rsa, p, q) == 0) { -+ r = SSH_ERR_LIBCRYPTO_ERROR; -+ BN_free(iqmp); -+ BN_free(p); -+ BN_free(q); -+ goto out; -+ } -+ if ((r = rsa_generate_additional_parameters(k->rsa, iqmp)) != 0) { -+ BN_free(iqmp); -+ goto out; -+ } -+ } - break; -- case KEY_RSA_CERT: -- if ((r = sshkey_froms(buf, &k)) != 0 || -- (r = sshkey_add_private(k)) != 0 || -- (r = sshbuf_get_bignum2(buf, k->rsa->d)) != 0 || -- (r = sshbuf_get_bignum2(buf, k->rsa->iqmp)) != 0 || -- (r = sshbuf_get_bignum2(buf, k->rsa->p)) != 0 || -- (r = sshbuf_get_bignum2(buf, k->rsa->q)) != 0 || -- (r = rsa_generate_additional_parameters(k->rsa)) != 0) -- goto out; -+ case KEY_RSA_CERT: { -+ BIGNUM *d, *iqmp, *p, *q; -+ -+ /* N and E are already set so make sure we will not overwrite them */ -+ d = BN_new(); -+ iqmp = BN_new(); -+ p = BN_new(); -+ q = BN_new(); -+ -+ if (d == NULL || iqmp == NULL || p == NULL || -+ q == NULL || -+ (r = sshkey_froms(buf, &k)) != 0 || -+ (r = sshkey_add_private(k)) != 0 || -+ (r = sshbuf_get_bignum2(buf, d)) != 0 || -+ (r = sshbuf_get_bignum2(buf, iqmp)) != 0 || -+ (r = sshbuf_get_bignum2(buf, p)) != 0 || -+ (r = sshbuf_get_bignum2(buf, q)) != 0 || -+ (r = ((RSA_set0_key(k->rsa, NULL, NULL, d) == 0) -+ ? SSH_ERR_LIBCRYPTO_ERROR : 0)) != 0) { -+ BN_free(d); -+ BN_free(iqmp); -+ BN_free(p); -+ BN_free(q); -+ goto out; -+ } -+ if (RSA_set0_factors(k->rsa, p, q) == 0) { -+ r = SSH_ERR_LIBCRYPTO_ERROR; -+ BN_free(p); -+ BN_free(q); -+ goto out; -+ } -+ if (rsa_generate_additional_parameters(k->rsa, iqmp) != 0) { -+ r = SSH_ERR_LIBCRYPTO_ERROR; -+ free(iqmp); -+ goto out; -+ } -+ } - break; - #endif /* WITH_OPENSSL */ - case KEY_ED25519: -@@ -3424,6 +3654,7 @@ sshkey_private_rsa1_to_blob(struct sshkey *key, struct sshbuf *blob, - struct sshcipher_ctx *ciphercontext = NULL; - const struct sshcipher *cipher; - u_char *cp; -+ const BIGNUM *n, *e, *d, *q, *p, *iqmp; - - /* - * If the passphrase is empty, use SSH_CIPHER_NONE to ease converting -@@ -3450,10 +3681,13 @@ sshkey_private_rsa1_to_blob(struct sshkey *key, struct sshbuf *blob, - * format would just give known plaintext). - * Note: q and p are stored in reverse order to SSL. - */ -- if ((r = sshbuf_put_bignum1(buffer, key->rsa->d)) != 0 || -- (r = sshbuf_put_bignum1(buffer, key->rsa->iqmp)) != 0 || -- (r = sshbuf_put_bignum1(buffer, key->rsa->q)) != 0 || -- (r = sshbuf_put_bignum1(buffer, key->rsa->p)) != 0) -+ RSA_get0_key(key->rsa, &n, &e, &d); -+ RSA_get0_factors(key->rsa, &p, &q); -+ RSA_get0_crt_params(key->rsa, NULL, NULL, &iqmp); -+ if ((r = sshbuf_put_bignum1(buffer, d)) != 0 || -+ (r = sshbuf_put_bignum1(buffer, iqmp)) != 0 || -+ (r = sshbuf_put_bignum1(buffer, q)) != 0 || -+ (r = sshbuf_put_bignum1(buffer, p)) != 0) - goto out; - - /* Pad the part to be encrypted to a size that is a multiple of 8. */ -@@ -3478,9 +3712,9 @@ sshkey_private_rsa1_to_blob(struct sshkey *key, struct sshbuf *blob, - goto out; - - /* Store public key. This will be in plain text. */ -- if ((r = sshbuf_put_u32(encrypted, BN_num_bits(key->rsa->n))) != 0 || -- (r = sshbuf_put_bignum1(encrypted, key->rsa->n)) != 0 || -- (r = sshbuf_put_bignum1(encrypted, key->rsa->e)) != 0 || -+ if ((r = sshbuf_put_u32(encrypted, BN_num_bits(n))) != 0 || -+ (r = sshbuf_put_bignum1(encrypted, n)) != 0 || -+ (r = sshbuf_put_bignum1(encrypted, e)) != 0 || - (r = sshbuf_put_cstring(encrypted, comment)) != 0) - goto out; - -@@ -3607,6 +3841,7 @@ sshkey_parse_public_rsa1_fileblob(struct sshbuf *blob, - int r; - struct sshkey *pub = NULL; - struct sshbuf *copy = NULL; -+ BIGNUM *n = NULL, *e = NULL; - - if (keyp != NULL) - *keyp = NULL; -@@ -3636,10 +3871,16 @@ sshkey_parse_public_rsa1_fileblob(struct sshbuf *blob, - goto out; - - /* Read the public key from the buffer. */ -- if ((pub = sshkey_new(KEY_RSA1)) == NULL || -- (r = sshbuf_get_bignum1(copy, pub->rsa->n)) != 0 || -- (r = sshbuf_get_bignum1(copy, pub->rsa->e)) != 0) -+ if ((n = BN_new()) == NULL || -+ (e = BN_new()) == NULL || -+ (pub = sshkey_new(KEY_RSA1)) == NULL || -+ (r = sshbuf_get_bignum1(copy, n)) != 0 || -+ (r = sshbuf_get_bignum1(copy, e)) != 0 || -+ RSA_set0_key(pub->rsa, n, e, NULL) == 0) { -+ BN_free(n); -+ BN_free(e); - goto out; -+ } - - /* Finally, the comment */ - if ((r = sshbuf_get_string(copy, (u_char**)commentp, NULL)) != 0) -@@ -3671,6 +3912,8 @@ sshkey_parse_private_rsa1(struct sshbuf *blob, const char *passphrase, - struct sshcipher_ctx *ciphercontext = NULL; - const struct sshcipher *cipher; - struct sshkey *prv = NULL; -+ BIGNUM *n = NULL, *e = NULL, *d = NULL, *q = NULL, *p = NULL, -+ *iqmp = NULL; - - if (keyp != NULL) - *keyp = NULL; -@@ -3706,11 +3949,17 @@ sshkey_parse_private_rsa1(struct sshbuf *blob, const char *passphrase, - goto out; - - /* Read the public key and comment from the buffer. */ -- if ((r = sshbuf_get_u32(copy, NULL)) != 0 || /* key bits */ -- (r = sshbuf_get_bignum1(copy, prv->rsa->n)) != 0 || -- (r = sshbuf_get_bignum1(copy, prv->rsa->e)) != 0 || -- (r = sshbuf_get_cstring(copy, &comment, NULL)) != 0) -+ if ((n = BN_new()) == NULL || -+ (e = BN_new()) == NULL || -+ (r = sshbuf_get_u32(copy, NULL)) != 0 || /* key bits */ -+ (r = sshbuf_get_bignum1(copy, n)) != 0 || -+ (r = sshbuf_get_bignum1(copy, e)) != 0 || -+ (r = sshbuf_get_cstring(copy, &comment, NULL)) != 0 || -+ RSA_set0_key(prv->rsa, n, e, NULL) == 0) { -+ BN_free(n); -+ BN_free(e); - goto out; -+ } - - /* Check that it is a supported cipher. */ - cipher = cipher_by_number(cipher_type); -@@ -3739,15 +3988,33 @@ sshkey_parse_private_rsa1(struct sshbuf *blob, const char *passphrase, - } - - /* Read the rest of the private key. */ -- if ((r = sshbuf_get_bignum1(decrypted, prv->rsa->d)) != 0 || -- (r = sshbuf_get_bignum1(decrypted, prv->rsa->iqmp)) != 0 || -- (r = sshbuf_get_bignum1(decrypted, prv->rsa->q)) != 0 || -- (r = sshbuf_get_bignum1(decrypted, prv->rsa->p)) != 0) -+ if ((d = BN_new()) == NULL || -+ (p = BN_new()) == NULL || -+ (q = BN_new()) == NULL || -+ (iqmp = BN_new()) == NULL || -+ (r = sshbuf_get_bignum1(decrypted, d)) != 0 || -+ (r = sshbuf_get_bignum1(decrypted, iqmp)) != 0 || -+ (r = sshbuf_get_bignum1(decrypted, q)) != 0 || -+ (r = sshbuf_get_bignum1(decrypted, p)) != 0 || -+ (RSA_set0_key(prv->rsa, NULL, NULL, d) == 0)) { -+ BN_free(d); -+ BN_free(p); -+ BN_free(q); -+ BN_free(iqmp); - goto out; -+ } -+ if (RSA_set0_factors(prv->rsa, p, q) == 0) { -+ BN_free(p); -+ BN_free(q); -+ BN_free(iqmp); -+ goto out; -+ } - - /* calculate p-1 and q-1 */ -- if ((r = rsa_generate_additional_parameters(prv->rsa)) != 0) -+ if ((r = rsa_generate_additional_parameters(prv->rsa, iqmp)) != 0) { -+ BN_free(iqmp); - goto out; -+ } - - /* enable blinding */ - if (RSA_blinding_on(prv->rsa, NULL) != 1) { -@@ -3820,7 +4087,9 @@ sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type, - case EVP_R_BAD_DECRYPT: - r = SSH_ERR_KEY_WRONG_PASSPHRASE; - goto out; -+#ifdef EVP_R_BN_DECODE_ERROR - case EVP_R_BN_DECODE_ERROR: -+#endif - case EVP_R_DECODE_ERROR: - #ifdef EVP_R_PRIVATE_KEY_DECODE_ERROR - case EVP_R_PRIVATE_KEY_DECODE_ERROR: -@@ -3838,7 +4107,7 @@ sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type, - r = SSH_ERR_LIBCRYPTO_ERROR; - goto out; - } -- if (pk->type == EVP_PKEY_RSA && -+ if (EVP_PKEY_id(pk) == EVP_PKEY_RSA && - (type == KEY_UNSPEC || type == KEY_RSA)) { - if ((prv = sshkey_new(KEY_UNSPEC)) == NULL) { - r = SSH_ERR_ALLOC_FAIL; -@@ -3853,7 +4122,7 @@ sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type, - r = SSH_ERR_LIBCRYPTO_ERROR; - goto out; - } -- } else if (pk->type == EVP_PKEY_DSA && -+ } else if (EVP_PKEY_id(pk) == EVP_PKEY_DSA && - (type == KEY_UNSPEC || type == KEY_DSA)) { - if ((prv = sshkey_new(KEY_UNSPEC)) == NULL) { - r = SSH_ERR_ALLOC_FAIL; -@@ -3865,7 +4134,7 @@ sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type, - DSA_print_fp(stderr, prv->dsa, 8); - #endif - #ifdef OPENSSL_HAS_ECC -- } else if (pk->type == EVP_PKEY_EC && -+ } else if (EVP_PKEY_id(pk) == EVP_PKEY_EC && - (type == KEY_UNSPEC || type == KEY_ECDSA)) { - if ((prv = sshkey_new(KEY_UNSPEC)) == NULL) { - r = SSH_ERR_ALLOC_FAIL; diff --git a/packaging/debian/gsi-openssh/debian/patches/openssh-7_5_P1-hpn-14.13.diff b/packaging/debian/gsi-openssh/debian/patches/openssh-7_5_P1-hpn-14.13.diff deleted file mode 100644 index c1ebc81e4a..0000000000 --- a/packaging/debian/gsi-openssh/debian/patches/openssh-7_5_P1-hpn-14.13.diff +++ /dev/null @@ -1,2342 +0,0 @@ -diff --git a/HPN-README b/HPN-README -new file mode 100644 -index 0000000..7065f2c ---- /dev/null -+++ b/HPN-README -@@ -0,0 +1,130 @@ -+Notes: -+ -+MULTI-THREADED CIPHER: -+The AES cipher in CTR mode has been multithreaded (MTR-AES-CTR). This will allow ssh installations -+on hosts with multiple cores to use more than one processing core during encryption. -+Tests have show significant throughput performance increases when using MTR-AES-CTR up -+to and including a full gigabit per second on quad core systems. It should be possible to -+achieve full line rate on dual core systems but OS and data management overhead makes this -+more difficult to achieve. The cipher stream from MTR-AES-CTR is entirely compatible with single -+thread AES-CTR (ST-AES-CTR) implementations and should be 100% backward compatible. Optimal -+performance requires the MTR-AES-CTR mode be enabled on both ends of the connection. -+The MTR-AES-CTR replaces ST-AES-CTR and is used in exactly the same way with the same -+nomenclature. -+Use examples: -+ ssh -caes128-ctr you@host.com -+ scp -oCipher=aes256-ctr file you@host.com:~/file -+ -+NONE CIPHER: -+To use the NONE option you must have the NoneEnabled switch set on the server and -+you *must* have *both* NoneEnabled and NoneSwitch set to yes on the client. The NONE -+feature works with ALL ssh subsystems (as far as we can tell) *AS LONG AS* a tty is not -+spawned. If a user uses the -T switch to prevent a tty being created the NONE cipher will -+be disabled. -+ -+The performance increase will only be as good as the network and TCP stack tuning -+on the reciever side of the connection allows. As a rule of thumb a user will need -+at least 10Mb/s connection with a 100ms RTT to see a doubling of performance. The -+HPN-SSH home page describes this in greater detail. -+ -+http://www.psc.edu/networking/projects/hpn-ssh -+ -+BUFFER SIZES: -+ -+If HPN is disabled the receive buffer size will be set to the -+OpenSSH default of 64K. -+ -+If an HPN system connects to a nonHPN system the receive buffer will -+be set to the HPNBufferSize value. The default is 2MB but user adjustable. -+ -+If an HPN to HPN connection is established a number of different things might -+happen based on the user options and conditions. -+ -+Conditions: HPNBufferSize NOT Set, TCPRcvBufPoll enabled, TCPRcvBuf NOT Set -+HPN Buffer Size = up to 64MB -+This is the default state. The HPN buffer size will grow to a maximum of 64MB -+as the TCP receive buffer grows. The maximum HPN Buffer size of 64MB is -+geared towards 10GigE transcontinental connections. -+ -+Conditions: HPNBufferSize NOT Set, TCPRcvBufPoll disabled, TCPRcvBuf NOT Set -+HPN Buffer Size = TCP receive buffer value. -+Users on non-autotuning systems should disable TCPRcvBufPoll in the -+ssh_config and sshd_config -+ -+Conditions: HPNBufferSize SET, TCPRcvBufPoll disabled, TCPRcvBuf NOT Set -+HPN Buffer Size = minimum of TCP receive buffer and HPNBufferSize. -+This would be the system defined TCP receive buffer (RWIN). -+ -+Conditions: HPNBufferSize SET, TCPRcvBufPoll disabled, TCPRcvBuf SET -+HPN Buffer Size = minimum of TCPRcvBuf and HPNBufferSize. -+Generally there is no need to set both. -+ -+Conditions: HPNBufferSize SET, TCPRcvBufPoll enabled, TCPRcvBuf NOT Set -+HPN Buffer Size = grows to HPNBufferSize -+The buffer will grow up to the maximum size specified here. -+ -+Conditions: HPNBufferSize SET, TCPRcvBufPoll enabled, TCPRcvBuf SET -+HPN Buffer Size = minimum of TCPRcvBuf and HPNBufferSize. -+Generally there is no need to set both of these, especially on autotuning -+systems. However, if the users wishes to override the autotuning this would be -+one way to do it. -+ -+Conditions: HPNBufferSize NOT Set, TCPRcvBufPoll enabled, TCPRcvBuf SET -+HPN Buffer Size = TCPRcvBuf. -+This will override autotuning and set the TCP recieve buffer to the user defined -+value. -+ -+ -+HPN Specific Configuration options -+ -+TcpRcvBuf=[int]KB client -+ set the TCP socket receive buffer to n Kilobytes. It can be set up to the -+maximum socket size allowed by the system. This is useful in situations where -+the tcp receive window is set low but the maximum buffer size is set -+higher (as is typical). This works on a per TCP connection basis. You can also -+use this to artifically limit the transfer rate of the connection. In these -+cases the throughput will be no more than n/RTT. The minimum buffer size is 1KB. -+Default is the current system wide tcp receive buffer size. -+ -+TcpRcvBufPoll=[yes/no] client/server -+ enable of disable the polling of the tcp receive buffer through the life -+of the connection. You would want to make sure that this option is enabled -+for systems making use of autotuning kernels (linux 2.4.24+, 2.6, MS Vista) -+default is yes. -+ -+NoneEnabled=[yes/no] client/server -+ enable or disable the use of the None cipher. Care must always be used -+when enabling this as it will allow users to send data in the clear. However, -+it is important to note that authentication information remains encrypted -+even if this option is enabled. Set to no by default. -+ -+NoneSwitch=[yes/no] client -+ Switch the encryption cipher being used to the None cipher after -+authentication takes place. NoneEnabled must be enabled on both the client -+and server side of the connection. When the connection switches to the NONE -+cipher a warning is sent to STDERR. The connection attempt will fail with an -+error if a client requests a NoneSwitch from the server that does not explicitly -+have NoneEnabled set to yes. Note: The NONE cipher cannot be used in -+interactive (shell) sessions and it will fail silently. Set to no by default. -+ -+HPNDisabled=[yes/no] client/server -+ In some situations, such as transfers on a local area network, the impact -+of the HPN code produces a net decrease in performance. In these cases it is -+helpful to disable the HPN functionality. By default HPNDisabled is set to no. -+ -+HPNBufferSize=[int]KB client/server -+ This is the default buffer size the HPN functionality uses when interacting -+with nonHPN SSH installations. Conceptually this is similar to the TcpRcvBuf -+option as applied to the internal SSH flow control. This value can range from -+1KB to 64MB (1-65536). Use of oversized or undersized buffers can cause performance -+problems depending on the length of the network path. The default size of this buffer -+is 2MB. -+ -+ -+Credits: This patch was conceived, designed, and led by Chris Rapier (rapier@psc.edu) -+ The majority of the actual coding for versions up to HPN12v1 was performed -+ by Michael Stevens (mstevens@andrew.cmu.edu). The MT-AES-CTR cipher was -+ implemented by Ben Bennet (ben@psc.edu) and improved by Mike Tasota -+ (tasota@gmail.com) an NSF REU grant recipient for 2013. -+ This work was financed, in part, by Cisco System, Inc., the National -+ Library of Medicine, and the National Science Foundation. -diff --git a/Makefile.in b/Makefile.in -index 5870e9e..d99e53a 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -44,7 +44,7 @@ CC=@CC@ - LD=@LD@ - CFLAGS=@CFLAGS@ - CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@ --LIBS=@LIBS@ -+LIBS=@LIBS@ -lpthread - K5LIBS=@K5LIBS@ - GSSLIBS=@GSSLIBS@ - SSHLIBS=@SSHLIBS@ -@@ -78,7 +78,7 @@ LIBOPENSSH_OBJS=\ - LIBSSH_OBJS=${LIBOPENSSH_OBJS} \ - authfd.o authfile.o bufaux.o bufbn.o bufec.o buffer.o \ - canohost.o channels.o cipher.o cipher-aes.o cipher-aesctr.o \ -- cipher-bf1.o cipher-ctr.o cipher-3des1.o cleanup.o \ -+ cipher-bf1.o cipher-ctr.o cipher-ctr-mt.o cipher-3des1.o cleanup.o \ - compat.o crc32.o deattack.o fatal.o hostfile.o \ - log.o match.o md-sha256.o moduli.o nchan.o packet.o opacket.o \ - readpass.o rsa.o ttymodes.o xmalloc.o addrmatch.o \ -diff --git a/README b/README -index bda8525..fa72dce 100644 ---- a/README -+++ b/README -@@ -1,3 +1,22 @@ -+THE FOLLOWING few lines are message from the developer of hpn-ssh. It is not part -+of the README file for OpenSSH. -+ -+HOWDY ALL! I hate doing this but I realize that I’ve been working on HPN-SSH for -+almost 13 years now. Initially I was funded by a generous grant from Cisco, the NSF, -+and NIH. That money is long long gone by now and I can only work on HPN-SSH when I -+have the time. *IF* I can get some donations to the project at -+http://www.psc.edu/index.php/hpn-sshit would let me free up more cycles to work on it. -+Keep in mind that I don’t get any money from the donations. It all goes to support -+the work of PSC (see psc.edu). However, if I can get some donations I’d have the -+back up I need to demand time to work on it. Now, that being said, if you want to -+support me directly I do have a wishlist at amazon http://amzn.com/w/34XO95A1A9CJL -+ -+I don’t really expect anyone to buy me things or donate money. -+It’s not why I’ve spent a whole lot of hours working on this. -+I just thought I’d throw it out there. -+ -+ -+----------Original README Follows-------------- - See https://www.openssh.com/releasenotes.html#7.5p1 for the release notes. - - Please read https://www.openssh.com/report.html for bug reporting -diff --git a/auth2.c b/auth2.c -index 97dd2ef..8c65ca6 100644 ---- a/auth2.c -+++ b/auth2.c -@@ -73,6 +73,8 @@ extern Authmethod method_hostbased; - extern Authmethod method_gssapi; - #endif - -+static int log_flag = 0; -+ - Authmethod *authmethods[] = { - &method_none, - &method_pubkey, -@@ -225,6 +227,11 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt) - service = packet_get_cstring(NULL); - method = packet_get_cstring(NULL); - debug("userauth-request for user %s service %s method %s", user, service, method); -+ if (!log_flag) { -+ logit("SSH: Server;Ltype: Authname;Remote: %s-%d;Name: %s", -+ ssh_remote_ipaddr(active_state), ssh_remote_port(active_state), user); -+ log_flag = 1; -+ } - debug("attempt %d failures %d", authctxt->attempt, authctxt->failures); - - if ((style = strchr(user, ':')) != NULL) -diff --git a/channels.c b/channels.c -index d030fcd..e400e80 100644 ---- a/channels.c -+++ b/channels.c -@@ -191,6 +191,9 @@ static const char *channel_rfwd_bind_host(const char *listen_host); - static int connect_next(struct channel_connect *); - static void channel_connect_ctx_free(struct channel_connect *); - -+static int hpn_disabled = 0; -+static int hpn_buffer_size = 2 * 1024 * 1024; -+ - /* -- channel core */ - - Channel * -@@ -356,6 +359,7 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, - c->local_window_max = window; - c->local_consumed = 0; - c->local_maxpacket = maxpack; -+ c->dynamic_window = 0; - c->remote_id = -1; - c->remote_name = xstrdup(remote_name); - c->remote_window = 0; -@@ -904,11 +908,39 @@ channel_pre_open_13(Channel *c, fd_set *readset, fd_set *writeset) - FD_SET(c->sock, writeset); - } - -+static int -+channel_tcpwinsz(void) -+{ -+ u_int32_t tcpwinsz = 0; -+ socklen_t optsz = sizeof(tcpwinsz); -+ int ret = -1; -+ -+ /* if we aren't on a socket return 128KB */ -+ if (!packet_connection_is_on_socket()) -+ return 128 * 1024; -+ -+ ret = getsockopt(packet_get_connection_in(), -+ SOL_SOCKET, SO_RCVBUF, &tcpwinsz, &optsz); -+ /* return no more than SSHBUF_SIZE_MAX (currently 256MB) */ -+ if (ret == 0 && tcpwinsz > SSHBUF_SIZE_MAX) -+ tcpwinsz = SSHBUF_SIZE_MAX; -+ -+ debug2("tcpwinsz: %d for connection: %d", tcpwinsz, -+ packet_get_connection_in()); -+ return tcpwinsz; -+} -+ - static void - channel_pre_open(Channel *c, fd_set *readset, fd_set *writeset) - { - u_int limit = compat20 ? c->remote_window : packet_get_maxsize(); - -+ /* check buffer limits */ -+ if (!c->tcpwinsz || c->dynamic_window > 0) -+ c->tcpwinsz = channel_tcpwinsz(); -+ -+ limit = MIN(limit, 2 * c->tcpwinsz); -+ - if (c->istate == CHAN_INPUT_OPEN && - limit > 0 && - buffer_len(&c->input) < limit && -@@ -1926,14 +1958,21 @@ channel_check_window(Channel *c) - c->local_maxpacket*3) || - c->local_window < c->local_window_max/2) && - c->local_consumed > 0) { -+ u_int addition = 0; -+ /* adjust max window size if we are in a dynamic environment */ -+ if (c->dynamic_window && c->tcpwinsz > c->local_window_max) { -+ /* grow the window somewhat aggressively to maintain pressure */ -+ addition = 1.5 * (c->tcpwinsz - c->local_window_max); -+ c->local_window_max += addition; -+ } - packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST); - packet_put_int(c->remote_id); -- packet_put_int(c->local_consumed); -+ packet_put_int(c->local_consumed + addition); - packet_send(); - debug2("channel %d: window %d sent adjust %d", - c->self, c->local_window, - c->local_consumed); -- c->local_window += c->local_consumed; -+ c->local_window += c->local_consumed + addition; - c->local_consumed = 0; - } - return 1; -@@ -3179,6 +3218,14 @@ channel_fwd_bind_addr(const char *listen_addr, int *wildcardp, - return addr; - } - -+void -+channel_set_hpn(int external_hpn_disabled, int external_hpn_buffer_size) -+{ -+ hpn_disabled = external_hpn_disabled; -+ hpn_buffer_size = external_hpn_buffer_size; -+ debug("HPN Disabled: %d, HPN Buffer Size: %d", hpn_disabled, hpn_buffer_size); -+} -+ - static int - channel_setup_fwd_listener_tcpip(int type, struct Forward *fwd, - int *allocated_listen_port, struct ForwardOptions *fwd_opts) -@@ -3307,8 +3354,10 @@ channel_setup_fwd_listener_tcpip(int type, struct Forward *fwd, - } - - /* Allocate a channel number for the socket. */ -+ /* explicitly test for hpn disabled option. if true use smaller window size */ - c = channel_new("port listener", type, sock, sock, -1, -- CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, -+ hpn_disabled ? CHAN_TCP_WINDOW_DEFAULT : hpn_buffer_size, -+ CHAN_TCP_PACKET_DEFAULT, - 0, "port listener", 1); - c->path = xstrdup(host); - c->host_port = fwd->connect_port; -@@ -4334,7 +4383,9 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost, - sock = socks[n]; - nc = channel_new("x11 listener", - SSH_CHANNEL_X11_LISTENER, sock, sock, -1, -- CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, -+ /* Is this really necassary? */ -+ hpn_disabled ? CHAN_X11_WINDOW_DEFAULT : hpn_buffer_size, -+ CHAN_X11_PACKET_DEFAULT, - 0, "X11 inet listener", 1); - nc->single_connection = single_connection; - (*chanids)[n] = nc->self; -diff --git a/channels.h b/channels.h -index ce43236..01c21b5 100644 ---- a/channels.h -+++ b/channels.h -@@ -135,8 +135,10 @@ struct Channel { - u_int local_window_max; - u_int local_consumed; - u_int local_maxpacket; -+ int dynamic_window; - int extended_usage; - int single_connection; -+ u_int tcpwinsz; - - char *ctype; /* type */ - -@@ -320,4 +322,7 @@ void chan_rcvd_ieof(Channel *); - void chan_write_failed(Channel *); - void chan_obuf_empty(Channel *); - -+/* hpn handler */ -+void channel_set_hpn(int, int); -+ - #endif -diff --git a/cipher-ctr-mt.c b/cipher-ctr-mt.c -new file mode 100644 -index 0000000..300cd90 ---- /dev/null -+++ b/cipher-ctr-mt.c -@@ -0,0 +1,602 @@ -+/* -+ * OpenSSH Multi-threaded AES-CTR Cipher -+ * -+ * Author: Benjamin Bennett -+ * Author: Mike Tasota -+ * Author: Chris Rapier -+ * Copyright (c) 2008-2013 Pittsburgh Supercomputing Center. All rights reserved. -+ * -+ * Based on original OpenSSH AES-CTR cipher. Small portions remain unchanged, -+ * Copyright (c) 2003 Markus Friedl -+ * -+ * Permission to use, copy, modify, and distribute this software for any -+ * purpose with or without fee is hereby granted, provided that the above -+ * copyright notice and this permission notice appear in all copies. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ */ -+#include "includes.h" -+ -+#if defined(WITH_OPENSSL) -+#include -+ -+#include -+#include -+ -+#include -+ -+#include "xmalloc.h" -+#include "log.h" -+ -+/* compatibility with old or broken OpenSSL versions */ -+#include "openbsd-compat/openssl-compat.h" -+ -+#ifndef USE_BUILTIN_RIJNDAEL -+#include -+#endif -+ -+#include -+ -+/*-------------------- TUNABLES --------------------*/ -+/* Number of pregen threads to use */ -+#define CIPHER_THREADS 2 -+ -+/* Number of keystream queues */ -+#define NUMKQ (CIPHER_THREADS + 2) -+ -+/* Length of a keystream queue */ -+#define KQLEN 4096 -+ -+/* Processor cacheline length */ -+#define CACHELINE_LEN 64 -+ -+/* Collect thread stats and print at cancellation when in debug mode */ -+/* #define CIPHER_THREAD_STATS */ -+ -+/* Can the system do unaligned loads natively? */ -+#if defined(__aarch64__) || \ -+ defined(__i386__) || \ -+ defined(__powerpc__) || \ -+ defined(__x86_64__) -+# define CIPHER_UNALIGNED_OK -+#endif -+#if defined(__SIZEOF_INT128__) -+# define CIPHER_INT128_OK -+#endif -+/*-------------------- END TUNABLES --------------------*/ -+ -+ -+const EVP_CIPHER *evp_aes_ctr_mt(void); -+ -+#ifdef CIPHER_THREAD_STATS -+/* -+ * Struct to collect thread stats -+ */ -+struct thread_stats { -+ u_int fills; -+ u_int skips; -+ u_int waits; -+ u_int drains; -+}; -+ -+/* -+ * Debug print the thread stats -+ * Use with pthread_cleanup_push for displaying at thread cancellation -+ */ -+static void -+thread_loop_stats(void *x) -+{ -+ struct thread_stats *s = x; -+ -+ debug("tid %lu - %u fills, %u skips, %u waits", pthread_self(), -+ s->fills, s->skips, s->waits); -+} -+ -+# define STATS_STRUCT(s) struct thread_stats s -+# define STATS_INIT(s) { memset(&s, 0, sizeof(s)); } -+# define STATS_FILL(s) { s.fills++; } -+# define STATS_SKIP(s) { s.skips++; } -+# define STATS_WAIT(s) { s.waits++; } -+# define STATS_DRAIN(s) { s.drains++; } -+#else -+# define STATS_STRUCT(s) -+# define STATS_INIT(s) -+# define STATS_FILL(s) -+# define STATS_SKIP(s) -+# define STATS_WAIT(s) -+# define STATS_DRAIN(s) -+#endif -+ -+/* Keystream Queue state */ -+enum { -+ KQINIT, -+ KQEMPTY, -+ KQFILLING, -+ KQFULL, -+ KQDRAINING -+}; -+ -+/* Keystream Queue struct */ -+struct kq { -+ u_char keys[KQLEN][AES_BLOCK_SIZE]; -+ u_char ctr[AES_BLOCK_SIZE]; -+ u_char pad0[CACHELINE_LEN]; -+ int qstate; -+ pthread_mutex_t lock; -+ pthread_cond_t cond; -+ u_char pad1[CACHELINE_LEN]; -+}; -+ -+/* Context struct */ -+struct ssh_aes_ctr_ctx -+{ -+ struct kq q[NUMKQ]; -+ AES_KEY aes_ctx; -+ STATS_STRUCT(stats); -+ u_char aes_counter[AES_BLOCK_SIZE]; -+ pthread_t tid[CIPHER_THREADS]; -+ pthread_rwlock_t tid_lock; -+#ifdef __APPLE__ -+ pthread_rwlock_t stop_lock; -+ int exit_flag; -+#endif /* __APPLE__ */ -+ int state; -+ int qidx; -+ int ridx; -+}; -+ -+/* -+ * increment counter 'ctr', -+ * the counter is of size 'len' bytes and stored in network-byte-order. -+ * (LSB at ctr[len-1], MSB at ctr[0]) -+ */ -+static void -+ssh_ctr_inc(u_char *ctr, size_t len) -+{ -+ int i; -+ -+ for (i = len - 1; i >= 0; i--) -+ if (++ctr[i]) /* continue on overflow */ -+ return; -+} -+ -+/* -+ * Add num to counter 'ctr' -+ */ -+static void -+ssh_ctr_add(u_char *ctr, uint32_t num, u_int len) -+{ -+ int i; -+ uint16_t n; -+ -+ for (n = 0, i = len - 1; i >= 0 && (num || n); i--) { -+ n = ctr[i] + (num & 0xff) + n; -+ num >>= 8; -+ ctr[i] = n & 0xff; -+ n >>= 8; -+ } -+} -+ -+/* -+ * Threads may be cancelled in a pthread_cond_wait, we must free the mutex -+ */ -+static void -+thread_loop_cleanup(void *x) -+{ -+ pthread_mutex_unlock((pthread_mutex_t *)x); -+} -+ -+#ifdef __APPLE__ -+/* Check if we should exit, we are doing both cancel and exit condition -+ * since on OSX threads seem to occasionally fail to notice when they have -+ * been cancelled. We want to have a backup to make sure that we won't hang -+ * when the main process join()-s the cancelled thread. -+ */ -+static void -+thread_loop_check_exit(struct ssh_aes_ctr_ctx *c) -+{ -+ int exit_flag; -+ -+ pthread_rwlock_rdlock(&c->stop_lock); -+ exit_flag = c->exit_flag; -+ pthread_rwlock_unlock(&c->stop_lock); -+ -+ if (exit_flag) -+ pthread_exit(NULL); -+} -+#else -+# define thread_loop_check_exit(s) -+#endif /* __APPLE__ */ -+ -+/* -+ * Helper function to terminate the helper threads -+ */ -+static void -+stop_and_join_pregen_threads(struct ssh_aes_ctr_ctx *c) -+{ -+ int i; -+ -+#ifdef __APPLE__ -+ /* notify threads that they should exit */ -+ pthread_rwlock_wrlock(&c->stop_lock); -+ c->exit_flag = TRUE; -+ pthread_rwlock_unlock(&c->stop_lock); -+#endif /* __APPLE__ */ -+ -+ /* Cancel pregen threads */ -+ for (i = 0; i < CIPHER_THREADS; i++) { -+ pthread_cancel(c->tid[i]); -+ } -+ for (i = 0; i < NUMKQ; i++) { -+ pthread_mutex_lock(&c->q[i].lock); -+ pthread_cond_broadcast(&c->q[i].cond); -+ pthread_mutex_unlock(&c->q[i].lock); -+ } -+ for (i = 0; i < CIPHER_THREADS; i++) { -+ pthread_join(c->tid[i], NULL); -+ } -+} -+ -+/* -+ * The life of a pregen thread: -+ * Find empty keystream queues and fill them using their counter. -+ * When done, update counter for the next fill. -+ */ -+static void * -+thread_loop(void *x) -+{ -+ AES_KEY key; -+ STATS_STRUCT(stats); -+ struct ssh_aes_ctr_ctx *c = x; -+ struct kq *q; -+ int i; -+ int qidx; -+ pthread_t first_tid; -+ -+ /* Threads stats on cancellation */ -+ STATS_INIT(stats); -+#ifdef CIPHER_THREAD_STATS -+ pthread_cleanup_push(thread_loop_stats, &stats); -+#endif -+ -+ /* Thread local copy of AES key */ -+ memcpy(&key, &c->aes_ctx, sizeof(key)); -+ -+ pthread_rwlock_rdlock(&c->tid_lock); -+ first_tid = c->tid[0]; -+ pthread_rwlock_unlock(&c->tid_lock); -+ -+ /* -+ * Handle the special case of startup, one thread must fill -+ * the first KQ then mark it as draining. Lock held throughout. -+ */ -+ if (pthread_equal(pthread_self(), first_tid)) { -+ q = &c->q[0]; -+ pthread_mutex_lock(&q->lock); -+ if (q->qstate == KQINIT) { -+ for (i = 0; i < KQLEN; i++) { -+ AES_encrypt(q->ctr, q->keys[i], &key); -+ ssh_ctr_inc(q->ctr, AES_BLOCK_SIZE); -+ } -+ ssh_ctr_add(q->ctr, KQLEN * (NUMKQ - 1), AES_BLOCK_SIZE); -+ q->qstate = KQDRAINING; -+ STATS_FILL(stats); -+ pthread_cond_broadcast(&q->cond); -+ } -+ pthread_mutex_unlock(&q->lock); -+ } else -+ STATS_SKIP(stats); -+ -+ /* -+ * Normal case is to find empty queues and fill them, skipping over -+ * queues already filled by other threads and stopping to wait for -+ * a draining queue to become empty. -+ * -+ * Multiple threads may be waiting on a draining queue and awoken -+ * when empty. The first thread to wake will mark it as filling, -+ * others will move on to fill, skip, or wait on the next queue. -+ */ -+ for (qidx = 1;; qidx = (qidx + 1) % NUMKQ) { -+ /* Check if I was cancelled, also checked in cond_wait */ -+ pthread_testcancel(); -+ -+ /* Check if we should exit as well */ -+ thread_loop_check_exit(c); -+ -+ /* Lock queue and block if its draining */ -+ q = &c->q[qidx]; -+ pthread_mutex_lock(&q->lock); -+ pthread_cleanup_push(thread_loop_cleanup, &q->lock); -+ while (q->qstate == KQDRAINING || q->qstate == KQINIT) { -+ STATS_WAIT(stats); -+ thread_loop_check_exit(c); -+ pthread_cond_wait(&q->cond, &q->lock); -+ } -+ pthread_cleanup_pop(0); -+ -+ /* If filling or full, somebody else got it, skip */ -+ if (q->qstate != KQEMPTY) { -+ pthread_mutex_unlock(&q->lock); -+ STATS_SKIP(stats); -+ continue; -+ } -+ -+ /* -+ * Empty, let's fill it. -+ * Queue lock is relinquished while we do this so others -+ * can see that it's being filled. -+ */ -+ q->qstate = KQFILLING; -+ pthread_cond_broadcast(&q->cond); -+ pthread_mutex_unlock(&q->lock); -+ for (i = 0; i < KQLEN; i++) { -+ AES_encrypt(q->ctr, q->keys[i], &key); -+ ssh_ctr_inc(q->ctr, AES_BLOCK_SIZE); -+ } -+ -+ /* Re-lock, mark full and signal consumer */ -+ pthread_mutex_lock(&q->lock); -+ ssh_ctr_add(q->ctr, KQLEN * (NUMKQ - 1), AES_BLOCK_SIZE); -+ q->qstate = KQFULL; -+ STATS_FILL(stats); -+ pthread_cond_broadcast(&q->cond); -+ pthread_mutex_unlock(&q->lock); -+ } -+ -+#ifdef CIPHER_THREAD_STATS -+ /* Stats */ -+ pthread_cleanup_pop(1); -+#endif -+ -+ return NULL; -+} -+ -+static int -+ssh_aes_ctr(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, -+ LIBCRYPTO_EVP_INL_TYPE len) -+{ -+ typedef union { -+#ifdef CIPHER_INT128_OK -+ __uint128_t *u128; -+#endif -+ uint64_t *u64; -+ uint32_t *u32; -+ uint8_t *u8; -+ const uint8_t *cu8; -+ uintptr_t u; -+ } ptrs_t; -+ ptrs_t destp, srcp, bufp; -+ uintptr_t align; -+ struct ssh_aes_ctr_ctx *c; -+ struct kq *q, *oldq; -+ int ridx; -+ u_char *buf; -+ -+ if (len == 0) -+ return 1; -+ if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) == NULL) -+ return 0; -+ -+ q = &c->q[c->qidx]; -+ ridx = c->ridx; -+ -+ /* src already padded to block multiple */ -+ srcp.cu8 = src; -+ destp.u8 = dest; -+ while (len > 0) { -+ buf = q->keys[ridx]; -+ bufp.u8 = buf; -+ -+ /* figure out the alignment on the fly */ -+#ifdef CIPHER_UNALIGNED_OK -+ align = 0; -+#else -+ align = destp.u | srcp.u | bufp.u; -+#endif -+ -+#ifdef CIPHER_INT128_OK -+ if ((align & 0xf) == 0) { -+ destp.u128[0] = srcp.u128[0] ^ bufp.u128[0]; -+ } else -+#endif -+ if ((align & 0x7) == 0) { -+ destp.u64[0] = srcp.u64[0] ^ bufp.u64[0]; -+ destp.u64[1] = srcp.u64[1] ^ bufp.u64[1]; -+ } else if ((align & 0x3) == 0) { -+ destp.u32[0] = srcp.u32[0] ^ bufp.u32[0]; -+ destp.u32[1] = srcp.u32[1] ^ bufp.u32[1]; -+ destp.u32[2] = srcp.u32[2] ^ bufp.u32[2]; -+ destp.u32[3] = srcp.u32[3] ^ bufp.u32[3]; -+ } else { -+ size_t i; -+ for (i = 0; i < AES_BLOCK_SIZE; ++i) -+ dest[i] = src[i] ^ buf[i]; -+ } -+ -+ destp.u += AES_BLOCK_SIZE; -+ srcp.u += AES_BLOCK_SIZE; -+ len -= AES_BLOCK_SIZE; -+ ssh_ctr_inc(ctx->iv, AES_BLOCK_SIZE); -+ -+ /* Increment read index, switch queues on rollover */ -+ if ((ridx = (ridx + 1) % KQLEN) == 0) { -+ oldq = q; -+ -+ /* Mark next queue draining, may need to wait */ -+ c->qidx = (c->qidx + 1) % NUMKQ; -+ q = &c->q[c->qidx]; -+ pthread_mutex_lock(&q->lock); -+ while (q->qstate != KQFULL) { -+ STATS_WAIT(c->stats); -+ pthread_cond_wait(&q->cond, &q->lock); -+ } -+ q->qstate = KQDRAINING; -+ pthread_cond_broadcast(&q->cond); -+ pthread_mutex_unlock(&q->lock); -+ -+ /* Mark consumed queue empty and signal producers */ -+ pthread_mutex_lock(&oldq->lock); -+ oldq->qstate = KQEMPTY; -+ STATS_DRAIN(c->stats); -+ pthread_cond_broadcast(&oldq->cond); -+ pthread_mutex_unlock(&oldq->lock); -+ } -+ } -+ c->ridx = ridx; -+ return 1; -+} -+ -+#define HAVE_NONE 0 -+#define HAVE_KEY 1 -+#define HAVE_IV 2 -+static int -+ssh_aes_ctr_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv, -+ int enc) -+{ -+ struct ssh_aes_ctr_ctx *c; -+ int i; -+ -+ if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) == NULL) { -+ c = xmalloc(sizeof(*c)); -+ pthread_rwlock_init(&c->tid_lock, NULL); -+#ifdef __APPLE__ -+ pthread_rwlock_init(&c->stop_lock, NULL); -+ c->exit_flag = FALSE; -+#endif /* __APPLE__ */ -+ -+ c->state = HAVE_NONE; -+ for (i = 0; i < NUMKQ; i++) { -+ pthread_mutex_init(&c->q[i].lock, NULL); -+ pthread_cond_init(&c->q[i].cond, NULL); -+ } -+ -+ STATS_INIT(c->stats); -+ EVP_CIPHER_CTX_set_app_data(ctx, c); -+ } -+ -+ if (c->state == (HAVE_KEY | HAVE_IV)) { -+ /* tell the pregen threads to exit */ -+ stop_and_join_pregen_threads(c); -+ -+#ifdef __APPLE__ -+ /* reset the exit flag */ -+ c->exit_flag = FALSE; -+#endif /* __APPLE__ */ -+ -+ /* Start over getting key & iv */ -+ c->state = HAVE_NONE; -+ } -+ -+ if (key != NULL) { -+ AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, -+ &c->aes_ctx); -+ c->state |= HAVE_KEY; -+ } -+ -+ if (iv != NULL) { -+ memcpy(ctx->iv, iv, AES_BLOCK_SIZE); -+ c->state |= HAVE_IV; -+ } -+ -+ if (c->state == (HAVE_KEY | HAVE_IV)) { -+ /* Clear queues */ -+ memcpy(c->q[0].ctr, ctx->iv, AES_BLOCK_SIZE); -+ c->q[0].qstate = KQINIT; -+ for (i = 1; i < NUMKQ; i++) { -+ memcpy(c->q[i].ctr, ctx->iv, AES_BLOCK_SIZE); -+ ssh_ctr_add(c->q[i].ctr, i * KQLEN, AES_BLOCK_SIZE); -+ c->q[i].qstate = KQEMPTY; -+ } -+ c->qidx = 0; -+ c->ridx = 0; -+ -+ /* Start threads */ -+ for (i = 0; i < CIPHER_THREADS; i++) { -+ debug("spawned a thread"); -+ pthread_rwlock_wrlock(&c->tid_lock); -+ pthread_create(&c->tid[i], NULL, thread_loop, c); -+ pthread_rwlock_unlock(&c->tid_lock); -+ } -+ pthread_mutex_lock(&c->q[0].lock); -+ while (c->q[0].qstate == KQINIT) -+ pthread_cond_wait(&c->q[0].cond, &c->q[0].lock); -+ pthread_mutex_unlock(&c->q[0].lock); -+ } -+ return 1; -+} -+ -+/* this function is no longer used but might prove handy in the future -+ * this comment also applies to ssh_aes_ctr_thread_reconstruction -+ */ -+void -+ssh_aes_ctr_thread_destroy(EVP_CIPHER_CTX *ctx) -+{ -+ struct ssh_aes_ctr_ctx *c; -+ -+ c = EVP_CIPHER_CTX_get_app_data(ctx); -+ -+ stop_and_join_pregen_threads(c); -+} -+ -+void -+ssh_aes_ctr_thread_reconstruction(EVP_CIPHER_CTX *ctx) -+{ -+ struct ssh_aes_ctr_ctx *c; -+ int i; -+ c = EVP_CIPHER_CTX_get_app_data(ctx); -+ /* reconstruct threads */ -+ for (i = 0; i < CIPHER_THREADS; i++) { -+ debug("spawned a thread"); -+ pthread_rwlock_wrlock(&c->tid_lock); -+ pthread_create(&c->tid[i], NULL, thread_loop, c); -+ pthread_rwlock_unlock(&c->tid_lock); -+ } -+} -+ -+static int -+ssh_aes_ctr_cleanup(EVP_CIPHER_CTX *ctx) -+{ -+ struct ssh_aes_ctr_ctx *c; -+ -+ if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) != NULL) { -+#ifdef CIPHER_THREAD_STATS -+ debug("main thread: %u drains, %u waits", c->stats.drains, -+ c->stats.waits); -+#endif -+ stop_and_join_pregen_threads(c); -+ -+ memset(c, 0, sizeof(*c)); -+ free(c); -+ EVP_CIPHER_CTX_set_app_data(ctx, NULL); -+ } -+ return 1; -+} -+ -+/* */ -+const EVP_CIPHER * -+evp_aes_ctr_mt(void) -+{ -+ static EVP_CIPHER aes_ctr; -+ -+ memset(&aes_ctr, 0, sizeof(EVP_CIPHER)); -+ aes_ctr.nid = NID_undef; -+ aes_ctr.block_size = AES_BLOCK_SIZE; -+ aes_ctr.iv_len = AES_BLOCK_SIZE; -+ aes_ctr.key_len = 16; -+ aes_ctr.init = ssh_aes_ctr_init; -+ aes_ctr.cleanup = ssh_aes_ctr_cleanup; -+ aes_ctr.do_cipher = ssh_aes_ctr; -+#ifndef SSH_OLD_EVP -+ aes_ctr.flags = EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | -+ EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CUSTOM_IV; -+#endif -+ return &aes_ctr; -+} -+ -+#endif /* defined(WITH_OPENSSL) */ -diff --git a/cipher.c b/cipher.c -index 2def333..a4d924a 100644 ---- a/cipher.c -+++ b/cipher.c -@@ -57,6 +57,13 @@ extern const EVP_CIPHER *evp_ssh1_3des(void); - extern int ssh1_3des_iv(EVP_CIPHER_CTX *, int, u_char *, int); - #endif - -+/* for multi-threaded aes-ctr cipher */ -+extern const EVP_CIPHER *evp_aes_ctr_mt(void); -+ -+/* no longer needed. replaced by evp pointer swap */ -+/* extern void ssh_aes_ctr_thread_destroy(EVP_CIPHER_CTX *ctx); */ -+/* extern void ssh_aes_ctr_thread_reconstruction(EVP_CIPHER_CTX *ctx); */ -+ - struct sshcipher_ctx { - int plaintext; - int encrypt; -@@ -86,7 +93,7 @@ struct sshcipher { - #endif - }; - --static const struct sshcipher ciphers[] = { -+static struct sshcipher ciphers[] = { - #ifdef WITH_SSH1 - { "des", SSH_CIPHER_DES, 8, 8, 0, 0, 0, 1, EVP_des_cbc }, - { "3des", SSH_CIPHER_3DES, 8, 16, 0, 0, 0, 1, evp_ssh1_3des }, -@@ -165,6 +172,29 @@ cipher_alg_list(char sep, int auth_only) - return ret; - } - -+/* used to get the cipher name so when force rekeying to handle the -+ * single to multithreaded ctr cipher swap we only rekey when appropriate -+ */ -+const char * -+cipher_ctx_name(const struct sshcipher_ctx *cc) -+{ -+ return cc->cipher->name; -+} -+ -+/* in order to get around sandbox and forking issues with a threaded cipher -+ * we set the initial pre-auth aes-ctr cipher to the default OpenSSH cipher -+ * post auth we set them to the new evp as defined by cipher-ctr-mt -+ */ -+#ifdef WITH_OPENSSL -+void -+cipher_reset_multithreaded(void) -+{ -+ cipher_by_name("aes128-ctr")->evptype = evp_aes_ctr_mt; -+ cipher_by_name("aes192-ctr")->evptype = evp_aes_ctr_mt; -+ cipher_by_name("aes256-ctr")->evptype = evp_aes_ctr_mt; -+} -+#endif -+ - u_int - cipher_blocksize(const struct sshcipher *c) - { -@@ -238,10 +268,10 @@ cipher_mask_ssh1(int client) - return mask; - } - --const struct sshcipher * -+struct sshcipher * - cipher_by_name(const char *name) - { -- const struct sshcipher *c; -+ struct sshcipher *c; - for (c = ciphers; c->name != NULL; c++) - if (strcmp(c->name, name) == 0) - return c; -@@ -273,7 +303,8 @@ ciphers_valid(const char *names) - for ((p = strsep(&cp, CIPHER_SEP)); p && *p != '\0'; - (p = strsep(&cp, CIPHER_SEP))) { - c = cipher_by_name(p); -- if (c == NULL || c->number != SSH_CIPHER_SSH2) { -+ if (c == NULL || (c->number != SSH_CIPHER_SSH2 && -+ c->number != SSH_CIPHER_NONE)) { - free(cipher_list); - return 0; - } -@@ -605,6 +636,7 @@ cipher_get_keyiv(struct sshcipher_ctx *cc, u_char *iv, u_int len) - - switch (c->number) { - #ifdef WITH_OPENSSL -+ case SSH_CIPHER_NONE: - case SSH_CIPHER_SSH2: - case SSH_CIPHER_DES: - case SSH_CIPHER_BLOWFISH: -@@ -653,6 +685,7 @@ cipher_set_keyiv(struct sshcipher_ctx *cc, const u_char *iv) - - switch (c->number) { - #ifdef WITH_OPENSSL -+ case SSH_CIPHER_NONE: - case SSH_CIPHER_SSH2: - case SSH_CIPHER_DES: - case SSH_CIPHER_BLOWFISH: -diff --git a/cipher.h b/cipher.h -index f4bca62..46d820a 100644 ---- a/cipher.h -+++ b/cipher.h -@@ -65,8 +65,11 @@ - struct sshcipher; - struct sshcipher_ctx; - -+void ssh_aes_ctr_thread_destroy(EVP_CIPHER_CTX *ctx); // defined in cipher-ctr-mt.c -+void ssh_aes_ctr_thread_reconstruction(EVP_CIPHER_CTX *ctx); -+ - u_int cipher_mask_ssh1(int); --const struct sshcipher *cipher_by_name(const char *); -+struct sshcipher *cipher_by_name(const char *); - const struct sshcipher *cipher_by_number(int); - int cipher_number(const char *); - char *cipher_name(int); -@@ -88,7 +91,9 @@ u_int cipher_seclen(const struct sshcipher *); - u_int cipher_authlen(const struct sshcipher *); - u_int cipher_ivlen(const struct sshcipher *); - u_int cipher_is_cbc(const struct sshcipher *); -+void cipher_reset_multithreaded(void); - -+const char *cipher_ctx_name(const struct sshcipher_ctx *); - u_int cipher_ctx_is_plaintext(struct sshcipher_ctx *); - u_int cipher_ctx_get_number(struct sshcipher_ctx *); - -diff --git a/clientloop.c b/clientloop.c -index 0648162..9d5523d 100644 ---- a/clientloop.c -+++ b/clientloop.c -@@ -1992,7 +1992,9 @@ client_request_x11(const char *request_type, int rchan) - return NULL; - c = channel_new("x11", - SSH_CHANNEL_X11_OPEN, sock, sock, -1, -- CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 0, "x11", 1); -+ /* again is this really necessary for X11? */ -+ options.hpn_disabled ? CHAN_TCP_WINDOW_DEFAULT : options.hpn_buffer_size, -+ CHAN_X11_PACKET_DEFAULT, 0, "x11", 1); - c->force_drain = 1; - return c; - } -@@ -2017,7 +2019,8 @@ client_request_agent(const char *request_type, int rchan) - } - c = channel_new("authentication agent connection", - SSH_CHANNEL_OPEN, sock, sock, -1, -- CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, -+ options.hpn_disabled ? CHAN_X11_WINDOW_DEFAULT : options.hpn_buffer_size, -+ CHAN_TCP_PACKET_DEFAULT, 0, - "authentication agent connection", 1); - c->force_drain = 1; - return c; -@@ -2046,7 +2049,8 @@ client_request_tun_fwd(int tun_mode, int local_tun, int remote_tun) - } - - c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1, -- CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1); -+ options.hpn_disabled ? CHAN_TCP_WINDOW_DEFAULT : options.hpn_buffer_size, -+ CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1); - c->datagram = 1; - - #if defined(SSH_TUN_FILTER) -diff --git a/compat.c b/compat.c -index 1e80cfa..f3e529f 100644 ---- a/compat.c -+++ b/compat.c -@@ -211,6 +211,13 @@ compat_datafellows(const char *version) - debug("match: %s pat %s compat 0x%08x", - version, check[i].pat, check[i].bugs); - datafellows = check[i].bugs; /* XXX for now */ -+ /* Check to see if the remote side is OpenSSH and not HPN */ -+ if (strstr(version, "OpenSSH") != NULL) { -+ if (strstr(version, "hpn") == NULL) { -+ datafellows |= SSH_BUG_LARGEWINDOW; -+ debug("Remote is NON-HPN aware"); -+ } -+ } - return check[i].bugs; - } - } -diff --git a/compat.h b/compat.h -index 2be290a..318fb98 100644 ---- a/compat.h -+++ b/compat.h -@@ -62,6 +62,7 @@ - #define SSH_BUG_CURVE25519PAD 0x10000000 - #define SSH_BUG_HOSTKEYS 0x20000000 - #define SSH_BUG_DHGEX_LARGE 0x40000000 -+#define SSH_BUG_LARGEWINDOW 0x80000000 - - void enable_compat13(void); - void enable_compat20(void); -diff --git a/kex.c b/kex.c -index cf4ac0d..5234752 100644 ---- a/kex.c -+++ b/kex.c -@@ -777,6 +777,11 @@ kex_choose_conf(struct ssh *ssh) - int nenc, nmac, ncomp; - u_int mode, ctos, need, dh_need, authlen; - int r, first_kex_follows; -+ int log_flag = 0; -+ int auth_flag; -+ -+ auth_flag = packet_authentication_state(ssh); -+ debug("AUTH STATE IS %d", auth_flag); - - debug2("local %s KEXINIT proposal", kex->server ? "server" : "client"); - if ((r = kex_buf2prop(kex->my, NULL, &my)) != 0) -@@ -847,11 +852,35 @@ kex_choose_conf(struct ssh *ssh) - peer[ncomp] = NULL; - goto out; - } -+ debug("REQUESTED ENC.NAME is '%s'", newkeys->enc.name); -+ if (strcmp(newkeys->enc.name, "none") == 0) { -+ debug("Requesting NONE. Authflag is %d", auth_flag); -+ if (auth_flag == 1) -+ debug("None requested post authentication."); -+ else -+ fatal("Pre-authentication none cipher requests are not allowed."); -+ } - debug("kex: %s cipher: %s MAC: %s compression: %s", - ctos ? "client->server" : "server->client", - newkeys->enc.name, - authlen == 0 ? newkeys->mac.name : "", - newkeys->comp.name); -+ /* -+ * client starts with ctos = 0 && log flag = 0 and no log. -+ * 2nd client pass ctos = 1 and flag = 1 so no log. -+ * server starts with ctos = 1 && log_flag = 0 so log. -+ * 2nd sever pass ctos = 1 && log flag = 1 so no log. -+ * -cjr -+ */ -+ if (ctos && !log_flag) { -+ logit("SSH: Server;Ltype: Kex;Remote: %s-%d;Enc: %s;MAC: %s;Comp: %s", -+ ssh_remote_ipaddr(ssh), -+ ssh_remote_port(ssh), -+ newkeys->enc.name, -+ authlen == 0 ? newkeys->mac.name : "", -+ newkeys->comp.name); -+ } -+ log_flag = 1; - } - need = dh_need = 0; - for (mode = 0; mode < MODE_MAX; mode++) { -diff --git a/opacket.c b/opacket.c -index 5970dd3..7bafc6b 100644 ---- a/opacket.c -+++ b/opacket.c -@@ -294,13 +294,15 @@ packet_write_wait(void) - sshpkt_fatal(active_state, __func__, r); - } - --void -+int - packet_write_poll(void) - { - int r; - - if ((r = ssh_packet_write_poll(active_state)) != 0) - sshpkt_fatal(active_state, __func__, r); -+ -+ return r; - } - - void -diff --git a/opacket.h b/opacket.h -index c487f4f..0b99099 100644 ---- a/opacket.h -+++ b/opacket.h -@@ -44,7 +44,7 @@ int packet_read_seqnr(u_int32_t *); - int packet_read_poll_seqnr(u_int32_t *); - void packet_process_incoming(const char *buf, u_int len); - void packet_write_wait(void); --void packet_write_poll(void); -+int packet_write_poll(void); - void packet_read_expect(int expected_type); - #define packet_set_timeout(timeout, count) \ - ssh_packet_set_timeout(active_state, (timeout), (count)) -diff --git a/packet.c b/packet.c -index 2f3a2ec..e5b3b29 100644 ---- a/packet.c -+++ b/packet.c -@@ -290,7 +290,7 @@ struct ssh * - ssh_packet_set_connection(struct ssh *ssh, int fd_in, int fd_out) - { - struct session_state *state; -- const struct sshcipher *none = cipher_by_name("none"); -+ struct sshcipher *none = cipher_by_name("none"); - int r; - - if (none == NULL) { -@@ -1040,6 +1040,24 @@ ssh_set_newkeys(struct ssh *ssh, int mode) - return 0; - } - -+/* this supports the forced rekeying required for the NONE cipher */ -+int rekey_requested = 0; -+void -+packet_request_rekeying(void) -+{ -+ rekey_requested = 1; -+} -+ -+/* this determines if authentciation has happened as of yet. Needed for -+ * NONE cipher switching. */ -+int -+packet_authentication_state(const struct ssh *ssh) -+{ -+ struct session_state *state = ssh->state; -+ -+ return state->after_authentication; -+} -+ - #define MAX_PACKETS (1U<<31) - static int - ssh_packet_need_rekeying(struct ssh *ssh, u_int outbound_packet_len) -@@ -1066,6 +1084,13 @@ ssh_packet_need_rekeying(struct ssh *ssh, u_int outbound_packet_len) - if (state->p_send.packets == 0 && state->p_read.packets == 0) - return 0; - -+ /* used to force rekeying when called for by the none -+ * cipher switch methods -cjr */ -+ if (rekey_requested == 1) { -+ rekey_requested = 0; -+ return 1; -+ } -+ - /* Time-based rekeying */ - if (state->rekey_interval != 0 && - (int64_t)state->rekey_time + state->rekey_interval <= monotime()) -@@ -3054,3 +3079,10 @@ sshpkt_add_padding(struct ssh *ssh, u_char pad) - ssh->state->extra_pad = pad; - return 0; - } -+ -+/* need this for the moment for the aes-ctr cipher */ -+void * -+ssh_packet_get_send_context(struct ssh *ssh) -+{ -+ return ssh->state->send_context; -+} -diff --git a/packet.h b/packet.h -index 0d25b35..d05768e 100644 ---- a/packet.h -+++ b/packet.h -@@ -151,6 +151,10 @@ int ssh_packet_inc_alive_timeouts(struct ssh *); - int ssh_packet_set_maxsize(struct ssh *, u_int); - u_int ssh_packet_get_maxsize(struct ssh *); - -+/* for forced packet rekeying post auth */ -+void packet_request_rekeying(void); -+int packet_authentication_state(const struct ssh *); -+ - int ssh_packet_get_state(struct ssh *, struct sshbuf *); - int ssh_packet_set_state(struct ssh *, struct sshbuf *); - -@@ -164,6 +168,7 @@ time_t ssh_packet_get_rekey_timeout(struct ssh *); - - void *ssh_packet_get_input(struct ssh *); - void *ssh_packet_get_output(struct ssh *); -+void *ssh_packet_get_send_context(struct ssh *); - - /* new API */ - int sshpkt_start(struct ssh *ssh, u_char type); -diff --git a/progressmeter.c b/progressmeter.c -index fe9bf52..85667b2 100644 ---- a/progressmeter.c -+++ b/progressmeter.c -@@ -69,6 +69,8 @@ static const char *file; /* name of the file being transferred */ - static off_t start_pos; /* initial position of transfer */ - static off_t end_pos; /* ending position of transfer */ - static off_t cur_pos; /* transfer position as of last refresh */ -+static off_t last_pos; -+static off_t max_delta_pos = 0; - static volatile off_t *counter; /* progress counter */ - static long stalled; /* how long we have been stalled */ - static int bytes_per_second; /* current speed in bytes per second */ -@@ -128,12 +130,17 @@ refresh_progress_meter(void) - int hours, minutes, seconds; - int i, len; - int file_len; -+ off_t delta_pos; - - transferred = *counter - (cur_pos ? cur_pos : start_pos); - cur_pos = *counter; - now = monotime_double(); - bytes_left = end_pos - cur_pos; - -+ delta_pos = cur_pos - last_pos; -+ if (delta_pos > max_delta_pos) -+ max_delta_pos = delta_pos; -+ - if (bytes_left > 0) - elapsed = now - last_update; - else { -@@ -158,7 +165,7 @@ refresh_progress_meter(void) - - /* filename */ - buf[0] = '\0'; -- file_len = win_size - 35; -+ file_len = win_size - 45; - if (file_len > 0) { - len = snprintf(buf, file_len + 1, "\r%s", file); - if (len < 0) -@@ -188,6 +195,15 @@ refresh_progress_meter(void) - (off_t)bytes_per_second); - strlcat(buf, "/s ", win_size); - -+ /* instantaneous rate */ -+ if (bytes_left > 0) -+ format_rate(buf + strlen(buf), win_size - strlen(buf), -+ delta_pos); -+ else -+ format_rate(buf + strlen(buf), win_size - strlen(buf), -+ max_delta_pos); -+ strlcat(buf, "/s ", win_size); -+ - /* ETA */ - if (!transferred) - stalled += elapsed; -@@ -224,6 +240,7 @@ refresh_progress_meter(void) - - atomicio(vwrite, STDOUT_FILENO, buf, win_size - 1); - last_update = now; -+ last_pos = cur_pos; - } - - /*ARGSUSED*/ -diff --git a/readconf.c b/readconf.c -index 9d59493..bd68875 100644 ---- a/readconf.c -+++ b/readconf.c -@@ -66,6 +66,7 @@ - #include "uidswap.h" - #include "myproposal.h" - #include "digest.h" -+#include "sshbuf.h" - - /* Format of the configuration file: - -@@ -164,6 +165,9 @@ typedef enum { - oSendEnv, oControlPath, oControlMaster, oControlPersist, - oHashKnownHosts, - oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand, -+ oNoneEnabled, oNoneSwitch, -+ oDisableMTAES, -+ oTcpRcvBufPoll, oTcpRcvBuf, oHPNDisabled, oHPNBufferSize, - oVisualHostKey, - oKexAlgorithms, oIPQoS, oRequestTTY, oIgnoreUnknown, oProxyUseFdpass, - oCanonicalDomains, oCanonicalizeHostname, oCanonicalizeMaxDots, -@@ -293,6 +297,9 @@ static struct { - { "kexalgorithms", oKexAlgorithms }, - { "ipqos", oIPQoS }, - { "requesttty", oRequestTTY }, -+ { "noneenabled", oNoneEnabled }, -+ { "noneswitch", oNoneSwitch }, -+ { "disablemtaes", oDisableMTAES }, - { "proxyusefdpass", oProxyUseFdpass }, - { "canonicaldomains", oCanonicalDomains }, - { "canonicalizefallbacklocal", oCanonicalizeFallbackLocal }, -@@ -309,6 +316,11 @@ static struct { - { "ignoreunknown", oIgnoreUnknown }, - { "proxyjump", oProxyJump }, - -+ { "tcprcvbufpoll", oTcpRcvBufPoll }, -+ { "tcprcvbuf", oTcpRcvBuf }, -+ { "hpndisabled", oHPNDisabled }, -+ { "hpnbuffersize", oHPNBufferSize }, -+ - { NULL, oBadOption } - }; - -@@ -985,6 +997,42 @@ parse_time: - intptr = &options->check_host_ip; - goto parse_flag; - -+ case oNoneEnabled: -+ intptr = &options->none_enabled; -+ goto parse_flag; -+ -+ case oDisableMTAES: -+ intptr = &options->disable_multithreaded; -+ goto parse_flag; -+ -+ /* -+ * We check to see if the command comes from the command -+ * line or not. If it does then enable it otherwise fail. -+ * NONE should never be a default configuration. -+ */ -+ case oNoneSwitch: -+ if (strcmp(filename, "command-line") == 0) { -+ intptr = &options->none_switch; -+ goto parse_flag; -+ } else { -+ error("NoneSwitch is found in %.200s.\nYou may only use this configuration option from the command line", filename); -+ error("Continuing..."); -+ debug("NoneSwitch directive found in %.200s.", filename); -+ return 0; -+ } -+ -+ case oHPNDisabled: -+ intptr = &options->hpn_disabled; -+ goto parse_flag; -+ -+ case oHPNBufferSize: -+ intptr = &options->hpn_buffer_size; -+ goto parse_int; -+ -+ case oTcpRcvBufPoll: -+ intptr = &options->tcp_rcv_buf_poll; -+ goto parse_flag; -+ - case oVerifyHostKeyDNS: - intptr = &options->verify_host_key_dns; - multistate_ptr = multistate_yesnoask; -@@ -1177,6 +1225,10 @@ parse_int: - intptr = &options->connection_attempts; - goto parse_int; - -+ case oTcpRcvBuf: -+ intptr = &options->tcp_rcv_buf; -+ goto parse_int; -+ - case oCipher: - intptr = &options->cipher; - arg = strdelim(&s); -@@ -1867,6 +1919,13 @@ initialize_options(Options * options) - options->ip_qos_interactive = -1; - options->ip_qos_bulk = -1; - options->request_tty = -1; -+ options->none_switch = -1; -+ options->none_enabled = -1; -+ options->disable_multithreaded = -1; -+ options->hpn_disabled = -1; -+ options->hpn_buffer_size = -1; -+ options->tcp_rcv_buf_poll = -1; -+ options->tcp_rcv_buf = -1; - options->proxy_use_fdpass = -1; - options->ignored_unknown = NULL; - options->num_canonical_domains = 0; -@@ -2030,6 +2089,32 @@ fill_default_options(Options * options) - options->server_alive_interval = 0; - if (options->server_alive_count_max == -1) - options->server_alive_count_max = 3; -+ if (options->none_switch == -1) -+ options->none_switch = 0; -+ if (options->none_enabled == -1) -+ options->none_enabled = 0; -+ if (options->disable_multithreaded == -1) -+ options->disable_multithreaded = 0; -+ if (options->hpn_disabled == -1) -+ options->hpn_disabled = 0; -+ if (options->hpn_buffer_size > -1) { -+ /* if a user tries to set the size to 0 set it to 1KB */ -+ if (options->hpn_buffer_size == 0) -+ options->hpn_buffer_size = 1; -+ /* limit the buffer to SSHBUF_SIZE_MAX (currently 256MB) */ -+ if (options->hpn_buffer_size > (SSHBUF_SIZE_MAX / 1024)) { -+ options->hpn_buffer_size = SSHBUF_SIZE_MAX; -+ debug("User requested buffer larger than 256MB. Request reverted to 256MB"); -+ } else -+ options->hpn_buffer_size *= 1024; -+ debug("hpn_buffer_size set to %d", options->hpn_buffer_size); -+ } -+ if (options->tcp_rcv_buf == 0) -+ options->tcp_rcv_buf = 1; -+ if (options->tcp_rcv_buf > -1) -+ options->tcp_rcv_buf *=1024; -+ if (options->tcp_rcv_buf_poll == -1) -+ options->tcp_rcv_buf_poll = 1; - if (options->control_master == -1) - options->control_master = 0; - if (options->control_persist == -1) { -diff --git a/readconf.h b/readconf.h -index cef55f7..a023324 100644 ---- a/readconf.h -+++ b/readconf.h -@@ -57,6 +57,10 @@ typedef struct { - int compression_level; /* Compression level 1 (fast) to 9 - * (best). */ - int tcp_keep_alive; /* Set SO_KEEPALIVE. */ -+ int tcp_rcv_buf; /* user switch to set tcp recv buffer */ -+ int tcp_rcv_buf_poll; /* Option to poll recv buf every window transfer */ -+ int hpn_disabled; /* Switch to disable HPN buffer management */ -+ int hpn_buffer_size; /* User definable size for HPN buffer window */ - int ip_qos_interactive; /* IP ToS/DSCP/class for interactive */ - int ip_qos_bulk; /* IP ToS/DSCP/class for bulk traffic */ - LogLevel log_level; /* Level for logging. */ -@@ -118,7 +122,11 @@ typedef struct { - - int enable_ssh_keysign; - int64_t rekey_limit; -+ int none_switch; /* Use none cipher */ -+ int none_enabled; /* Allow none to be used */ -+ int disable_multithreaded; /*disable multithreaded aes-ctr*/ - int rekey_interval; -+ - int no_host_authentication_for_localhost; - int identities_only; - int server_alive_interval; -diff --git a/sandbox-seccomp-filter.c b/sandbox-seccomp-filter.c -index 3a1aedc..aef5fec 100644 ---- a/sandbox-seccomp-filter.c -+++ b/sandbox-seccomp-filter.c -@@ -163,6 +163,9 @@ static const struct sock_filter preauth_insns[] = { - #ifdef __NR_exit_group - SC_ALLOW(__NR_exit_group), - #endif -+#ifdef __NR_getpeername /* not defined on archs that go via socketcall(2) */ -+ SC_ALLOW(__NR_getpeername), -+#endif - #ifdef __NR_getpgid - SC_ALLOW(__NR_getpgid), - #endif -@@ -214,6 +217,9 @@ static const struct sock_filter preauth_insns[] = { - #ifdef __NR_sigprocmask - SC_ALLOW(__NR_sigprocmask), - #endif -+#ifdef __NR_socketcall -+ SC_ALLOW(__NR_socketcall), -+#endif - #ifdef __NR_time - SC_ALLOW(__NR_time), - #endif -diff --git a/scp.c b/scp.c -index b4db851..989601a 100644 ---- a/scp.c -+++ b/scp.c -@@ -763,7 +763,7 @@ source(int argc, char **argv) - off_t i, statbytes; - size_t amt, nr; - int fd = -1, haderr, indx; -- char *last, *name, buf[2048], encname[PATH_MAX]; -+ char *last, *name, buf[16384], encname[PATH_MAX]; - int len; - - for (indx = 0; indx < argc; ++indx) { -@@ -931,7 +931,7 @@ sink(int argc, char **argv) - off_t size, statbytes; - unsigned long long ull; - int setimes, targisdir, wrerrno = 0; -- char ch, *cp, *np, *targ, *why, *vect[1], buf[2048], visbuf[2048]; -+ char ch, *cp, *np, *targ, *why, *vect[1], buf[16384], visbuf[16384]; - struct timeval tv[2]; - - #define atime tv[0] -diff --git a/servconf.c b/servconf.c -index 56b8316..8576d9d 100644 ---- a/servconf.c -+++ b/servconf.c -@@ -57,6 +57,7 @@ - #include "auth.h" - #include "myproposal.h" - #include "digest.h" -+#include "sshbuf.h" - - static void add_listen_addr(ServerOptions *, char *, int); - static void add_one_listen_addr(ServerOptions *, char *, int); -@@ -159,6 +160,11 @@ initialize_server_options(ServerOptions *options) - options->authorized_principals_file = NULL; - options->authorized_principals_command = NULL; - options->authorized_principals_command_user = NULL; -+ options->none_enabled = -1; -+ options->disable_multithreaded = -1, -+ options->tcp_rcv_buf_poll = -1; -+ options->hpn_disabled = -1; -+ options->hpn_buffer_size = -1; - options->ip_qos_interactive = -1; - options->ip_qos_bulk = -1; - options->version_addendum = NULL; -@@ -191,6 +197,10 @@ void - fill_default_server_options(ServerOptions *options) - { - int i; -+ /* needed for hpn socket tests */ -+ int sock; -+ int socksize; -+ int socksizelen = sizeof(int); - - /* Portable-specific options */ - if (options->use_pam == -1) -@@ -319,6 +329,45 @@ fill_default_server_options(ServerOptions *options) - } - if (options->permit_tun == -1) - options->permit_tun = SSH_TUNMODE_NO; -+ if (options->none_enabled == -1) -+ options->none_enabled = 0; -+ if (options->disable_multithreaded == -1) -+ options->disable_multithreaded = 0; -+ if (options->hpn_disabled == -1) -+ options->hpn_disabled = 0; -+ -+ if (options->hpn_buffer_size == -1) { -+ /* option not explicitly set. Now we have to figure out */ -+ /* what value to use */ -+ if (options->hpn_disabled == 1) { -+ options->hpn_buffer_size = CHAN_SES_WINDOW_DEFAULT; -+ } else { -+ /* get the current RCV size and set it to that */ -+ /*create a socket but don't connect it */ -+ /* we use that the get the rcv socket size */ -+ sock = socket(AF_INET, SOCK_STREAM, 0); -+ getsockopt(sock, SOL_SOCKET, SO_RCVBUF, -+ &socksize, &socksizelen); -+ close(sock); -+ options->hpn_buffer_size = socksize; -+ debug("HPN Buffer Size: %d", options->hpn_buffer_size); -+ } -+ } else { -+ /* we have to do this in case the user sets both values in a contradictory */ -+ /* manner. hpn_disabled overrrides hpn_buffer_size*/ -+ if (options->hpn_disabled <= 0) { -+ if (options->hpn_buffer_size == 0) -+ options->hpn_buffer_size = 1; -+ /* limit the maximum buffer to SSHBUF_SIZE_MAX (currently 256MB) */ -+ if (options->hpn_buffer_size > (SSHBUF_SIZE_MAX / 1024)) { -+ options->hpn_buffer_size = SSHBUF_SIZE_MAX; -+ } else { -+ options->hpn_buffer_size *= 1024; -+ } -+ } else -+ options->hpn_buffer_size = CHAN_TCP_WINDOW_DEFAULT; -+ } -+ - if (options->ip_qos_interactive == -1) - options->ip_qos_interactive = IPTOS_LOWDELAY; - if (options->ip_qos_bulk == -1) -@@ -395,6 +444,9 @@ typedef enum { - sPasswordAuthentication, sKbdInteractiveAuthentication, - sListenAddress, sAddressFamily, - sPrintMotd, sPrintLastLog, sIgnoreRhosts, -+ sNoneEnabled, -+ sDisableMTAES, -+ sTcpRcvBufPoll, sHPNDisabled, sHPNBufferSize, - sX11Forwarding, sX11DisplayOffset, sX11UseLocalhost, - sPermitTTY, sStrictModes, sEmptyPasswd, sTCPKeepAlive, - sPermitUserEnvironment, sAllowTcpForwarding, sCompression, -@@ -548,6 +600,11 @@ static struct { - { "revokedkeys", sRevokedKeys, SSHCFG_ALL }, - { "trustedusercakeys", sTrustedUserCAKeys, SSHCFG_ALL }, - { "authorizedprincipalsfile", sAuthorizedPrincipalsFile, SSHCFG_ALL }, -+ { "noneenabled", sNoneEnabled, SSHCFG_ALL }, -+ { "disableMTAES", sDisableMTAES, SSHCFG_ALL }, -+ { "hpndisabled", sHPNDisabled, SSHCFG_ALL }, -+ { "hpnbuffersize", sHPNBufferSize, SSHCFG_ALL }, -+ { "tcprcvbufpoll", sTcpRcvBufPoll, SSHCFG_ALL }, - { "kexalgorithms", sKexAlgorithms, SSHCFG_GLOBAL }, - { "ipqos", sIPQoS, SSHCFG_ALL }, - { "authorizedkeyscommand", sAuthorizedKeysCommand, SSHCFG_ALL }, -@@ -1158,10 +1215,30 @@ process_server_config_line(ServerOptions *options, char *line, - *intptr = value; - break; - -+ case sTcpRcvBufPoll: -+ intptr = &options->tcp_rcv_buf_poll; -+ goto parse_flag; -+ -+ case sHPNDisabled: -+ intptr = &options->hpn_disabled; -+ goto parse_flag; -+ -+ case sHPNBufferSize: -+ intptr = &options->hpn_buffer_size; -+ goto parse_int; -+ - case sIgnoreUserKnownHosts: - intptr = &options->ignore_user_known_hosts; - goto parse_flag; - -+ case sNoneEnabled: -+ intptr = &options->none_enabled; -+ goto parse_flag; -+ -+ case sDisableMTAES: -+ intptr = &options->disable_multithreaded; -+ goto parse_flag; -+ - case sHostbasedAuthentication: - intptr = &options->hostbased_authentication; - goto parse_flag; -diff --git a/servconf.h b/servconf.h -index 5853a97..09c443e 100644 ---- a/servconf.h -+++ b/servconf.h -@@ -166,7 +166,14 @@ typedef struct { - char *adm_forced_command; - - int use_pam; /* Enable auth via PAM */ -+ int tcp_rcv_buf_poll; /* poll tcp rcv window in autotuning kernels*/ -+ int hpn_disabled; /* disable hpn functionality. false by default */ -+ int hpn_buffer_size; /* set the hpn buffer size - default 3MB */ - -+ int none_enabled; /* Enable NONE cipher switch */ -+ -+ int disable_multithreaded; /*disable multithreaded aes-ctr cipher */ -+ - int permit_tun; - - int num_permitted_opens; -diff --git a/serverloop.c b/serverloop.c -index 2976f55..07507f3 100644 ---- a/serverloop.c -+++ b/serverloop.c -@@ -84,6 +84,9 @@ extern ServerOptions options; - extern Authctxt *the_authctxt; - extern int use_privsep; - -+static u_long stdin_bytes = 0; /* Number of bytes written to stdin. */ -+static u_long fdout_bytes = 0; /* Number of stdout bytes read from program. */ -+ - static int no_more_sessions = 0; /* Disallow further sessions. */ - - /* -@@ -100,6 +103,20 @@ static volatile sig_atomic_t received_sigterm = 0; - static void server_init_dispatch(void); - - /* -+ * Returns current time in seconds from Jan 1, 1970 with the maximum -+ * available resolution. -+ */ -+ -+static double -+get_current_time(void) -+{ -+ struct timeval tv; -+ gettimeofday(&tv, NULL); -+ return (double) tv.tv_sec + (double) tv.tv_usec / 1000000.0; -+} -+ -+ -+/* - * we write to this pipe if a SIGCHLD is caught in order to avoid - * the race between select() and child_terminated - */ -@@ -304,6 +321,7 @@ process_input(fd_set *readset, int connection_in) - } else { - /* Buffer any received data. */ - packet_process_incoming(buf, len); -+ fdout_bytes += len; - } - } - return 0; -@@ -317,7 +335,7 @@ process_output(fd_set *writeset, int connection_out) - { - /* Send any buffered packet data to the client. */ - if (FD_ISSET(connection_out, writeset)) -- packet_write_poll(); -+ stdin_bytes += packet_write_poll(); - } - - static void -@@ -352,11 +370,13 @@ void - server_loop2(Authctxt *authctxt) - { - fd_set *readset = NULL, *writeset = NULL; -+ double start_time, total_time; - int max_fd; - u_int nalloc = 0, connection_in, connection_out; - u_int64_t rekey_timeout_ms = 0; - - debug("Entering interactive session for SSH2."); -+ start_time = get_current_time(); - - mysignal(SIGCHLD, sigchld_handler); - child_terminated = 0; -@@ -414,6 +434,11 @@ server_loop2(Authctxt *authctxt) - - /* free remaining sessions, e.g. remove wtmp entries */ - session_destroy_all(NULL); -+ total_time = get_current_time() - start_time; -+ logit("SSH: Server;LType: Throughput;Remote: %s-%d;IN: %lu;OUT: %lu;Duration: %.1f;tPut_in: %.1f;tPut_out: %.1f", -+ ssh_remote_ipaddr(active_state), ssh_remote_port(active_state), -+ stdin_bytes, fdout_bytes, total_time, stdin_bytes / total_time, -+ fdout_bytes / total_time); - } - - static int -@@ -533,7 +558,8 @@ server_request_tun(void) - if (sock < 0) - goto done; - c = channel_new("tun", SSH_CHANNEL_OPEN, sock, sock, -1, -- CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1); -+ options.hpn_disabled ? CHAN_TCP_WINDOW_DEFAULT : options.hpn_buffer_size, -+ CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1); - c->datagram = 1; - #if defined(SSH_TUN_FILTER) - if (mode == SSH_TUNMODE_POINTOPOINT) -@@ -569,6 +595,8 @@ server_request_session(void) - c = channel_new("session", SSH_CHANNEL_LARVAL, - -1, -1, -1, /*window size*/0, CHAN_SES_PACKET_DEFAULT, - 0, "server-session", 1); -+ if (options.tcp_rcv_buf_poll && !options.hpn_disabled) -+ c->dynamic_window = 1; - if (session_open(the_authctxt, c->self) != 1) { - debug("session open failed, free channel %d", c->self); - channel_free(c); -diff --git a/session.c b/session.c -index a08aa69..8a0d9c8 100644 ---- a/session.c -+++ b/session.c -@@ -220,6 +220,7 @@ auth_input_request_forwarding(struct passwd * pw) - goto authsock_err; - - /* Allocate a channel for the authentication agent socket. */ -+ /* this shouldn't matter if its hpn or not - cjr */ - nc = channel_new("auth socket", - SSH_CHANNEL_AUTH_SOCKET, sock, sock, -1, - CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, -@@ -2124,7 +2125,8 @@ session_set_fds(Session *s, int fdin, int fdout, int fderr, int ignore_fderr, - channel_set_fds(s->chanid, - fdout, fdin, fderr, - ignore_fderr ? CHAN_EXTENDED_IGNORE : CHAN_EXTENDED_READ, -- 1, is_tty, CHAN_SES_WINDOW_DEFAULT); -+ 1, is_tty, -+ options.hpn_disabled ? CHAN_SES_WINDOW_DEFAULT : options.hpn_buffer_size); - } - - /* -diff --git a/sftp.1 b/sftp.1 -index fbdd00a..47dd655 100644 ---- a/sftp.1 -+++ b/sftp.1 -@@ -266,7 +266,8 @@ diagnostic messages from - Specify how many requests may be outstanding at any one time. - Increasing this may slightly improve file transfer speed - but will increase memory usage. --The default is 64 outstanding requests. -+The default is 256 outstanding requests providing for 8MB -+of outstanding data with a 32KB buffer. - .It Fl r - Recursively copy entire directories when uploading and downloading. - Note that -diff --git a/sftp.c b/sftp.c -index 76add39..fa91220 100644 ---- a/sftp.c -+++ b/sftp.c -@@ -72,7 +72,7 @@ typedef void EditLine; - #include "sftp-client.h" - - #define DEFAULT_COPY_BUFLEN 32768 /* Size of buffer for up/download */ --#define DEFAULT_NUM_REQUESTS 64 /* # concurrent outstanding requests */ -+#define DEFAULT_NUM_REQUESTS 256 /* # concurrent outstanding requests */ - - /* File to read commands from */ - FILE* infile; -diff --git a/ssh.c b/ssh.c -index 32b27bb..0aaa548 100644 ---- a/ssh.c -+++ b/ssh.c -@@ -909,6 +909,10 @@ main(int ac, char **av) - break; - case 'T': - options.request_tty = REQUEST_TTY_NO; -+ /* ensure that the user doesn't try to backdoor a */ -+ /* null cipher switch on an interactive session */ -+ /* so explicitly disable it no matter what */ -+ options.none_switch=0; - break; - case 'o': - line = xstrdup(optarg); -@@ -1511,6 +1515,8 @@ control_persist_detach(void) - setproctitle("%s [mux]", options.control_path); - } - -+extern const EVP_CIPHER *evp_aes_ctr_mt(void); -+ - /* Do fork() after authentication. Used by "ssh -f" */ - static void - fork_postauth(void) -@@ -1904,6 +1910,78 @@ ssh_session2_setup(int id, int success, void *arg) - NULL, fileno(stdin), &command, environ); - } - -+static void -+hpn_options_init(void) -+{ -+ /* -+ * We need to check to see if what they want to do about buffer -+ * sizes here. In a hpn to nonhpn connection we want to limit -+ * the window size to something reasonable in case the far side -+ * has the large window bug. In hpn to hpn connection we want to -+ * use the max window size but allow the user to override it -+ * lastly if they disabled hpn then use the ssh std window size. -+ * -+ * So why don't we just do a getsockopt() here and set the -+ * ssh window to that? In the case of a autotuning receive -+ * window the window would get stuck at the initial buffer -+ * size generally less than 96k. Therefore we need to set the -+ * maximum ssh window size to the maximum hpn buffer size -+ * unless the user has specifically set the tcprcvbufpoll -+ * to no. In which case we *can* just set the window to the -+ * minimum of the hpn buffer size and tcp receive buffer size. -+ */ -+ -+ if (tty_flag) -+ options.hpn_buffer_size = CHAN_SES_WINDOW_DEFAULT; -+ else -+ options.hpn_buffer_size = 2 * 1024 * 1024; -+ -+ if (datafellows & SSH_BUG_LARGEWINDOW) { -+ debug("HPN to Non-HPN Connection"); -+ } else { -+ int sock, socksize; -+ socklen_t socksizelen; -+ if (options.tcp_rcv_buf_poll <= 0) { -+ sock = socket(AF_INET, SOCK_STREAM, 0); -+ socksizelen = sizeof(socksize); -+ getsockopt(sock, SOL_SOCKET, SO_RCVBUF, -+ &socksize, &socksizelen); -+ close(sock); -+ debug("socksize %d", socksize); -+ options.hpn_buffer_size = socksize; -+ debug("HPNBufferSize set to TCP RWIN: %d", options.hpn_buffer_size); -+ } else { -+ if (options.tcp_rcv_buf > 0) { -+ /* -+ * Create a socket but don't connect it: -+ * we use that the get the rcv socket size -+ */ -+ sock = socket(AF_INET, SOCK_STREAM, 0); -+ /* -+ * If they are using the tcp_rcv_buf option, -+ * attempt to set the buffer size to that. -+ */ -+ if (options.tcp_rcv_buf) { -+ socksizelen = sizeof(options.tcp_rcv_buf); -+ setsockopt(sock, SOL_SOCKET, SO_RCVBUF, -+ &options.tcp_rcv_buf, socksizelen); -+ } -+ socksizelen = sizeof(socksize); -+ getsockopt(sock, SOL_SOCKET, SO_RCVBUF, -+ &socksize, &socksizelen); -+ close(sock); -+ debug("socksize %d", socksize); -+ options.hpn_buffer_size = socksize; -+ debug("HPNBufferSize set to user TCPRcvBuf: %d", options.hpn_buffer_size); -+ } -+ } -+ } -+ -+ debug("Final hpn_buffer_size = %d", options.hpn_buffer_size); -+ -+ channel_set_hpn(options.hpn_disabled, options.hpn_buffer_size); -+} -+ - /* open new channel for a session */ - static int - ssh_session2_open(void) -@@ -1930,9 +2008,11 @@ ssh_session2_open(void) - if (!isatty(err)) - set_nonblock(err); - -- window = CHAN_SES_WINDOW_DEFAULT; -+ window = options.hpn_buffer_size; -+ - packetmax = CHAN_SES_PACKET_DEFAULT; - if (tty_flag) { -+ window = CHAN_SES_WINDOW_DEFAULT; - window >>= 1; - packetmax >>= 1; - } -@@ -1941,6 +2021,10 @@ ssh_session2_open(void) - window, packetmax, CHAN_EXTENDED_WRITE, - "client-session", /*nonblock*/0); - -+ if (options.tcp_rcv_buf_poll > 0 && !options.hpn_disabled) { -+ c->dynamic_window = 1; -+ debug("Enabled Dynamic Window Scaling"); -+ } - debug3("ssh_session2_open: channel_new: %d", c->self); - - channel_send_open(c->self); -@@ -1956,6 +2040,13 @@ ssh_session2(void) - { - int id = -1; - -+ /* -+ * We need to initialize this early because the forwarding logic below -+ * might open channels that use the hpn buffer sizes. We can't send a -+ * window of -1 (the default) to the server as it breaks things. -+ */ -+ hpn_options_init(); -+ - /* XXX should be pre-session */ - if (!options.control_persist) - ssh_init_stdio_forwarding(); -diff --git a/sshbuf.h b/sshbuf.h -index 1ac4b8c..b27cd0d 100644 ---- a/sshbuf.h -+++ b/sshbuf.h -@@ -28,7 +28,7 @@ - # endif /* OPENSSL_HAS_ECC */ - #endif /* WITH_OPENSSL */ - --#define SSHBUF_SIZE_MAX 0x8000000 /* Hard maximum size */ -+#define SSHBUF_SIZE_MAX 0xF000000 /* Hard maximum size 256MB */ - #define SSHBUF_REFS_MAX 0x100000 /* Max child buffers */ - #define SSHBUF_MAX_BIGNUM (16384 / 8) /* Max bignum *bytes* */ - #define SSHBUF_MAX_ECPOINT ((528 * 2 / 8) + 1) /* Max EC point *bytes* */ -diff --git a/sshconnect.c b/sshconnect.c -index 948b638..21b403f 100644 ---- a/sshconnect.c -+++ b/sshconnect.c -@@ -267,6 +267,30 @@ ssh_kill_proxy_command(void) - } - - /* -+ * Set TCP receive buffer if requested. -+ * Note: tuning needs to happen after the socket is -+ * created but before the connection happens -+ * so winscale is negotiated properly -cjr -+ */ -+static void -+ssh_set_socket_recvbuf(int sock) -+{ -+ void *buf = (void *)&options.tcp_rcv_buf; -+ int sz = sizeof(options.tcp_rcv_buf); -+ int socksize; -+ int socksizelen = sizeof(int); -+ -+ debug("setsockopt Attempting to set SO_RCVBUF to %d", options.tcp_rcv_buf); -+ if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, buf, sz) >= 0) { -+ getsockopt(sock, SOL_SOCKET, SO_RCVBUF, &socksize, &socksizelen); -+ debug("setsockopt SO_RCVBUF: %.100s %d", strerror(errno), socksize); -+ } -+ else -+ error("Couldn't set socket receive buffer to %d: %.100s", -+ options.tcp_rcv_buf, strerror(errno)); -+} -+ -+/* - * Creates a (possibly privileged) socket for use as the ssh connection. - */ - static int -@@ -282,6 +306,9 @@ ssh_create_socket(int privileged, struct addrinfo *ai) - } - fcntl(sock, F_SETFD, FD_CLOEXEC); - -+ if (options.tcp_rcv_buf > 0) -+ ssh_set_socket_recvbuf(sock); -+ - /* Bind the socket to an alternative local IP address */ - if (options.bind_address == NULL && !privileged) - return sock; -@@ -526,10 +553,10 @@ send_client_banner(int connection_out, int minor1) - /* Send our own protocol version identification. */ - if (compat20) { - xasprintf(&client_version_string, "SSH-%d.%d-%.100s\r\n", -- PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION); -+ PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_RELEASE); - } else { - xasprintf(&client_version_string, "SSH-%d.%d-%.100s\n", -- PROTOCOL_MAJOR_1, minor1, SSH_VERSION); -+ PROTOCOL_MAJOR_1, minor1, SSH_RELEASE); - } - if (atomicio(vwrite, connection_out, client_version_string, - strlen(client_version_string)) != strlen(client_version_string)) -diff --git a/sshconnect2.c b/sshconnect2.c -index f8a54be..e6abd8f 100644 ---- a/sshconnect2.c -+++ b/sshconnect2.c -@@ -83,6 +83,13 @@ extern char *server_version_string; - extern Options options; - - /* -+ * tty_flag is set in ssh.c. Use this in ssh_userauth2: -+ * if it is set, then prevent the switch to the null cipher. -+ */ -+ -+extern int tty_flag; -+ -+/* - * SSH2 key exchange - */ - -@@ -154,6 +161,8 @@ order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port) - return ret; - } - -+static char *myproposal[PROPOSAL_MAX]; -+static const char *myproposal_default[PROPOSAL_MAX] = { KEX_CLIENT }; - void - ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port) - { -@@ -162,6 +171,8 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port) - struct kex *kex; - int r; - -+ memcpy(&myproposal, &myproposal_default, sizeof(myproposal)); -+ - xxx_host = host; - xxx_hostaddr = hostaddr; - -@@ -407,6 +418,47 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host, - - if (!authctxt.success) - fatal("Authentication failed."); -+ -+ /* -+ * If the user wants to use the none cipher, do it post authentication -+ * and only if the right conditions are met -- both of the NONE commands -+ * must be true and there must be no tty allocated. -+ */ -+ if ((options.none_switch == 1) && (options.none_enabled == 1)) { -+ if (!tty_flag) { /* no null on tty sessions */ -+ debug("Requesting none rekeying..."); -+ memcpy(&myproposal, &myproposal_default, sizeof(myproposal)); -+ myproposal[PROPOSAL_ENC_ALGS_STOC] = "none"; -+ myproposal[PROPOSAL_ENC_ALGS_CTOS] = "none"; -+ kex_prop2buf(active_state->kex->my, myproposal); -+ packet_request_rekeying(); -+ fprintf(stderr, "WARNING: ENABLED NONE CIPHER\n"); -+ } else { -+ /* requested NONE cipher when in a tty */ -+ debug("Cannot switch to NONE cipher with tty allocated"); -+ fprintf(stderr, "NONE cipher switch disabled when a TTY is allocated\n"); -+ } -+ } -+ -+#ifdef WITH_OPENSSL -+ if (options.disable_multithreaded == 0) { -+ /* if we are using aes-ctr there can be issues in either a fork or sandbox -+ * so the initial aes-ctr is defined to point to the original single process -+ * evp. After authentication we'll be past the fork and the sandboxed privsep -+ * so we repoint the define to the multithreaded evp. To start the threads we -+ * then force a rekey -+ */ -+ const void *cc = ssh_packet_get_send_context(active_state); -+ -+ /* only do this for the ctr cipher. otherwise gcm mode breaks. Don't know why though */ -+ if (strstr(cipher_ctx_name(cc), "ctr")) { -+ debug("Single to Multithread CTR cipher swap - client request"); -+ cipher_reset_multithreaded(); -+ packet_request_rekeying(); -+ } -+ } -+#endif -+ - debug("Authentication succeeded (%s).", authctxt.method->name); - } - -diff --git a/sshd.c b/sshd.c -index 010a2c3..1bff88c 100644 ---- a/sshd.c -+++ b/sshd.c -@@ -367,7 +367,7 @@ sshd_exchange_identification(struct ssh *ssh, int sock_in, int sock_out) - char remote_version[256]; /* Must be at least as big as buf. */ - - xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s\r\n", -- PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION, -+ PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_RELEASE, - *options.version_addendum == '\0' ? "" : " ", - options.version_addendum); - -@@ -422,6 +422,9 @@ sshd_exchange_identification(struct ssh *ssh, int sock_in, int sock_out) - } - debug("Client protocol version %d.%d; client software version %.100s", - remote_major, remote_minor, remote_version); -+ logit("SSH: Server;Ltype: Version;Remote: %s-%d;Protocol: %d.%d;Client: %.100s", -+ ssh_remote_ipaddr(ssh), ssh_remote_port(ssh), -+ remote_major, remote_minor, remote_version); - - ssh->compat = compat_datafellows(remote_version); - -@@ -1020,6 +1023,8 @@ server_listen(void) - int ret, listen_sock, on = 1; - struct addrinfo *ai; - char ntop[NI_MAXHOST], strport[NI_MAXSERV]; -+ int socksize; -+ int socksizelen = sizeof(int); - - for (ai = options.listen_addrs; ai; ai = ai->ai_next) { - if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) -@@ -1065,6 +1070,11 @@ server_listen(void) - - debug("Bind to port %s on %s.", strport, ntop); - -+ getsockopt(listen_sock, SOL_SOCKET, SO_RCVBUF, -+ &socksize, &socksizelen); -+ debug("Server TCP RWIN socket size: %d", socksize); -+ debug("HPN Buffer Size: %d", options.hpn_buffer_size); -+ - /* Bind the socket to the desired port. */ - if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) { - error("Bind to port %s on %s failed: %.200s.", -@@ -1589,6 +1599,13 @@ main(int ac, char **av) - /* Fill in default values for those options not explicitly set. */ - fill_default_server_options(&options); - -+ if (options.none_enabled == 1) { -+ char *old_ciphers = options.ciphers; -+ -+ xasprintf(&options.ciphers, "%s,none", old_ciphers); -+ free(old_ciphers); -+ } -+ - /* challenge-response is implemented via keyboard interactive */ - if (options.challenge_response_authentication) - options.kbd_interactive_authentication = 1; -@@ -1992,6 +2009,9 @@ main(int ac, char **av) - remote_ip, remote_port, laddr, ssh_local_port(ssh)); - free(laddr); - -+ /* set the HPN options for the child */ -+ channel_set_hpn(options.hpn_disabled, options.hpn_buffer_size); -+ - /* - * We don't want to listen forever unless the other side - * successfully authenticates itself. So we set up an alarm which is -@@ -2090,6 +2110,26 @@ main(int ac, char **av) - notify_hostkeys(active_state); - - /* Start session. */ -+ -+#ifdef WITH_OPENSSL -+ if (options.disable_multithreaded == 0) { -+ /* if we are using aes-ctr there can be issues in either a fork or sandbox -+ * so the initial aes-ctr is defined to point ot the original single process -+ * evp. After authentication we'll be past the fork and the sandboxed privsep -+ * so we repoint the define to the multithreaded evp. To start the threads we -+ * then force a rekey -+ */ -+ const void *cc = ssh_packet_get_send_context(active_state); -+ -+ /* only rekey if necessary. If we don't do this gcm mode cipher breaks */ -+ if (strstr(cipher_ctx_name(cc), "ctr")) { -+ debug("Single to Multithreaded CTR cipher swap - server request"); -+ cipher_reset_multithreaded(); -+ packet_request_rekeying(); -+ } -+ } -+#endif -+ - do_authenticated(authctxt); - - /* The connection has been terminated. */ -@@ -2152,6 +2192,9 @@ do_ssh2_kex(void) - struct kex *kex; - int r; - -+ if (options.none_enabled == 1) -+ debug("WARNING: None cipher enabled"); -+ - myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal( - options.kex_algorithms); - myproposal[PROPOSAL_ENC_ALGS_CTOS] = compat_cipher_proposal( -diff --git a/sshd_config b/sshd_config -index 4eb2e02..b8d51bf 100644 ---- a/sshd_config -+++ b/sshd_config -@@ -110,6 +110,19 @@ AuthorizedKeysFile .ssh/authorized_keys - # override default of no subsystems - Subsystem sftp /usr/libexec/sftp-server - -+# the following are HPN related configuration options -+# tcp receive buffer polling. disable in non autotuning kernels -+#TcpRcvBufPoll yes -+ -+# disable hpn performance boosts -+#HPNDisabled no -+ -+# buffer size for hpn to non-hpn connections -+#HPNBufferSize 2048 -+ -+# allow the use of the none cipher -+#NoneEnabled no -+ - # Example of overriding settings on a per-user basis - #Match User anoncvs - # X11Forwarding no -diff --git a/version.h b/version.h -index c86e209..5ae8c7d 100644 ---- a/version.h -+++ b/version.h -@@ -3,4 +3,5 @@ - #define SSH_VERSION "OpenSSH_7.5" - - #define SSH_PORTABLE "p1" --#define SSH_RELEASE SSH_VERSION SSH_PORTABLE -+#define SSH_HPN "-hpn14v13" -+#define SSH_RELEASE SSH_VERSION SSH_PORTABLE SSH_HPN diff --git a/packaging/debian/gsi-openssh/debian/patches/series b/packaging/debian/gsi-openssh/debian/patches/series deleted file mode 100644 index a612efdb99..0000000000 --- a/packaging/debian/gsi-openssh/debian/patches/series +++ /dev/null @@ -1,4 +0,0 @@ -openssh-7_5_P1-hpn-14.13.diff -hpn-14.13-isshd.v3.19.1.patch -hpn_isshd-gsi.7.5p1c.patch -hpn_isshd-gsi_ossl.7.5p1c.patch diff --git a/packaging/debian/gsi-openssh/debian/rules b/packaging/debian/gsi-openssh/debian/rules deleted file mode 100755 index fa0d767df7..0000000000 --- a/packaging/debian/gsi-openssh/debian/rules +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- - -DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) - -ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) -NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) -MAKEFLAGS += -j$(NUMJOBS) -endif - -name = gsi-openssh -_name = gsi_openssh - -INSTALLDIR = $(CURDIR)/debian/tmp - -_prefix = /usr -_bindir = $(_prefix)/bin -_sbindir = $(_prefix)/sbin -_libdir = $(_prefix)/lib -_datadir = $(_prefix)/share -_mandir = $(_datadir)/man -_docdir = $(_datadir)/doc - -DEB_BUILD_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU) - -configure: configure-stamp - -configure-stamp: - dh_testdir - libtoolize -c -f -i - dh_autoreconf - ./configure \ - --prefix=/usr \ - --sysconfdir=/etc/gsissh \ - --libexecdir=$(_libdir)/gsissh \ - --build=$(DEB_BUILD_GNU_TYPE) \ - --datarootdir=$(_datadir) \ - --datadir=$(_datadir)/gsissh \ - --docdir='$(_datadir)/doc/$(_name)' \ - --with-tcp-wrappers \ - --with-default-path=/usr/local/bin:/bin:/usr/bin \ - --with-superuser-path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin \ - --with-privsep-path=/var/empty/gsisshd \ - --enable-vendor-patchlevel=GT6-$(version) \ - --program-prefix=gsi \ - --disable-strip \ - --without-zlib-version-check \ - --with-ssl-engine \ - --with-authorized-keys-command \ - --with-pam \ - --without-kerberos \ - --with-gsi=/usr \ - --with-libedit \ - --enable-doxygen - - touch $@ - -build: build-arch build-indep - -build-arch: build-stamp - -build-indep: - -build-stamp: configure-stamp - dh_testdir - - $(MAKE) SSH_PROGRAM=$(_bindir)/gsissh \ - ASKPASS_PROGRAM=$(_libdir)/$(name)/ssh-askpass - - touch $@ - -clean: - dh_testdir - dh_testroot - - if [ -r Makefile ] ; then $(MAKE) distclean ; fi - - dh_autoreconf_clean - rm -f config.guess config.sub install-sh libtool ltmain.sh l*.m4 - - rm -f build-stamp configure-stamp - - dh_clean - -install: build-stamp - dh_testdir - dh_testroot - dh_prep - - $(MAKE) install DESTDIR=$(INSTALLDIR) sysconfdir=/etc/gsissh \ - bindir=$(_bindir) - - install -d $(INSTALLDIR)/etc/pam.d - install -m644 contrib/redhat/gsisshd.pam $(INSTALLDIR)/etc/pam.d/gsissh - -binary: binary-indep binary-arch - -binary-arch: install - dh_testdir - dh_testroot - dh_installchangelogs - dh_installdocs debian/README - dh_install --fail-missing - dh_installinit - dh_installman - dh_link - dh_strip --dbg-package=gsi-openssh-dbg - dh_compress -X .tag - dh_fixperms - dh_perl - dh_makeshlibs - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary-indep: - -.PHONY: binary binary-arch binary-indep build build-arch build-indep clean configure install diff --git a/packaging/debian/gsi-openssh/debian/source/format b/packaging/debian/gsi-openssh/debian/source/format deleted file mode 100644 index 163aaf8d82..0000000000 --- a/packaging/debian/gsi-openssh/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt)