OSSP CVS Repository

ossp - Check-in [787]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 787
Date: 2001-Aug-29 16:58:21 (local)
2001-Aug-29 14:58:21 (UTC)
User:thl
Branch:
Comment: added -m maxmessagesize option
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/00TODO      1.20 -> 1.21     0 inserted, 1 deleted
ossp-pkg/lmtp2nntp/lmtp.c      1.17 -> 1.18     1 inserted, 1 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp.c      1.33 -> 1.34     18 inserted, 9 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp.pod      1.8 -> 1.9     26 inserted, 2 deleted

ossp-pkg/lmtp2nntp/00TODO 1.20 -> 1.21

--- 00TODO       2001/08/28 14:27:35     1.20
+++ 00TODO       2001/08/29 14:58:21     1.21
@@ -1,5 +1,4 @@
 
-M=NNNN im Sendmail ergaenzen (weil Postfix gar nix hat) durch -l Commandline options fuer Maximum Message Size
 use "RFC1918-like" private Domainnames for @example.com (check which name is registered)
 whatsup draufleiten
 RFC1891 ENVID


ossp-pkg/lmtp2nntp/lmtp.c 1.17 -> 1.18

--- lmtp.c       2001/08/28 11:31:22     1.17
+++ lmtp.c       2001/08/29 14:58:21     1.18
@@ -218,7 +218,7 @@
     size_t offset;     /* required when cpBuf changed through realloc */
     size_t offsetline; /* memorizing start of line when reallocing in the middle of a line */
 
-    nBuf = 4096;
+    for (nBuf = 4096; nBuf > maxlen; nBuf = nBuf >> 1);
     if ((cpBuf = (char *)malloc(nBuf)) == NULL)
         return LMTP_ERR_MEM;
     *cppBuf = cpBuf;                           /* tell caller about the buffer */


ossp-pkg/lmtp2nntp/lmtp2nntp.c 1.33 -> 1.34

--- lmtp2nntp.c  2001/08/28 14:27:35     1.33
+++ lmtp2nntp.c  2001/08/29 14:58:21     1.34
@@ -52,7 +52,6 @@
 #define ERR_EXECUTION -1
 #define ERR_DELIVERY -2
 
-#define MESSAGE_MAXLEN 8*1024*1024
 #define STDSTRLEN 128
 #define MAXNEWSSERVICES 3
 
@@ -94,6 +93,7 @@
     int             option_deliverymode;
     char           *option_deliverymodefakestatus;
     char           *option_deliverymodefakedsn;
+    int             option_maxmessagesize;
     int             nsc;
     struct ns       ns[MAXNEWSSERVICES];
     char           *azGroupargs;
@@ -130,8 +130,8 @@
      */
     fprintf(stderr, 
             "USAGE: %s "
-            "lmtp2nntp [-d deliverymode] [-g groupmode] [-h host[:port]] "
-            "[-t tracefile] [-v] [-V] newsgroup [newsgroup ...]"
+            "[-d deliverymode] [-g groupmode] [-h host[:port]] "
+            "[-m maxmessagesize] [-t tracefile] [-v] [-V] newsgroup [newsgroup ...]"
             "\n",
             command);
     return;
@@ -163,6 +163,7 @@
     ctx->option_deliverymode = DELIVERYMODE_FAKE;
     ctx->option_deliverymodefakestatus = "553";   /* Requested action not taken: mailbox name not allowed */
     ctx->option_deliverymodefakedsn    = "5.7.1"; /* Delivery not authorized, message refused */
+    ctx->option_maxmessagesize = 8 * 1024 * 1024;
     ctx->nsc = 0;
     for (i=0; i < MAXNEWSSERVICES; i++) {
         ctx->ns[i].h = NULL;
@@ -199,12 +200,12 @@
     /*POD B<lmtp2nntp> */
 
     /*  use
-     *  perl <lmtp2nntp.c -e 'while (<>) { if(m/\/\*POD (.*) .*\*\//) { $_=$1; s/.<(.*?)>/$1/g ; print "$_\n" };}'
+     *  perl <lmtp2nntp.c -e 'while (<>) { if(m/\/\*POD (.*) .*\*\//) { $_=$1; print "$_\n" };}'
      *  to pull the POD SYNOPSIS header directly out of this source
      */
 
     /* read in the arguments */
-    while ((i = getopt(argc, argv, "d:g:h:t:vV")) != -1) {
+    while ((i = getopt(argc, argv, "d:g:h:m:t:vV")) != -1) {
         switch (i) {
             case 'd': /*POD [B<-d> I<deliverymode>] */
                 if      (strcasecmp(optarg, "post") == 0)
@@ -304,6 +305,13 @@
                 }
                 free(azHosts);
                 break;
+            case 'm': /*POD [B<-m> I<maxmessagesize>] */
+                    ctx->option_maxmessagesize = atoi(optarg);
+                    if(ctx->option_maxmessagesize < 64) {
+                        fprintf(stderr, "%s:Error: maximum message size is unacceptable small.\n", progname);
+                        exit(ERR_EXECUTION);
+                    }
+                break;
             case 't': /*POD [B<-t> I<tracefile>] */
                 ctx->option_tracing = TRUE;
                 trace_read (-1, optarg, 0);
@@ -873,16 +881,17 @@
     res.statusmsg  = "Enter mail, end with \".\" on a line by itself";
     lmtp_response(lmtp, &res);
 
-    rc = lmtp_readmsg(lmtp, &ctx->msg->cpMsg, MESSAGE_MAXLEN);
+    rc = lmtp_readmsg(lmtp, &ctx->msg->cpMsg, ctx->option_maxmessagesize);
 
     /*  RFC0821 4.2.1. REPLY CODES BY FUNCTION GROUPS   552 Requested mail action aborted: exceeded storage allocation
      *  RFC1893 2. Status Codes                         5.X.X   Permanent Failure
-     *  RFC1893 3.5 Network and Routing Status          X.3.4   Message too big for system
+     *  RFC1893 3.5 Network and Routing Status          X.2.3   Message length exceeds administrative limit.
+
      */
     if (rc == LMTP_ERR_OVERFLOW) {
-        str_format(errorstring, sizeof(errorstring), "Overflow reading message: %s", lmtp_error(rc));
+        str_format(errorstring, sizeof(errorstring), "Message length exceeds administrative limit. %s", lmtp_error(rc));
         res.statuscode = "552";
-        res.dsncode    = "5.3.4";
+        res.dsncode    = "5.2.3";
         res.statusmsg  = errorstring;
         rcpt = NULL;
         while ((rcpt = argz_next(ctx->msg->azRcpt, ctx->msg->asRcpt, rcpt)) != NULL) {


ossp-pkg/lmtp2nntp/lmtp2nntp.pod 1.8 -> 1.9

--- lmtp2nntp.pod        2001/08/28 13:12:58     1.8
+++ lmtp2nntp.pod        2001/08/29 14:58:21     1.9
@@ -11,10 +11,10 @@
 [B<-d> I<deliverymode>]
 [B<-g> I<groupmode>]
 [B<-h> I<host>[I<:port>]]
+[B<-m> I<maxmessagesize>]
 [B<-t> I<tracefile>]
 [B<-v>]
 [B<-V>]
-I<newsgroup> [I<newsgroup> ...]
 B<FIXME NOT YET IMPLEMENTED>
 [B<-o> I<origin>]
 [B<-j> I<hostname>]
@@ -53,6 +53,11 @@
 
 LMTP and NNTP protocol timeouts (in seconds).
  
+=item [B<-m> I<maxmessagesize>]
+
+Maximum message size in bytes. Default is 8388608 (8M). Values below 64 are
+considered unacceptable small.
+
 =item B<-p> I<protocol>
 
 Incoming protocol. Default is C<stdin> which means B<lmtp2nntp>
@@ -126,7 +131,26 @@
 
 =head1 SENDMAIL INTEGRATION
 
-  Mlmtp2nntp, P=/... /*FIXME*/
+t.virtusertable
+
+    # mail to news gateway
+    posting+*@mail.de.cw.net %2@lmtp2nntp
+
+t.mailertable
+
+    # mail to news gateway
+    lmtp2nntp       lmtp2nntp:visp.engelschall.com
+
+sendmail.m4
+
+    dnl #  Mailer: LMTP2NNTP (mail to news gateway)
+    define(`LMTP2NNTP_MAILER_PATH',         `confMYBINDIR/lmtp2nntp')
+    define(`LMTP2NNTP_MAILER_MAX',          `100000')
+    define(`LMTP2NNTP_MAILER_DELIVERYMODE', `post')
+    define(`LMTP2NNTP_MAILER_GROUPMODE',    `envelope')
+    define(`LMTP2NNTP_MAILER_ARGS',         `-t confMYVARDIR/lmtp2nntp.log')
+    define(`LMTP2NNTP_MAILER_GROUPS',       `cw.\* en.\*')
+    MAILER(lmtp2nntp)
 
 =head1 EXAMPLE
 

CVSTrac 2.0.1