git: 7344c09f84ab - main - net-mgmt/net-snmp: fix net-snmp-config on jail hosts

From: Dan Langille <dvl_at_FreeBSD.org>
Date: Fri, 24 Feb 2023 15:35:57 UTC
The branch main has been updated by dvl:

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

commit 7344c09f84ab44ed4cefe39f671b2b0b26449fe0
Author:     Dan Langille <dvl@FreeBSD.org>
AuthorDate: 2023-02-24 15:32:28 +0000
Commit:     Dan Langille <dvl@FreeBSD.org>
CommitDate: 2023-02-24 15:35:47 +0000

    net-mgmt/net-snmp: fix net-snmp-config on jail hosts
    
    re https://github.com/net-snmp/net-snmp/issues/280
    
    This patch allows 'net-snmp-config --create-snmpv3-user' to succeed
    if run on a jail host and snmpd is also running in one of the jails.
    
    Thhis patch limits the check to the host, ingnoring jails.
    
    PR:             269791
---
 net-mgmt/net-snmp/Makefile                               |  2 +-
 net-mgmt/net-snmp/files/patch-net-snmp-create-v3-user.in | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/net-mgmt/net-snmp/Makefile b/net-mgmt/net-snmp/Makefile
index 408c5a9a2baf..7c8700af94ee 100644
--- a/net-mgmt/net-snmp/Makefile
+++ b/net-mgmt/net-snmp/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	snmp
 PORTVERSION=	5.9.1
-PORTREVISION=	2
+PORTREVISION=	3
 PORTEPOCH=	1
 CATEGORIES=	net-mgmt
 MASTER_SITES=	SF/net-${PORTNAME}/net-${PORTNAME}/${PORTVERSION} \
diff --git a/net-mgmt/net-snmp/files/patch-net-snmp-create-v3-user.in b/net-mgmt/net-snmp/files/patch-net-snmp-create-v3-user.in
index 10afdc703070..7dbc8315504d 100644
--- a/net-mgmt/net-snmp/files/patch-net-snmp-create-v3-user.in
+++ b/net-mgmt/net-snmp/files/patch-net-snmp-create-v3-user.in
@@ -1,5 +1,14 @@
---- net-snmp-create-v3-user.in.orig	2022-12-03 13:29:45 UTC
+--- net-snmp-create-v3-user.in.orig	2021-05-25 22:19:35 UTC
 +++ net-snmp-create-v3-user.in
+@@ -3,7 +3,7 @@
+ # this shell script is designed to add new SNMPv3 users
+ # to Net-SNMP config file.
+ 
+-if @PSCMD@ | egrep ' snmpd *$' > /dev/null 2>&1 ; then
++if @PSCMD@ -J 0 | egrep ' snmpd *$' > /dev/null 2>&1 ; then
+     echo "Apparently at least one snmpd demon is already running."
+     echo "You must stop them in order to use this command."
+     exit 1
 @@ -135,6 +135,7 @@ if test ! -d "$outfile"; then
  fi
  echo "$line" >> "$outfile"