1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-18 19:49:40 +00:00

security/snoopy: Convert REINPLACE_CMD to patch files

This commit is contained in:
Po-Chuan Hsieh 2021-06-15 01:38:34 +08:00
parent 9d9f506d06
commit dfac76115b
No known key found for this signature in database
GPG Key ID: 9A4BD10F002DD04B
10 changed files with 124 additions and 16 deletions

View File

@ -27,19 +27,7 @@ SHEBANG_GLOB= *.sh
OPTIONS_DEFINE= DOCS
post-patch:
@${REINPLACE_CMD} -e 's| -Wall -Werror||' ${WRKSRC}/configure.ac ${WRKSRC}/build/Makefile.am.common
@${REINPLACE_CMD} -e '/gcov/d' ${WRKSRC}/configure.ac
@${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|g' ${WRKSRC}/README.md
@${REINPLACE_CMD} -e '/#define.*_XOPEN_SOURCE/d' \
${WRKSRC}/src/configfile.c \
${WRKSRC}/src/datasource/sid.c \
${WRKSRC}/src/datasource/snoopy_version.c \
${WRKSRC}/src/snoopy.h \
${WRKSRC}/tests/bin/snoopy-test-threads.c \
${WRKSRC}/src/tsrm.c
@${REINPLACE_CMD} -e '/features.h/d' ${WRKSRC}/configure.ac ${WRKSRC}/src/output/socketoutput.c ${WRKSRC}/src/snoopy.h
@${REINPLACE_CMD} -e 's|HOST_NAME_MAX|_POSIX_&|' ${WRKSRC}/src/datasource/domain.c
@${REINPLACE_CMD} -e 's|#include <wait.h>|#include <sys/wait.h>|' ${WRKSRC}/tests/bin/snoopy-test-exec-in-threads.c ${WRKSRC}/tests/bin/snoopy-test-threads.c
do-install-DOCS-on:
${MKDIR} ${STAGEDIR}${DOCSDIR}/

View File

@ -0,0 +1,8 @@
--- build/Makefile.am.common.orig 2020-12-28 04:42:28 UTC
+++ build/Makefile.am.common
@@ -10,4 +10,4 @@ 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 = -Wextra -Wno-unused-parameter -std=c99 -Wpedantic -I$(top_srcdir)/src -I$(top_srcdir)

View File

@ -1,6 +1,6 @@
--- build/snoopy.m4.orig 2016-09-14 15:02:26 UTC
--- build/snoopy.m4.orig 2020-12-07 03:14:46 UTC
+++ build/snoopy.m4
@@ -183,7 +183,8 @@ AU_DEFUN([SNOOPY_CONFIGURE_ENTITY_MSG],
@@ -191,7 +191,8 @@ AU_DEFUN([SNOOPY_CONFIGURE_ENTITY_MSG],
[
dotLine="..................................................";
whatString="Snoopy $1 enabled: $3 ";

View File

@ -1,6 +1,23 @@
--- configure.ac.orig 2016-09-14 15:02:26 UTC
--- configure.ac.orig 2021-01-18 13:01:11 UTC
+++ configure.ac
@@ -125,12 +125,6 @@ SNOOPY_PROG_CHECK([wc], [WC],
@@ -30,7 +30,7 @@ AC_CONFIG_SRCDIR([src/eventsource/execve_wrapper.c])
AC_CONFIG_AUX_DIR([build/aux])
AC_CONFIG_MACRO_DIR([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
### Check for programs required for TEST suite
#
SNOOPY_PROG_REQUIRE([dirname], [DIRNAME], [Needed for "make check" test suite.])
-SNOOPY_PROG_REQUIRE([gcov], [GCOV], [Needed for "make coverage" build target.])
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
@ -13,3 +30,18 @@
dnl Checks for header files.
AC_CHECK_HEADERS([ \
ctype.h \
dlfcn.h \
errno.h \
fcntl.h \
- features.h \
grp.h \
limits.h \
pwd.h \
@@ -784,7 +776,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"
- LDFLAGS="$LDFLAGS -lgcov --coverage"
changequote([,])
])

View File

@ -0,0 +1,12 @@
--- src/configfile.c.orig 2020-12-07 03:14:46 UTC
+++ src/configfile.c
@@ -35,9 +35,6 @@
#include "lib/inih/src/ini.h"
-#ifndef _XOPEN_SOURCE // For strdup
-#define _XOPEN_SOURCE 500
-#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -0,0 +1,26 @@
--- src/datasource/domain.c.orig 2020-12-17 13:03:54 UTC
+++ src/datasource/domain.c
@@ -44,7 +44,7 @@
/*
* Local defines
*/
-#define HOST_NAME_BUF_SIZE HOST_NAME_MAX + 2 // +1 for terminal \0 and +1 because we'll be adding a trailing dot
+#define HOST_NAME_BUF_SIZE _POSIX_HOST_NAME_MAX + 2 // +1 for terminal \0 and +1 because we'll be adding a trailing dot
#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
* START: COPY FROM datasource/hostname
*/
/* Get my hostname first */
- retVal = gethostname(hostname, HOST_NAME_MAX);
+ retVal = gethostname(hostname, _POSIX_HOST_NAME_MAX);
if (0 != retVal) {
return snprintf(result, SNOOPY_DATASOURCE_MESSAGE_MAX_SIZE, "(error @ gethostname(): %d)", errno);
}
- // If hostname was something alien (longer than HOST_NAME_MAX), then the
+ // If hostname was something alien (longer than _POSIX_HOST_NAME_MAX), then the
// last character may not be NULL (the behavior is unspecified).
// Let's avoid any surprises and null-terminate at the end of this buffer.
hostname[HOST_NAME_BUF_SIZE-1] = '\0';

View File

@ -0,0 +1,10 @@
--- src/datasource/sid.c.orig 2020-12-06 01:59:36 UTC
+++ src/datasource/sid.c
@@ -30,7 +30,6 @@
#include "snoopy.h"
#ifndef _XOPEN_SOURCE /* Needed to get getpgid and getsid on older glibc */
-#define _XOPEN_SOURCE 500
#endif
#include <stdio.h>
#include <sys/types.h>

View File

@ -0,0 +1,10 @@
--- src/output/socketoutput.c.orig 2020-12-07 03:14:46 UTC
+++ src/output/socketoutput.c
@@ -30,7 +30,6 @@
#include "snoopy.h"
#include "configuration.h"
-#include <features.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -0,0 +1,11 @@
--- src/snoopy.h.orig 2021-02-09 23:00:14 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
*/
-#define _XOPEN_SOURCE 700
-#include <features.h> /* Needed for GLIBC macros here */
#include <syslog.h> /* Needed for syslog defaults */
#include <unistd.h>

View File

@ -0,0 +1,11 @@
--- 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>