mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-30 09:14:59 +02:00
Disable tracing on FreeBSD using procctl.
Placed at the start of platform_disable_tracing() to prevent declaration after code errors from strict C89 compilers (in the unlikely event that more than one method is enabled).
This commit is contained in:
parent
73050fa38f
commit
2d678c5e3b
@ -454,6 +454,7 @@ AC_CHECK_HEADERS([ \
|
|||||||
sys/ndir.h \
|
sys/ndir.h \
|
||||||
sys/poll.h \
|
sys/poll.h \
|
||||||
sys/prctl.h \
|
sys/prctl.h \
|
||||||
|
sys/procctl.h \
|
||||||
sys/pstat.h \
|
sys/pstat.h \
|
||||||
sys/ptrace.h \
|
sys/ptrace.h \
|
||||||
sys/random.h \
|
sys/random.h \
|
||||||
@ -1868,6 +1869,7 @@ AC_CHECK_FUNCS([ \
|
|||||||
pledge \
|
pledge \
|
||||||
poll \
|
poll \
|
||||||
prctl \
|
prctl \
|
||||||
|
procctl \
|
||||||
pselect \
|
pselect \
|
||||||
pstat \
|
pstat \
|
||||||
raise \
|
raise \
|
||||||
|
@ -17,6 +17,9 @@
|
|||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#ifdef HAVE_SYS_PROCCTL_H
|
||||||
|
#include <sys/procctl.h>
|
||||||
|
#endif
|
||||||
#if defined(HAVE_SYS_PRCTL_H)
|
#if defined(HAVE_SYS_PRCTL_H)
|
||||||
#include <sys/prctl.h> /* For prctl() and PR_SET_DUMPABLE */
|
#include <sys/prctl.h> /* For prctl() and PR_SET_DUMPABLE */
|
||||||
#endif
|
#endif
|
||||||
@ -33,6 +36,13 @@
|
|||||||
void
|
void
|
||||||
platform_disable_tracing(int strict)
|
platform_disable_tracing(int strict)
|
||||||
{
|
{
|
||||||
|
#if defined(HAVE_PROCCTL) && defined(PROC_TRACE_CTL)
|
||||||
|
/* On FreeBSD, we should make this process untraceable */
|
||||||
|
int disable_trace = PROC_TRACE_CTL_DISABLE;
|
||||||
|
|
||||||
|
if (procctl(P_PID, 0, PROC_TRACE_CTL, &disable_trace) && strict)
|
||||||
|
fatal("unable to make the process untraceable");
|
||||||
|
#endif
|
||||||
#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
|
#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
|
||||||
/* Disable ptrace on Linux without sgid bit */
|
/* Disable ptrace on Linux without sgid bit */
|
||||||
if (prctl(PR_SET_DUMPABLE, 0) != 0 && strict)
|
if (prctl(PR_SET_DUMPABLE, 0) != 0 && strict)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user