OSSP CVS Repository

ossp - Difference in ossp-pkg/lmtp2nntp/lmtp2nntp.c versions 1.44 and 1.45
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

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