git: 93250c4daa16 - main - security/snoopy: Update to 2.5.1

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Sat, 27 May 2023 04:25:57 UTC
The branch main has been updated by sunpoet:

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

commit 93250c4daa162d0c3a39f9ed26fa7be399662159
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-05-27 04:07:50 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-05-27 04:07:50 +0000

    security/snoopy: Update to 2.5.1
    
    Changes:        https://github.com/a2o/snoopy/releases
---
 security/snoopy/Makefile                           |  2 +-
 security/snoopy/distinfo                           |  6 ++--
 .../snoopy/files/patch-build-Makefile.am.common    |  9 ++++--
 security/snoopy/files/patch-configure.ac           | 24 ++++++++++-----
 .../snoopy/files/patch-src-datasource-domain.c     | 16 ++++++++--
 security/snoopy/files/patch-src-datasource-tid.c   | 11 -------
 security/snoopy/files/patch-src-snoopy.h           | 13 ++++-----
 security/snoopy/files/patch-src-util-pwd.c         | 34 ++++++++++++++++++++++
 .../patch-tests-bin-action-stress-threadsexec.c    | 11 +++++++
 .../patch-tests-bin-snoopy-test-exec-in-threads.c  | 11 -------
 security/snoopy/pkg-plist                          |  3 +-
 11 files changed, 91 insertions(+), 49 deletions(-)

diff --git a/security/snoopy/Makefile b/security/snoopy/Makefile
index 8065e22b4c3c..4a446ff74996 100644
--- a/security/snoopy/Makefile
+++ b/security/snoopy/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	snoopy
-PORTVERSION=	2.4.15
+PORTVERSION=	2.5.1
 CATEGORIES=	security
 MASTER_SITES=	https://github.com/a2o/snoopy/releases/download/snoopy-${PORTVERSION}/
 
diff --git a/security/snoopy/distinfo b/security/snoopy/distinfo
index 76681117b826..8d35d7fc851c 100644
--- a/security/snoopy/distinfo
+++ b/security/snoopy/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1643971000
-SHA256 (snoopy-2.4.15.tar.gz) = 4502136308fa0ce36d7e7458f00a53d7415d6bbd13206129ec2969c20bd4b572
-SIZE (snoopy-2.4.15.tar.gz) = 617952
+TIMESTAMP = 1684104332
+SHA256 (snoopy-2.5.1.tar.gz) = 09daa74213c360acaf84318710f2902763a9c08be54753dabcc09478dcb9c43e
+SIZE (snoopy-2.5.1.tar.gz) = 685195
diff --git a/security/snoopy/files/patch-build-Makefile.am.common b/security/snoopy/files/patch-build-Makefile.am.common
index 8f6b8156fa43..78fd87472f8d 100644
--- a/security/snoopy/files/patch-build-Makefile.am.common
+++ b/security/snoopy/files/patch-build-Makefile.am.common
@@ -1,8 +1,11 @@
---- build/Makefile.am.common.orig	2020-12-28 04:42:28 UTC
+--- build/Makefile.am.common.orig	2022-08-24 00:12:41 UTC
 +++ build/Makefile.am.common
-@@ -10,4 +10,4 @@ MAINTAINERCLEANFILES = Makefile.in
+@@ -10,7 +10,7 @@ MAINTAINERCLEANFILES = Makefile.in
  # -I$(top_srcdir)/src is here for #include "snoopy.h" (or similar) to work everywhere
  # -I$(top_srcdir)     is here for #include "lib/*/src/*.h" to work everywhere (additionally, this also makes references "src/*/*.h" work too)
  #
--AM_CFLAGS = -Wall -Werror -Wextra -Wno-unused-parameter -std=c99 -Wpedantic -I$(top_srcdir)/src -I$(top_srcdir)
+-AM_CFLAGS = -Wall -Werror -Wextra -Wno-unused-parameter -std=c99 -Wpedantic -fvisibility=hidden -I$(top_srcdir)/src -I$(top_srcdir)
 +AM_CFLAGS = -Wextra -Wno-unused-parameter -std=c99 -Wpedantic -I$(top_srcdir)/src -I$(top_srcdir)
+ 
+ 
+ 
diff --git a/security/snoopy/files/patch-configure.ac b/security/snoopy/files/patch-configure.ac
index 082eba06c24c..ea08512b4add 100644
--- a/security/snoopy/files/patch-configure.ac
+++ b/security/snoopy/files/patch-configure.ac
@@ -1,15 +1,15 @@
---- configure.ac.orig	2021-01-18 13:01:11 UTC
+--- configure.ac.orig	2022-09-20 22:03:33 UTC
 +++ configure.ac
-@@ -30,7 +30,7 @@ AC_CONFIG_SRCDIR([src/eventsource/execve_wrapper.c])  
+@@ -27,7 +27,7 @@ AC_CONFIG_SRCDIR([src/entrypoint/execve-wrapper.c])   
  AC_CONFIG_AUX_DIR([build/aux])
- AC_CONFIG_MACRO_DIR([build/m4])
+ AC_CONFIG_MACRO_DIRS([build/m4])
  m4_include([build/snoopy.m4])
 -AM_INIT_AUTOMAKE([1.11 gnu silent-rules subdir-objects -Wall -Werror])
 +AM_INIT_AUTOMAKE([1.11 gnu silent-rules subdir-objects])
  
  
  ### Silent make output
-@@ -81,7 +81,6 @@ AC_PROG_SED
+@@ -82,7 +82,6 @@ LT_PATH_NM
  ### Check for programs required for TEST suite
  #
  SNOOPY_PROG_REQUIRE([dirname],  [DIRNAME],  [Needed for "make check" test suite.])
@@ -17,19 +17,19 @@
  SNOOPY_PROG_REQUIRE([readlink], [READLINK], [Needed for "make check" test suite.])
  SNOOPY_PROG_SUGGEST([socat],    [SOCAT],    [Needed for "make check" test suite.])
  SNOOPY_PROG_SUGGEST([ps],       [PS],       [Needed for "make check" test suite.])
-@@ -89,19 +88,12 @@ SNOOPY_PROG_REQUIRE([wc],       [WC],       [Needed fo
+@@ -90,11 +89,6 @@ SNOOPY_PROG_REQUIRE([wc],       [WC],       [Needed fo
  
  
  
 -dnl Checks for libraries.
--dnl FIXME: Replace `main' with a function in `-ldl':
 -AC_CHECK_LIB([dl], [dlsym], [], [
 -    AC_MSG_ERROR([A library is missing. Unable to continue.])
 -])
 -
  dnl Checks for header files.
  AC_CHECK_HEADERS([ \
-     ctype.h \
+     arpa/inet.h \
+@@ -102,7 +96,6 @@ AC_CHECK_HEADERS([ \
      dlfcn.h \
      errno.h \
      fcntl.h \
@@ -37,7 +37,15 @@
      grp.h \
      limits.h \
      pwd.h \
-@@ -784,7 +776,6 @@ AS_IF([test "x$code_coverage_enabled" = "xyes"], [
+@@ -119,7 +112,6 @@ AC_CHECK_HEADERS([ \
+     sys/un.h \
+     time.h \
+     unistd.h \
+-    utmp.h \
+ ], [], [
+     AC_MSG_ERROR([A header file is missing. Unable to continue.])
+ ])
+@@ -818,7 +810,6 @@ AS_IF([test "x$code_coverage_enabled" = "xyes"], [
      CXXFLAGS=`echo $CXXFLAGS | sed 's/-O[1-9s]/-O0/g'`
      CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
      CXXFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
diff --git a/security/snoopy/files/patch-src-datasource-domain.c b/security/snoopy/files/patch-src-datasource-domain.c
index aa0a3226e961..4cb56051c32f 100644
--- a/security/snoopy/files/patch-src-datasource-domain.c
+++ b/security/snoopy/files/patch-src-datasource-domain.c
@@ -1,6 +1,16 @@
---- src/datasource/domain.c.orig	2020-12-17 13:03:54 UTC
+--- src/datasource/domain.c.orig	2022-08-27 02:05:09 UTC
 +++ src/datasource/domain.c
-@@ -44,7 +44,7 @@
+@@ -36,7 +36,9 @@
+ #include   <errno.h>
+ #include   <limits.h>
+ #include   <stdio.h>
++#define __BSD_VISIBLE 1
+ #include   <string.h>
++#undef __BSD_VISIBLE
+ #include   <unistd.h>
+ 
+ 
+@@ -44,7 +46,7 @@
  /*
   * Local defines
   */
@@ -9,7 +19,7 @@
  #define   HOSTS_PATH            "/etc/hosts"
  #define   HOSTS_LINE_SIZE_MAX   1024
  #define   HOSTS_LINE_POS_MAX    1023
-@@ -76,12 +76,12 @@ int snoopy_datasource_domain (char * const result, cha
+@@ -76,12 +78,12 @@ int snoopy_datasource_domain (char * const result, __a
       * START: COPY FROM datasource/hostname
       */
      /* Get my hostname first */
diff --git a/security/snoopy/files/patch-src-datasource-tid.c b/security/snoopy/files/patch-src-datasource-tid.c
deleted file mode 100644
index 240a9dc72e93..000000000000
--- a/security/snoopy/files/patch-src-datasource-tid.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/datasource/tid.c.orig	2021-04-20 15:35:54 UTC
-+++ src/datasource/tid.c
-@@ -49,7 +49,7 @@
-  */
- int snoopy_datasource_tid (char * const result, char const * const arg)
- {
--    long unsigned int tid = pthread_self();
-+    long unsigned int tid = (long unsigned int) pthread_self();
- 
-     // This happens if -lpthread is not given to compiler
-     if (0 == tid) {
diff --git a/security/snoopy/files/patch-src-snoopy.h b/security/snoopy/files/patch-src-snoopy.h
index e358ebb2a715..9dd2a425914d 100644
--- a/security/snoopy/files/patch-src-snoopy.h
+++ b/security/snoopy/files/patch-src-snoopy.h
@@ -1,11 +1,10 @@
---- src/snoopy.h.orig	2021-02-09 23:00:14 UTC
+--- src/snoopy.h.orig	2022-08-27 02:05:09 UTC
 +++ src/snoopy.h
-@@ -31,8 +31,6 @@
- /* This must be the first file to be included, or implicit inclusion
-  * (by i.e. <features.h>) does the wrong thing
+@@ -28,7 +28,6 @@
+  * - prevents GCC from complaining about not using strerror_r return value
+  * - enables strdup() presence
   */
 -#define  _XOPEN_SOURCE   700
--#include <features.h>   /* Needed for GLIBC macros here */
- #include <syslog.h>     /* Needed for syslog defaults */
- #include <unistd.h>
+ 
+ 
  
diff --git a/security/snoopy/files/patch-src-util-pwd.c b/security/snoopy/files/patch-src-util-pwd.c
new file mode 100644
index 000000000000..c67877f043a5
--- /dev/null
+++ b/security/snoopy/files/patch-src-util-pwd.c
@@ -0,0 +1,34 @@
+--- src/util/pwd.c.orig	2022-08-27 02:05:10 UTC
++++ src/util/pwd.c
+@@ -31,6 +31,7 @@
+ #include <pwd.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <sys/param.h>
+ #include <unistd.h>
+ 
+ 
+@@ -67,7 +68,7 @@ char * snoopy_util_pwd_convertUidToUsername (uid_t uid
+         return NULL;
+     }
+ 
+-    username = malloc(LOGIN_NAME_MAX+1);
++    username = malloc(MAXLOGNAME+1);
+     if (NULL == username) {
+         free(buffpwd_uid);
+         return NULL;
+@@ -85,11 +86,11 @@ char * snoopy_util_pwd_convertUidToUsername (uid_t uid
+ 
+     // Format the return
+     if (NULL == pwd_uid) {
+-        snprintf(username, LOGIN_NAME_MAX, "user-%d", (int)uid);
++        snprintf(username, MAXLOGNAME, "user-%d", (int)uid);
+     } else {
+-        snprintf(username, LOGIN_NAME_MAX, "%s", pwd_uid->pw_name);
++        snprintf(username, MAXLOGNAME, "%s", pwd_uid->pw_name);
+     }
+-    username[LOGIN_NAME_MAX] = '\0'; // Just in case
++    username[MAXLOGNAME] = '\0'; // Just in case
+ 
+ 
+     // Return
diff --git a/security/snoopy/files/patch-tests-bin-action-stress-threadsexec.c b/security/snoopy/files/patch-tests-bin-action-stress-threadsexec.c
new file mode 100644
index 000000000000..bccb31f5ba3e
--- /dev/null
+++ b/security/snoopy/files/patch-tests-bin-action-stress-threadsexec.c
@@ -0,0 +1,11 @@
+--- tests/bin/action-stress-threadsexec.c.orig	2022-09-28 19:48:05 UTC
++++ tests/bin/action-stress-threadsexec.c
+@@ -178,7 +178,7 @@ int snoopyTestCli_action_stress_threadsexec (int argc,
+             } else {
+                 int res;
+ 
+-                res = pthread_tryjoin_np(snoopyTestCli_action_stress_threadsexec_tRepo[i], NULL);
++                res = pthread_peekjoin_np(snoopyTestCli_action_stress_threadsexec_tRepo[i], NULL);
+                 if (res == EBUSY) {
+                     if (verbose) printf("  M: Thread #%d has not finished executing yet.\n", i+1);
+                     if (verbose) fflush(stdout);
diff --git a/security/snoopy/files/patch-tests-bin-snoopy-test-exec-in-threads.c b/security/snoopy/files/patch-tests-bin-snoopy-test-exec-in-threads.c
deleted file mode 100644
index 2474375760e4..000000000000
--- a/security/snoopy/files/patch-tests-bin-snoopy-test-exec-in-threads.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- tests/bin/snoopy-test-exec-in-threads.c.orig	2020-12-07 03:14:46 UTC
-+++ tests/bin/snoopy-test-exec-in-threads.c
-@@ -31,7 +31,7 @@
- #include <string.h>
- #include <sys/types.h>
- #include <unistd.h>
--#include <wait.h>
-+#include <sys/wait.h>
- 
- 
- 
diff --git a/security/snoopy/pkg-plist b/security/snoopy/pkg-plist
index 2f7dd9f39e15..d3965631223d 100644
--- a/security/snoopy/pkg-plist
+++ b/security/snoopy/pkg-plist
@@ -2,8 +2,7 @@ etc/snoopy.ini
 lib/libsnoopy.so
 lib/libsnoopy.so.0
 lib/libsnoopy.so.0.0.0
-sbin/snoopy-disable
-sbin/snoopy-enable
+sbin/snoopyctl
 %%PORTDOCS%%%%DOCSDIR%%/CONTRIBUTING.md
 %%PORTDOCS%%%%DOCSDIR%%/ChangeLog
 %%PORTDOCS%%%%DOCSDIR%%/FAQ.md