]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Adjusting code for MAIL FROM <someone> SIZE=1234
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sat, 19 Jul 2025 04:40:07 +0000 (00:40 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sat, 19 Jul 2025 04:40:07 +0000 (00:40 -0400)
Makefile.dbg
data-feed/feed01.tst
lib/lvleml.c

index 49bc404c6691e60f1b52805df25a5ca2256f556d..af27a0e0f587050edf0c683e4b42c8fccb4a496a 100644 (file)
@@ -9,7 +9,7 @@ TESTDIR =       $(CURDIR)/test_area
 TESTSRV        =       mailleur.example.com
 TESTIP =       127.127.10.25
 TESTPORT=      1025
-TESTPROT=      smtps
+#TESTPROT=     smtps
 EXTIP  =       safemail3.safe.ca
 EXTPORT =      25
 TESTITER=      1
index 5ff901a3182245aba003a90a1130de982abf3374..64702deed2f2b8d51c27f55b1d7f92ee3ad6a61e 100644 (file)
@@ -17,7 +17,7 @@ R:250-AUTH PLAIN LOGIN DIGEST-MD5
 R:250-SIZE 52428800
 R:250-8BITMIME
 R:250 ENHANCEDSTATUSCODES
-S:MAIL FROM: <postmaster@example.com>
+S:MAIL FROM: <postmaster@example.com> SIZE=1024
 R:250 2.1.3 postmaster@example.com.. sender ok
 S:RCPT TO: <user1@mailref1.example.com>
 R:250 2.6.4 Address accepted <user1@mailref1.example.com>
index 658acec54ab2eb7370af7e5ec5c7c686201329db..a406d43676f6942e465ebf449c4e3917e6d0806b 100644 (file)
@@ -1448,11 +1448,13 @@ static _Bool checkfrom(CONTYP *contact,char *mailfrom)
 #define OPEP    "lvleml.c:checkfrom,"
 
 _Bool success;
-_Bool proceed;
+char *strsize;
 int status;
 int phase;
+_Bool proceed;
 
 success=false;
+strsize=(char *)0;
 status=CMDOK;
 proceed=true;
 phase=0;
@@ -1473,16 +1475,25 @@ while (proceed==true) {
         phase=999;      //no need to go further
         }
       break;
-    case 2      :       //check from format
+    case 2      :       //do we have SIZE= component
+      if ((strsize=strchr(mailfrom,' '))!=(char *)0) {
+        while (*strsize==' ') {
+          *strsize='\000';
+          strsize++;
+          }
+        //JMPDBG need to check size
+        }
+      break;
+    case 3      :       //check from format
       if ((mailfrom[0]!='<')||(mailfrom[strlen(mailfrom)-1]!='>')) {
-        (void) transmit(contact,true,"%d 5.5.2 '%s' bad Format error",
+        (void) transmit(contact,true,"%d 5.5.3 '%s' bad Format error",
                                      BADPAR,mailfrom);
         phase=999;      //no need to go further
         }
       mailfrom[strlen(mailfrom)-1]='\000'; 
       (void) memmove(mailfrom,mailfrom+1,strlen(mailfrom));
       break;
-    case 3      :       //check if contact authenticated
+    case 4      :       //check if contact authenticated
       switch (contact->privilege) {
         case rel_authentic      :       //User was authenticated
           break;
@@ -1491,19 +1502,19 @@ while (proceed==true) {
         case rel_isrelay        :       //Remote IP way already relay
           contact->privilege=rel_plain;
           if ((status=checkcredit(contact))!=CMDOK) {
-            (void) transmit(contact,true,"%d 5.5.3 Closing connection",status);
+            (void) transmit(contact,true,"%d 5.5.4 Closing connection",status);
             phase=999;      //bad credit not need to go further
             }
           break;
         default :
           (void) rou_alert(0,"%s unexpected priviliged='%d' (Bug?)",
                               OPEP,contact->privilege);
-            (void) transmit(contact,true,"%d 5.5.3 Closing connection",FAILED);
+            (void) transmit(contact,true,"%d 5.5.5 Closing connection",FAILED);
             phase=999;      //bad credit not need to go further
           break;
         }
       break;
-    case 4      :       //everything ok
+    case 5      :       //everything ok
       contact->mailfrom=strdup(mailfrom);
       (void) transmit(contact,true,"%d 2.1.3 %s.. sender ok",
                                     CMDOK,contact->mailfrom);