From 66e9752d60af1c057a7ed8959c259b9c15264a71 Mon Sep 17 00:00:00 2001 From: "Tom G. Christensen" Date: Sun, 16 Oct 2022 20:35:37 +0200 Subject: [PATCH] openssh: update 9.1p1 --- openssh/build.sh | 7 ++- openssh/meta/ChangeLog | 5 +- .../0001-Workaround-missing-MAP_ANON.patch | 54 +++++++++++++++++++ 3 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 openssh/src/0001-Workaround-missing-MAP_ANON.patch diff --git a/openssh/build.sh b/openssh/build.sh index d396579..87ac24f 100755 --- a/openssh/build.sh +++ b/openssh/build.sh @@ -6,11 +6,12 @@ ########################################################### # Check the following 4 variables before running the script topdir=openssh -version=9.0p1 +version=9.1p1 pkgver=1 source[0]=https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/$topdir-$version.tar.gz # If there are no patches, simply comment this patch[0]=0007-Fix-authopt-test-on-platforms-without-IPv6-support.patch +patch[1]=0001-Workaround-missing-MAP_ANON.patch # Source function library . ${BUILDPKG_SCRIPTS}/buildpkg.functions @@ -18,7 +19,7 @@ patch[0]=0007-Fix-authopt-test-on-platforms-without-IPv6-support.patch # Global settings export LDFLAGS="-R$prefix/lib -L$prefix/lib" export CPPFLAGS="-I$prefix/include" -export CC=gcc +export CC="gcc" make_check_target="tests" configure_args=(--prefix=$prefix --mandir=$prefix/$_mandir --sysconfdir=$prefix/${_sysconfdir}/ssh --datadir=$prefix/${_sharedir}/openssh --with-default-path=/usr/bin:$prefix/${_bindir} --with-mantype=man --with-pam --with-privsep-user=sshd --with-privsep-path=/var/empty/sshd --with-superuser-path=/usr/bin:/usr/sbin:$prefix/$_bindir:$prefix/$_sbindir --with-lastlog=/var/adm/lastlog --without-zlib-version-check) @@ -27,8 +28,6 @@ reg prep prep() { generic_prep - setdir source - autoreconf } reg build diff --git a/openssh/meta/ChangeLog b/openssh/meta/ChangeLog index 6f8564d..c4d9836 100644 --- a/openssh/meta/ChangeLog +++ b/openssh/meta/ChangeLog @@ -1,5 +1,8 @@ CHANGELOG ---------- +-------- +* Wed Oct 05 2022 Tom G. Christensen - 9.1p1-1 +- Update to 9.1p1 + * Fri Apr 08 2022 Tom G. Christensen - 9.0p1-1 - Update to 9.0p1 diff --git a/openssh/src/0001-Workaround-missing-MAP_ANON.patch b/openssh/src/0001-Workaround-missing-MAP_ANON.patch new file mode 100644 index 0000000..3140194 --- /dev/null +++ b/openssh/src/0001-Workaround-missing-MAP_ANON.patch @@ -0,0 +1,54 @@ +From 2117a08838a57b2d042cc7df7010ff6a863613f6 Mon Sep 17 00:00:00 2001 +From: "Tom G. Christensen" +Date: Sun, 16 Oct 2022 18:29:07 +0200 +Subject: [PATCH] Workaround missing MAP_ANON + +On Solaris MAP_ANON is only available from Solaris 8 and onward so a +workaround is needed. +This patch is based on https://stackoverflow.com/a/39945292 +--- + openbsd-compat/arc4random.h | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/openbsd-compat/arc4random.h b/openbsd-compat/arc4random.h +index 2b57611f..a7cbe1c4 100644 +--- a/openbsd-compat/arc4random.h ++++ b/openbsd-compat/arc4random.h +@@ -63,6 +63,7 @@ _rs_forkdetect(void) + static inline int + _rs_allocate(struct _rs **rsp, struct _rsx **rsxp) + { ++#ifdef MAP_ANON + if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE, + MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) + return (-1); +@@ -73,6 +74,26 @@ _rs_allocate(struct _rs **rsp, struct _rsx **rsxp) + *rsp = NULL; + return (-1); + } ++#else /*Map /dev/zero*/ ++ int fd; ++ fd = open("/dev/zero", O_RDWR); ++ if (fd == -1) ++ return (-1); ++ ++ if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE, ++ MAP_PRIVATE, fd, 0)) == MAP_FAILED) ++ return (-1); ++ ++ if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE, ++ MAP_PRIVATE, fd, 0)) == MAP_FAILED) { ++ munmap(*rsp, sizeof(**rsp)); ++ *rsp = NULL; ++ return (-1); ++ } ++ ++ if (close(fd) == -1) /*No longer needed*/ ++ return (-1); ++#endif + + _ARC4_ATFORK(_rs_forkhandler); + return (0); +-- +2.36.1 +