From e3f92a7b4b829a23e235ee744a754aa010d53907 Mon Sep 17 00:00:00 2001 From: Jean-Marc Pigeon Date: Sat, 20 Sep 2025 05:18:14 -0400 Subject: [PATCH] Starting to implement badrcpt report within database --- lib/lvleml.c | 49 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/lib/lvleml.c b/lib/lvleml.c index 03883a8..7c19c6e 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -1176,8 +1176,6 @@ while (proceed==true) { phase++; } return status; - - #undef OPEP } /* @@ -1237,6 +1235,44 @@ return status; */ /************************************************/ /* */ +/* Procedure to report rcpt problem and */ +/* store status within the database. */ +/* */ +/************************************************/ +static void bad_rcpt(CONTYP *contact,char *rcpt,int smtpcode,char *fmt,...) + +{ +va_list args; +char **resp; +char *report; +char *info; +ACTTYP action; + +va_start(args,fmt); +resp=(char **)0; +(void) rou_vasprintf(&report,fmt,args); +(void) rou_asprintf(&info,"%d %s",smtpcode,report); +(void) rou_alert(0,"JMPDBG info=<%s>",info); +resp=(char **)rou_addlist((void **)resp,(void *)info); +(void) memset(&action,'\000',sizeof(ACTTYP)); +action.sessid=contact->session->sessid; +action.code='X'; +action.reverse=contact->peername; +action.sfrom=contact->mailfrom; +action.hfrom="----"; +action.hsubject="----"; +action.rcptto=rcpt; +action.resp=resp; +(void) eml_transmit(contact,true,"%s",info); +resp=(char **)rou_freelist((void **)resp,(genfree_t)rou_freestr); +report=rou_freestr(report); +va_end(args); +} +/* + +*/ +/************************************************/ +/* */ /* Procedure to send a simple SMTP ccommand*/ /* (no need to have the response wording) */ /* */ @@ -1763,10 +1799,9 @@ while (proceed==true) { break; case 4 : //Do we have a domain MX if (setlocdom(contact,neu)==false) { - (void) eml_transmit(contact,true,"%d 5.6.4 %s (domain=%s)", - MISSMX, - "No valid MX found for recipient " - "domain name",neu->domain); + (void) bad_rcpt(contact,rcptto,MISSMX,"5.6.4 %s (domain=%s)", + "No valid MX found for recipient " + "domain name",neu->domain); phase=999; //no need to go further } break; @@ -2742,7 +2777,7 @@ return contact; /********************************************************/ /* */ /* Procedure to wait for a remote client. */ -/* return the frreed memory contact (NULL pointer) */ +/* return the fee memory contact (NULL pointer) */ /* */ /********************************************************/ PUBLIC CONTYP *eml_dropcontact(CONTYP *contact) -- 2.47.3