]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
Use Solaris setpflags(__PROC_PROTECT, ...).
authorDarren Tucker <dtucker@zip.com.au>
Tue, 14 Jun 2016 00:48:27 +0000 (10:48 +1000)
committerDarren Tucker <dtucker@zip.com.au>
Tue, 14 Jun 2016 00:48:27 +0000 (10:48 +1000)
Where possible, use Solaris setpflags to disable process tracing on
ssh-agent and sftp-server.  bz#2584, based on a patch from huieying.lee
at oracle.com, ok djm.

configure.ac
platform.c

index 6638703814fab560ecb31300f384dee9c570ea54..83548767ec5943e9f8deffc5f8ece015c9088912 100644 (file)
@@ -898,6 +898,7 @@ mips-sony-bsd|mips-sony-newsos4)
        else
                AC_MSG_RESULT([no])
        fi
+       AC_CHECK_FUNCS([setpflags])
        AC_CHECK_FUNCS([setppriv])
        AC_CHECK_FUNCS([priv_basicset])
        AC_CHECK_HEADERS([priv.h])
index e3722e4ae6739a438460fa57aeba365e68bd8a48..c68bb09c169979576439a742ba3bffd36b4bd968 100644 (file)
@@ -22,6 +22,9 @@
 #if defined(HAVE_SYS_PRCTL_H)
 #include <sys/prctl.h> /* For prctl() and PR_SET_DUMPABLE */
 #endif
+#ifdef HAVE_PRIV_H
+#include <priv.h> /* For setpflags() and __PROC_PROTECT  */
+#endif
 
 #include <stdarg.h>
 #include <unistd.h>
@@ -229,4 +232,9 @@ platform_disable_tracing(int strict)
        if (prctl(PR_SET_DUMPABLE, 0) != 0 && strict)
                fatal("unable to make the process undumpable");
 #endif
+#if defined(HAVE_SETPFLAGS) && defined(__PROC_PROTECT)
+       /* On Solaris, we should make this process untraceable */
+       if (setpflags(__PROC_PROTECT, 1) != 0 && strict)
+               fatal("unable to make the process untraceable");
+#endif
 }