From: Jean-Marc Pigeon (Delson) Date: Sat, 19 Jul 2025 04:40:07 +0000 (-0400) Subject: Adjusting code for MAIL FROM SIZE=1234 X-Git-Tag: tag-0.14~48 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=06a3e5815598e6677335574ef9425c16daf3dbd9;p=jmp%2Fmailleur Adjusting code for MAIL FROM SIZE=1234 --- diff --git a/Makefile.dbg b/Makefile.dbg index 49bc404..af27a0e 100644 --- a/Makefile.dbg +++ b/Makefile.dbg @@ -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 diff --git a/data-feed/feed01.tst b/data-feed/feed01.tst index 5ff901a..64702de 100644 --- a/data-feed/feed01.tst +++ b/data-feed/feed01.tst @@ -17,7 +17,7 @@ R:250-AUTH PLAIN LOGIN DIGEST-MD5 R:250-SIZE 52428800 R:250-8BITMIME R:250 ENHANCEDSTATUSCODES -S:MAIL FROM: +S:MAIL FROM: SIZE=1024 R:250 2.1.3 postmaster@example.com.. sender ok S:RCPT TO: R:250 2.6.4 Address accepted diff --git a/lib/lvleml.c b/lib/lvleml.c index 658acec..a406d43 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -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);