summaryrefslogtreecommitdiff
path: root/mail/dspam
diff options
context:
space:
mode:
authorxtraeme <xtraeme@pkgsrc.org>2004-10-27 23:27:00 +0000
committerxtraeme <xtraeme@pkgsrc.org>2004-10-27 23:27:00 +0000
commit008533d8256e2214739b756ffdc69ff7a2ef5930 (patch)
treeb431ae3303d74539e8bb2934c40b3c7790795413 /mail/dspam
parent13f538476201193f538c72a207c56daac7457299 (diff)
downloadpkgsrc-008533d8256e2214739b756ffdc69ff7a2ef5930.tar.gz
Apply patch from dspam CVS to fix some errors when using MySQL-4.1.x.
Bump PKGREVISION.
Diffstat (limited to 'mail/dspam')
-rw-r--r--mail/dspam/Makefile3
-rw-r--r--mail/dspam/distinfo3
-rw-r--r--mail/dspam/patches/patch-ab109
3 files changed, 113 insertions, 2 deletions
diff --git a/mail/dspam/Makefile b/mail/dspam/Makefile
index a99a7674ea2..61c0987ef75 100644
--- a/mail/dspam/Makefile
+++ b/mail/dspam/Makefile
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.11 2004/10/22 05:43:29 xtraeme Exp $
+# $NetBSD: Makefile,v 1.12 2004/10/27 23:27:00 xtraeme Exp $
DISTNAME= dspam-3.2.0
+PKGREVISION= 1
CATEGORIES= mail
MASTER_SITES= http://www.nuclearelephant.com/projects/dspam/sources/
diff --git a/mail/dspam/distinfo b/mail/dspam/distinfo
index 36dc5ab974b..ca2adf4b0b0 100644
--- a/mail/dspam/distinfo
+++ b/mail/dspam/distinfo
@@ -1,5 +1,6 @@
-$NetBSD: distinfo,v 1.3 2004/10/22 05:43:29 xtraeme Exp $
+$NetBSD: distinfo,v 1.4 2004/10/27 23:27:00 xtraeme Exp $
SHA1 (dspam-3.2.0.tar.gz) = 45dd9addddf42bf8e891c3f35fd9009f4fae9a5f
Size (dspam-3.2.0.tar.gz) = 617716 bytes
SHA1 (patch-aa) = 0f5ca6fc4c03ea0b73ccd1214f047fec6ffe4cb3
+SHA1 (patch-ab) = 31711472c5b7b60cd8ecbe1427d56e2a86e28024
diff --git a/mail/dspam/patches/patch-ab b/mail/dspam/patches/patch-ab
new file mode 100644
index 00000000000..4cbcb82b05e
--- /dev/null
+++ b/mail/dspam/patches/patch-ab
@@ -0,0 +1,109 @@
+$NetBSD: patch-ab,v 1.1 2004/10/27 23:27:00 xtraeme Exp $
+
+Fix for MySQL 4.1.x users:
+
+http://dspam.nuclearelephant.com/dspam-users/5709.html
+
+--- mysql_drv.c.orig 2004-10-28 01:01:32.000000000 +0200
++++ mysql_drv.c 2004-10-28 01:07:44.000000000 +0200
+@@ -512,10 +512,10 @@
+ struct _ds_spam_stat stat, stat2;
+ struct lht_node *node_lht;
+ struct lht_c c_lht;
+- buffer *query, *insert;
++ buffer *query;
+ char scratch[1024];
+ struct passwd *p;
+- int update_one = 0, insert_one = 0;
++ int update_one = 0;
+
+ if (s->dbh == NULL)
+ {
+@@ -546,14 +546,6 @@
+ return EUNKNOWN;
+ }
+
+- insert = buffer_create(NULL);
+- if (insert == NULL)
+- {
+- buffer_destroy(query);
+- LOG (LOG_CRIT, ERROR_MEM_ALLOC);
+- return EUNKNOWN;
+- }
+-
+ if (s->control_token == 0)
+ {
+ node_lht = c_lht_first (freq, &c_lht);
+@@ -585,9 +577,6 @@
+
+ buffer_cat (query, scratch);
+
+- buffer_copy (insert, "insert into dspam_token_data(uid, token, spam_hits, "
+- "innocent_hits, last_hit) values");
+-
+ node_lht = c_lht_first (freq, &c_lht);
+ while (node_lht != NULL)
+ {
+@@ -605,7 +594,7 @@
+
+ if (stat2.disk != 'Y')
+ {
+- char ins[1024];
++ char insert[1024];
+
+ /* If we're processing a message with a MERGED group, assign it based on
+ an empty count and not the current count (since the current count
+@@ -615,25 +604,27 @@
+ on the actual count (so that tools like dspam_merge don't break) */
+
+ if (CTX->flags & DSF_MERGED) {
+- snprintf (ins, sizeof (ins),
+- "%s(%d, '%llu', %d, %d, current_date())",
+- (insert_one) ? ", " : "",
++ snprintf (insert, sizeof (insert),
++ "insert into dspam_token_data(uid, token, spam_hits, "
++ "innocent_hits, last_hit) values(%d, '%llu', %d, %d, "
++ "current_date())",
+ p->pw_uid,
+ node_lht->key,
+ stat.spam_hits > s->control_sh ? 1 : 0,
+ stat.innocent_hits > s->control_ih ? 1 : 0);
+ } else {
+- snprintf (ins, sizeof (ins),
+- "%s(%d, '%llu', %ld, %ld, current_date())",
+- (insert_one) ? ", " : "",
++ snprintf(insert, sizeof (insert),
++ "insert into dspam_token_data(uid, token, spam_hits, "
++ "innocent_hits, last_hit) values(%d, '%llu', %ld, %ld, "
++ "current_date())",
+ p->pw_uid,
+ node_lht->key,
+ stat2.spam_hits,
+ stat2.innocent_hits);
+ }
+
+- insert_one = 1;
+- buffer_cat(insert, ins);
++ if (MYSQL_RUN_QUERY (s->dbh, insert))
++ stat2.disk = 'Y';
+ }
+
+ if (stat2.disk == 'Y')
+@@ -675,17 +666,6 @@
+ }
+ }
+
+- if (insert_one)
+- {
+- if (MYSQL_RUN_QUERY (s->dbh, insert->data))
+- {
+- _mysql_drv_query_error (mysql_error (s->dbh), insert->data);
+- buffer_destroy(insert);
+- return EFAILURE;
+- }
+- }
+-
+- buffer_destroy (insert);
+ buffer_destroy (query);
+ return 0;
+ }