git: f4a5ae5fd8ee - main - security/openssh-portable: Fix sftp crash

From: Bryan Drewery <bdrewery_at_FreeBSD.org>
Date: Fri, 15 Oct 2021 17:10:23 UTC
The branch main has been updated by bdrewery:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f4a5ae5fd8ee4948c8b7d1c9bfd0e07d33a8aa18

commit f4a5ae5fd8ee4948c8b7d1c9bfd0e07d33a8aa18
Author:     Bryan Drewery <bdrewery@FreeBSD.org>
AuthorDate: 2021-10-15 16:44:40 +0000
Commit:     Bryan Drewery <bdrewery@FreeBSD.org>
CommitDate: 2021-10-15 17:10:21 +0000

    security/openssh-portable: Fix sftp crash
    
    This fixes an error trying to disabling process tracing.
    
    It has been sent upstream.
    
    PR:             259174
    Submitted by:   mike at sentex dot net
---
 security/openssh-portable/Makefile                 |  2 +-
 .../files/patch-platform-tracing.c                 | 25 ++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/security/openssh-portable/Makefile b/security/openssh-portable/Makefile
index 309edc422ff3..b5c9e473c388 100644
--- a/security/openssh-portable/Makefile
+++ b/security/openssh-portable/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	openssh
 DISTVERSION=	8.8p1
-PORTREVISION=	0
+PORTREVISION=	1
 PORTEPOCH=	1
 CATEGORIES=	security
 MASTER_SITES=	OPENBSD/OpenSSH/portable
diff --git a/security/openssh-portable/files/patch-platform-tracing.c b/security/openssh-portable/files/patch-platform-tracing.c
new file mode 100644
index 000000000000..54f6db4421ad
--- /dev/null
+++ b/security/openssh-portable/files/patch-platform-tracing.c
@@ -0,0 +1,25 @@
+--- platform-tracing.c.orig	2021-09-26 07:03:19.000000000 -0700
++++ platform-tracing.c	2021-10-15 10:08:20.537813000 -0700
+@@ -16,6 +16,10 @@
+ 
+ #include "includes.h"
+ 
++#if defined(HAVE_PROCCTL)
++#include <string.h>
++#include <unistd.h>
++#endif
+ #include <sys/types.h>
+ #ifdef HAVE_SYS_PROCCTL_H
+ #include <sys/procctl.h>
+@@ -40,8 +44,9 @@ platform_disable_tracing(int strict)
+ 	/* 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");
++	if (procctl(P_PID, getpid(), PROC_TRACE_CTL, &disable_trace) && strict)
++		fatal("unable to make the process untraceable: %s for pid %d",
++		    strerror(errno), (int)getpid());
+ #endif
+ #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
+ 	/* Disable ptrace on Linux without sgid bit */