git: e15fe24d5de0 - main - security/maia: update to 1.0.4_9 (48df5fb)

From: Fernando Apesteguía <fernape_at_FreeBSD.org>
Date: Wed, 27 Apr 2022 06:49:57 UTC
The branch main has been updated by fernape:

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

commit e15fe24d5de09ddaeb63d1f437d7ba776b0c049d
Author:     Fernando Apesteguía <fernape@FreeBSD.org>
AuthorDate: 2022-04-26 05:44:19 +0000
Commit:     Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2022-04-27 06:47:42 +0000

    security/maia: update to 1.0.4_9 (48df5fb)
    
     * Fix code obtaining content-encoding from content-type header.
     * Fix encoding error for two languages. (MySQL)
    
    While here, do some clean up.
    
    PR:     262606
    Reported by:    ek@purplehat.org (maintainer)
    MFH:    2022Q2 (bugfix release)
---
 security/maia/Makefile                             | 66 ++++++++++------------
 security/maia/distinfo                             |  6 +-
 security/maia/files/patch-maia.conf.dist           | 11 ++++
 security/maia/files/patch-maiad.conf.dist          | 49 ++++++++++++++++
 security/maia/files/patch-scripts_configtest.pl    |  8 +++
 security/maia/files/patch-scripts_detectvba.pl     |  8 +++
 .../files/patch-scripts_expire-quarantine-cache.pl |  8 +++
 security/maia/files/patch-scripts_load-sa-rules.pl |  8 +++
 security/maia/files/patch-scripts_maiadbtool.pl    |  8 +++
 .../maia/files/patch-scripts_process-quarantine.pl |  8 +++
 security/maia/files/patch-scripts_resend.pl        |  8 +++
 .../files/patch-scripts_send-quarantine-digests.pl |  8 +++
 .../patch-scripts_send-quarantine-reminders.pl     |  8 +++
 .../maia/files/patch-scripts_stats-snapshot.pl     |  8 +++
 14 files changed, 174 insertions(+), 38 deletions(-)

diff --git a/security/maia/Makefile b/security/maia/Makefile
index 1af0ad53cb72..a54ca315dfe6 100644
--- a/security/maia/Makefile
+++ b/security/maia/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	maia
 DISTVERSION=	1.0.4
-PORTREVISION=	8
+PORTREVISION=	9
 CATEGORIES=	security
 
 MAINTAINER=	ek@purplehat.org
@@ -30,7 +30,7 @@ USES=		perl5 shebangfix
 USE_GITHUB=	yes
 GH_ACCOUNT=	technion
 GH_PROJECT=	maia_mailguard
-GH_TAGNAME=	7f20bd4
+GH_TAGNAME=	48df5fb
 USE_PERL5=	run
 NO_BUILD=	yes
 DOCS=	LICENSE.txt README.md maiad.conf.dist maia-mysql.sql maia-pgsql.sql maia.conf.dist
@@ -41,23 +41,21 @@ MAIAQUARANTINE?=	/var/maiad/virusmails
 PEAR_DIR?=	${LOCALBASE}/share/pear
 PLIST_SUB+=	USERS="${USERS}" GROUPS="${GROUPS}" WWWOWN="${WWWOWN}" WWWGRP="${WWWGRP}"
 
-OPTIONS_DEFINE=	APACHE LIGHTTPD NGINX WEBHOST MYSQL MYSQLSERVER PGSQL PGSQLSERVER \
+OPTIONS_DEFINE=	APACHE LIGHTTPD NGINX WEBHOST MYSQL LOCAL PGSQL \
 		DOVECOT2 POSTFIX PFA CLAMAV SPAMASSASSIN BDB CRYPT \
 		IPCOUNTRY DOMAINKEYS SPF DKIM FILE RAR UNRAR ARJ UNARJ LHA ARC NOMARCH CAB \
 		RPM ZOO UNZOO LZOP TNEF DOCS
 
-OPTIONS_DEFAULT=	MYSQL CLAMAV SPAMASSASSIN BDB IPCOUNTRY \
-			DOMAINKEYS SPF DKIM FILE UNRAR ARJ LHA ARC CAB RPM \
-			ZOO
+OPTIONS_DEFAULT=	MYSQL CLAMAV DOCS SPAMASSASSIN BDB IPCOUNTRY \
+			DOMAINKEYS SPF DKIM FILE UNRAR ARJ LHA ARC CAB RPM ZOO
 
 APACHE_DESC=		Use Apache web server
 LIGHTTPD_DESC=		Use LighTTPD web server
 NGINX_DESC=			Use Nginx web server
 WEBHOST_DESC=		PHP, PEAR, etc... for Maia web interface
-MYSQL_DESC=		Use MySQL datebase
-MYSQLSERVER_DESC=	Install MySQL Server
-PGSQL_DESC=		Use PgSQL database
-PGSQLSERVER_DESC=	Install PGSQL Server
+MYSQL_DESC=		Use MySQL
+LOCAL_DESC=		All services/databases hosted locally
+PGSQL_DESC=		Use PgSQL
 DOVECOT2_DESC=		Use Dovecot 2.x IMAP/POP3
 POSTFIX_DESC=		Use Postfix MTA
 PFA_DESC=		Use Postfixadmin
@@ -104,7 +102,7 @@ USES+=		apache:run,2.4+
 .endif
 
 .if ${PORT_OPTIONS:MWEBHOST}
-USES+=		php
+USES+=	php
 USE_PHP=	bcmath ctype dom gettext hash iconv imap json mbstring \
 		mcrypt pdo pdo_sqlite posix session simplexml sockets \
 		sqlite3 tokenizer xml xmlreader xmlwriter xmlrpc
@@ -134,8 +132,13 @@ PLIST_SUB+=	WEBHOST=""
 PLIST_SUB+=	WEBHOST="@comment "
 .endif
 
-.if ${PORT_OPTIONS:MMYSQL}
-USES+=		mysql:client
+.if ${PORT_OPTIONS:MMYSQL} && ${PORT_OPTIONS:MLOCAL}
+USES+=		mysql:server,client
+RUN_DEPENDS+=	p5-DBD-mysql>=0:databases/p5-DBD-mysql
+.endif
+
+.if ${PORT_OPTIONS:MMYSQL} && ! ${PORT_OPTIONS:MLOCAL}
+USES+=	mysql:client
 RUN_DEPENDS+=	p5-DBD-mysql>=0:databases/p5-DBD-mysql
 .endif
 
@@ -143,9 +146,17 @@ RUN_DEPENDS+=	p5-DBD-mysql>=0:databases/p5-DBD-mysql
 USE_PHP+=	mysqli
 .endif
 
-.if ${PORT_OPTIONS:MPGSQL}
+.if ${PORT_OPTIONS:MPGSQL} && ${PORT_OPTIONS:MLOCAL}
 USES+=		pgsql
+WANT_PGSQL=	server
+RUN_DEPENDS+=	p5-DBD-Pg>=0:databases/p5-DBD-Pg
+.endif
+
+.if ${PORT_OPTIONS:MPGSQL} && ! ${PORT_OPTIONS:MLOCAL}
+USES+=		pgsql
+RUN_DEPENDS+=	p5-DBD-Pg>=0:databases/p5-DBD-Pg
 .endif
+
 .if ${PORT_OPTIONS:MPGSQL} && ${PORT_OPTIONS:MWEBHOST}
 USE_PHP+=	pgsql
 .endif
@@ -157,19 +168,6 @@ RUN_DEPENDS+=	lighttpd:www/lighttpd
 .if ${PORT_OPTIONS:MNGINX}
 RUN_DEPENDS+=	nginx:www/nginx
 .endif
- 
-.if ${PORT_OPTIONS:MMYSQLSERVER}
-USES+=		mysql:server
-.endif
-
-.if ${PORT_OPTIONS:MPGSQL}
-RUN_DEPENDS+=	p5-DBD-Pg>=0:databases/p5-DBD-Pg
-.endif
-
-.if ${PORT_OPTIONS:MPGSQLSERVER}
-USES:=		${USES:Npgsql} pgsql
-WANT_PGSQL=	server
-.endif
 
 .if ${PORT_OPTIONS:MDOVECOT2}
 RUN_DEPENDS+=	dovecot:mail/dovecot
@@ -180,7 +178,8 @@ RUN_DEPENDS+=	postfix:mail/postfix
 .endif
 
 .if ${PORT_OPTIONS:MPFA}
-RUN_DEPENDS+=	${LOCALBASE}/www/postfixadmin/config.inc.php:mail/postfixadmin
+USES+=	php
+RUN_DEPENDS+=	postfixadmin-${PHP_FLAVOR}>=0:mail/postfixadmin
 .endif
 
 .if ${PORT_OPTIONS:MCLAMAV}
@@ -286,8 +285,7 @@ post-patch:
 	scripts/load-sa-rules.pl scripts/maiadbtool.pl \
 	scripts/process-quarantine.pl scripts/resend.pl scripts/send-quarantine-digests.pl \
 	scripts/send-quarantine-reminders.pl scripts/stats-snapshot.pl
-		@${REINPLACE_CMD} -e "s|/etc/maia/maia.conf|${ETCDIR}/maia.conf|" \
-		-e "s|/usr/bin/perl.*|/usr/bin/env perl|" \
+	@${REINPLACE_CMD} -e "s|/etc/maia/maia.conf|${ETCDIR}/maia.conf|" \
 		${WRKSRC}/${m}
 .endfor
 
@@ -298,22 +296,20 @@ post-patch:
 	@${REINPLACE_CMD} -e "s|daemon_user  = 'maia'|daemon_user  = '${USERS}'|" \
 		-e "s|daemon_group = 'maia'|daemon_group = '${GROUPS}'|" \
 		-e "s|/var/lib/maia|${MAIAHOME}|" \
-		-e "s|'unrar'|'unrar v -c- -p- --'|" \
-		-e "s|DO_SYSLOG = 0|DO_SYSLOG = 1|" ${WRKSRC}/maiad.conf.dist
+		${WRKSRC}/maiad.conf.dist
 
 	@${REINPLACE_CMD} -e "s|/etc/maia.conf|${ETCDIR}/maia.conf|" \
 		-e "s|username = 'maia'|username = '${USERS}'|" \
 		-e "s|/var/lib/maia|${DATADIR}|" \
 		-e "s|/usr/bin/sa-learn|${PREFIX}/bin/sa-learn|" \
 		-e "s|local_cf_dir = undef|local_cf_dir = '${PREFIX}/etc/mail/spamassassin'|" \
-		-e "s|system_rules_dir = undef|system_rules_dir = '/var/db/spamassassin'|" \
 		-e "s|user_rules_dir = undef|user_rules_dir = '${MAIAHOME}/.spamassassin'|" \
 		-e "s|template_dir = '/etc/maia/templates/'|template_dir = '${ETCDIR}/templates/'|" \
-			${WRKSRC}/maia.conf.dist
+		${WRKSRC}/maia.conf.dist
 
 	@${REINPLACE_CMD} -e "s|/etc/maia/maiad.conf|${ETCDIR}/maiad.conf|" \
 		-e "s|/var/lib/maia|${DATADIR}|" \
-		-e "s@'zoo'\]@['zoo','unzoo'] ]@" ${WRKSRC}/maiad
+		${WRKSRC}/maiad
 
 	@${FIND} -E ${WRKSRC} -iregex '.*(bak|~)$$' -delete
 	@${FIND} -E ${WRKSRC} -iregex '.*(gitkeep|~)$$' -delete
diff --git a/security/maia/distinfo b/security/maia/distinfo
index 9d43abbaf4b5..bcb6b72cac72 100644
--- a/security/maia/distinfo
+++ b/security/maia/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1615478289
-SHA256 (technion-maia_mailguard-1.0.4-7f20bd4_GH0.tar.gz) = dc54b76ee72b4018768665f504315ccc831d4d64dff24421bfc3775a70548f16
-SIZE (technion-maia_mailguard-1.0.4-7f20bd4_GH0.tar.gz) = 2298104
+TIMESTAMP = 1647483858
+SHA256 (technion-maia_mailguard-1.0.4-48df5fb_GH0.tar.gz) = efe7291e96b38bfac29de9655706e6d58d907290b02172a3c73e7aa3b9aebf71
+SIZE (technion-maia_mailguard-1.0.4-48df5fb_GH0.tar.gz) = 2298060
diff --git a/security/maia/files/patch-maia.conf.dist b/security/maia/files/patch-maia.conf.dist
new file mode 100644
index 000000000000..072b380d4603
--- /dev/null
+++ b/security/maia/files/patch-maia.conf.dist
@@ -0,0 +1,11 @@
+--- maia.conf.dist.orig	2022-04-25 16:08:35 UTC
++++ maia.conf.dist
+@@ -52,7 +52,7 @@ $local_cf_dir = undef;  # default: let the script find
+ # %%VERSION%% macro to replace the actual SpamAssassin version number.
+ #$system_rules_dir = '/usr/share/spamassassin';
+ #$system_rules_dir = '/var/lib/spamassassin/%%VERSION%%';  # sa-update
+-$system_rules_dir = undef;  # default: let the script find it
++$system_rules_dir = '/var/db/spamassassin';  # default: let the script find it
+ 
+ # The directory where your amavis user's user_prefs file can be found.
+ #$user_rules_dir = '/var/lib/maia/.spamassassin';
diff --git a/security/maia/files/patch-maiad.conf.dist b/security/maia/files/patch-maiad.conf.dist
new file mode 100644
index 000000000000..da4250defad1
--- /dev/null
+++ b/security/maia/files/patch-maiad.conf.dist
@@ -0,0 +1,49 @@
+--- maiad.conf.dist.orig	2022-04-25 17:16:14 UTC
++++ maiad.conf.dist
+@@ -55,8 +55,8 @@ $daemon_chroot_dir = undef;
+ # Path overrides for chrooted environments
+ #   * Uncomment and adjust as necessary if using chroot
+ 
+-# $lock_file = "$daemon_chroot_dir/var/lock/maia/maiad.lock";
+-# $pid_file = "$daemon_chroot_dir/var/run/maia/maiad.pid";
++$lock_file = "/var/run/maia/maiad.lock";
++$pid_file = "/var/run/maia/maiad.pid";
+ 
+ 
+ ###########################################################################
+@@ -160,7 +160,7 @@ $log_level = 0;
+ #   * Set to 1 to send logs to syslog, 0 to disable
+ #   * If enabled, configure $SYSLOG_LEVEL as well
+ 
+-$DO_SYSLOG = 0;
++$DO_SYSLOG = 1;
+ 
+ 
+ # Syslog logging facility and level ($SYSLOG_LEVEL)
+@@ -199,7 +199,7 @@ $LOGFILE = "/var/log/maia/maiad.log";
+ #   * If enabled, stores data for optional SNMP agents and nanny utility
+ #   * Required for the optional Message-ID cache feature
+ 
+-$enable_db = 1;
++$enable_db = 0;
+ 
+ 
+ # Message-ID cache ($enable_global_cache)
+@@ -243,7 +243,7 @@ $uncompress  = ['uncompress', 'gzip -d', 'zcat'];
+ $unfreeze    = ['unfreeze', 'freeze -d', 'melt', 'fcat'];
+ $arc         = ['nomarch', 'arc'];
+ $unarj       = ['arj', 'unarj'];
+-#$unrar      = ['rar', 'unrar'];
++$unrar      = ['rar', 'unrar v -c- -p- --'];
+ $zoo         = 'zoo';
+ $lha         = 'lha';
+ $cpio        = ['gcpio','cpio'];
+@@ -390,7 +390,7 @@ $banned_filename_re = new_RE(
+ 
+ # Clam Antivirus Daemon (clamd)
+ ['ClamAV-clamd',
+-   \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.ctl"],
++   \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.sock"],
+    qr/\bOK$/m, qr/\bFOUND$/m,
+    qr/^.*?: (?!Infected Archive)(.*) FOUND$/m ],
+ # NOTE: run clamd under the same user as maiad, or run it under its own
diff --git a/security/maia/files/patch-scripts_configtest.pl b/security/maia/files/patch-scripts_configtest.pl
new file mode 100644
index 000000000000..bab393c72978
--- /dev/null
+++ b/security/maia/files/patch-scripts_configtest.pl
@@ -0,0 +1,8 @@
+--- scripts/configtest.pl.orig	2022-03-02 01:05:20 UTC
++++ scripts/configtest.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl
++#!/usr/bin/env perl
+ 
+ # $Id: configtest.pl 1570 2011-07-01 19:09:55Z rjl $
+ 
diff --git a/security/maia/files/patch-scripts_detectvba.pl b/security/maia/files/patch-scripts_detectvba.pl
new file mode 100644
index 000000000000..78ef46e6ce1e
--- /dev/null
+++ b/security/maia/files/patch-scripts_detectvba.pl
@@ -0,0 +1,8 @@
+--- scripts/detectvba.pl.orig	2022-03-16 00:45:19 UTC
++++ scripts/detectvba.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl -w
++#!/usr/bin/env perl
+ #technion@lolware.net
+ #Detects vba macros containing blacklisted strings.
+ #
diff --git a/security/maia/files/patch-scripts_expire-quarantine-cache.pl b/security/maia/files/patch-scripts_expire-quarantine-cache.pl
new file mode 100644
index 000000000000..b2edb64c42af
--- /dev/null
+++ b/security/maia/files/patch-scripts_expire-quarantine-cache.pl
@@ -0,0 +1,8 @@
+--- scripts/expire-quarantine-cache.pl.orig	2022-03-02 01:05:20 UTC
++++ scripts/expire-quarantine-cache.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl
++#!/usr/bin/env perl
+ 
+ # $Id: expire-quarantine-cache.pl 1528 2011-05-31 10:09:15Z rjl $
+ 
diff --git a/security/maia/files/patch-scripts_load-sa-rules.pl b/security/maia/files/patch-scripts_load-sa-rules.pl
new file mode 100644
index 000000000000..8c2fc0678709
--- /dev/null
+++ b/security/maia/files/patch-scripts_load-sa-rules.pl
@@ -0,0 +1,8 @@
+--- scripts/load-sa-rules.pl.orig	2022-03-02 01:05:20 UTC
++++ scripts/load-sa-rules.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl
++#!/usr/bin/env perl
+ 
+ # $Id: load-sa-rules.pl 1528 2011-05-31 10:09:15Z rjl $
+ 
diff --git a/security/maia/files/patch-scripts_maiadbtool.pl b/security/maia/files/patch-scripts_maiadbtool.pl
new file mode 100644
index 000000000000..29c6fb562ae1
--- /dev/null
+++ b/security/maia/files/patch-scripts_maiadbtool.pl
@@ -0,0 +1,8 @@
+--- scripts/maiadbtool.pl.orig	2022-03-02 01:05:20 UTC
++++ scripts/maiadbtool.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl
++#!/usr/bin/env perl
+ 
+ # $Id: $
+ 
diff --git a/security/maia/files/patch-scripts_process-quarantine.pl b/security/maia/files/patch-scripts_process-quarantine.pl
new file mode 100644
index 000000000000..263a221661b4
--- /dev/null
+++ b/security/maia/files/patch-scripts_process-quarantine.pl
@@ -0,0 +1,8 @@
+--- scripts/process-quarantine.pl.orig	2022-03-02 01:05:20 UTC
++++ scripts/process-quarantine.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl -w
++#!/usr/bin/env perl
+ 
+ package Maia::ProcessQuarantine;
+ 
diff --git a/security/maia/files/patch-scripts_resend.pl b/security/maia/files/patch-scripts_resend.pl
new file mode 100644
index 000000000000..d10980786d7f
--- /dev/null
+++ b/security/maia/files/patch-scripts_resend.pl
@@ -0,0 +1,8 @@
+--- scripts/resend.pl.orig	2022-03-02 01:05:20 UTC
++++ scripts/resend.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl -w
++#!/usr/bin/env perl
+ 
+ # $Id: $
+ 
diff --git a/security/maia/files/patch-scripts_send-quarantine-digests.pl b/security/maia/files/patch-scripts_send-quarantine-digests.pl
new file mode 100644
index 000000000000..90948897bd43
--- /dev/null
+++ b/security/maia/files/patch-scripts_send-quarantine-digests.pl
@@ -0,0 +1,8 @@
+--- scripts/send-quarantine-digests.pl.orig	2022-03-02 01:05:20 UTC
++++ scripts/send-quarantine-digests.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl
++#!/usr/bin/env perl
+ 
+ # $Id$
+ 
diff --git a/security/maia/files/patch-scripts_send-quarantine-reminders.pl b/security/maia/files/patch-scripts_send-quarantine-reminders.pl
new file mode 100644
index 000000000000..e2cc72c05c47
--- /dev/null
+++ b/security/maia/files/patch-scripts_send-quarantine-reminders.pl
@@ -0,0 +1,8 @@
+--- scripts/send-quarantine-reminders.pl.orig	2022-03-02 01:05:20 UTC
++++ scripts/send-quarantine-reminders.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl
++#!/usr/bin/env perl
+ 
+ # $Id: send-quarantine-reminders.pl 1528 2011-05-31 10:09:15Z rjl $
+ 
diff --git a/security/maia/files/patch-scripts_stats-snapshot.pl b/security/maia/files/patch-scripts_stats-snapshot.pl
new file mode 100644
index 000000000000..7158e8c2e301
--- /dev/null
+++ b/security/maia/files/patch-scripts_stats-snapshot.pl
@@ -0,0 +1,8 @@
+--- scripts/stats-snapshot.pl.orig	2022-03-02 01:05:20 UTC
++++ scripts/stats-snapshot.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl
++#!/usr/bin/env perl
+ 
+ # $Id: stats-snapshot.pl 1528 2011-05-31 10:09:15Z rjl $
+