From cf3e0be7f5828a5e5f6c296a607d20be2f07d60c Mon Sep 17 00:00:00 2001 From: Tim Rice Date: Mon, 1 Aug 2016 14:31:52 -0700 Subject: modified: configure.ac opensshd.init.in Skip generating missing RSA1 key on startup unless ssh1 support is enabled. Spotted by Jean-Pierre Radley --- configure.ac | 3 +++ 1 file changed, 3 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 373d21b34..7c1956dc6 100644 --- a/configure.ac +++ b/configure.ac @@ -123,6 +123,7 @@ AC_CHECK_DECL([PR_SET_NO_NEW_PRIVS], [have_linux_no_new_privs=1], , [ openssl=yes ssh1=no +COMMENT_OUT_RSA1="#no ssh1#" AC_ARG_WITH([openssl], [ --without-openssl Disable use of OpenSSL; use only limited internal crypto **EXPERIMENTAL** ], [ if test "x$withval" = "xno" ; then @@ -147,6 +148,7 @@ AC_ARG_WITH([ssh1], AC_MSG_ERROR([Cannot enable SSH protocol 1 with OpenSSL disabled]) fi ssh1=yes + COMMENT_OUT_RSA1="" elif test "x$withval" = "xno" ; then ssh1=no else @@ -158,6 +160,7 @@ AC_MSG_CHECKING([whether SSH protocol 1 support is enabled]) if test "x$ssh1" = "xyes" ; then AC_MSG_RESULT([yes]) AC_DEFINE_UNQUOTED([WITH_SSH1], [1], [include SSH protocol version 1 support]) + AC_SUBST([COMMENT_OUT_RSA1]) else AC_MSG_RESULT([no]) fi -- cgit v1.2.3 From 20e5e8ba9c5d868d897896190542213a60fffbd2 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Tue, 2 Aug 2016 12:16:34 +1000 Subject: Explicitly test for broken strnvis. NetBSD added an strnvis and unfortunately made it incompatible with the existing one in OpenBSD and Linux's libbsd (the former having existed for over ten years). Despite this incompatibility being reported during development (see http://gnats.netbsd.org/44977) they still shipped it. Even more unfortunately FreeBSD and later MacOS picked up this incompatible implementation. Try to detect this mess, and assume the only safe option if we're cross compiling. OpenBSD 2.9 (2001): strnvis(char *dst, const char *src, size_t dlen, int flag); NetBSD 6.0 (2012): strnvis(char *dst, size_t dlen, const char *src, int flag); ok djm@ --- configure.ac | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 7c1956dc6..1df3cbfdd 100644 --- a/configure.ac +++ b/configure.ac @@ -849,8 +849,6 @@ mips-sony-bsd|mips-sony-newsos4) AC_DEFINE([SSH_TUN_PREPEND_AF], [1], [Prepend the address family to IP tunnel traffic]) TEST_MALLOC_OPTIONS="AJRX" - AC_DEFINE([BROKEN_STRNVIS], [1], - [NetBSD strnvis argument order is swapped compared to OpenBSD]) AC_DEFINE([BROKEN_READ_COMPARISON], [1], [NetBSD read function is sometimes redirected, breaking atomicio comparisons against it]) ;; @@ -861,8 +859,6 @@ mips-sony-bsd|mips-sony-newsos4) AC_CHECK_HEADER([net/if_tap.h], , AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support])) AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need]) - AC_DEFINE([BROKEN_STRNVIS], [1], - [FreeBSD strnvis argument order is swapped compared to OpenBSD]) TEST_MALLOC_OPTIONS="AJRX" # Preauth crypto occasionally uses file descriptors for crypto offload # and will crash if they cannot be opened. @@ -2336,6 +2332,41 @@ if test "x$check_for_conflicting_getspnam" = "x1"; then ) fi +dnl NetBSD added an strnvis and unfortunately made it incompatible with the +dnl existing one in OpenBSD and Linux's libbsd (the former having existed +dnl for over ten years). Despite this incompatibility being reported during +dnl development (see http://gnats.netbsd.org/44977) they still shipped it. +dnl Even more unfortunately FreeBSD and later MacOS picked up this incompatible +dnl implementation. Try to detect this mess, and assume the only safe option +dnl if we're cross compiling. +dnl +dnl OpenBSD, 2001: strnvis(char *dst, const char *src, size_t dlen, int flag); +dnl NetBSD: 2012, strnvis(char *dst, size_t dlen, const char *src, int flag); +if test "x$ac_cv_func_strnvis" = "xyes"; then + AC_MSG_CHECKING([for working strnvis]) + AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#include +#include +#include +static void sighandler(int sig) { _exit(1); } + ]], [[ + char dst[16]; + + signal(SIGSEGV, sighandler); + if (strnvis(dst, "src", 4, 0) && strcmp(dst, "src") == 0) + exit(0); + exit(1) + ]])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis detected broken])], + [AC_MSG_WARN([cross compiling: assuming broken]) + AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis assumed broken])] + ) +fi + AC_FUNC_GETPGRP # Search for OpenSSL -- cgit v1.2.3 From 5faa52d295f764562ed6dd75c4a4ce9134ae71e3 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Tue, 2 Aug 2016 15:22:40 +1000 Subject: Use tabs consistently inside "case $host". --- configure.ac | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 1df3cbfdd..e08374755 100644 --- a/configure.ac +++ b/configure.ac @@ -656,11 +656,11 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) TEST_MALLOC_OPTIONS="AFGJPRX" ;; *-*-haiku*) - LIBS="$LIBS -lbsd " - AC_CHECK_LIB([network], [socket]) - AC_DEFINE([HAVE_U_INT64_T]) - MANTYPE=man - ;; + LIBS="$LIBS -lbsd " + AC_CHECK_LIB([network], [socket]) + AC_DEFINE([HAVE_U_INT64_T]) + MANTYPE=man + ;; *-*-hpux*) # first we define all of the options common to all HP-UX releases CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1" @@ -1162,9 +1162,10 @@ mips-sony-bsd|mips-sony-newsos4) ;; *-*-lynxos) - CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__" - AC_DEFINE([BROKEN_SETVBUF], [1], [LynxOS has broken setvbuf() implementation]) - ;; + CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__" + AC_DEFINE([BROKEN_SETVBUF], [1], + [LynxOS has broken setvbuf() implementation]) + ;; esac AC_MSG_CHECKING([compiler and flags for sanity]) -- cgit v1.2.3 From 8bd81e1596ab1bab355146cb65e82fb96ade3b23 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 16 Aug 2016 13:30:56 +1000 Subject: add --with-pam-service to specify PAM service name Saves messing around with CFLAGS to do it. --- auth-pam.c | 6 +++++- auth-pam.h | 4 ---- configure.ac | 11 +++++++++++ 3 files changed, 16 insertions(+), 5 deletions(-) (limited to 'configure.ac') diff --git a/auth-pam.c b/auth-pam.c index 348fe370a..7a14c89f4 100644 --- a/auth-pam.c +++ b/auth-pam.c @@ -66,6 +66,11 @@ #include #endif +#if !defined(SSHD_PAM_SERVICE) +extern char *__progname; +# define SSHD_PAM_SERVICE __progname +#endif + /* OpenGroup RFC86.0 and XSSO specify no "const" on arguments */ #ifdef PAM_SUN_CODEBASE # define sshpam_const /* Solaris, HP-UX, SunOS */ @@ -615,7 +620,6 @@ sshpam_cleanup(void) static int sshpam_init(Authctxt *authctxt) { - extern char *__progname; const char *pam_rhost, *pam_user, *user = authctxt->user; const char **ptr_pam_user = &pam_user; struct ssh *ssh = active_state; /* XXX */ diff --git a/auth-pam.h b/auth-pam.h index 2e9a0c0a3..58a257a48 100644 --- a/auth-pam.h +++ b/auth-pam.h @@ -27,10 +27,6 @@ #include "includes.h" #ifdef USE_PAM -#if !defined(SSHD_PAM_SERVICE) -# define SSHD_PAM_SERVICE __progname -#endif - void start_pam(Authctxt *); void finish_pam(void); u_int do_pam_account(void); diff --git a/configure.ac b/configure.ac index e08374755..1f1941a15 100644 --- a/configure.ac +++ b/configure.ac @@ -3047,6 +3047,17 @@ AC_ARG_WITH([pam], ] ) +AC_ARG_WITH([pam-service], + [ --with-pam-service=name Specify PAM service name ], + [ + if test "x$withval" != "xno" && \ + test "x$withval" != "xyes" ; then + AC_DEFINE_UNQUOTED([SSHD_PAM_SERVICE], + ["$withval"], [sshd PAM service name]) + fi + ] +) + # Check for older PAM if test "x$PAM_MSG" = "xyes" ; then # Check PAM strerror arguments (old PAM) -- cgit v1.2.3 From a1cc637e7e11778eb727559634a6ef1c19c619f6 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 16 Aug 2016 14:47:34 +1000 Subject: add a --with-login-program configure argument Saves messing around with LOGIN_PROGRAM env var, which come packaging environments make hard to do during configure phase. --- configure.ac | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 1f1941a15..959826fe9 100644 --- a/configure.ac +++ b/configure.ac @@ -80,15 +80,27 @@ if test -z "$AR" ; then fi # Use LOGIN_PROGRAM from environment if possible -if test ! -z "$LOGIN_PROGRAM" ; then - AC_DEFINE_UNQUOTED([LOGIN_PROGRAM_FALLBACK], ["$LOGIN_PROGRAM"], - [If your header files don't define LOGIN_PROGRAM, - then use this (detected) from environment and PATH]) +login_program=$LOGIN_PROGRAM +# Allow override on command-line +AC_ARG_WITH([login-program], + [ --with-login-program=path Specify login program name ], + [ + if test "x$withval" != "xno" && \ + test "x$withval" != "xyes" ; then + login_program=$withval + fi + ] +) +# If no login_program specified then find one using the path. +if test ! -z "$login_program" ; then + AC_DEFINE_UNQUOTED([LOGIN_PROGRAM_FALLBACK], ["$login_program"], + [login program to use if system headers lack LOGIN_PROGRAM]) else # Search for login AC_PATH_PROG([LOGIN_PROGRAM_FALLBACK], [login]) if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then - AC_DEFINE_UNQUOTED([LOGIN_PROGRAM_FALLBACK], ["$LOGIN_PROGRAM_FALLBACK"]) + AC_DEFINE_UNQUOTED([LOGIN_PROGRAM_FALLBACK], + ["$LOGIN_PROGRAM_FALLBACK"]) fi fi -- cgit v1.2.3 From 33ba55d9e358c07f069e579bfab80eccaaad52cb Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Wed, 17 Aug 2016 16:26:04 +1000 Subject: Only check for prctl once. --- configure.ac | 1 - 1 file changed, 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 959826fe9..a3c22c187 100644 --- a/configure.ac +++ b/configure.ac @@ -796,7 +796,6 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) fi AC_CHECK_HEADERS([linux/seccomp.h linux/filter.h linux/audit.h], [], [], [#include ]) - AC_CHECK_FUNCS([prctl]) AC_MSG_CHECKING([for seccomp architecture]) seccomp_audit_arch= case "$host" in -- cgit v1.2.3 From 857568d2ac81c14bcfd625b27536c1e28c992b3c Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 23 Aug 2016 14:32:37 +1000 Subject: removing UseLogin bits from configure.ac --- configure.ac | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index a3c22c187..f6b56db17 100644 --- a/configure.ac +++ b/configure.ac @@ -79,31 +79,6 @@ if test -z "$AR" ; then AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***]) fi -# Use LOGIN_PROGRAM from environment if possible -login_program=$LOGIN_PROGRAM -# Allow override on command-line -AC_ARG_WITH([login-program], - [ --with-login-program=path Specify login program name ], - [ - if test "x$withval" != "xno" && \ - test "x$withval" != "xyes" ; then - login_program=$withval - fi - ] -) -# If no login_program specified then find one using the path. -if test ! -z "$login_program" ; then - AC_DEFINE_UNQUOTED([LOGIN_PROGRAM_FALLBACK], ["$login_program"], - [login program to use if system headers lack LOGIN_PROGRAM]) -else - # Search for login - AC_PATH_PROG([LOGIN_PROGRAM_FALLBACK], [login]) - if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then - AC_DEFINE_UNQUOTED([LOGIN_PROGRAM_FALLBACK], - ["$LOGIN_PROGRAM_FALLBACK"]) - fi -fi - AC_PATH_PROG([PATH_PASSWD_PROG], [passwd]) if test ! -z "$PATH_PASSWD_PROG" ; then AC_DEFINE_UNQUOTED([_PATH_PASSWD_PROG], ["$PATH_PASSWD_PROG"], @@ -678,8 +653,6 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1" IPADDR_IN_DISPLAY=yes AC_DEFINE([USE_PIPES]) - AC_DEFINE([LOGIN_NO_ENDOPT], [1], - [Define if your login program cannot handle end of options ("--")]) AC_DEFINE([LOGIN_NEEDS_UTMPX]) AC_DEFINE([LOCKED_PASSWD_STRING], ["*"], [String used in /etc/passwd to denote locked account]) @@ -906,9 +879,6 @@ mips-sony-bsd|mips-sony-newsos4) fi AC_DEFINE([PAM_SUN_CODEBASE]) AC_DEFINE([LOGIN_NEEDS_UTMPX]) - AC_DEFINE([LOGIN_NEEDS_TERM], [1], - [Some versions of /bin/login need the TERM supplied - on the commandline]) AC_DEFINE([PAM_TTY_KLUDGE]) AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1], [Define if pam_chauthtok wants real uid set -- cgit v1.2.3 From 1cfd5c06efb121e58e8b6671548fda77ef4b4455 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Thu, 29 Sep 2016 03:19:23 +1000 Subject: Remove portability support for mmap We no longer need to wrap/replace mmap for portability now that pre-auth compression has been removed from OpenSSH. --- README.privsep | 7 ---- TODO | 4 -- configure.ac | 2 - openbsd-compat/Makefile.in | 2 +- openbsd-compat/openbsd-compat.h | 1 - openbsd-compat/xmmap.c | 86 ----------------------------------------- 6 files changed, 1 insertion(+), 101 deletions(-) delete mode 100644 openbsd-compat/xmmap.c (limited to 'configure.ac') diff --git a/README.privsep b/README.privsep index d910650c5..2120544c7 100644 --- a/README.privsep +++ b/README.privsep @@ -8,10 +8,6 @@ More information is available at: Privilege separation is now enabled by default; see the UsePrivilegeSeparation option in sshd_config(5). -On systems which lack mmap or anonymous (MAP_ANON) memory mapping, -compression must be disabled in order for privilege separation to -function. - When privsep is enabled, during the pre-authentication phase sshd will chroot(2) to "/var/empty" and change its privileges to the "sshd" user and its primary group. sshd is a pseudo-account that should not be @@ -35,9 +31,6 @@ privsep user and chroot directory: --with-privsep-path=xxx Path for privilege separation chroot --with-privsep-user=user Specify non-privileged user for privilege separation -Privsep requires operating system support for file descriptor passing. -Compression will be disabled on systems without a working mmap MAP_ANON. - PAM-enabled OpenSSH is known to function with privsep on AIX, FreeBSD, HP-UX (including Trusted Mode), Linux, NetBSD and Solaris. diff --git a/TODO b/TODO index 645787a6c..f22c7e224 100644 --- a/TODO +++ b/TODO @@ -69,10 +69,6 @@ Packaging: (gilbert.r.loomis@saic.com) PrivSep Issues: -- mmap() issues. - + /dev/zero solution (Solaris) - + No/broken MAP_ANON (Irix) - + broken /dev/zero parse (Linux) - PAM + See above PAM notes - AIX diff --git a/configure.ac b/configure.ac index f6b56db17..f5e137812 100644 --- a/configure.ac +++ b/configure.ac @@ -1137,7 +1137,6 @@ mips-sony-bsd|mips-sony-newsos4) *-*-ultrix*) AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1]) - AC_DEFINE([BROKEN_MMAP], [1], [Ultrix mmap can't map files]) AC_DEFINE([NEED_SETPGRP]) AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix]) ;; @@ -1708,7 +1707,6 @@ AC_CHECK_FUNCS([ \ memmove \ memset_s \ mkdtemp \ - mmap \ ngetaddrinfo \ nsleep \ ogetaddrinfo \ diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in index 7f7368aa3..eedbd9eec 100644 --- a/openbsd-compat/Makefile.in +++ b/openbsd-compat/Makefile.in @@ -18,7 +18,7 @@ LDFLAGS=-L. @LDFLAGS@ OPENBSD=base64.o basename.o bcrypt_pbkdf.o bindresvport.o blowfish.o daemon.o dirname.o fmt_scaled.o getcwd.o getgrouplist.o getopt_long.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o pwcache.o readpassphrase.o reallocarray.o realpath.o rresvport.o setenv.o setproctitle.o sha1.o sha2.o rmd160.o md5.o sigact.o strlcat.o strlcpy.o strmode.o strnlen.o strptime.o strsep.o strtonum.o strtoll.o strtoul.o strtoull.o timingsafe_bcmp.o vis.o blowfish.o bcrypt_pbkdf.o explicit_bzero.o -COMPAT=arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.o bsd-err.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-setres_id.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xmmap.o xcrypt.o kludge-fd_set.o +COMPAT=arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.o bsd-err.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-setres_id.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xcrypt.o kludge-fd_set.o PORTS=port-aix.o port-irix.o port-linux.o port-solaris.o port-tun.o port-uw.o diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h index 0de07e9c3..2e56203e1 100644 --- a/openbsd-compat/openbsd-compat.h +++ b/openbsd-compat/openbsd-compat.h @@ -297,7 +297,6 @@ int bcrypt_pbkdf(const char *, size_t, const u_int8_t *, size_t, void explicit_bzero(void *p, size_t n); #endif -void *xmmap(size_t size); char *xcrypt(const char *password, const char *salt); char *shadow_pw(struct passwd *pw); diff --git a/openbsd-compat/xmmap.c b/openbsd-compat/xmmap.c deleted file mode 100644 index 262a79095..000000000 --- a/openbsd-compat/xmmap.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2002 Tim Rice. All rights reserved. - * MAP_FAILED code by Solar Designer. - * - * 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 -#ifdef HAVE_SYS_MMAN_H -#include -#endif -#include - -#ifdef HAVE_FCNTL_H -# include -#endif -#include -#include -#include -#include -#include - -#include "log.h" - -void * -xmmap(size_t size) -{ -#ifdef HAVE_MMAP - void *address; - -# ifdef MAP_ANON - address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED, - -1, (off_t)0); -# else - address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_SHARED, - open("/dev/zero", O_RDWR), (off_t)0); -# endif - -#define MM_SWAP_TEMPLATE "/var/run/sshd.mm.XXXXXXXX" - if (address == (void *)MAP_FAILED) { - char tmpname[sizeof(MM_SWAP_TEMPLATE)] = MM_SWAP_TEMPLATE; - int tmpfd; - mode_t old_umask; - - old_umask = umask(0177); - tmpfd = mkstemp(tmpname); - umask(old_umask); - if (tmpfd == -1) - fatal("mkstemp(\"%s\"): %s", - MM_SWAP_TEMPLATE, strerror(errno)); - unlink(tmpname); - if (ftruncate(tmpfd, size) != 0) - fatal("%s: ftruncate: %s", __func__, strerror(errno)); - address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_SHARED, - tmpfd, (off_t)0); - close(tmpfd); - } - - return (address); -#else - fatal("%s: UsePrivilegeSeparation=yes and Compression=yes not supported", - __func__); -#endif /* HAVE_MMAP */ - -} - -- cgit v1.2.3 From 5ee3fb5affd7646f141749483205ade5fc54adaf Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Tue, 1 Nov 2016 08:12:33 +1100 Subject: Use ptrace(PT_DENY_ATTACH, ..) on OS X. --- configure.ac | 1 + platform-tracing.c | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index f5e137812..88c4633d5 100644 --- a/configure.ac +++ b/configure.ac @@ -405,6 +405,7 @@ AC_CHECK_HEADERS([ \ sys/poll.h \ sys/prctl.h \ sys/pstat.h \ + sys/ptrace.h \ sys/select.h \ sys/stat.h \ sys/stream.h \ diff --git a/platform-tracing.c b/platform-tracing.c index 81020e7f7..4c80a282c 100644 --- a/platform-tracing.c +++ b/platform-tracing.c @@ -20,6 +20,9 @@ #if defined(HAVE_SYS_PRCTL_H) #include /* For prctl() and PR_SET_DUMPABLE */ #endif +#ifdef HAVE_SYS_PTRACE_H +#include +#endif #ifdef HAVE_PRIV_H #include /* For setpflags() and __PROC_PROTECT */ #endif @@ -40,4 +43,9 @@ platform_disable_tracing(int strict) if (setpflags(__PROC_PROTECT, 1) != 0 && strict) fatal("unable to make the process untraceable"); #endif +#ifdef PT_DENY_ATTACH + /* Mac OS X */ + if (ptrace(PT_DENY_ATTACH, 0, 0, 0) == -1 && strict) + fatal("unable to set PT_DENY_ATTACH"); +#endif } -- cgit v1.2.3 From 4089fc1885b3a2822204effbb02b74e3da58240d Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Thu, 8 Dec 2016 12:57:24 +1100 Subject: Use AC_PATH_TOOL for krb5-config. This will use the host-prefixed version when cross compiling; patch from david.michael at coreos.com. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 88c4633d5..4d9382ca7 100644 --- a/configure.ac +++ b/configure.ac @@ -4151,7 +4151,7 @@ AC_ARG_WITH([kerberos5], AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support]) KRB5_MSG="yes" - AC_PATH_PROG([KRB5CONF], [krb5-config], + AC_PATH_TOOL([KRB5CONF], [krb5-config], [$KRB5ROOT/bin/krb5-config], [$KRB5ROOT/bin:$PATH]) if test -x $KRB5CONF ; then -- cgit v1.2.3 From 47b8c99ab3221188ad3926108dd9d36da3b528ec Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Thu, 8 Dec 2016 15:48:34 +1100 Subject: Check for utf8 local support before testing it. Check for utf8 local support and if not found, do not attempt to run the utf8 tests. Suggested by djm@ --- Makefile.in | 2 ++ configure.ac | 18 ++++++++++++++++++ regress/Makefile | 4 +++- 3 files changed, 23 insertions(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/Makefile.in b/Makefile.in index 3990f5525..e10f3742a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -580,6 +580,7 @@ tests interop-tests t-exec: regress-prep regress-binaries $(TARGETS) TEST_SSH_PUTTYGEN="puttygen"; \ TEST_SSH_CONCH="conch"; \ TEST_SSH_IPV6="@TEST_SSH_IPV6@" ; \ + TEST_SSH_UTF8="@TEST_SSH_UTF8@" ; \ TEST_SSH_ECC="@TEST_SSH_ECC@" ; \ cd $(srcdir)/regress || exit $$?; \ $(MAKE) \ @@ -604,6 +605,7 @@ tests interop-tests t-exec: regress-prep regress-binaries $(TARGETS) TEST_SSH_PUTTYGEN="$${TEST_SSH_PUTTYGEN}" \ TEST_SSH_CONCH="$${TEST_SSH_CONCH}" \ TEST_SSH_IPV6="$${TEST_SSH_IPV6}" \ + TEST_SSH_UTF8="$${TEST_SSH_UTF8}" \ TEST_SSH_ECC="$${TEST_SSH_ECC}" \ TEST_SHELL="${TEST_SHELL}" \ EXEEXT="$(EXEEXT)" \ diff --git a/configure.ac b/configure.ac index 4d9382ca7..9c8d1173b 100644 --- a/configure.ac +++ b/configure.ac @@ -1776,6 +1776,23 @@ CFLAGS="$CFLAGS -D_XOPEN_SOURCE" AC_CHECK_FUNCS([mblen mbtowc nl_langinfo wcwidth]) CFLAGS="$saved_CFLAGS" +TEST_SSH_UTF8=yes +AC_MSG_CHECKING([for utf8 locale support]) +AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ +#include + ]], [[ + char *loc = setlocale(LC_CTYPE, "en_US.UTF-8"); + if (loc != NULL) + exit(0); + exit(1); + ]])], + AC_MSG_RESULT(yes), + [AC_MSG_RESULT(no) + TEST_SSH_UTF8=no], + AC_MSG_WARN([cross compiling: assuming yes]) +) + AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ #include ]], @@ -5009,6 +5026,7 @@ else fi AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no]) AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6]) +AC_SUBST([TEST_SSH_UTF8], [$TEST_SSH_UTF8]) AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS]) AC_SUBST([UNSUPPORTED_ALGORITHMS], [$unsupported_algorithms]) diff --git a/regress/Makefile b/regress/Makefile index 1f71761fa..bb8806818 100644 --- a/regress/Makefile +++ b/regress/Makefile @@ -225,5 +225,7 @@ unit: $$V ${.OBJDIR}/unittests/hostkeys/test_hostkeys \ -d ${.CURDIR}/unittests/hostkeys/testdata ; \ $$V ${.OBJDIR}/unittests/match/test_match ; \ - $$V ${.OBJDIR}/unittests/utf8/test_utf8 ; \ + if test "x${TEST_SSH_UTF8}" = "xyes" ; then \ + $$V ${.OBJDIR}/unittests/utf8/test_utf8 ; \ + fi \ fi -- cgit v1.2.3 From d399a8b914aace62418c0cfa20341aa37a192f98 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 9 Dec 2016 12:33:25 +1100 Subject: Include for exit in utf8 locale test. --- configure.ac | 1 + 1 file changed, 1 insertion(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 9c8d1173b..7b1be32e9 100644 --- a/configure.ac +++ b/configure.ac @@ -1781,6 +1781,7 @@ AC_MSG_CHECKING([for utf8 locale support]) AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include +#include ]], [[ char *loc = setlocale(LC_CTYPE, "en_US.UTF-8"); if (loc != NULL) -- cgit v1.2.3 From c35995048f41239fc8895aadc3374c5f75180554 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 9 Dec 2016 12:52:02 +1100 Subject: exit is in stdlib.h not unistd.h (that's _exit). --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 7b1be32e9..a221214d1 100644 --- a/configure.ac +++ b/configure.ac @@ -1781,7 +1781,7 @@ AC_MSG_CHECKING([for utf8 locale support]) AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include -#include +#include ]], [[ char *loc = setlocale(LC_CTYPE, "en_US.UTF-8"); if (loc != NULL) -- cgit v1.2.3 From afec07732aa2985142f3e0b9a01eb6391f523dec Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Tue, 13 Dec 2016 10:23:03 +1100 Subject: Add strcasestr to compat library. Fixes build on (at least) Solaris 10. --- configure.ac | 1 + openbsd-compat/Makefile.in | 2 +- openbsd-compat/strcasestr.c | 69 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 openbsd-compat/strcasestr.c (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index a221214d1..59582524e 100644 --- a/configure.ac +++ b/configure.ac @@ -1743,6 +1743,7 @@ AC_CHECK_FUNCS([ \ socketpair \ statfs \ statvfs \ + strcasestr \ strdup \ strerror \ strlcat \ diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in index eedbd9eec..d51eacf65 100644 --- a/openbsd-compat/Makefile.in +++ b/openbsd-compat/Makefile.in @@ -16,7 +16,7 @@ RANLIB=@RANLIB@ INSTALL=@INSTALL@ LDFLAGS=-L. @LDFLAGS@ -OPENBSD=base64.o basename.o bcrypt_pbkdf.o bindresvport.o blowfish.o daemon.o dirname.o fmt_scaled.o getcwd.o getgrouplist.o getopt_long.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o pwcache.o readpassphrase.o reallocarray.o realpath.o rresvport.o setenv.o setproctitle.o sha1.o sha2.o rmd160.o md5.o sigact.o strlcat.o strlcpy.o strmode.o strnlen.o strptime.o strsep.o strtonum.o strtoll.o strtoul.o strtoull.o timingsafe_bcmp.o vis.o blowfish.o bcrypt_pbkdf.o explicit_bzero.o +OPENBSD=base64.o basename.o bcrypt_pbkdf.o bindresvport.o blowfish.o daemon.o dirname.o fmt_scaled.o getcwd.o getgrouplist.o getopt_long.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o pwcache.o readpassphrase.o reallocarray.o realpath.o rresvport.o setenv.o setproctitle.o sha1.o sha2.o rmd160.o md5.o sigact.o strcasestr.o strlcat.o strlcpy.o strmode.o strnlen.o strptime.o strsep.o strtonum.o strtoll.o strtoul.o strtoull.o timingsafe_bcmp.o vis.o blowfish.o bcrypt_pbkdf.o explicit_bzero.o COMPAT=arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.o bsd-err.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-setres_id.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xcrypt.o kludge-fd_set.o diff --git a/openbsd-compat/strcasestr.c b/openbsd-compat/strcasestr.c new file mode 100644 index 000000000..4c4d1475a --- /dev/null +++ b/openbsd-compat/strcasestr.c @@ -0,0 +1,69 @@ +/* $OpenBSD: strcasestr.c,v 1.4 2015/08/31 02:53:57 guenther Exp $ */ +/* $NetBSD: strcasestr.c,v 1.2 2005/02/09 21:35:47 kleink Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * 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. + */ + +/* OPENBSD ORIGINAL: lib/libc/string/strcasestr.c */ + +#include "includes.h" + +#ifndef HAVE_STRCASESTR + +#include +#include + +/* + * Find the first occurrence of find in s, ignore case. + */ +char * +strcasestr(const char *s, const char *find) +{ + char c, sc; + size_t len; + + if ((c = *find++) != 0) { + c = (char)tolower((unsigned char)c); + len = strlen(find); + do { + do { + if ((sc = *s++) == 0) + return (NULL); + } while ((char)tolower((unsigned char)sc) != c); + } while (strncasecmp(s, find, len) != 0); + s--; + } + return ((char *)s); +} +DEF_WEAK(strcasestr); + +#endif -- cgit v1.2.3 From 10e290ec00964b2bf70faab15a10a5574bb80527 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Tue, 13 Dec 2016 13:51:32 +1100 Subject: Get default of TEST_SSH_UTF8 from environment. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 59582524e..eb9f45dcc 100644 --- a/configure.ac +++ b/configure.ac @@ -1777,7 +1777,7 @@ CFLAGS="$CFLAGS -D_XOPEN_SOURCE" AC_CHECK_FUNCS([mblen mbtowc nl_langinfo wcwidth]) CFLAGS="$saved_CFLAGS" -TEST_SSH_UTF8=yes +TEST_SSH_UTF8=${TEST_SSH_UTF8:=yes} AC_MSG_CHECKING([for utf8 locale support]) AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ -- cgit v1.2.3