Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Sep 2020 14:15:14 +0000 (UTC)
From:      =?UTF-8?Q?Stefan_E=c3=9fer?= <se@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r549729 - in head/mail/spamguard: . files
Message-ID:  <202009231415.08NEFEM7046683@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: se
Date: Wed Sep 23 14:15:14 2020
New Revision: 549729
URL: https://svnweb.freebsd.org/changeset/ports/549729

Log:
  Fix build with -fno-common and correct software bugs
  
  There were software bugs in 3 source files, most due to wrong use of sizeof
  (e.g. using the size of a pointer instead of the data, or subtracting a
  value from the argument of sizeof, not the resulting size value.
  
  A test for a short write assigned the length written to a variable and
  performed a comparison with that variable in a single expression and with
  no defined order of the these two operations resulting in either a
  comparison with 0 (the value before assignement) or with the just assigned
  value (tautological comparison). Either case did not catch a short write.
  
  I have not checked the quality of the code nay further than these issues
  that caused compiler warnings, but given the severity and fundamental lack
  of understanding shown by these examples, I'm not convinced that this
  program can be trusted to work correctly.

Added:
  head/mail/spamguard/files/patch-config.h.in   (contents, props changed)
  head/mail/spamguard/files/patch-functions.c   (contents, props changed)
  head/mail/spamguard/files/patch-functions.h   (contents, props changed)
  head/mail/spamguard/files/patch-hash.c   (contents, props changed)
  head/mail/spamguard/files/patch-hash.h   (contents, props changed)
  head/mail/spamguard/files/patch-loadconfig.c   (contents, props changed)
  head/mail/spamguard/files/patch-loadconfig.h   (contents, props changed)
  head/mail/spamguard/files/patch-main.c   (contents, props changed)
  head/mail/spamguard/files/patch-parser.c   (contents, props changed)
  head/mail/spamguard/files/patch-qsheff__parser.c   (contents, props changed)
Modified:
  head/mail/spamguard/Makefile
  head/mail/spamguard/files/patch-Makefile.am

Modified: head/mail/spamguard/Makefile
==============================================================================
--- head/mail/spamguard/Makefile	Wed Sep 23 14:08:09 2020	(r549728)
+++ head/mail/spamguard/Makefile	Wed Sep 23 14:15:14 2020	(r549729)
@@ -3,6 +3,7 @@
 
 PORTNAME=	spamguard
 PORTVERSION=	1.8
+PORTREVISION=	1
 CATEGORIES=	mail
 MASTER_SITES=	http://www.enderunix.org/spamguard/
 
@@ -10,6 +11,7 @@ MAINTAINER=	bofh@FreeBSD.org
 COMMENT=	MTA spam prevention program for qmail/postfix/sendmail
 
 LICENSE=	BSD3CLAUSE
+LICENSE_FILE=	${WRKSRC}/COPYING
 
 WRKSRC=		${WRKDIR}/${PORTNAME}
 GNU_CONFIGURE=	yes

Modified: head/mail/spamguard/files/patch-Makefile.am
==============================================================================
--- head/mail/spamguard/files/patch-Makefile.am	Wed Sep 23 14:08:09 2020	(r549728)
+++ head/mail/spamguard/files/patch-Makefile.am	Wed Sep 23 14:15:14 2020	(r549729)
@@ -1,5 +1,5 @@
---- Makefile.am.orig	2012-03-28 17:13:44.319243270 +0600
-+++ Makefile.am	2012-03-28 17:14:10.552245509 +0600
+--- Makefile.am.orig	2007-05-11 06:46:52 UTC
++++ Makefile.am
 @@ -1,22 +1,8 @@
  #EnderUNIX spamguard Makefile.am file
 -SUBDIRS = tr
@@ -23,7 +23,7 @@
  spamguard_confdir = ${sysconfdir}/spamguard
  spamguard_conf_DATA = spam-ignore.txt\
  	spam-ignore.txt.sample\
-@@ -36,7 +22,7 @@
+@@ -36,7 +22,7 @@ spamguard_headers = functions.h\
  	qsheff_parser.h\
  	hash.h
  

Added: head/mail/spamguard/files/patch-config.h.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/spamguard/files/patch-config.h.in	Wed Sep 23 14:15:14 2020	(r549729)
@@ -0,0 +1,19 @@
+--- config.h.in.orig	2007-05-08 06:59:20 UTC
++++ config.h.in
+@@ -78,6 +78,9 @@
+ /* Define to the one symbol short name of this package. */
+ #undef PACKAGE_TARNAME
+ 
++/* Define to the home page for this package. */
++#undef PACKAGE_URL
++
+ /* Define to the version of this package. */
+ #undef PACKAGE_VERSION
+ 
+@@ -90,5 +93,5 @@
+ /* Define to rpl_malloc if the replacement function should be used. */
+ #undef malloc
+ 
+-/* Define to `unsigned' if <sys/types.h> does not define. */
++/* Define to `unsigned int' if <sys/types.h> does not define. */
+ #undef size_t

Added: head/mail/spamguard/files/patch-functions.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/spamguard/files/patch-functions.c	Wed Sep 23 14:15:14 2020	(r549729)
@@ -0,0 +1,31 @@
+--- functions.c.orig	2008-01-21 15:41:05 UTC
++++ functions.c
+@@ -10,16 +10,9 @@
+ #include "wildmat.h"
+ #include "hash.h"
+ 
+-extern char mail_command[VALSIZE];
+-extern char makemap_command[VALSIZE];
+-extern char sysadmin[VALSIZE];
+-extern char statfile[VALSIZE];
+-extern char badmailfile[VALSIZE];
++maddr *spammer_hash[MAXADDR];
++iaddr *iaddrlist;
+ 
+-extern int wcnt;
+-extern int bcnt;
+-extern int pcnt;
+-
+ extern int w;
+ extern int b;
+ extern int p;
+@@ -107,7 +100,8 @@ send_notify_mail(char *n, char *sender, char *spam_typ
+          	return errno;
+         }
+ 
+-        if ((bytes = write(fd, n, strlen(n))) < bytes) {
++	bytes = strlen(n);
++        if (write(fd, n, bytes) < bytes) {
+                 fprintf(stderr, "Couldn't write to temporary file");
+                 return errno;
+         }

Added: head/mail/spamguard/files/patch-functions.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/spamguard/files/patch-functions.h	Wed Sep 23 14:15:14 2020	(r549729)
@@ -0,0 +1,13 @@
+--- functions.h.orig	2007-05-07 06:38:05 UTC
++++ functions.h
+@@ -28,8 +28,8 @@ struct iaddr {
+ 	iaddr *next;
+ };
+ 
+-maddr *spammer_hash[MAXADDR];
+-iaddr *iaddrlist;
++extern maddr *spammer_hash[MAXADDR];
++extern iaddr *iaddrlist;
+ 
+ 
+ int

Added: head/mail/spamguard/files/patch-hash.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/spamguard/files/patch-hash.c	Wed Sep 23 14:15:14 2020	(r549729)
@@ -0,0 +1,20 @@
+--- hash.c.orig	2007-05-10 21:18:39 UTC
++++ hash.c
+@@ -141,7 +141,7 @@ hash_lookup(const char *target, unsigned int h)
+         bp = bucket_arr[h];
+ 
+         while (bp != NULL) {
+-                if (! strncmp(bp->subject, target, sizeof(target)))
++                if (! strncmp(bp->subject, target, sizeof(bp->subject)))
+                         return bp;
+                 bp = bp->next;
+         }
+@@ -156,7 +156,7 @@ hash_lookup_IP(const char *target, unsigned int h)
+         ip = IP_bucket_arr[h];
+ 
+         while (ip != NULL) {
+-                if (! strncmp(ip->IP, target, sizeof(target)))
++                if (! strncmp(ip->IP, target, sizeof(ip->IP)))
+                         return 1;
+                 ip = ip->next;
+         }

Added: head/mail/spamguard/files/patch-hash.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/spamguard/files/patch-hash.h	Wed Sep 23 14:15:14 2020	(r549729)
@@ -0,0 +1,20 @@
+--- hash.h.orig	2007-05-10 21:18:39 UTC
++++ hash.h
+@@ -18,7 +18,7 @@ struct IP_bucket {
+         char IP[RECVFROM];
+         IP_bucket *next;
+ };
+-IP_bucket* IP_bucket_arr[NUM_HASH];
++extern IP_bucket* IP_bucket_arr[NUM_HASH];
+ 
+ 
+ typedef struct bucket bucket;
+@@ -30,7 +30,7 @@ struct bucket {
+ 	int is_spammer;
+ 	bucket *next;
+ };
+-bucket* bucket_arr[NUM_HASH];
++extern bucket* bucket_arr[NUM_HASH];
+ 
+ extern unsigned int
+ cdbhash(char *buf, unsigned int len);

Added: head/mail/spamguard/files/patch-loadconfig.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/spamguard/files/patch-loadconfig.c	Wed Sep 23 14:15:14 2020	(r549729)
@@ -0,0 +1,28 @@
+--- loadconfig.c.orig	2007-05-14 15:19:00 UTC
++++ loadconfig.c
+@@ -10,6 +10,25 @@
+ 
+ #include "loadconfig.h"
+ 
++
++int wcnt;
++int bcnt;
++int pcnt;
++int enable_subj_filt;
++
++char logtype[VALSIZE];
++char logfile[VALSIZE];
++char ignorefile[VALSIZE];
++char highfile[VALSIZE];
++char badmailfile[VALSIZE];
++char hostname[VALSIZE];
++char sysadmin[VALSIZE];
++char statfile[VALSIZE];
++char mail_command[VALSIZE];
++char makemap_command[VALSIZE];
++char qsheff_rules_file[VALSIZE];
++char trim_subj_str[VALSIZE];
++
+ extern int errno;
+ extern int w;
+ extern int b;

Added: head/mail/spamguard/files/patch-loadconfig.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/spamguard/files/patch-loadconfig.h	Wed Sep 23 14:15:14 2020	(r549729)
@@ -0,0 +1,42 @@
+--- loadconfig.h.orig	2007-05-14 15:19:00 UTC
++++ loadconfig.h
+@@ -12,23 +12,23 @@ enum {
+         VALSIZE = 256
+ };
+ 
+-int wcnt;
+-int bcnt;
+-int pcnt;
+-int enable_subj_filt;
++extern int wcnt;
++extern int bcnt;
++extern int pcnt;
++extern int enable_subj_filt;
+ 
+-char logtype[VALSIZE];
+-char logfile[VALSIZE];
+-char ignorefile[VALSIZE];
+-char highfile[VALSIZE];
+-char badmailfile[VALSIZE];
+-char hostname[VALSIZE];
+-char sysadmin[VALSIZE];
+-char statfile[VALSIZE];
+-char mail_command[VALSIZE];
+-char makemap_command[VALSIZE];
+-char qsheff_rules_file[VALSIZE];
+-char trim_subj_str[VALSIZE];
++extern char logtype[VALSIZE];
++extern char logfile[VALSIZE];
++extern char ignorefile[VALSIZE];
++extern char highfile[VALSIZE];
++extern char badmailfile[VALSIZE];
++extern char hostname[VALSIZE];
++extern char sysadmin[VALSIZE];
++extern char statfile[VALSIZE];
++extern char mail_command[VALSIZE];
++extern char makemap_command[VALSIZE];
++extern char qsheff_rules_file[VALSIZE];
++extern char trim_subj_str[VALSIZE];
+ 
+ void
+ loadconfig(const char *);

Added: head/mail/spamguard/files/patch-main.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/spamguard/files/patch-main.c	Wed Sep 23 14:15:14 2020	(r549729)
@@ -0,0 +1,14 @@
+--- main.c.orig	2007-05-07 06:38:05 UTC
++++ main.c
+@@ -27,11 +27,6 @@
+ #include "qsheff_parser.h"
+ #include "config.h"
+ 
+-extern char logtype[VALSIZE];
+-extern char logfile[VALSIZE];
+-extern char ignorefile[VALSIZE];
+-extern char badmailfile[VALSIZE];
+-
+ int w = 0;
+ int b = 0;
+ int p = 0;

Added: head/mail/spamguard/files/patch-parser.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/spamguard/files/patch-parser.c	Wed Sep 23 14:15:14 2020	(r549729)
@@ -0,0 +1,11 @@
+--- parser.c.orig	2007-05-04 06:37:36 UTC
++++ parser.c
+@@ -14,8 +14,6 @@
+ #include "loadconfig.h"
+ #include "parser.h"
+ 
+-extern char logtype[VALSIZE];
+-
+ void
+ read_logfile(char *fn) 
+ {	

Added: head/mail/spamguard/files/patch-qsheff__parser.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/spamguard/files/patch-qsheff__parser.c	Wed Sep 23 14:15:14 2020	(r549729)
@@ -0,0 +1,23 @@
+--- qsheff_parser.c.orig	2007-05-30 14:06:19 UTC
++++ qsheff_parser.c
+@@ -1,6 +1,9 @@
+ #include <stdio.h>
+ #include "qsheff_parser.h"
+ 
++IP_bucket* IP_bucket_arr[NUM_HASH];
++bucket* bucket_arr[NUM_HASH];
++
+ extern int w;
+ extern int b;
+ extern int p;
+@@ -225,8 +228,8 @@ qsheff_finalize(void)
+                             		fprintf(fp, "%s\n", bp->recvfrom);
+ 					bp->is_spammer = 1;
+ 					printf("Paranoid Spammer: %s - %s  sent %d mails\n", bp->mail, bp->recvfrom, bp->count);
+-					snprintf(mailbuf, sizeof(mailbuf - 1), " %s - %s has been spamming your box! (sent %d mails)\n No matter this mail address is matched against your spam high list: %s, or not. I'm still adding it to blacklist since s/he sent more mails then your paranoid threshold.\n\n Source mail address has been added to %s file\n Target successfully nuked!\n\n Regards,\n -EnderUNIX spamGuard %s\n http://www.enderunix.org/spamguard\n", bp->mail, bp->recvfrom, bp->count, highfile, badmailfile, VERSION);
+-					mailbuf[sizeof(mailbuf - 2)] = '\0';  /* -1 is for NULL byte, the other -1 is for 'Sir BALABAN Byte' ... */
++					snprintf(mailbuf, sizeof(mailbuf) - 1, " %s - %s has been spamming your box! (sent %d mails)\n No matter this mail address is matched against your spam high list: %s, or not. I'm still adding it to blacklist since s/he sent more mails then your paranoid threshold.\n\n Source mail address has been added to %s file\n Target successfully nuked!\n\n Regards,\n -EnderUNIX spamGuard %s\n http://www.enderunix.org/spamguard\n", bp->mail, bp->recvfrom, bp->count, highfile, badmailfile, VERSION);
++					mailbuf[sizeof(mailbuf) - 2] = '\0';  /* -1 is for NULL byte, the other -1 is for 'Sir BALABAN Byte' ... */
+ 					send_notify_mail(mailbuf,  bp->recvfrom, "paranoid ");
+                          	}
+ 		



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009231415.08NEFEM7046683>