Hello,
The mail/dspam port is getting old and the 3.2.x branch is not maintained
any more.
So here is an update to the latest release of the stable and maintained
branch, 3.4.9.
Additionnal changes over the previous port:
- New flavor: sqlite3 to link against databases/sqlite3. It is way faster
than sqlite v2 especially when the dictionnary is getting large. It also
avoid deadlocks that often happen with v2 when feeding a corpus. This is why
sqlite3 becomes the default in that port.
- New flavor : daemon.
- strcpy()/strcat()/sprintf() removal.
- documentation update.
Tested on i386 and amd64 with sqlite, sqlite3, pgsql and mysql.
tarball here: ftp://ftp.00f.net/misc/port-dspam-3.4.9.tar.gz
Best regards,
-Frank.
diff -urN mail/dspam.orig/Makefile mail/dspam/Makefile
--- mail/dspam.orig/Makefile Sun Feb 13 18:55:26 2005
+++ mail/dspam/Makefile Sat Aug 20 22:48:39 2005
@@ -2,7 +2,7 @@
COMMENT= "anti-spam filter"
-VERSION= 3.2.6
+VERSION= 3.4.9
DISTNAME= dspam-${VERSION}
CATEGORIES= mail
@@ -31,17 +31,43 @@
--with-dspam-mode=0555 \
--enable-long-usernames
-DOCS= ${WRKSRC}/README ${WRKSRC}/README.*
+DOCS= ${WRKSRC}/README ${WRKSRC}/UPGRADING ${WRKSRC}/RELEASE.NOTES \
+ ${WRKSRC}/doc/appliance.txt ${WRKSRC}/doc/courier.txt \
+ ${WRKSRC}/doc/exim.txt ${WRKSRC}/doc/pop3filter.txt \
+ ${WRKSRC}/doc/postfix.txt ${WRKSRC}/doc/qmail.txt \
+ ${WRKSRC}/doc/sendmail.txt
+
EXAMPLESDIR= ${PREFIX}/share/examples/dspam
DRIVER=
-FLAVORS= sqlite mysql pgsql
-FLAVOR?= sqlite
+FLAVORS= sqlite3 sqlite mysql pgsql daemon
+FLAVOR?= sqlite3
+.if ${FLAVOR:L:Mdaemon}
+.if ${FLAVOR:L:Msqlite3}
+BROKEN= daemon mode is currently incompatible with
sqlite3
+.endif
.if ${FLAVOR:L:Msqlite}
+BROKEN= daemon mode is currently incompatible with
sqlite
+.endif
+CONFIGURE_ARGS+= --enable-daemon
+.endif
+
+.if ${FLAVOR:L:Msqlite3}
.if !empty(DRIVER)
-BROKEN= choose either mysql or pgsql or sqlite
+BROKEN= choose either mysql or pgsql or sqlite or
sqlite3
.endif
+CONFIGURE_ARGS+= --with-storage-driver=sqlite3_drv \
+ --with-sqlite-includes=${LOCALBASE}/include \
+ --with-sqlite-libraries=${LOCALBASE}/lib
+LIB_DEPENDS= sqlite3.8.6::databases/sqlite3
+DRIVER= sqlite
+.endif
+
+.if ${FLAVOR:L:Msqlite}
+.if !empty(DRIVER)
+BROKEN= choose either mysql or pgsql or sqlite or
sqlite3
+.endif
CONFIGURE_ARGS+= --with-storage-driver=sqlite_drv \
--with-sqlite-includes=${LOCALBASE}/include \
--with-sqlite-libraries=${LOCALBASE}/lib
@@ -51,7 +77,7 @@
.if ${FLAVOR:L:Mmysql}
.if !empty(DRIVER)
-BROKEN= choose either mysql or pgsql or sqlite
+BROKEN= choose either mysql or pgsql or sqlite or
sqlite3
.endif
CONFIGURE_ARGS+= --with-storage-driver=mysql_drv \
--with-mysql-includes=${LOCALBASE}/include/mysql \
@@ -64,7 +90,7 @@
.if ${FLAVOR:L:Mpgsql}
.if !empty(DRIVER)
-BROKEN= choose either mysql or pgsql or sqlite
+BROKEN= choose either mysql or pgsql or sqlite or
sqlite3
.endif
CONFIGURE_ARGS+= --with-storage-driver=pgsql_drv \
--with-pgsql-includes=${LOCALBASE}/include/postgresql \
@@ -76,10 +102,14 @@
post-install:
${INSTALL_DATA_DIR} ${EXAMPLESDIR}
- ${INSTALL_DATA} ${WRKBUILD}/dspam.conf
${PREFIX}/share/examples/dspam/dspam.conf
- ${INSTALL_DATA} ${WRKSRC}/tools.${DRIVER}_drv/README
${EXAMPLESDIR}/README.${DRIVER}
- ${INSTALL_DATA} ${WRKSRC}/tools.${DRIVER}_drv/*.sql ${EXAMPLESDIR}
+ ${INSTALL_DATA} ${WRKBUILD}/src/dspam.conf \
+ ${PREFIX}/share/examples/dspam/dspam.conf
+ ${INSTALL_DATA_DIR} ${EXAMPLESDIR}/${DRIVER}
+ ${INSTALL_DATA} ${WRKSRC}/src/tools.${DRIVER}_drv/*.sql \
+ ${EXAMPLESDIR}/${DRIVER}
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/dspam
${INSTALL_DATA} ${DOCS} ${PREFIX}/share/doc/dspam
+ ${INSTALL_DATA} ${WRKSRC}/doc/${DRIVER}_drv.txt \
+ ${PREFIX}/share/doc/dspam
.include <bsd.port.mk>
diff -urN mail/dspam.orig/distinfo mail/dspam/distinfo
--- mail/dspam.orig/distinfo Wed Feb 2 20:21:30 2005
+++ mail/dspam/distinfo Sat Aug 20 22:48:39 2005
@@ -1,4 +1,3 @@
-MD5 (dspam-3.2.6.tar.gz) = aad53b4542076840e2a0e1fd43e48ebb
-RMD160 (dspam-3.2.6.tar.gz) = 1508dce53979dc10649a644b5153f0ed2ebb80fa
-SHA1 (dspam-3.2.6.tar.gz) = 38bce0bb771a9cbdb8df7442071d492794cf1ce3
-SIZE (dspam-3.2.6.tar.gz) = 621074
+MD5 (dspam-3.4.9.tar.gz) = ef7ceba47e63edb02a59be3c36cf0f6f
+SHA1 (dspam-3.4.9.tar.gz) = e697774e0f2eb4a9a363cf80257072219641f8e3
+RMD160 (dspam-3.4.9.tar.gz) = f4088017e3e5984101bba7d5e5e313d35076d469
diff -urN mail/dspam.orig/patches/patch-src_agent_shared_c
mail/dspam/patches/patch-src_agent_shared_c
--- mail/dspam.orig/patches/patch-src_agent_shared_c Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_agent_shared_c Sat Aug 20 23:53:29 2005
@@ -0,0 +1,51 @@
+--- src/agent_shared.c Mon Jun 13 15:08:24 2005
++++ dspam-obsd/src/agent_shared.c Sat Aug 20 23:50:55 2005
+@@ -301,7 +301,7 @@
+ char user[MAX_USERNAME_LENGTH];
+
+ if (_ds_match_attribute(agent_config, "Broken", "case"))
+- lc(user, argv[i]);
++ lc(user, sizeof (user), argv[i]);
+ else
+ strlcpy(user, argv[i], MAX_USERNAME_LENGTH);
+
+@@ -338,7 +338,7 @@
+ char user[MAX_USERNAME_LENGTH];
+
+ if (_ds_match_attribute(agent_config, "Broken", "case"))
+- lc(user, argv[i]);
++ lc(user, sizeof (user), argv[i]);
+ else
+ strlcpy(user, argv[i], MAX_USERNAME_LENGTH);
+
+@@ -574,10 +574,10 @@
+ char key[32];
+ #ifdef TRUSTED_USER_SECURITY
+ if (!ATX->trusted)
+- strcpy(key, "UntrustedDeliveryAgent");
++ strlcpy(key, "UntrustedDeliveryAgent", sizeof (key));
+ else
+ #endif
+- strcpy(key, "TrustedDeliveryAgent");
++ strlcpy(key, "TrustedDeliveryAgent", sizeof (key));
+
+ if (_ds_read_attribute(agent_config, key)) {
+ char fmt[sizeof(ATX->mailer_args)];
+@@ -589,7 +589,7 @@
+ if (ATX->trusted)
+ #endif
+ strlcat(fmt, ATX->mailer_args, sizeof(fmt));
+- strcpy(ATX->mailer_args, fmt);
++ strlcpy(ATX->mailer_args, fmt, sizeof (ATX->mailer_args));
+ } else if (!_ds_read_attribute(agent_config, "Deliveryhost")) {
+ if (!(ATX->flags & DAF_STDOUT)) {
+ report_error_printf(ERROR_NO_AGENT, key);
+@@ -703,7 +703,7 @@
+ if (buff[0] == '.' && buff[1] < 32) {
+ char x[sizeof(buff)];
+ snprintf(x, sizeof(x), ".%s", buff);
+- strcpy(buff, x);
++ strlcpy(buff, x, sizeof (buff));
+ }
+
+ if (line > 1 || strncmp (buff, "From QUARANTINE", 15))
diff -urN mail/dspam.orig/patches/patch-src_base64_c
mail/dspam/patches/patch-src_base64_c
--- mail/dspam.orig/patches/patch-src_base64_c Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_base64_c Sat Aug 20 23:43:54 2005
@@ -0,0 +1,25 @@
+diff -ur src/base64.c dspam-obsd/src/base64.c
+--- src/base64.c Mon Dec 13 23:58:45 2004
++++ dspam-obsd/src/base64.c Sat Aug 20 23:24:12 2005
+@@ -128,9 +128,11 @@
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ int cols, bits, c, char_count;
+ char *out;
++ size_t sizeof_out;
+ long rpos = 0, wpos = 0;
+
+- out = malloc (strlen (text) * 2);
++ sizeof_out = strlen(text) * 2;
++ out = malloc (sizeof_out);
+ if (out == NULL)
+ return NULL;
+
+@@ -195,7 +197,7 @@
+ }
+
+ if (out[strlen (out) - 1] != '\n')
+- strcat (out, "\n");
++ strlcat (out, "\n", sizeof_out);
+
+ return out;
+ }
diff -urN mail/dspam.orig/patches/patch-src_bnr_c
mail/dspam/patches/patch-src_bnr_c
--- mail/dspam.orig/patches/patch-src_bnr_c Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_bnr_c Sat Aug 20 23:42:58 2005
@@ -0,0 +1,31 @@
+diff -ur src/bnr.c dspam-obsd/src/bnr.c
+--- src/bnr.c Tue Jan 18 19:28:27 2005
++++ dspam-obsd/src/bnr.c Sat Aug 20 23:24:12 2005
+@@ -129,11 +129,11 @@
+ }
+
+ previous_bnr_probs[BNR_SIZE-1] = _bnr_round(node_list->value);
+- sprintf(bnr_token, "bnr.%c|", BTX->identifier);
++ snprintf(bnr_token, sizeof (bnr_token), "bnr.%c|", BTX->identifier);
+ for(i=0;i<BNR_SIZE;i++) {
+ char x[6];
+ snprintf(x, 6, "%01.2f_", previous_bnr_probs[i]);
+- strcat(bnr_token, x);
++ strlcat(bnr_token, x, sizeof (bnr_token));
+ }
+
+ #ifdef LIBBNR_VERBOSE_DEBUG
+@@ -272,11 +272,11 @@
+ previous_bnr_probs[BNR_SIZE-1] = _bnr_round(node_list->value);
+ previous_bnr_tokens[BNR_SIZE-1] = node_list;
+
+- sprintf(bnr_token, "bnr.%c|", BTX->identifier);
++ snprintf(bnr_token, sizeof (bnr_token), "bnr.%c|", BTX->identifier);
+ for(i=0;i<BNR_SIZE;i++) {
+ char x[6];
+ snprintf(x, 6, "%01.2f_", previous_bnr_probs[i]);
+- strcat(bnr_token, x);
++ strlcat(bnr_token, x, sizeof (bnr_token));
+ }
+
+ /* Identify interesting patterns */
diff -urN mail/dspam.orig/patches/patch-src_client_c
mail/dspam/patches/patch-src_client_c
--- mail/dspam.orig/patches/patch-src_client_c Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_client_c Sat Aug 20 23:42:58 2005
@@ -0,0 +1,21 @@
+diff -ur src/client.c dspam-obsd/src/client.c
+--- src/client.c Mon Jun 13 16:02:45 2005
++++ dspam-obsd/src/client.c Sat Aug 20 23:24:12 2005
+@@ -94,7 +94,7 @@
+ /* RCPT TO - Send recipient information */
+ /* ------------------------------------ */
+
+- strcpy(buff, "RCPT TO: ");
++ strlcpy(buff, "RCPT TO: ", sizeof (buff));
+ node_nt = c_nt_first(ATX->users, &c_nt);
+ while(node_nt != NULL) {
+ const char *ptr = (const char *) node_nt->ptr;
+@@ -264,7 +264,7 @@
+ if (domain) {
+ sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
+ saun.sun_family = AF_UNIX;
+- strcpy(saun.sun_path, host);
++ strlcpy(saun.sun_path, host, sizeof (saun.sun_path));
+ addr_len = sizeof(saun.sun_family) + strlen(saun.sun_path) + 1;
+
+ LOGDEBUG(CLIENT_CONNECT, host, 0);
diff -urN mail/dspam.orig/patches/patch-src_daemon_c
mail/dspam/patches/patch-src_daemon_c
--- mail/dspam.orig/patches/patch-src_daemon_c Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_daemon_c Sat Aug 20 23:42:58 2005
@@ -0,0 +1,21 @@
+diff -ur src/daemon.c dspam-obsd/src/daemon.c
+--- src/daemon.c Thu Jun 2 14:00:25 2005
++++ dspam-obsd/src/daemon.c Sat Aug 20 23:24:12 2005
+@@ -127,7 +127,7 @@
+
+ memset(&saun, 0, sizeof(struct sockaddr_un));
+ saun.sun_family = AF_UNIX;
+- strcpy(saun.sun_path, address);
++ strlcpy(saun.sun_path, address, sizeof (saun.sun_path));
+
+ unlink(address);
+ len = sizeof(saun.sun_family) + strlen(saun.sun_path) + 1;
+@@ -472,7 +472,7 @@
+ ptr = processmode;
+ for(i=0;ptr[i];i++) {
+ if (ptr[i] == '\\' && ptr[i+1] == '"') {
+- strcpy(ptr+i, ptr+i+1);
++ strlcpy(ptr+i, ptr+i+1, strlen(ptr + i) + 1);
+ }
+ }
+ LOGDEBUG("process mode: '%s'", processmode);
diff -urN mail/dspam.orig/patches/patch-src_decode_c
mail/dspam/patches/patch-src_decode_c
--- mail/dspam.orig/patches/patch-src_decode_c Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_decode_c Sat Aug 20 23:42:58 2005
@@ -0,0 +1,107 @@
+diff -ur src/decode.c dspam-obsd/src/decode.c
+--- src/decode.c Mon Jul 25 20:26:53 2005
++++ dspam-obsd/src/decode.c Sat Aug 20 23:24:12 2005
+@@ -151,15 +151,16 @@
+ {
+ char *eow;
+ char *ptr;
++ size_t sizeof_ptr;
+
++ sizeof_ptr = strlen (current_heading->data) + strlen (line) + 2;
+ ptr =
+- realloc (current_heading->data,
+- strlen (current_heading->data) + strlen (line) + 2);
++ realloc (current_heading->data, sizeof_ptr);
+ if (ptr)
+ {
+ current_heading->data = ptr;
+- strcat (current_heading->data, "\n");
+- strcat (current_heading->data, line);
++ strlcat (current_heading->data, "\n", sizeof_ptr);
++ strlcat (current_heading->data, line, sizeof_ptr);
+ } else {
+ report_error(ERROR_MEM_ALLOC);
+ }
+@@ -167,28 +168,27 @@
+ /* Our concatenated data doesn't have any whitespace between lines
*/
+ for(eow=line;eow[0] && isspace((int) eow[0]);eow++) { }
+
++ sizeof_ptr = strlen (current_heading->concatenated_data) + strlen
(eow) + 1;
+ ptr =
+- realloc (current_heading->concatenated_data,
+- strlen (current_heading->concatenated_data) + strlen (eow) + 1);
++ realloc (current_heading->concatenated_data, sizeof_ptr);
+ if (ptr)
+ {
+ current_heading->concatenated_data = ptr;
+- strcat (current_heading->concatenated_data, eow);
++ strlcat (current_heading->concatenated_data, eow, sizeof_ptr);
+ } else {
+ report_error(ERROR_MEM_ALLOC);
+ }
+
+ if (current_heading->original_data != NULL) {
+-
++ sizeof_ptr = strlen (current_heading->original_data) +
++ strlen (line) + 2;
+ ptr =
+- realloc (current_heading->original_data,
+- strlen (current_heading->original_data) +
+- strlen (line) + 2);
++ realloc (current_heading->original_data, sizeof_ptr);
+ if (ptr)
+ {
+ current_heading->original_data = ptr;
+- strcat (current_heading->original_data, "\n");
+- strcat (current_heading->original_data, line);
++ strlcat (current_heading->original_data, "\n", sizeof_ptr);
++ strlcat (current_heading->original_data, line, sizeof_ptr);
+ } else {
+ report_error(ERROR_MEM_ALLOC);
+ }
+@@ -390,11 +390,12 @@
+ if (decoded)
+ {
+ char *new_alloc;
++ size_t sizeof_new_alloc;
+
+ decoded_len = strlen(decoded);
+
+- new_alloc =
+- calloc (1, offset + decoded_len + strlen (rest) + 2);
++ sizeof_new_alloc = offset + decoded_len + strlen (rest) + 2;
++ new_alloc = calloc (1, sizeof_new_alloc);
+ if (new_alloc == NULL)
+ {
+ LOG (LOG_CRIT, ERROR_MEM_ALLOC);
+@@ -405,8 +406,8 @@
+ if (offset)
+ strncpy(new_alloc, header->concatenated_data, offset);
+
+- strcat(new_alloc, decoded);
+- strcat(new_alloc, rest);
++ strlcat(new_alloc, decoded, sizeof_new_alloc);
++ strlcat(new_alloc, rest, sizeof_new_alloc);
+ free(decoded);
+ decoded = new_alloc;
+ }
+@@ -886,15 +887,17 @@
+ _ds_push_boundary (struct nt *stack, const char *boundary)
+ {
+ char *y;
++ size_t sizeof_y;
+
+ if (boundary == NULL || boundary[0] == 0)
+ return EINVAL;
+
+- y = malloc (strlen (boundary) + 3);
++ sizeof_y = strlen (boundary) + 3;
++ y = malloc (sizeof_y);
+ if (y == NULL)
+ return EUNKNOWN;
+
+- sprintf (y, "--%s", boundary);
++ snprintf (y, sizeof_y, "--%s", boundary);
+ nt_add (stack, (char *) y);
+ free(y);
+
diff -urN mail/dspam.orig/patches/patch-src_dspam_c
mail/dspam/patches/patch-src_dspam_c
--- mail/dspam.orig/patches/patch-src_dspam_c Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_dspam_c Sat Aug 20 23:42:58 2005
@@ -0,0 +1,41 @@
+diff -ur src/dspam.c dspam-obsd/src/dspam.c
+--- src/dspam.c Mon Aug 8 06:04:49 2005
++++ dspam-obsd/src/dspam.c Sat Aug 20 23:24:12 2005
+@@ -656,13 +656,13 @@
+
+ switch (CTX->result) {
+ case DSR_ISSPAM:
+- strcpy(data, "Spam");
++ strlcpy(data, "Spam", sizeof (data));
+ break;
+ case DSR_ISWHITELISTED:
+- strcpy(data, "Whitelisted");
++ strlcpy(data, "Whitelisted", sizeof (data));
+ break;
+ default:
+- strcpy(data, "Innocent");
++ strlcpy(data, "Innocent", sizeof (data));
+ break;
+ }
+
+@@ -2630,16 +2630,16 @@
+ char data[10240];
+ char scratch[128];
+
+- strcpy(data, (CTX->source == DSS_ERROR) ? "X-DSPAM-Reclassified: " :
"X-DSPAM-Result: ");
++ strlcpy(data, (CTX->source == DSS_ERROR) ? "X-DSPAM-Reclassified: " :
"X-DSPAM-Result: ", sizeof (data));
+ switch (CTX->result) {
+ case DSR_ISSPAM:
+- strcat(data, "Spam");
++ strlcat(data, "Spam", sizeof (data));
+ break;
+ case DSR_ISWHITELISTED:
+- strcat(data, "Whitelisted");
++ strlcat(data, "Whitelisted", sizeof (data));
+ break;
+ default:
+- strcat(data, "Innocent");
++ strlcat(data, "Innocent", sizeof (data));
+ break;
+ }
+
diff -urN mail/dspam.orig/patches/patch-src_error_c
mail/dspam/patches/patch-src_error_c
--- mail/dspam.orig/patches/patch-src_error_c Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_error_c Sat Aug 20 23:46:52 2005
@@ -0,0 +1,44 @@
+diff -ur src/error.c dspam-obsd/src/error.c
+--- src/error.c Tue Mar 15 18:37:19 2005
++++ dspam-obsd/src/error.c Sat Aug 20 23:24:12 2005
+@@ -60,7 +60,7 @@
+ {
+ char buf[128];
+
+- fprintf (stderr, "%ld: [%s] %s\n", (long) getpid (), format_date_r(buf),
error);
++ fprintf (stderr, "%ld: [%s] %s\n", (long) getpid (), format_date_r(buf,
sizeof (buf)), error);
+
+ #ifdef DEBUG
+ debug (error);
+@@ -106,11 +106,11 @@
+ file = fopen (fn, "a");
+ if (file != NULL)
+ {
+- fprintf (file, "%ld: [%s] %s\n", (long) getpid (), format_date_r(buf),
text);
++ fprintf (file, "%ld: [%s] %s\n", (long) getpid (), format_date_r(buf,
sizeof (buf)), text);
+ fclose (file);
+ }
+ } else if (DO_DEBUG == 2) {
+- printf ("%ld: [%s] %s\n", (long) getpid (), format_date_r(buf), text);
++ printf ("%ld: [%s] %s\n", (long) getpid (), format_date_r(buf, sizeof
(buf)), text);
+ }
+ return;
+ }
+@@ -161,7 +161,7 @@
+ #endif
+
+ char *
+-format_date_r(char *buf) {
++format_date_r(char *buf, size_t sizeof_buf) {
+ struct tm *l;
+ #ifdef HAVE_LOCALTIME_R
+ struct tm lt;
+@@ -174,7 +174,7 @@
+ l = localtime(&t);
+ #endif
+
+- sprintf(buf, "%d/%d/%d %d:%d:%d",
++ snprintf(buf, sizeof (buf), "%d/%d/%d %d:%d:%d",
+ l->tm_mon+1, l->tm_mday, l->tm_year+1900, l->tm_hour, l->tm_min,
+ l->tm_sec);
+ return buf;
diff -urN mail/dspam.orig/patches/patch-src_error_h
mail/dspam/patches/patch-src_error_h
--- mail/dspam.orig/patches/patch-src_error_h Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_error_h Sat Aug 20 23:42:58 2005
@@ -0,0 +1,12 @@
+diff -ur src/error.h dspam-obsd/src/error.h
+--- src/error.h Tue Mar 15 18:37:19 2005
++++ dspam-obsd/src/error.h Sat Aug 20 23:24:12 2005
+@@ -40,7 +40,7 @@
+ extern int DO_DEBUG;
+ #endif
+
+-char *format_date_r (char *buf);
++char *format_date_r (char *buf, size_t sizeof_buf);
+ void report_error (const char *);
+ void report_error_printf (const char *fmt, ...);
+ void file_error (const char *operation,
diff -urN mail/dspam.orig/patches/patch-src_example_c
mail/dspam/patches/patch-src_example_c
--- mail/dspam.orig/patches/patch-src_example_c Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_example_c Sat Aug 20 23:42:58 2005
@@ -0,0 +1,12 @@
+diff -ur src/example.c dspam-obsd/src/example.c
+--- src/example.c Mon Jan 3 19:40:18 2005
++++ dspam-obsd/src/example.c Sat Aug 20 23:24:12 2005
+@@ -64,7 +64,7 @@
+ fprintf (stderr, "out of memory!");
+ exit (EXIT_FAILURE);
+ }
+- strcat (message, buffer);
++ strlcat (message, buffer, len);
+ }
+
+ /* MESSAGE PROCESSING */
diff -urN mail/dspam.orig/patches/patch-src_libdb3_drv_c
mail/dspam/patches/patch-src_libdb3_drv_c
--- mail/dspam.orig/patches/patch-src_libdb3_drv_c Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_libdb3_drv_c Sat Aug 20 23:42:58 2005
@@ -0,0 +1,21 @@
+diff -ur src/libdb3_drv.c dspam-obsd/src/libdb3_drv.c
+--- src/libdb3_drv.c Tue Jan 18 19:28:27 2005
++++ dspam-obsd/src/libdb3_drv.c Sat Aug 20 23:24:12 2005
+@@ -81,7 +81,7 @@
+ memset (&key, 0, sizeof (DBT));
+ memset (&data, 0, sizeof (DBT));
+
+- strcpy (hashkey, "_TOTALS");
++ strlcpy (hashkey, "_TOTALS", sizeof (hashkey));
+ key.data = hashkey;
+ key.size = strlen (hashkey);
+
+@@ -132,7 +132,7 @@
+ memset (&key, 0, sizeof (DBT));
+ memset (&data, 0, sizeof (DBT));
+
+- strcpy (hashkey, "_TOTALS");
++ strlcpy (hashkey, "_TOTALS", sizeof (hashkey));
+ key.data = hashkey;
+ key.size = strlen (hashkey);
+ data.data = &CTX->totals;
diff -urN mail/dspam.orig/patches/patch-src_libdb4_drv_c
mail/dspam/patches/patch-src_libdb4_drv_c
--- mail/dspam.orig/patches/patch-src_libdb4_drv_c Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_libdb4_drv_c Sat Aug 20 23:42:58 2005
@@ -0,0 +1,21 @@
+diff -ur src/libdb4_drv.c dspam-obsd/src/libdb4_drv.c
+--- src/libdb4_drv.c Tue Jan 18 19:28:27 2005
++++ dspam-obsd/src/libdb4_drv.c Sat Aug 20 23:24:12 2005
+@@ -81,7 +81,7 @@
+ memset (&key, 0, sizeof (DBT));
+ memset (&data, 0, sizeof (DBT));
+
+- strcpy (hashkey, "_TOTALS");
++ strlcpy (hashkey, "_TOTALS", sizeof (hashkey));
+ key.data = hashkey;
+ key.size = strlen (hashkey);
+
+@@ -132,7 +132,7 @@
+ memset (&key, 0, sizeof (DBT));
+ memset (&data, 0, sizeof (DBT));
+
+- strcpy (hashkey, "_TOTALS");
++ strlcpy (hashkey, "_TOTALS", sizeof (hashkey));
+ key.data = hashkey;
+ key.size = strlen (hashkey);
+ data.data = &CTX->totals;
diff -urN mail/dspam.orig/patches/patch-src_libdspam_c
mail/dspam/patches/patch-src_libdspam_c
--- mail/dspam.orig/patches/patch-src_libdspam_c Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_libdspam_c Sat Aug 20 23:42:58 2005
@@ -0,0 +1,25 @@
+diff -ur src/libdspam.c dspam-obsd/src/libdspam.c
+--- src/libdspam.c Mon Jun 13 15:08:24 2005
++++ dspam-obsd/src/libdspam.c Sat Aug 20 23:24:12 2005
+@@ -715,9 +715,9 @@
+ goto bail;
+ }
+
+- strcpy(CTX->signature->data, headers);
+- strcat(CTX->signature->data, "\001");
+- strcat(CTX->signature->data, body);
++ strlcpy(CTX->signature->data, headers, CTX->signature->length);
++ strlcat(CTX->signature->data, "\001", CTX->signature->length);
++ strlcat(CTX->signature->data, body, CTX->signature->length);
+ }
+
+ if (body != NULL)
+@@ -3095,7 +3095,7 @@
+ previous_bnr_probs[i] = previous_bnr_probs[i+1];
+
+ previous_bnr_probs[BNR_SIZE-1] = _ds_round(ds_term->s.probability);
+- sprintf(bnr_token, "bnr.%c|", identifier);
++ snprintf(bnr_token, sizeof (bnr_token), "bnr.%c|", identifier);
+ for(i=0;i<BNR_SIZE;i++) {
+ char x[6];
+ snprintf(x, 6, "%01.2f_", previous_bnr_probs[i]);
diff -urN mail/dspam.orig/patches/patch-src_list_c
mail/dspam/patches/patch-src_list_c
--- mail/dspam.orig/patches/patch-src_list_c Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_list_c Sat Aug 20 23:42:58 2005
@@ -0,0 +1,12 @@
+diff -ur src/list.c dspam-obsd/src/list.c
+--- src/list.c Wed Dec 29 06:18:56 2004
++++ dspam-obsd/src/list.c Sat Aug 20 23:24:12 2005
+@@ -113,7 +113,7 @@
+ perror("memory allocation error: list_insert() failed");
+ return NULL;
+ }
+- strcpy (vptr, data);
++ strlcpy (vptr, data, size);
+ }
+ else
+ {
diff -urN mail/dspam.orig/patches/patch-src_mysql_drv_c
mail/dspam/patches/patch-src_mysql_drv_c
--- mail/dspam.orig/patches/patch-src_mysql_drv_c Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_mysql_drv_c Sat Aug 20 23:42:58 2005
@@ -0,0 +1,24 @@
+diff -ur src/mysql_drv.c dspam-obsd/src/mysql_drv.c
+--- src/mysql_drv.c Mon Apr 11 14:31:56 2005
++++ dspam-obsd/src/mysql_drv.c Sat Aug 20 23:24:12 2005
+@@ -1312,9 +1312,9 @@
+ if (s->iter_user == NULL)
+ {
+ #ifdef VIRTUAL_USERS
+- strcpy (query, "select distinct username from dspam_virtual_uids");
++ strlcpy (query, "select distinct username from dspam_virtual_uids",
sizeof (query));
+ #else
+- strcpy (query, "select distinct uid from dspam_stats");
++ strlcpy (query, "select distinct uid from dspam_stats", sizeof (query));
+ #endif
+ if (MYSQL_RUN_QUERY (s->dbh, query))
+ {
+@@ -1713,7 +1713,7 @@
+ return;
+ }
+
+- fprintf (file, "[%s] %d: %s: %s\n", format_date_r(buf), (int) getpid (),
++ fprintf (file, "[%s] %d: %s: %s\n", format_date_r(buf, sizeof (buf)), (int)
getpid (),
+ error, query); fclose (file);
+ return;
+ }
diff -urN mail/dspam.orig/patches/patch-src_pgsql_drv_c
mail/dspam/patches/patch-src_pgsql_drv_c
--- mail/dspam.orig/patches/patch-src_pgsql_drv_c Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_pgsql_drv_c Sat Aug 20 23:42:58 2005
@@ -0,0 +1,24 @@
+diff -ur src/pgsql_drv.c dspam-obsd/src/pgsql_drv.c
+--- src/pgsql_drv.c Mon Apr 11 14:31:56 2005
++++ dspam-obsd/src/pgsql_drv.c Sat Aug 20 23:24:12 2005
+@@ -1367,9 +1367,9 @@
+
+ /* Declare Cursor */
+ #ifdef VIRTUAL_USERS
+- strcpy (query, "DECLARE dscursor CURSOR FOR SELECT DISTINCT username FROM
dspam_virtual_uids");
++ strlcpy (query, "DECLARE dscursor CURSOR FOR SELECT DISTINCT username
FROM dspam_virtual_uids", sizeof (query));
+ #else
+- strcpy (query, "DECLARE dscursor CURSOR FOR SELECT DISTINCT uid FROM
dspam_stats");
++ strlcpy (query, "DECLARE dscursor CURSOR FOR SELECT DISTINCT uid FROM
dspam_stats", sizeof (query));
+ #endif
+
+ result = PQexec(s->dbh, query);
+@@ -1840,7 +1840,7 @@
+ return;
+ }
+
+- fprintf (file, "[%s] %d: %s: %s\n", format_date_r(buf), (int) getpid (),
error, query);
++ fprintf (file, "[%s] %d: %s: %s\n", format_date_r(buf, sizeof (buf)), (int)
getpid (), error, query);
+ fclose (file);
+ return;
+ }
diff -urN mail/dspam.orig/patches/patch-src_util_c
mail/dspam/patches/patch-src_util_c
--- mail/dspam.orig/patches/patch-src_util_c Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_util_c Sat Aug 20 23:52:39 2005
@@ -0,0 +1,55 @@
+--- src/util.c Fri Feb 25 16:09:08 2005
++++ dspam-obsd/src/util.c Sat Aug 20 23:51:38 2005
+@@ -123,7 +123,7 @@
+ /* do nothing */
+ }
+ if (p > str)
+- strcpy (str, p); /* __STRCPY_CHECKED__ */
++ strlcpy (str, p, strlen(str) + 1);
+ return str;
+ }
+
+@@ -256,7 +256,7 @@
+ #endif
+
+ if (p == NULL)
+- strcpy(userhome, home);
++ strlcpy(userhome, home, sizeof (userhome));
+ else
+ strlcpy(userhome, p->pw_dir, sizeof(userhome));
+
+@@ -285,7 +285,7 @@
+ free(f);
+ #else
+ strlcpy(username, filename, MAX_FILENAME_LENGTH);
+- strcpy(userpath, username);
++ strlcpy(userpath, username, sizeof (userpath));
+ #endif
+
+ /* Use home/opt-in/ and home/opt-out/ to store opt files, instead of
+@@ -444,7 +444,7 @@
+ */
+
+ int
+-lc (char *buff, const char *string)
++lc (char *buff, size_t sizeof_buff, const char *string)
+ {
+ char *buffer;
+ int i, j = 0;
+@@ -473,7 +473,7 @@
+ }
+
+ buffer[len] = 0;
+- strcpy (buff, buffer);
++ strlcpy (buff, buffer, sizeof_buff);
+
+ free (buffer);
+ return j;
+@@ -708,6 +708,6 @@
+ return(NULL);
+ }
+
+- return strcpy(buf, b);
++ return strlcpy(buf, b, len);
+ }
+ #endif
diff -urN mail/dspam.orig/patches/patch-src_util_h
mail/dspam/patches/patch-src_util_h
--- mail/dspam.orig/patches/patch-src_util_h Thu Jan 1 01:00:00 1970
+++ mail/dspam/patches/patch-src_util_h Sat Aug 20 23:55:23 2005
@@ -0,0 +1,11 @@
+--- src/util.h Fri Feb 25 15:52:14 2005
++++ dspam-obsd/src/util.h Sat Aug 20 23:54:57 2005
+@@ -59,7 +59,7 @@
+ void chomp (char *string);
+ char * ltrim (char *str);
+ char * rtrim (char *str);
+-int lc (char *buff, const char *string);
++int lc (char *buff, size_t sizeof_buff, const char *string);
+ char * strcasestr (const char *, const char *);
+
+ #define ALLTRIM(str) ltrim(rtrim(str))
diff -urN mail/dspam.orig/pkg/DESCR mail/dspam/pkg/DESCR
--- mail/dspam.orig/pkg/DESCR Tue Jan 11 17:05:42 2005
+++ mail/dspam/pkg/DESCR Sat Aug 20 22:48:39 2005
@@ -6,3 +6,18 @@
large system and provides an administratively maintenance free solution
capable of learning each user's email behaviors with very few false
positives.
+
+Available flavors are:
+
+- daemon: add the ability to run dspam as multiple clients connecting to a
+central server. This flavor is required in order to use the --daemon and
+--client command-line switches. However, the daemon mode is currently
+incompatible with sqlite.
+
+- sqlite: use the sqlite 2.x library as a storage engine.
+
+- sqlite3: use the sqlite 3.x library as a storage engine.
+
+- pgsql: use a posgresql server as a storage engine.
+
+- mysql: use a mysql server as a storage engine.
diff -urN mail/dspam.orig/pkg/PFRAG.mysql mail/dspam/pkg/PFRAG.mysql
--- mail/dspam.orig/pkg/PFRAG.mysql Tue Jan 11 17:05:42 2005
+++ mail/dspam/pkg/PFRAG.mysql Sat Aug 20 22:48:39 2005
@@ -1,9 +1,10 @@
@comment $OpenBSD: PFRAG.mysql,v 1.1.1.1 2005/01/11 16:06:04 jakob Exp $
-share/examples/dspam/README.mysql
-share/examples/dspam/mysql_objects-4.1.sql
-share/examples/dspam/mysql_objects-space.sql
-share/examples/dspam/mysql_objects-speed.sql
-share/examples/dspam/neural.sql
-share/examples/dspam/purge-4.1.sql
-share/examples/dspam/purge.sql
-share/examples/dspam/virtual_users.sql
+share/doc/dspam/mysql_drv.txt
+share/examples/dspam/mysql
+share/examples/dspam/mysql/mysql_objects-4.1.sql
+share/examples/dspam/mysql/mysql_objects-space.sql
+share/examples/dspam/mysql/mysql_objects-speed.sql
+share/examples/dspam/mysql/neural.sql
+share/examples/dspam/mysql/purge-4.1.sql
+share/examples/dspam/mysql/purge.sql
+share/examples/dspam/mysql/virtual_users.sql
diff -urN mail/dspam.orig/pkg/PFRAG.pgsql mail/dspam/pkg/PFRAG.pgsql
--- mail/dspam.orig/pkg/PFRAG.pgsql Tue Jan 11 17:05:42 2005
+++ mail/dspam/pkg/PFRAG.pgsql Sat Aug 20 22:48:39 2005
@@ -1,4 +1,7 @@
@comment $OpenBSD: PFRAG.pgsql,v 1.1.1.1 2005/01/11 16:06:04 jakob Exp $
-share/examples/dspam/pgsql_objects.sql
-share/examples/dspam/purge.sql
-share/examples/dspam/virtual_users.sql
+bin/dspam_pg2int8
+share/doc/dspam/pgsql_drv.txt
+share/examples/dspam/pgsql
+share/examples/dspam/pgsql/pgsql_objects.sql
+share/examples/dspam/pgsql/purge.sql
+share/examples/dspam/pgsql/virtual_users.sql
diff -urN mail/dspam.orig/pkg/PFRAG.sqlite mail/dspam/pkg/PFRAG.sqlite
--- mail/dspam.orig/pkg/PFRAG.sqlite Tue Jan 11 17:05:42 2005
+++ mail/dspam/pkg/PFRAG.sqlite Sat Aug 20 22:48:39 2005
@@ -1,2 +1,4 @@
@comment $OpenBSD: PFRAG.sqlite,v 1.1.1.1 2005/01/11 16:06:04 jakob Exp $
-share/examples/dspam/README.sqlite
+share/doc/dspam/sqlite_drv.txt
+share/examples/dspam/sqlite
+share/examples/dspam/sqlite/purge.sql
diff -urN mail/dspam.orig/pkg/PFRAG.sqlite3 mail/dspam/pkg/PFRAG.sqlite3
--- mail/dspam.orig/pkg/PFRAG.sqlite3 Thu Jan 1 01:00:00 1970
+++ mail/dspam/pkg/PFRAG.sqlite3 Sat Aug 20 22:48:39 2005
@@ -0,0 +1,4 @@
[EMAIL PROTECTED] $OpenBSD: PFRAG.sqlite,v 1.1.1.1 2005/01/11 16:06:04 jakob
Exp $
+share/doc/dspam/sqlite_drv.txt
+share/examples/dspam/sqlite3/
+share/examples/dspam/sqlite3/purge.sql
diff -urN mail/dspam.orig/pkg/PLIST mail/dspam/pkg/PLIST
--- mail/dspam.orig/pkg/PLIST Tue Jan 11 17:05:42 2005
+++ mail/dspam/pkg/PLIST Sat Aug 20 23:00:19 2005
@@ -1,6 +1,4 @@
[EMAIL PROTECTED] $OpenBSD: PLIST,v 1.1.1.1 2005/01/11 16:06:04 jakob Exp $
[EMAIL PROTECTED] _dspam:540
[EMAIL PROTECTED] _dspam:540:540:daemon:DSPAM Account:/var/dspam:/sbin/nologin
[EMAIL PROTECTED] $OpenBSD$
%%SHARED%%
bin/dspam
bin/dspam_2sql
@@ -10,19 +8,22 @@
bin/dspam_crc
bin/dspam_dump
bin/dspam_genaliases
+bin/dspam_logrotate
bin/dspam_merge
bin/dspam_stats
+bin/dspamc
include/dspam/
include/dspam/buffer.h
include/dspam/config.h
+include/dspam/config_shared.h
include/dspam/decode.h
+include/dspam/diction.h
include/dspam/error.h
-include/dspam/lht.h
+include/dspam/heap.h
include/dspam/libdspam.h
include/dspam/libdspam_objects.h
include/dspam/nodetree.h
include/dspam/storage_driver.h
-include/dspam/tbt.h
lib/libdspam.a
lib/libdspam.la
lib/pkgconfig/
@@ -44,17 +45,14 @@
@man man/man3/libdspam.3
share/doc/dspam/
share/doc/dspam/README
-share/doc/dspam/README.courier
-share/doc/dspam/README.exim
-share/doc/dspam/README.pop3filter
-share/doc/dspam/README.postfix
-share/doc/dspam/README.qmail
-share/doc/dspam/README.sendmail
+share/doc/dspam/RELEASE.NOTES
+share/doc/dspam/UPGRADING
+share/doc/dspam/appliance.txt
+share/doc/dspam/courier.txt
+share/doc/dspam/exim.txt
+share/doc/dspam/pop3filter.txt
+share/doc/dspam/postfix.txt
+share/doc/dspam/qmail.txt
+share/doc/dspam/sendmail.txt
share/examples/dspam/
share/examples/dspam/dspam.conf
-%%sqlite%%
-%%mysql%%
-%%pgsql%%
[EMAIL PROTECTED] rm -rf /var/dspam
[EMAIL PROTECTED] /etc/dspam.conf
[EMAIL PROTECTED] install -o _dspam -g _dspam -m 755 -d /var/dspam