From f9c82bef500f29eff4a353a6ac125d6b5f1aebea Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Sun, 18 May 2025 15:40:40 -0400 Subject: [PATCH] Able to set 'L' or 'R' about recipient domain --- data-feed/xxfeed.tst | 2 ++ lib/lvleml.c | 49 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/data-feed/xxfeed.tst b/data-feed/xxfeed.tst index 038bd15..f9290fa 100644 --- a/data-feed/xxfeed.tst +++ b/data-feed/xxfeed.tst @@ -7,6 +7,8 @@ S:HELO example.com R:250-mailleur.example.com, link (cleartext) ready,... S:MAIL FROM: R:250 2.1.3 postmaster@example.com.. sender ok +S:RCPT TO: +R:250 2.6.4 Address accepted S:RCPT TO: R:250 2.6.4 Address accepted S:RCPT TO: diff --git a/lib/lvleml.c b/lib/lvleml.c index e4b89dd..463e9c9 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -60,6 +60,54 @@ return contact; */ /********************************************************/ /* */ +/* Procedure to get the domain code */ +/* */ +/********************************************************/ +static _Bool setlocdom(CONTYP *contact,RCPTYP *rcpt) + +{ +#define OPEP "lvleml.c:setlocdom," + +char done; +int phase; +_Bool proceed; + +done=true; +phase=0; +proceed=true; +while (proceed==true) { + //(void) rou_alert(0,"JMPDBG %s phase='%d' parm=<%s>",OPEP,phase,parameter); + switch (phase) { + case 0 : //is RCPT ok; + if ((rcpt==(RCPTYP *)0)||(rcpt->domain==(char *)0)) { + (void) rou_alert(0,"%s Recipient is NULL (Bug!?)",OPEP); + done=false; + phase=999; + } + break; + case 1 : //check about local domain, TEMPORARY code + if (strcmp(rcpt->domain,"example.com")==0) { + rcpt->code='L'; //domain is local + phase=999; //No need to go further + } + break; + case 2 : //domain is a remote one + rcpt->code='R'; + break; + default : //SAFE Guard + proceed=false; + break; + } + phase++; + } +return done; +#undef OPEP +} +/* +^L +*/ +/********************************************************/ +/* */ /* Procedure to transmit a string to the remot peer*/ /* */ /********************************************************/ @@ -501,6 +549,7 @@ while (proceed==true) { } break; case 3 : //Do we have a domain MX + (void) setlocdom(contact,neu); if (neu->domain!=(const char *)0) { //always MXTYP **mx; -- 2.47.3