OSSP CVS Repository

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

Check-in Number: 906
Date: 2001-Sep-10 08:50:56 (local)
2001-Sep-10 06:50:56 (UTC)
User:thl
Branch:
Comment: added -m mailfrom filter
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/00TODO      1.27 -> 1.28     3 inserted, 17 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp.c      1.44 -> 1.45     20 inserted, 1 deleted

ossp-pkg/lmtp2nntp/00TODO 1.27 -> 1.28

--- 00TODO       2001/09/07 13:53:16     1.27
+++ 00TODO       2001/09/10 06:50:56     1.28
@@ -1,6 +1,4 @@
 
-whatsup draufleiten
-
 panic   = unexpected
 error   = i/o error, errno ...
 warning = NNTP connect failed
@@ -8,21 +6,14 @@
 trace   = ist bisheriger trace.c
 debug   = developer meldungen
 
-
-Hallo Thomas, wir haben festgestellt, dass wir noch ein feature brauchen.
-Momentan waere es moeglich, dass jeder x-beliebige (der die entsprechende
-Mail-Adresse kennt) eine Mail an mail.de.cw.net schickt, und diese somit auf
-unsern News-Server abgebildet wird. Wir brauchen daher noch einen Filter, der
-dies pro Gruppe auf einen definierten, erlaubten Absender erlaubt.
-[B<-m> I<mailfrom>]
-
-use L2 for logging, grab ID through RFC1891 ENVID, 6.2
-[B<-i> I<messageid>]
+[B<-i> I<messageid>] use L2 for logging, grab ID through RFC1891 ENVID, 6.2
 
 CU/CUS
 
 str debugging
 
+FIXME 
+
 check str library version
 - openpkg (package time)
 - autoconf, (autoconf time)
@@ -33,11 +24,6 @@
 
     **** DEVELOPMENT INFORMATION ****
 
-news-muc1.de.cw.net Feeder
-news-ffm2.de.cw.net Feeder
-news-dus2.de.cw.net Feeder
-news.ecrc.de        Feeder/Reader
-
   Debugging:
   $ ./.configure [wegen --with-dmalloc!]
   $ dmalloc -l dmalloc.log


ossp-pkg/lmtp2nntp/lmtp2nntp.c 1.44 -> 1.45

--- lmtp2nntp.c  2001/09/07 15:02:08     1.44
+++ lmtp2nntp.c  2001/09/10 06:50:56     1.45
@@ -435,7 +435,11 @@
                 free(azHosts);
                 break;
             case 'm': /*POD [B<-m> I<mailfrom>] */
-                    ctx->option_mailfrom = strdup(optarg);
+                ctx->option_mailfrom = strdup(optarg);
+                if (str_parse("<>", ctx->option_mailfrom) == -1) {
+                    fprintf(stderr, "%s:Error: illegal regex \"%s\" to option -m.\n", ctx->progname, ctx->option_mailfrom);
+                    exit(ERR_EXECUTION);
+                }
                 break;
             case 'n': /*POD [B<-n> I<nodename>] */
                 if (strlen(optarg) > sizeof(ctx->uname.nodename)-1) {
@@ -1087,6 +1091,21 @@
         return LMTP_OK;
     }
     
+    /*  RFC0821 4.2.1. REPLY CODES BY FUNCTION GROUPS   550 Requested action not taken: mailbox unavailable
+     *  RFC1893 2. Status Codes                         5.X.X   Permanent Failure
+     *  RFC1893 3.5 Network and Routing Status          X.7.1   Delivery not authorized, message refused
+     */
+    if ((ctx->option_mailfrom != NULL) &&
+        (str_parse(ctx->msg->mail_from, ctx->option_mailfrom) <= 0)) {
+        res.statuscode = "550";
+        res.dsncode    = "5.7.1";
+        res.statusmsg  = "Delivery not authorized, message refused.";
+        lmtp_response(lmtp, &res);
+        msg_destroy(ctx->msg);
+        ctx->msg = NULL;
+        return LMTP_OK;
+    }
+
     /*  RFC0821 4.2.1. REPLY CODES BY FUNCTION GROUPS   250 Requested mail action okay, completed
      *  RFC1893 2. Status Codes                         2.X.X   Success
      *  RFC1893 3.5 Network and Routing Status          X.1.0   Other address status

CVSTrac 2.0.1