diff --git a/mail/bogofilter-kc/Makefile b/mail/bogofilter-kc/Makefile index 9aa253204a77..615ad8325c13 100644 --- a/mail/bogofilter-kc/Makefile +++ b/mail/bogofilter-kc/Makefile @@ -1,21 +1,21 @@ PORTNAME= bogofilter -PORTREVISION= 1 +PORTREVISION= 2 PKGNAMESUFFIX= -kc COMMENT= Fast, teachable, learning spam detector (KyotoCabinet database) DEPRECATED= # override master port LIB_DEPENDS= libkyotocabinet.so:databases/kyotocabinet CONFIGURE_ARGS= --with-database=kyotocabinet CONFLICTS_INSTALL= bogofilter bogofilter-lmdb1 bogofilter-sqlite MASTERDIR= ${.CURDIR}/../bogofilter DESCR= ${PKGDIR}/pkg-descr BF_CPPFLAGS= -I${LOCALBASE}/include BF_LIBS= .include "${MASTERDIR}/Makefile" diff --git a/mail/bogofilter-lmdb1/Makefile b/mail/bogofilter-lmdb1/Makefile index 0379514f854a..5bfd7787213c 100644 --- a/mail/bogofilter-lmdb1/Makefile +++ b/mail/bogofilter-lmdb1/Makefile @@ -1,23 +1,23 @@ PORTNAME= bogofilter -PORTREVISION= 0 +PORTREVISION= 1 PKGNAMESUFFIX= -lmdb1 COMMENT= Fast, teachable, learning spam detector (LMDB 1.0 database) DEPRECATED= This port will be renamed to bogofilter at some point, see UPDATING # at the same time, bogofilter shall update from lmdb0 to lmdb (1.0) EXPIRATION_DATE=2026-12-31 LIB_DEPENDS= liblmdb.so.1:databases/lmdb CONFIGURE_ARGS= --with-database=lmdb CONFLICTS_INSTALL= bogofilter bogofilter-kc bogofilter-sqlite MASTERDIR= ${.CURDIR}/../bogofilter DESCR= ${PKGDIR}/pkg-descr BF_CPPFLAGS= -I${LOCALBASE}/include BF_LIBS= .include "${MASTERDIR}/Makefile" diff --git a/mail/bogofilter-sqlite/Makefile b/mail/bogofilter-sqlite/Makefile index 8e95209c9b0b..0b660068a64d 100644 --- a/mail/bogofilter-sqlite/Makefile +++ b/mail/bogofilter-sqlite/Makefile @@ -1,20 +1,20 @@ PORTNAME= bogofilter -PORTREVISION= 1 +PORTREVISION= 2 PKGNAMESUFFIX= -sqlite COMMENT?= Fast, teachable, learning spam detector (SQLite3 database) DEPRECATED= # override master port USES= sqlite CONFIGURE_ARGS= --with-database=sqlite CONFLICTS_INSTALL= bogofilter bogofilter-kc bogofilter-lmdb1 MASTERDIR= ${.CURDIR}/../bogofilter DESCR= ${PKGDIR}/pkg-descr BF_CPPFLAGS= -I${LOCALBASE}/include BF_LIBS= .include "${MASTERDIR}/Makefile" diff --git a/mail/bogofilter/Makefile b/mail/bogofilter/Makefile index 12ba42744f5b..ccba0f443d8b 100644 --- a/mail/bogofilter/Makefile +++ b/mail/bogofilter/Makefile @@ -1,102 +1,102 @@ PORTNAME= bogofilter DISTVERSION= 1.3.0.rc1 -PORTREVISION?= 3 +PORTREVISION?= 4 CATEGORIES?= mail MASTER_SITES= SF/bogofilter/bogofilter-current/bogofilter-1.3.0.beta/ \ https://gitlab.com/-/project/12408342/uploads/647db3bd2f28a1f91bdd3bb1945d91fe/ MAINTAINER= mandree@FreeBSD.org COMMENT?= Fast, teachable, learning spam detector (LMDB 0.9 database) WWW= https://bogofilter.sourceforge.io/ LICENSE= GPLv2+ DEPRECATED?= This port will update to LMDB 1.0. Please transition to bogofilter-lmdb1 before December 2026, see UPDATING # no EXPIRATION_DATE, we don't intend to remove this. # The plan is: at the same time as bogofilter-lmdb1 expires, upgrade this port to LMDB 1.0. USES+= cpe perl5 shebangfix tar:xz CPE_VENDOR= bogofilter_project USE_PERL5= run SHEBANG_FILES= contrib/randomtrain.sh contrib/scramble.sh \ src/tests/unsort.pl contrib/*.pl GNU_CONFIGURE= yes TEST_TARGET= check CONFLICTS_INSTALL?= bogofilter-kc bogofilter-lmdb1 bogofilter-sqlite PORTDOCS= * OPTIONS_DEFINE= GSL UNICODE DOCS OPTIONS_DEFAULT= GSL UNICODE GSL_DESC= Link with system-wide GSL dynamically (recommended) UNICODE_DESC= Normalize tokens to Unicode (UTF-8) (recommended) GSL_LIB_DEPENDS= libgsl.so:math/gsl GSL_CONFIGURE_OFF= --with-included-gsl UNICODE_USES= iconv UNICODE_CONFIGURE_ENABLE= unicode .include BF_CPPFLAGS?= -I${LOCALBASE}/include BF_LIBS?= # empty, can be passed in by slave ports CONFIGURE_ARGS+= --sysconfdir=${PREFIX}/etc .if ${MASTERDIR} == ${.CURDIR} # we're building the master port CONFIGURE_ARGS+= --with-database=lmdb LIB_DEPENDS+= liblmdb.so.0:databases/lmdb0 .endif .if ${PORT_OPTIONS:MUNICODE} BF_LIBS+= ${ICONV_LIB} .endif CPPFLAGS+= ${BF_CPPFLAGS} LIBS+= -L${LOCALBASE}/lib ${BF_LIBS} CONFIGURE_ENV+= PERL="${PERL}" INSTALL_TARGET= install-strip prefix=${PREFIX} mandir=${PREFIX}/share/man post-patch: ${REINPLACE_CMD} -e 's/INTEGRITY_TESTS = t.lock1 t.lock3 t.valgrind/INTEGRITY_TESTS = t.lock1/' \ -e 's/ENVIRON_TESTS = t.abort/ENVIRON_TESTS =/' \ ${WRKSRC}/src/tests/Makefile.in post-build: cd ${WRKSRC}/src && ${SETENVI} SHELL=${SH} ${MAKE_CMD} ${TEST_TARGET} ${_MAKE_JOBS} SHELL=${SH} \ || { r=$$? ; head -n30000 ${WRKSRC}/src/tests/test-suite.log ; exit $$r ; } post-install: @${MKDIR} ${STAGEDIR}${DOCSDIR}/contrib .for i in html programmer xml @${MKDIR} ${STAGEDIR}${DOCSDIR}/${i} .endfor .for i in AUTHORS COPYING INSTALL NEWS README README.git \ doc/README.validation TODO GETTING.STARTED \ RELEASE.NOTES doc/README.db doc/README.sqlite \ doc/integrating-with-postfix doc/integrating-with-qmail \ doc/bogofilter-tuning.HOWTO.html doc/bogofilter-SA-* \ doc/bogofilter-faq.html doc/bogofilter-faq-fr.html ${INSTALL_DATA} ${WRKSRC}/${i} ${STAGEDIR}${DOCSDIR} .endfor .for i in README.randomtrain README.contrib ${INSTALL_DATA} ${WRKSRC}/contrib/${i} ${STAGEDIR}${DOCSDIR}/contrib/${i} .endfor ${INSTALL_DATA} ${WRKSRC}/doc/*.html ${STAGEDIR}${DOCSDIR}/html ${INSTALL_DATA} ${WRKSRC}/doc/*.xml ${STAGEDIR}${DOCSDIR}/xml ${INSTALL_DATA} ${WRKSRC}/doc/programmer/README.freebsd ${STAGEDIR}${DOCSDIR}/programmer ${INSTALL_PROGRAM} ${WRKSRC}/bogogrep ${STAGEDIR}${PREFIX}/bin/ .for i in bfproxy.pl bogofilter-milter.pl bogo.R bogofilter-qfe.sh \ mime.get.rfc822.pl parmtest.sh printmaildir.pl \ bogominitrain.pl \ randomtrain.sh scramble.sh spamitarium.pl stripsearch.pl trainbogo.sh ${INSTALL_SCRIPT} ${WRKSRC}/contrib/${i} ${STAGEDIR}${DOCSDIR}/contrib/${i} .endfor .for i in dot-qmail-bogofilter-default \ mailfilter.example vm-bogofilter.el ${INSTALL_DATA} ${WRKSRC}/contrib/${i} ${STAGEDIR}${DOCSDIR}/contrib/${i} .endfor .include diff --git a/mail/bogofilter/files/patch-src_datastore.c b/mail/bogofilter/files/patch-src_datastore.c new file mode 100644 index 000000000000..b958c332bef5 --- /dev/null +++ b/mail/bogofilter/files/patch-src_datastore.c @@ -0,0 +1,52 @@ +--- src/datastore.c.orig 2025-04-09 19:03:00 UTC ++++ src/datastore.c +@@ -93,17 +93,24 @@ static void convert_external_to_internal(dsh_t *dsh, d + + static void convert_external_to_internal(dsh_t *dsh, dbv_const_t *ex_data, dsv_t *in_data) + { +- size_t i = 0; +- const uint32_t *cv = (const uint32_t *)ex_data->data; ++ size_t i = 0u; ++ const uint32_t len = ex_data->leng; ++ uint32_t cv[3] = {0u, 0u, 0u}; ++ ++ // ensure we don't break on misaligned access ++ if (len < 4u) abort(); ++ memcpy(&cv, ex_data->data, min(ex_data->leng, sizeof(cv))); + +- in_data->spamcount = !dsh->is_swapped ? cv[i++] : swap_32bit(cv[i++]); ++ in_data->spamcount = !dsh->is_swapped ? cv[i] : swap_32bit(cv[i]); ++ ++i; + +- if (ex_data->leng <= i * sizeof(uint32_t)) ++ if (len < (i + 1) * sizeof(uint32_t)) + in_data->goodcount = 0; + else +- in_data->goodcount = !dsh->is_swapped ? cv[i++] : swap_32bit(cv[i++]); ++ in_data->goodcount = !dsh->is_swapped ? cv[i] : swap_32bit(cv[i]); ++ ++i; + +- if (ex_data->leng <= i * sizeof(uint32_t)) ++ if (len < (i + 1) * sizeof(uint32_t)) + in_data->date = 0; + else + in_data->date = !dsh->is_swapped ? cv[i] : swap_32bit(cv[i]); +@@ -113,8 +120,8 @@ static void convert_internal_to_external(dsh_t *dsh, d + + static void convert_internal_to_external(dsh_t *dsh, dsv_t *in_data, dbv_t *ex_data) + { +- size_t i = 0; +- uint32_t *cv = (uint32_t *)ex_data->data; ++ size_t i = 0u; ++ uint32_t cv[3] = {0u, 0u, 0u}; + + /* Writing requires extra magic since the counts may need to be + ** separated for output to different wordlists. +@@ -127,6 +133,7 @@ static void convert_internal_to_external(dsh_t *dsh, d + cv[i++] = !dsh->is_swapped ? in_data->date : swap_32bit(in_data->date); + + ex_data->leng = i * sizeof(cv[0]); ++ memcpy(ex_data->data, &cv, i * sizeof(cv[0])); + + return; + }