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 2006/09/08 15:54:01 UTC

svn commit: r441496 - in /spamassassin/trunk/spamc: libspamc.c libspamc.h spamc.c spamc.pod

Author: jm
Date: Fri Sep  8 06:54:00 2006
New Revision: 441496

URL: http://svn.apache.org/viewvc?view=rev&rev=441496
Log:
bug 4928: document max message size limit in spamc; increase from a very arbitrary 9999999 bytes to a much harder-to-hit 250MB; and make it an explicit upper limit in spamc command-line UI.  Also, change exit code for this condition to a more appropriate EX_DATAERR if the message is too large

Modified:
    spamassassin/trunk/spamc/libspamc.c
    spamassassin/trunk/spamc/libspamc.h
    spamassassin/trunk/spamc/spamc.c
    spamassassin/trunk/spamc/spamc.pod

Modified: spamassassin/trunk/spamc/libspamc.c
URL: http://svn.apache.org/viewvc/spamassassin/trunk/spamc/libspamc.c?view=diff&rev=441496&r1=441495&r2=441496
==============================================================================
--- spamassassin/trunk/spamc/libspamc.c (original)
+++ spamassassin/trunk/spamc/libspamc.c Fri Sep  8 06:54:00 2006
@@ -1010,9 +1010,9 @@
 	strcat(buf + len, "\r\n");
 	len += strlen(buf + len);
       }
-      if ((m->msg_len > 9999999) || ((len + 27) >= (bufsiz - len))) {
+      if ((m->msg_len > SPAMC_MAX_MESSAGE_LEN) || ((len + 27) >= (bufsiz - len))) {
 	_use_msg_for_out(m);
-	return EX_OSERR;
+	return EX_DATAERR;
       }
       len += sprintf(buf + len, "Content-length: %d\r\n\r\n", (int) m->msg_len);
     }
@@ -1337,9 +1337,9 @@
 	strcat(buf + len, "\r\n");
 	len += strlen(buf + len);
     }
-    if ((m->msg_len > 9999999) || ((len + 27) >= (bufsiz - len))) {
+    if ((m->msg_len > SPAMC_MAX_MESSAGE_LEN) || ((len + 27) >= (bufsiz - len))) {
 	_use_msg_for_out(m);
-	return EX_OSERR;
+	return EX_DATAERR;
     }
     len += sprintf(buf + len, "Content-length: %d\r\n\r\n", (int) m->msg_len);
 

Modified: spamassassin/trunk/spamc/libspamc.h
URL: http://svn.apache.org/viewvc/spamassassin/trunk/spamc/libspamc.h?view=diff&rev=441496&r1=441495&r2=441496
==============================================================================
--- spamassassin/trunk/spamc/libspamc.h (original)
+++ spamassassin/trunk/spamc/libspamc.h Fri Sep  8 06:54:00 2006
@@ -122,6 +122,8 @@
 #define SPAMC_REMOVE_LOCAL       4
 #define SPAMC_REMOVE_REMOTE      8
 
+#define SPAMC_MAX_MESSAGE_LEN     (256 * 1024 * 1024)     /* see bug 4928 */
+
 /* Aug 14, 2002 bj: A struct for storing a message-in-progress */
 typedef enum
 {

Modified: spamassassin/trunk/spamc/spamc.c
URL: http://svn.apache.org/viewvc/spamassassin/trunk/spamc/spamc.c?view=diff&rev=441496&r1=441495&r2=441496
==============================================================================
--- spamassassin/trunk/spamc/spamc.c (original)
+++ spamassassin/trunk/spamc/spamc.c Fri Sep  8 06:54:00 2006
@@ -420,6 +420,12 @@
         }
     }
 
+    if (*max_size > SPAMC_MAX_MESSAGE_LEN) {
+        libspamc_log(flags, LOG_ERR, "-s parameter is beyond max of %d",
+                        SPAMC_MAX_MESSAGE_LEN);
+        ret = EX_USAGE;
+    }
+
     /* learning action has to block some parameters */
     if (flags & SPAMC_LEARN) {
         if (flags & SPAMC_CHECK_ONLY) {

Modified: spamassassin/trunk/spamc/spamc.pod
URL: http://svn.apache.org/viewvc/spamassassin/trunk/spamc/spamc.pod?view=diff&rev=441496&r1=441495&r2=441496
==============================================================================
--- spamassassin/trunk/spamc/spamc.pod (original)
+++ spamassassin/trunk/spamc/spamc.pod Fri Sep  8 06:54:00 2006
@@ -150,9 +150,10 @@
 Set the maximum message size which will be sent to spamd -- any bigger than
 this threshold and the message will be returned unprocessed (default: 500 KB).
 If spamc gets handed a message bigger than this, it won't be passed to spamd.
+The maximum message size is 256 MB.
 
 The size is specified in bytes, as a positive integer greater than 0.
-For example, B<-s 500000>.
+For example, B<-s 500000>. 
 
 =item B<-S>, B<--ssl>