diff options
author | Darren Tucker <dtucker@zip.com.au> | 2016-06-09 16:23:07 +1000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2016-06-09 16:23:07 +1000 |
commit | 0fb7f5985351fbbcd2613d8485482c538e5123be (patch) | |
tree | e1f112e1d19fcb004a643bef8ce24c03ea38e5e2 /platform.c | |
parent | e6508898c3cd838324ecfe1abd0eb8cf802e7106 (diff) | |
download | openssh-git-0fb7f5985351fbbcd2613d8485482c538e5123be.tar.gz |
Move prctl PR_SET_DUMPABLE into platform.c.
This should make it easier to add additional platform support such as
Solaris (bz#2584).
Diffstat (limited to 'platform.c')
-rw-r--r-- | platform.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -19,6 +19,9 @@ #include "includes.h" #include <sys/types.h> +#if defined(HAVE_SYS_PRCTL_H) +#include <sys/prctl.h> /* For prctl() and PR_SET_DUMPABLE */ +#endif #include <stdarg.h> #include <unistd.h> @@ -217,3 +220,14 @@ platform_sys_dir_uid(uid_t uid) #endif return 0; } + +void +platform_disable_tracing(int strict) +{ +#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) + /* Disable ptrace on Linux without sgid bit */ + if (prctl(PR_SET_DUMPABLE, 0) != 0) + if (strict) + fatal("unable to make the process undumpable"); +#endif +} |