Mailing List Archive

OpenSSH broken on HP-UX 10.x and fix
OpenSSH is broken on HP-UX 10.x as the libc has an undocumented
`getline` which is detected by configure, openbsd-compat's `getline`
ends up not being used. This causes a segfault as soon as you try to do
anything useful with the built binaries.

I think it could be worked around with something like this (after taking
getline out of the long list of functions to check) in configure.ac, but
consider this as pseudocode as I don't know much about actually writing
m4/for autoconf:

if [ `uname` = "HP-UX" ]; then
case `uname -r` in
B.10.*)
# However you explicitly define that we don't have getline.
;;
*)
AC_CHECK_FUNC(getline)
;;
esac
fi

With this resolved, OpenSSH compiles and works perfectly (tested with
GCC 4.2.4 on 10.20).

$ nc 192.168.1.110 22
SSH-2.0-OpenSSH_8.8
^C
$ ssh 192.168.1.110 uname -a
HP-UX alouette B.10.20 U 9000/777 2014502315 unlimited-user license
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: OpenSSH broken on HP-UX 10.x and fix [ In reply to ]
On Thu, Nov 04, 2021 at 10:33:58PM -0400, Larkin Nickle wrote:
> OpenSSH is broken on HP-UX 10.x as the libc has an undocumented `getline`
> which is detected by configure, openbsd-compat's `getline` ends up not being
> used. This causes a segfault as soon as you try to do anything useful with
> the built binaries.
>
> I think it could be worked around with something like this (after taking
> getline out of the long list of functions to check) in configure.ac, but
> consider this as pseudocode as I don't know much about actually writing
> m4/for autoconf:

Usually we have a BROKEN_$THING to disable $THING in that case (grep for
BROKEN_SNPRINTF for an example), and there's an existing case statement
for HP-UX where we can put it. Please try this patch (you'll need to
run "autoreconf" to rebuild configure).


diff --git a/configure.ac b/configure.ac
index 57fcc9bc..67824888 100644
--- a/configure.ac
+++ b/configure.ac
@@ -765,6 +765,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
if test -z "$GCC"; then
CFLAGS="$CFLAGS -Ae"
fi
+ AC_DEFINE([BROKEN_GETLINE], [1], [getine is not what we expect])
;;
*-*-hpux11*)
AC_DEFINE([PAM_SUN_CODEBASE], [1],
diff --git a/openbsd-compat/bsd-getline.c b/openbsd-compat/bsd-getline.c
index d676f4ce..a1c78e96 100644
--- a/openbsd-compat/bsd-getline.c
+++ b/openbsd-compat/bsd-getline.c
@@ -39,7 +39,7 @@
#include "file.h"
#endif

-#if !HAVE_GETLINE
+#if !defined(HAVE_GETLINE) && !defined(BROKEN_GETLINE)
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>

--
Darren Tucker (dtucker at dtucker.net)
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA (new)
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: OpenSSH broken on HP-UX 10.x and fix [ In reply to ]
On Sat, 6 Nov 2021, Darren Tucker wrote:

> -#if !HAVE_GETLINE
> +#if !defined(HAVE_GETLINE) && !defined(BROKEN_GETLINE)

Did you mean:

#if !defined(HAVE_GETLINE) || defined(BROKEN_GETLINE)

Mraw,
//mirabilos
--
Infrastrukturexperte • tarent solutions GmbH
Am Dickobskreuz 10, D-53121 Bonn • http://www.tarent.de/
Telephon +49 228 54881-393 • Fax: +49 228 54881-235
HRB AG Bonn 5168 • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

****************************************************
/?\ The UTF-8 Ribbon
? ? Campaign against Mit dem tarent-Newsletter nichts mehr verpassen:
 ?  HTML eMail! Also, https://www.tarent.de/newsletter
? ? header encryption!
****************************************************
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: OpenSSH broken on HP-UX 10.x and fix [ In reply to ]
On Sat, 6 Nov 2021, 08:28 Thorsten Glaser, <t.glaser@tarent.de> wrote:

> On Sat, 6 Nov 2021, Darren Tucker wrote:
>
> > -#if !HAVE_GETLINE
> > +#if !defined(HAVE_GETLINE) && !defined(BROKEN_GETLINE)
>
> Did you mean:
>
> #if !defined(HAVE_GETLINE) || defined(BROKEN_GETLINE)
>

Err, yeah. I shouldn't make patches before coffee :-)
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: OpenSSH broken on HP-UX 10.x and fix [ In reply to ]
On 2021-11-05 17:00, Darren Tucker wrote:
> Usually we have a BROKEN_$THING to disable $THING in that case (grep for
> BROKEN_SNPRINTF for an example), and there's an existing case statement
> for HP-UX where we can put it. Please try this patch (you'll need to
> run "autoreconf" to rebuild configure).

After getting m4 and autoconf up to test this, it does indeed work when
combined with the correction from Thorsten; thanks much! There is
another (more minor) typo however: "getine is not what we expect" should
be "getline is not what we expect".
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: OpenSSH broken on HP-UX 10.x and fix [ In reply to ]
On Sat, 6 Nov 2021 at 11:06, Larkin Nickle <me@larbob.org> wrote:
> After getting m4 and autoconf up to test this, it does indeed work when
> combined with the correction from Thorsten; thanks much! There is
> another (more minor) typo however: "getine is not what we expect" should
> be "getline is not what we expect".

Applied (with correction), thanks.
https://github.com/openssh/openssh-portable/commit/7a78fe63b0b28ef7231913dfefe9d08f9bc41c61

--
Darren Tucker (dtucker at dtucker.net)
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA (new)
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev