You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2007/12/10 14:20:29 UTC

svn commit: r602893 [3/3] - in /spamassassin/branches/bug-5293-pluginized-bayes: ./ build/ build/automc/ build/backup/ build/buildbot/ build/nightlymc/ lib/Mail/ lib/Mail/SpamAssassin/ lib/Mail/SpamAssassin/BayesStore/ lib/Mail/SpamAssassin/Conf/ lib/M...

Modified: spamassassin/branches/bug-5293-pluginized-bayes/rules/active.list
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/rules/active.list?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/rules/active.list (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/rules/active.list Mon Dec 10 05:20:24 2007
@@ -1,30 +1,24 @@
 # active ruleset list, automatically generated from http://ruleqa.spamassassin.org/
-# with results from: day 1: alexb bb-fredt bb-jm bb-zmi daf dos jm theo zmi; day 2: alexb bb-fredt bb-jm bb-zmi cthielen daf dos jm theo zmi; day 3: alexb bb-fredt bb-jm bb-zmi cthielen daf dos jm theo zmi
+# with results from: day 1: bb-fredt cthielen dos; day 2: bb-fredt cthielen dos; day 3: bb-fredt cthielen dos
 
 # tflags userconf
 ALL_TRUSTED
 
-# good enough
-APOSTROPHE_FROM
-
 # tflags userconf
 AWL
 
 # good enough
-AXB_XMID_1212
+AXB_RCVD_ZOOBSEND
 
 # good enough
-AXB_XMID_1510
+AXB_RCVD_ZOONAT
 
 # good enough
-AXB_XMID_OEGOESNULL
+AXB_XMID_1212
 
 # good enough
 BASE64_LENGTH_78_79
 
-# good enough
-BASE64_LENGTH_79_INF
-
 # tflags learn
 BAYES_00
 
@@ -52,9 +46,6 @@
 # tflags learn
 BAYES_99
 
-# good enough
-CARD_DIRECT_WWW_ADDRESS
-
 # tflags userconf
 CHARSET_FARAWAY
 
@@ -85,15 +76,6 @@
 # tflags net
 DNS_FROM_RFC_DSN
 
-# tflags net
-DNS_FROM_SECURITYSAGE
-
-# tflags publish
-DOS_ANAL_SPAM_MAILER
-
-# good enough
-DOS_FORGED_RCVD_QUADS
-
 # good enough
 DOS_OE_TO_MX
 
@@ -107,10 +89,10 @@
 DOS_OUTLOOK_TO_MX_IMAGE
 
 # good enough
-DOS_STOCK_BAT
+DRUGS_STOCK_MIMEOLE
 
 # good enough
-DRUGS_STOCK_MIMEOLE
+DVLABS_GOZI_PDF
 
 # good enough
 DYN_RDNS_AND_INLINE_IMAGE
@@ -124,38 +106,35 @@
 # tflags userconf
 ENV_AND_HDR_SPF_MATCH
 
-# good enough
-FAKE_REPLY_C
-
-# good enough
-FB_ACHIEVE_BACH
+# tflags net
+FAKE_HELO_EMAIL_COM
 
-# good enough
-FB_ADD_INCHES
+# tflags net
+FAKE_HELO_EXCITE
 
-# good enough
-FB_CASINO
+# tflags net
+FAKE_HELO_LYCOS
 
-# good enough
-FB_CIALIS_LEO3
+# tflags net
+FAKE_HELO_MAIL_COM
 
-# good enough
-FB_GVR
+# tflags net
+FAKE_HELO_MSN
 
-# good enough
-FB_HEY_BRO_COMMA
+# tflags net
+FAKE_HELO_YAHOO_CA
 
 # good enough
-FB_INDEPEND_RWD
+FB_ALMOST_SEX
 
 # good enough
-FB_LETTERS_21B
+FB_CIALIS_LEO3
 
 # good enough
-FB_LOWER_PAYM
+FB_EXTRA_INCHES
 
 # good enough
-FB_NO_SCRIP_NEEDED
+FB_GVR
 
 # good enough
 FB_QUALITY_REPLICA
@@ -164,19 +143,13 @@
 FB_REPLIC_CAP
 
 # good enough
-FB_SAVE_PERSC
+FB_SMALL_PEN
 
 # good enough
 FB_SOFTTABS
 
 # good enough
-FB_STRONGER_EJ
-
-# good enough
-FB_TO_STOP_DISTRO
-
-# good enough
-FB_YOUR_REFI
+FB_YOUR_WOMAN
 
 # good enough
 FH_BAD_OEV1441
@@ -188,12 +161,6 @@
 FH_DATE_PAST_20XX
 
 # good enough
-FH_FAKE_RCVD_LINE
-
-# good enough
-FH_FROMEML_NOTLD
-
-# good enough
 FH_FROM_CASH
 
 # good enough
@@ -212,109 +179,73 @@
 FH_HELO_EQ_D_D_D_D
 
 # good enough
-FH_HOST_ALMOST_IP
-
-# good enough
 FH_HOST_EQ_DYNAMICIP
 
 # good enough
-FH_HOST_EQ_D_D_D_D
-
-# good enough
 FH_HOST_EQ_PACBELL_D
 
 # good enough
 FH_HOST_EQ_VERIZON_P
 
 # good enough
-FH_MSGID_000000
-
-# good enough
-FH_MSGID_REPLACE
-
-# good enough
-FH_MSGID_XXBLAH
+FH_HOST_IN_ADDRARPA
 
 # good enough
 FH_MSGID_XXX
 
 # good enough
-FH_XMAIL_REPLACE
-
-# good enough
-FM_DDDD_TIMES_2
-
-# good enough
-FM_DOESNT_SAY_STOCK
+FM_FRM_RN_L_BRACK
 
 # good enough
-FM_FAKE_HELO_VERIZON
+FM_LOTTO_YOU_WON
 
 # good enough
-FM_RE_HELLO_SPAM
-
-# good enough
-FM_SCHOOL_DIPLOMA
+FM_SCHOOLING
 
 # good enough
 FM_SEX_HELODDDD
 
 # good enough
-FM_SEX_HOSTDDDD
-
-# good enough
-FM_SUBJ_APPROVE
-
-# good enough
 FM_XMAIL_F_OUT
 
 # tflags userconf
 FRAGMENTED_MESSAGE
 
 # good enough
-FRT_BEFORE
-
-# good enough
-FRT_DISCOUNT
-
-# good enough
 FRT_LEVITRA
 
 # good enough
-FRT_OPPORTUN2
-
-# good enough
 FRT_PENIS1
 
 # good enough
-FRT_REFINANCE1
+FRT_PRICE
 
 # good enough
 FRT_SEXUAL
 
 # good enough
-FRT_STRONG1
+FR_ALMOST_VIAG2
 
 # good enough
-FRT_SYMBOL
+FR_WATCHES_HTTP
 
 # good enough
-FRT_XANAX1
+FS_ABIGGER
 
 # good enough
-FR_ALMOST_VIAG2
+FS_EJACULA
 
 # good enough
-FS_DOLLAR_BONUS
+FS_ERECTION
 
 # good enough
-FS_EJACULA
+FS_GET_LAID
 
 # good enough
-FS_ERECTION
+FS_MORE_CONFIDENT
 
 # good enough
-FS_MORE_CONFIDENT
+FS_OBFU_PRMCY
 
 # good enough
 FS_REPLICA
@@ -323,20 +254,11 @@
 FS_REPLICAWATCH
 
 # good enough
-FS_START_DOYOU2
-
-# good enough
 FS_WILL_HELP
 
 # good enough
-FUZZY_MERIDIA
-
-# good enough
 FU_LONG_QUERY3
 
-# good enough
-GEO_QUERY_STRING
-
 # tflags userconf
 GTUBE
 
@@ -373,22 +295,10 @@
 # tflags userconf
 HASHCASH_HIGH
 
-# good enough
-HDR_ORDER_FTSDMCXX_001C
-
-# good enough
-HDR_ORDER_FTSDMCXX_BAT
-
 # tflags userconf
 HEAD_LONG
 
 # good enough
-HELO_FRIEND
-
-# good enough
-HELO_LH_HOME
-
-# good enough
 HELO_LH_LD
 
 # good enough
@@ -401,9 +311,6 @@
 HIGH_CODEPAGE_URI
 
 # good enough
-HS_FORGED_OE_FW
-
-# good enough
 HS_INDEX_PARAM
 
 # tflags userconf
@@ -419,10 +326,7 @@
 JM_GMT_RCVD
 
 # good enough
-JM_I_FEEL_LUCKY
-
-# good enough
-JM_RCVD_QMAILV1
+JM_NICE_GIRL
 
 # good enough
 JM_SOUGHT_1
@@ -436,6 +340,12 @@
 # good enough
 JM_TORA_XM
 
+# good enough
+KAM_LOTTO1
+
+# good enough
+KAM_LOTTO2
+
 # tflags publish
 KAM_STOCKOTC
 
@@ -443,19 +353,13 @@
 KAM_STOCKTIP15
 
 # good enough
-LOTTERY_1
-
-# good enough
-LOTTERY_PH_004470
-
-# good enough
-L_SPAM_TOOL_13
+KB_DATE_CONTAINS_TAB
 
 # good enough
-MID_DEGREES
+KB_FAKED_THE_BAT
 
 # good enough
-MIME_BOUND_EQ_REL
+LOTTERY_PH_004470
 
 # tflags userconf
 MIME_CHARSET_FARAWAY
@@ -476,9 +380,6 @@
 NO_RELAYS
 
 # good enough
-NULL_IN_BODY
-
-# good enough
 OUTLOOK_3416
 
 # tflags net
@@ -676,27 +577,42 @@
 # tflags net
 RCVD_IN_XBL
 
-# good enough
-RCVD_MAIL_COM
-
 # tflags net
 ROUND_THE_WORLD
 
-# good enough
-SHORT_HELO_AND_INLINE_IMAGE
+# tflags net
+ROUND_THE_WORLD_LOCAL
 
 # good enough
-SHORT_TERM_PRICE
+SHORT_HELO_AND_INLINE_IMAGE
 
 # good enough
 SPAMMY_XMAILER
 
+# tflags net
+SPF_FAIL
+
+# tflags net
+SPF_HELO_FAIL
+
+# tflags net
+SPF_HELO_NEUTRAL
+
 # tflags userconf
 SPF_HELO_PASS
 
+# tflags net
+SPF_HELO_SOFTFAIL
+
+# tflags net
+SPF_NEUTRAL
+
 # tflags userconf
 SPF_PASS
 
+# tflags net
+SPF_SOFTFAIL
+
 # good enough
 STOCK_IMG_CTYPE
 
@@ -706,18 +622,6 @@
 # good enough
 STOCK_IMG_HTML
 
-# good enough
-STOCK_IMG_OUTLOOK
-
-# good enough
-STOX_AND_PRICE
-
-# good enough
-STOX_META_5
-
-# good enough
-STOX_REPLY_TYPE
-
 # tflags userconf
 SUBJECT_IN_BLACKLIST
 
@@ -725,76 +629,25 @@
 SUBJECT_IN_WHITELIST
 
 # good enough
-SUBJ_RE_NUM
-
-# good enough
 TT_OBSCURED_VIAGRA
 
 # good enough
-TVD_DEAR_HOMEOWNER
-
-# good enough
-TVD_ENVFROM_APOST
-
-# good enough
-TVD_FINGER_02
-
-# good enough
-TVD_PDF_FINGER01_JO
-
-# good enough
-TVD_PH_SUBJ_URGENT
+TVD_PP_PHISH
 
 # good enough
 TVD_QUAL_MEDS
 
 # good enough
-TVD_RCVD_IP
-
-# good enough
-TVD_RCVD_IP4
-
-# good enough
-TVD_RCVD_SINGLE
-
-# good enough
-TVD_STOCK1
-
-# good enough
 TVD_VISIT_PHARMA
 
 # good enough
-AXB_RCVD_ZOOBSEND
-
-# good enough
-AXB_RCVD_ZOONAT
-
-# good enough
-AXB_XTIDX_CHAIN
-
-# good enough
-FB_SMALL_PEN
-
-# good enough
-FM_MORTGAGE3PLUS
-
-# good enough
-FRT_ERECTION
-
-# good enough
-FRT_OPPORTUN1
-
-# good enough
-FS_ABIGGER
-
-# good enough
-KAM_LOTTO1
+FB_ACHIEVE_BACH
 
 # good enough
-KAM_LOTTO2
+FRT_BELOW2
 
 # good enough
-KAM_LOTTO3
+FRT_PHARMAC
 
 # tflags net
 RCVD_IN_DSBL
@@ -1001,12 +854,6 @@
 XMAILER_MIMEOLE_OL_07794
 
 # good enough
-XMAILER_MIMEOLE_OL_09BB4
-
-# good enough
-XMAILER_MIMEOLE_OL_20C99
-
-# good enough
 XMAILER_MIMEOLE_OL_22B61
 
 # good enough
@@ -1019,12 +866,6 @@
 XMAILER_MIMEOLE_OL_3AC1D
 
 # good enough
-XMAILER_MIMEOLE_OL_3D61D
-
-# good enough
-XMAILER_MIMEOLE_OL_465CD
-
-# good enough
 XMAILER_MIMEOLE_OL_4B815
 
 # good enough
@@ -1040,6 +881,9 @@
 XMAILER_MIMEOLE_OL_58CB5
 
 # good enough
+XMAILER_MIMEOLE_OL_5B79A
+
+# good enough
 XMAILER_MIMEOLE_OL_6554A
 
 # good enough
@@ -1049,30 +893,15 @@
 XMAILER_MIMEOLE_OL_7533E
 
 # good enough
-XMAILER_MIMEOLE_OL_812FF
-
-# good enough
-XMAILER_MIMEOLE_OL_83BF7
-
-# good enough
 XMAILER_MIMEOLE_OL_8627E
 
 # good enough
-XMAILER_MIMEOLE_OL_8E893
-
-# good enough
 XMAILER_MIMEOLE_OL_91287
 
 # good enough
 XMAILER_MIMEOLE_OL_9B90B
 
 # good enough
-XMAILER_MIMEOLE_OL_A50F8
-
-# good enough
-XMAILER_MIMEOLE_OL_A842E
-
-# good enough
 XMAILER_MIMEOLE_OL_ADFF7
 
 # good enough
@@ -1088,9 +917,6 @@
 XMAILER_MIMEOLE_OL_C65FA
 
 # good enough
-XMAILER_MIMEOLE_OL_CAC8F
-
-# good enough
 XMAILER_MIMEOLE_OL_CF0C0
 
 # good enough
@@ -1104,9 +930,6 @@
 
 # good enough
 XMAILER_MIMEOLE_OL_F6D01
-
-# good enough
-XMAILER_MIMEOLE_OL_FF5C8
 
 # tflags net
 __DNS_FROM_RFC_ABUSE

Modified: spamassassin/branches/bug-5293-pluginized-bayes/spamassassin.raw
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/spamassassin.raw?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/spamassassin.raw (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/spamassassin.raw Mon Dec 10 05:20:24 2007
@@ -287,6 +287,7 @@
     die "spamassassin: oops! unhandled whitelist operation";
   }
 
+  $spamtest->finish();
   exit(0);
 }
 
@@ -382,6 +383,8 @@
 
 # if the eval died from something, report it here and return an error.
 if ($@) { die $@; }
+
+$spamtest->finish()  if $spamtest;
 
 # Ok, exit!
 exit( $exitvalue || 0 );

Modified: spamassassin/branches/bug-5293-pluginized-bayes/spamc/libspamc.c
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/spamc/libspamc.c?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/spamc/libspamc.c (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/spamc/libspamc.c Mon Dec 10 05:20:24 2007
@@ -27,6 +27,7 @@
 #include "libspamc.h"
 #include "utils.h"
 
+#include <stdarg.h>
 #include <stdlib.h>
 #include <assert.h>
 #include <stdio.h>
@@ -149,8 +150,13 @@
 {
     int flags;			/* copied from "flags" arg to message_read() */
     int alloced_size;           /* allocated space for the "out" buffer */
+
+    void (*spamc_header_callback)(struct message *m, int flags, char *buf, int len);
+    void (*spamd_header_callback)(struct message *m, int flags, const char *buf, int len);
 };
 
+void (*libspamc_log_callback)(int flags, int level, char *msg, va_list args) = NULL;
+
 int libspamc_timeout = 0;
 
 /*
@@ -458,7 +464,7 @@
     if (connect_retries == 0) {
       connect_retries = 3;
     }
-    if (retry_sleep == 0) {
+    if (retry_sleep < 0) {
       retry_sleep = 1;
     }
 
@@ -751,6 +757,8 @@
     }
     m->priv->flags = flags;
     m->priv->alloced_size = 0;
+    m->priv->spamc_header_callback = 0;
+    m->priv->spamd_header_callback = 0;
 
     if (flags & SPAMC_PING) {
       _clear_message(m);
@@ -1025,6 +1033,8 @@
 	  *didtellflags |= SPAMC_REMOVE_REMOTE;
 	}
     }
+    else if (m->priv->spamd_header_callback != NULL)
+      m->priv->spamd_header_callback(m, flags, buf, len);
 
     return EX_OK;
 }
@@ -1038,6 +1048,10 @@
 
 #ifndef HAVE_LIBZ
 
+    UNUSED_VARIABLE(m_msg);
+    UNUSED_VARIABLE(m_msg_len);
+    UNUSED_VARIABLE(zlib_buf);
+    UNUSED_VARIABLE(zlib_bufsiz);
     UNUSED_VARIABLE(rc);
     UNUSED_VARIABLE(len);
     UNUSED_VARIABLE(totallen);
@@ -1188,6 +1202,9 @@
     }
 
     m->is_spam = EX_TOOBIG;
+
+    if (m->outbuf != NULL)
+        free(m->outbuf);
     m->priv->alloced_size = m->max_len + EXPANSION_ALLOWANCE + 1;
     if ((m->outbuf = malloc(m->priv->alloced_size)) == NULL) {
 	failureval = EX_OSERR;
@@ -1376,7 +1393,7 @@
 	}
 
 
-	if (len + m->out_len > (m->priv->alloced_size-1)) {
+	if ((int) len + (int) m->out_len > (m->priv->alloced_size - 1)) {
 	    failureval = EX_TOOBIG;
 	    goto failure;
 	}
@@ -1501,6 +1518,9 @@
     }
 
     m->is_spam = EX_TOOBIG;
+
+    if (m->outbuf != NULL)
+        free(m->outbuf);
     m->priv->alloced_size = m->max_len + EXPANSION_ALLOWANCE + 1;
     if ((m->outbuf = malloc(m->priv->alloced_size)) == NULL) {
 	failureval = EX_OSERR;
@@ -1583,6 +1603,12 @@
     }
     len += sprintf(buf + len, "Content-length: %d\r\n\r\n", (int) m->msg_len);
 
+    if (m->priv->spamc_header_callback != NULL) {
+      char buf2[1024];
+      m->priv->spamc_header_callback(m, flags, buf2, 1024);
+      strncat(buf, buf2, bufsiz - len);
+    }
+
     libspamc_timeout = m->timeout;
 
     if (tp->socketpath)
@@ -1727,6 +1753,7 @@
     tp->type = TRANSPORT_LOCALHOST;
     tp->port = 783;
     tp->flags = 0;
+    tp->retry_sleep = -1;
 }
 
 /*
@@ -2038,6 +2065,36 @@
 
 }
 
+/*
+* register_libspamc_log_callback()
+*
+* Register a callback handler for libspamc_log to replace the default behaviour.
+*/
+
+void register_libspamc_log_callback(void (*function)(int flags, int level, char *msg, va_list args)) {
+  libspamc_log_callback = function;
+}
+
+/*
+* register_spamc_header_callback()
+*
+* Register a callback handler to generate spamc headers for a given message
+*/
+
+void register_spamc_header_callback(const struct message *m, void (*func)(struct message *m, int flags, char *buf, int len)) {
+  m->priv->spamc_header_callback = func;
+}
+
+/*
+* register_spamd_header_callback()
+*
+* Register a callback handler to generate spamd headers for a given message
+*/
+
+void register_spamd_header_callback(const struct message *m, void (*func)(struct message *m, int flags, const char *buf, int len)) {
+  m->priv->spamd_header_callback = func;
+}
+
 /* --------------------------------------------------------------------------- */
 
 #define LOG_BUFSIZ      1023
@@ -2051,7 +2108,10 @@
 
     va_start(ap, msg);
 
-    if ((flags & SPAMC_LOG_TO_STDERR) != 0) {
+    if ((flags & SPAMC_LOG_TO_CALLBACK) != 0 && libspamc_log_callback != NULL) {
+      libspamc_log_callback(flags, level, msg, ap);
+    }
+    else if ((flags & SPAMC_LOG_TO_STDERR) != 0) {
         /* create a log-line buffer */
         len = snprintf(buf, LOG_BUFSIZ, "spamc: ");
         len += vsnprintf(buf+len, LOG_BUFSIZ-len, msg, ap);

Modified: spamassassin/branches/bug-5293-pluginized-bayes/spamc/libspamc.h
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/spamc/libspamc.h?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/spamc/libspamc.h (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/spamc/libspamc.h Mon Dec 10 05:20:24 2007
@@ -128,6 +128,9 @@
 /* Jan 16, 2007 jm: get markup headers from spamd */
 #define SPAMC_HEADERS         (1<<15)
 
+/* December 5, 2007 duncf: send log messages to callback */
+#define SPAMC_LOG_TO_CALLBACK (1<<14)
+
 #define SPAMC_MESSAGE_CLASS_SPAM 1
 #define SPAMC_MESSAGE_CLASS_HAM  2
 
@@ -292,6 +295,11 @@
 int process_message(struct transport *tp, char *username,
 		    int max_size, int in_fd, int out_fd,
 		    const int check_only, const int safe_fallback);
+
+void register_spamc_header_callback(const struct message *m, void (*func)(struct message *m, int flags, char *buf, int len));
+void register_spamd_header_callback(const struct message *m, void (*func)(struct message *m, int flags, const char *buf, int len));
+
+void register_libspamc_log_callback(void (*function)(int flags, int level, char *msg, va_list args));
 
 void libspamc_log(int flags, int level, char *msg, ...);
 

Modified: spamassassin/branches/bug-5293-pluginized-bayes/spamd/spamd.raw
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/spamd/spamd.raw?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/spamd/spamd.raw (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/spamd/spamd.raw Mon Dec 10 05:20:24 2007
@@ -496,12 +496,15 @@
 # run with -u
 # we're not root
 # doing --vpopmail or --virtual-config-dir
-# we disable user-config
+# using --sql-config or --ldap-config
+# (unless we're also using --setuid-with-sql or --setuid-with-ldap)
 my $setuid_to_user = (
-	$opt{'username'} ||
-	$> != 0 ||
-	$opt{'vpopmail'} ||
-	$opt{'virtual-config-dir'}
+        $opt{'username'} ||
+        $> != 0 ||
+        $opt{'vpopmail'} ||
+        $opt{'virtual-config-dir'} ||
+        ($opt{'sql-config'} && !$opt{'setuid-with-sql'}) ||
+        ($opt{'ldap-config'} && !$opt{'setuid-with-ldap'})
       ) ? 0 : 1;
 
 dbg("spamd: will perform setuids? $setuid_to_user");
@@ -518,6 +521,18 @@
   }
 }
 
+if ($opt{'sql-config'} && !$opt{'setuid-with-sql'}) {
+  if ( !$opt{'username'} ) {
+    die "spamd: cannot use --sql-config without -u\n";
+  }
+}
+
+if ($opt{'ldap-config'} && !$opt{'setuid-with-ldap'}) {
+  if ( !$opt{'username'} ) {
+    die "spamd: cannot use --ldap-config without -u\n";
+  }
+}
+
 # always copy the config, later code may disable
 my $copy_config_p = 1;
 
@@ -2780,7 +2795,6 @@
 connections will be accepted on the B<--port> at the same time as encrypted
 connections are accepted at B<--ssl-port>.
 
-
 =item B<-q>, B<--sql-config>
 
 Turn on SQL lookups even when per-user config files have been disabled
@@ -2791,10 +2805,17 @@
 If your spamc client does not support sending the C<User:> header,
 like C<exiscan>, then the SQL username used will always be B<nobody>.
 
+This inhibits the setuid() behavior, so the C<-u> option is
+required. If you want the setuid() behaviour, use C<-Q> or
+C<--setuid-with-sql> instead.
+
 =item B<--ldap-config>
 
 Turn on LDAP lookups. This is completely analog to C<--sql-config>,
 only it is using an LDAP server.
+
+Like C<--sql-config>, this disables the setuid behavior, and requires
+C<-u>. If you want it, use C<--setuid-with-ldap> instead.
 
 =item B<-Q>, B<--setuid-with-sql>
 

Modified: spamassassin/branches/bug-5293-pluginized-bayes/sql/README
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/sql/README?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/sql/README (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/sql/README Mon Dec 10 05:20:24 2007
@@ -219,11 +219,6 @@
 with the utmost simplicity using DBI, and any database driver that conforms to
 the DBI interface should work without problems.
 
-******
-NB:  This should be considered BETA, and the interface, schema, or overall
-operation of SQL support may change at any time with future releases of SA.
-******
-
 Web Interfaces
 --------------
 

Modified: spamassassin/branches/bug-5293-pluginized-bayes/sql/README.awl
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/sql/README.awl?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/sql/README.awl (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/sql/README.awl Mon Dec 10 05:20:24 2007
@@ -137,8 +137,3 @@
 little or no problems.  If you find a driver that has issues, please
 report them to the SADev list.
 
-******
-NB:  This should be considered BETA, and the interface, schema, or overall
-operation of SQL support may change at any time with future releases of SA.
-******
-

Modified: spamassassin/branches/bug-5293-pluginized-bayes/sql/README.bayes
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/sql/README.bayes?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/sql/README.bayes (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/sql/README.bayes Mon Dec 10 05:20:24 2007
@@ -176,12 +176,6 @@
 over using the default DBM implementation.  If you find a driver that
 should work and has issues, please report them to the SADev list.
 
-******
-NB:  This should be considered BETA, and the interface, schema, or
-overall operation of SQL support may change at any time with future
-releases of SA.
-******
-
 Converting Bayes Data From a DBM Database
 -----------------------------------------
 

Modified: spamassassin/branches/bug-5293-pluginized-bayes/t/SATest.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/t/SATest.pm?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/t/SATest.pm (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/t/SATest.pm Mon Dec 10 05:20:24 2007
@@ -485,13 +485,14 @@
                     );
   unlink ($spamd_stdout, $spamd_stderr, $spamd_stdlog);
   print ("\t${spamd_cmd}\n");
+  my $startat = time;
   system ($spamd_cmd);
 
   # now find the PID
   $spamd_pid = 0;
   # note that the wait period increases the longer it takes,
   # 20 retries works out to a total of 60 seconds
-  my $retries = 20;
+  my $retries = 30;
   my $wait = 0;
   while ($spamd_pid <= 0) {
     my $spamdlog = '';
@@ -514,9 +515,11 @@
     }
 
     sleep (int($wait++ / 4) + 1) if $retries > 0;
+
     if ($retries-- <= 0) {
       warn "spamd start failed: log: $spamdlog";
-      warn "\n\nMaybe you need to kill a running spamd process?\n\n";
+      warn "\n\nMaybe you need to kill a running spamd process?\n";
+      warn "started at $startat, gave up at ".time."\n\n";
       return 0;
     }
   }
@@ -575,7 +578,17 @@
 
   return $sa;
 }
-  
+
+sub create_clientobj {
+  my $args = shift;
+
+  # We'll assume that the test has setup INC correctly
+  require Mail::SpamAssassin::Client;
+
+  my $client = Mail::SpamAssassin::Client->new($args);
+
+  return $client;
+}
 
 # ---------------------------------------------------------------------------
 

Modified: spamassassin/branches/bug-5293-pluginized-bayes/t/config.dist
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/t/config.dist?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/t/config.dist (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/t/config.dist Mon Dec 10 05:20:24 2007
@@ -10,6 +10,11 @@
 # Run DCC Tests
 run_dcc_tests=n
 
+
+# ---------------------------------------------------------------------------
+# Run SQL-based user pref tests during 'make test' REQUIRES DBD::SQLite
+run_sql_pref_tests=n
+
 # ---------------------------------------------------------------------------
 # Run SQL-based Auto-whitelist tests during 'make test' (additional
 # information required, below:)

Modified: spamassassin/branches/bug-5293-pluginized-bayes/t/rcvd_parser.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/t/rcvd_parser.t?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/t/rcvd_parser.t (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/t/rcvd_parser.t Mon Dec 10 05:20:24 2007
@@ -18,7 +18,7 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("rcvd_parser");
-use Test; BEGIN { plan tests => 130 };
+use Test; BEGIN { plan tests => 131 };
 use strict;
 
 # format is:
@@ -415,6 +415,9 @@
 
   'from dslb-082-083-045-064.pools.arcor-ip.net (EHLO homepc) [82.83.45.64] by mail.gmx.net (mp010) with SMTP; 03 Feb 2007 13:13:47 +0100' =>
   '[ ip=82.83.45.64 rdns=dslb-082-083-045-064.pools.arcor-ip.net helo=homepc by=mail.gmx.net ident= envfrom= intl=0 id= auth= msa=0 ]',
+
+  'from [86.122.158.69] by mta2.iomartmail.com; Thu, 2 Aug 2007 21:50:04 -0200' =>
+  '[ ip=86.122.158.69 rdns= helo=!86.122.158.69! by=mta2.iomartmail.com ident= envfrom= id= auth= msa=0 ]',
 
   'from p5498acaa.dip0.t-ipconnect.de (HELO JIMBOBSPC) (user@84.152.172.1) by msa.example.com with ESMTPA; 23 May 2007 15:05:04 -0000' =>
   '[ ip=84.152.172.1 rdns=p5498acaa.dip0.t-ipconnect.de helo=JIMBOBSPC by=msa.example.com ident=user envfrom= id= auth=ESMTPA msa=0 ]',

Modified: spamassassin/branches/bug-5293-pluginized-bayes/t/re_base_extraction.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/t/re_base_extraction.t?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/t/re_base_extraction.t (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/t/re_base_extraction.t Mon Dec 10 05:20:24 2007
@@ -22,7 +22,7 @@
   if (-e 't/test_dir') { chdir 't'; } 
   if (-e 'test_dir') { unshift(@INC, '../blib/lib'); }
 
-  plan tests => 122;
+  plan tests => 125;
 
 };
 use lib '../lib';
@@ -225,6 +225,29 @@
 
 # ---------------------------------------------------------------------------
 
+# also not suitable for perl 5.6.x
+($running_perl56) and ok(1);
+($running_perl56) and ok(1);
+($running_perl56) and ok(1);
+(!$running_perl56) and try_extraction ('
+
+  body FOO /foobar\x{e2}\x{82}\x{ac}baz/
+
+', {
+    base_extract => 1,
+    bases_must_be_casei => 0,
+    bases_can_use_alternations => 0,
+    bases_can_use_quantifiers => 0,
+    bases_can_use_char_classes => 0,
+    bases_split_out_alternations => 1
+}, [
+
+  'foobar:FOO,[l=0]',
+
+], [ ]);
+
+# ---------------------------------------------------------------------------
+
 try_extraction ('
     body FOO /(?:Viagra|Valium|Xanax|Soma|Cialis){2}/i
 
@@ -408,8 +431,9 @@
     site_rules_filename => "log/test_default.cf",
     userprefs_filename  => "log/userprefs.cf",
     local_tests_only    => 1,
-    debug             => $debug,
-    dont_copy_prefs   => 1,
+    debug               => $debug,
+    dont_copy_prefs     => 1,
+    base_quiet          => 1,
   });
   ok($sa);
 

Modified: spamassassin/branches/bug-5293-pluginized-bayes/t/spamd_kill_restart.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/t/spamd_kill_restart.t?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/t/spamd_kill_restart.t (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/t/spamd_kill_restart.t Mon Dec 10 05:20:24 2007
@@ -15,6 +15,10 @@
 my $pid_file = "log/spamd.pid";
 my($pid1, $pid2);
 
+tstlocalrules("
+    use_auto_whitelist 0
+  ");
+
 dbgprint "Starting spamd...\n";
 start_spamd("-L -r ${pid_file}");
 sleep 1;

Modified: spamassassin/branches/bug-5293-pluginized-bayes/t/spamd_kill_restart_rr.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/t/spamd_kill_restart_rr.t?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/t/spamd_kill_restart_rr.t (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/t/spamd_kill_restart_rr.t Mon Dec 10 05:20:24 2007
@@ -15,6 +15,10 @@
 my $pid_file = "log/spamd.pid";
 my($pid1, $pid2);
 
+tstlocalrules("
+      use_auto_whitelist 0
+  ");
+
 dbgprint "Starting spamd...\n";
 start_spamd("-L --round-robin -r ${pid_file}");
 sleep 1;
@@ -43,11 +47,13 @@
   $spamd_pid = 0;
 
   dbgprint "starting new spamd, loop try $retry...\n";
+  my $startat = time;
   start_spamd("-D -L --round-robin -r ${pid_file}");
 
   dbgprint "Waiting for spamd at pid $pid1 to restart...\n";
   wait_for_file_to_appear ($pid_file, 40);
-  ok (-e $pid_file) or warn "$pid_file does not exist post restart";
+  ok (-e $pid_file) or warn "$pid_file does not exist post restart; started at $startat, gave up at ".time;
+
   ok (!-z $pid_file) or warn "$pid_file is empty post restart";
   ok ($pid2 = read_from_pidfile($pid_file));
 

Modified: spamassassin/branches/bug-5293-pluginized-bayes/t/spamd_unix.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/t/spamd_unix.t?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/t/spamd_unix.t (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/t/spamd_unix.t Mon Dec 10 05:20:24 2007
@@ -18,6 +18,10 @@
 
 );
 
+tstlocalrules("
+      use_auto_whitelist 0
+    ");
+
 my $sockpath = mk_safe_tmpdir()."/spamd.sock";
 start_spamd("-D -L --socketpath=$sockpath");
 ok (spamcrun ("-U $sockpath < data/spam/001", \&patterns_run_cb));

Modified: spamassassin/branches/bug-5293-pluginized-bayes/t/trust_path.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/t/trust_path.t?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/t/trust_path.t (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/t/trust_path.t Mon Dec 10 05:20:24 2007
@@ -18,7 +18,7 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("trust_path");
-use Test; BEGIN { plan tests => 69 };
+use Test; BEGIN { plan tests => 81 };
 use IO::File;
 
 use strict;
@@ -425,6 +425,77 @@
 
 # ---------------------------------------------------------------------------
 
+# bug 5680: 'X-Originating-IP'
+q{
+
+  trusted_networks 1/8
+  Received: from sender.net (1.1.1.1) by receiver.net
+              with SMTP; 10 Nov 2005 00:00:00 -0000
+  X-Originating-IP: 2.2.2.2
+
+} => q{
+
+Trusted: [ ip=1.1.1.1 rdns=sender.net helo=sender.net by=receiver.net ident= envfrom= intl=1 id= auth= msa=0 ]
+Untrusted: [ ip=2.2.2.2 rdns= helo= by= ident= envfrom= intl=0 id= auth= msa=0 ]
+
+},
+
+# ---------------------------------------------------------------------------
+
+# bug 5680: 'X-Originating-IP', trusted
+q{
+
+  trusted_networks 1/8 2/8
+  internal_networks 1/8
+  Received: from sender.net (1.1.1.1) by receiver.net
+              with SMTP; 10 Nov 2005 00:00:00 -0000
+  X-Originating-IP: 2.2.2.2
+
+} => q{
+
+Trusted: [ ip=1.1.1.1 rdns=sender.net helo=sender.net by=receiver.net ident= envfrom= intl=1 id= auth= msa=0 ] [ ip=2.2.2.2 rdns= helo= by= ident= envfrom= intl=0 id= auth= msa=0 ]
+Untrusted: 
+
+},
+
+# ---------------------------------------------------------------------------
+
+# bug 5680: 'X-Originating-IP', msa
+q{
+
+  trusted_networks 1/8
+  msa_networks 1/8
+  Received: from sender.net (1.1.1.1) by receiver.net
+              with SMTP; 10 Nov 2005 00:00:00 -0000
+  X-Originating-IP: 2.2.2.2
+
+} => q{
+
+Trusted: [ ip=1.1.1.1 rdns=sender.net helo=sender.net by=receiver.net ident= envfrom= intl=1 id= auth= msa=1 ] [ ip=2.2.2.2 rdns= helo= by= ident= envfrom= intl=1 id= auth= msa=0 ]
+Untrusted: 
+
+},
+
+# ---------------------------------------------------------------------------
+
+# bug 5680: 'X-Originating-IP', internal
+q{
+
+  trusted_networks 1/8 2/8
+  internal_networks 1/8 2/8
+  Received: from sender.net (1.1.1.1) by receiver.net
+              with SMTP; 10 Nov 2005 00:00:00 -0000
+  X-Originating-IP: 2.2.2.2
+
+} => q{
+
+Trusted: [ ip=1.1.1.1 rdns=sender.net helo=sender.net by=receiver.net ident= envfrom= intl=1 id= auth= msa=0 ] [ ip=2.2.2.2 rdns= helo= by= ident= envfrom= intl=1 id= auth= msa=0 ]
+Untrusted: 
+
+},
+
+# ---------------------------------------------------------------------------
+
 # test to make sure netset is detecting overlap correctly when using short CIDR notations
 q{
 
@@ -497,7 +568,7 @@
   }
 
   my $msg = $hdrs."\n\n[no body]\n";
-  $msg =~ s/^\s+Received: /Received: /gm;
+  $msg =~ s/^\s+(Received|X-\S+): /$1: /gm;
   my $status = $sa->check_message_text ($msg);
   my $result = $status->rewrite_mail();
 

Modified: spamassassin/branches/bug-5293-pluginized-bayes/t/uri.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/bug-5293-pluginized-bayes/t/uri.t?rev=602893&r1=602892&r2=602893&view=diff
==============================================================================
--- spamassassin/branches/bug-5293-pluginized-bayes/t/uri.t (original)
+++ spamassassin/branches/bug-5293-pluginized-bayes/t/uri.t Mon Dec 10 05:20:24 2007
@@ -23,7 +23,7 @@
 use Mail::SpamAssassin::HTML;
 use Mail::SpamAssassin::Util;
 
-plan tests => 89;
+plan tests => 91;
 
 ##############################################
 
@@ -242,6 +242,19 @@
    'http://127.0.0.1',
    ]));
 
+ok(try_canon([
+   'http://0xcc.0xf.0x50.0x89/',
+   ], [
+   'http://0xcc.0xf.0x50.0x89/',
+   'http://204.15.80.137/',
+       ]));
+
+ok(try_canon([
+   'http://0xcc.0x50.0x89.0xf/',
+   ], [
+   'http://0xcc.0x50.0x89.0xf/',
+   'http://204.80.137.15/',
+       ]));
 
 ##############################################