From: Jean-Marc Pigeon (Delson) Date: Wed, 25 Jun 2025 09:54:36 +0000 (-0400) Subject: Staring to implement local user existing implementation X-Git-Tag: tag-0.10~39 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=11ed5c8e45e28f35a9558eafc26a38cf7eea2c05;p=jmp%2Fmailleur Staring to implement local user existing implementation --- diff --git a/lib/lvleml.c b/lib/lvleml.c index 43bbbb4..80a1e34 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -261,6 +261,40 @@ return status; */ /********************************************************/ /* */ +/* checking if local recipient is acceptable. */ +/* */ +/********************************************************/ +static _Bool is_user_good(CONTYP *contact,RCPTYP *user) + +{ +_Bool isok; +int phase; +_Bool proceed; + +isok=true; +phase=0; +proceed=true; +while (proceed==true) { + switch (phase) { + case 0 : //is user a local user + if (user->code!='L') + phase=999; //User is Not local + break; + case 1 : //is user existing within database + break; + default : //SAFE Guard + proceed=false; + break; + } + phase++; + } +return isok; +} +/* +^L +*/ +/********************************************************/ +/* */ /* Procedure to check if helo or ehlo paratmeter */ /* is a correct one */ /* */ @@ -744,19 +778,19 @@ while (proceed==true) { switch (phase) { case 0 : //do we have a mailfrom if ((contact->mailfrom==(char *)0)||(strlen(contact->mailfrom)==0)) { - (void) transmit(contact,true,"%d Bad sequence of commands.",BADSEQ); + (void) transmit(contact,true,"%d 5.6.0 Bad sequence of commands.",BADSEQ); phase=999; //no need to go further } break; case 1 : //do we have an originator if ((rcptto==(char *)0)||(strlen(rcptto)==0)) { - (void) transmit(contact,true,"%d 5.6.0 recipient not specified",BADPAR); + (void) transmit(contact,true,"%d 5.6.1 recipient not specified",BADPAR); phase=999; //no need to go further } break; case 2 : //check rcpt format if ((rcptto[0]!='<')||(rcptto[strlen(rcptto)-1]!='>')) { - (void) transmit(contact,true,"%d 5.6.1 '%s' bad Format error", + (void) transmit(contact,true,"%d 5.6.2 '%s' bad Format error", BADPAR,rcptto); phase=999; //no need to go further } @@ -766,14 +800,14 @@ while (proceed==true) { case 3 : //checking rcptto format neu=eml_isemailok(rcptto,&report); if (neu==(RCPTYP *)0) { - (void) transmit(contact,true,"%d 5.6.2 %s",NOTEML,report); + (void) transmit(contact,true,"%d 5.6.3 %s",NOTEML,report); report=rou_freestr(report); phase=999; //no need to go further } break; case 4 : //Do we have a domain MX if (setlocdom(contact,neu)==false) { - (void) transmit(contact,true,"%d 5.6.3 %s (domain=%s)", + (void) transmit(contact,true,"%d 5.6.4 %s (domain=%s)", MISSMX, "No valid MX found for recipient domain name", neu->domain); @@ -781,13 +815,19 @@ while (proceed==true) { phase=999; //no need to go further } break; - case 5 : //Storing rcpt to + case 5 : //if the user is acceptable + if (is_user_good(contact,neu)==false) { + neu=eml_freerecipient(neu); + phase=999; + } + break; + case 6 : //Storing rcpt to if (eml_addrecipient(&(contact->recipients),neu)==false) { detail="duplicate recipients will be consolidated"; neu=eml_freerecipient(neu); } break; - case 6 : //everything ok + case 7 : //everything ok (void) transmit(contact,true,"%d 2.6.4 %s <%s>",CMDOK,detail,rcptto); success=true; break;