From: Jean-Marc Pigeon Date: Tue, 18 Nov 2025 16:06:51 +0000 (-0500) Subject: Fix note_status parameters sequence X-Git-Tag: tag-0.18~23 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=e3ba4f53ef765bb7e6ba470b4849f818185cf517;p=jmp%2Fmailleur Fix note_status parameters sequence --- diff --git a/lib/lvleml.c b/lib/lvleml.c index 7786730..29e350d 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -223,7 +223,7 @@ 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_asprintf(&info,"%d%s",smtpcode,report); resp=(char **)rou_addlist((void **)resp,(void *)info); (void) memset(&action,'\000',sizeof(ACTTYP)); action.sessid=contact->session->sessid; @@ -400,8 +400,7 @@ while (proceed==true) { case 1 : //checking credential if (srv->links>1) { status=ALREADY; - (void) note_status(contact,status,NULL,"%d-4.5.6 Server already connected", - status); + (void) note_status(contact,status,NULL,"-4.5.6 Server already connected"); phase=999; //To many server connected } break; @@ -411,7 +410,7 @@ while (proceed==true) { const char *ninfo; cmt=srv->listing; - ninfo="%d-4.5.7 Originator server IP [%s] black listed <%s>"; + ninfo="-4.5.7 Originator server IP [%s] black listed <%s>"; if (cmt==(char *)0) cmt="credit too low"; (void) log_fprintlog(contact->logptr,false,"(Remote %s[%s] credit='%d' %s)", @@ -419,7 +418,7 @@ while (proceed==true) { contact->peerip, srv->credit,"too low"); status=BLCKLST; - (void) note_status(contact,status,NULL,ninfo,status,contact->peerip,cmt); + (void) note_status(contact,status,NULL,ninfo,contact->peerip,cmt); (void) setterminator(contact,"Remote server credit is too low"); phase=999; //To many server connected } @@ -634,10 +633,10 @@ for (int i=0;i<2;i++) { (void) eml_transmit(contact,true,"%d %s",SENDB64,logdat[i]); got=tcp_getline(contact->socptr,contact->delay,&line); if (got<=0) { - const char *ninfo="%d 5.7.2 auth sequence missing"; + const char *ninfo=" 5.7.2 auth sequence missing"; (void) strcpy(local,""); - (void) note_status(contact,UKNUSER,NULL,ninfo,UKNUSER); + (void) note_status(contact,UKNUSER,NULL,ninfo); break; //exiting from loop } (void) log_fprintlog(contact->logptr,false,"%s",line); @@ -840,7 +839,7 @@ while (proceed==true) { case 0 : //are we encrypted and on the right port if (soc_iscrypted(contact->socptr)==false) { static char *cmt="no authentication allowed on clear chanel"; - (void) note_status(contact,FAILED,NULL,"%d 5.7.0 %s",FAILED,cmt); + (void) note_status(contact,FAILED,NULL," 5.7.0 %s",cmt); (void) setterminator(contact,cmt); contact->credit-=1; //"Bad boy" phase=999; //No need to go further @@ -848,9 +847,9 @@ while (proceed==true) { break; case 1 : //check buffer if ((buffer==(char *)0)||(strlen(buffer)==0)) { - const char *ninfo="%d 5.7.1 Missing auth type"; + const char *ninfo=" 5.7.1 Missing auth type"; - (void) note_status(contact,UKNUSER,NULL,ninfo,FAILED); + (void) note_status(contact,UKNUSER,NULL,ninfo); phase=999; //No need to go further } break; @@ -871,7 +870,7 @@ while (proceed==true) { static char *cmt="bad authentication type"; (void) rou_alert(0,"%s auth type <%s> unknown (Bug?)",OPEP,local); - (void) note_status(contact,BADPAR,NULL,"%d 5.7.2 %s",BADPAR,cmt); + (void) note_status(contact,BADPAR,NULL," 5.7.2 %s",cmt); (void) setterminator(contact,cmt); phase=999; //Trouble Trouble } @@ -913,14 +912,12 @@ while (proceed==true) { fmt=DISP"Auth Rejected status='%d' for user=<%s> pass=<%s>"; (void) log_fprintlog(contact->logptr,true,fmt,BADAUTH,auth,rmtpass); (void) sleep(2); - (void) note_status(contact,BADAUTH,NULL,"%d 5.7.4 wrong authentication", - BADAUTH); + (void) note_status(contact,BADAUTH,NULL," 5.7.4 wrong authentication"); contact->credit-=1; } else { (void) log_fprintlog(contact->logptr,true,fmt,auth); - (void) note_status(contact,IDOK,NULL,"%d 5.7.5 authentication successful", - IDOK); + (void) note_status(contact,IDOK,NULL," 5.7.5 authentication successful"); contact->credit+=2; } } @@ -961,7 +958,9 @@ while (proceed==true) { switch (phase) { case 0 : //is user a local user if ((sql_mngusr(contact->sqlptr,sql_select,rcptto,&usr))==false) { - (void) note_status(contact,UKNUSER,rcptto,"5.6.0 <%s> unknown user",rcptto); + (void) note_status(contact,UKNUSER,rcptto, + " 5.6.0 <%s> unknown user", + rcptto); phase=999; //No user found in database } break; @@ -978,7 +977,9 @@ while (proceed==true) { break; case 2 : //is user lock? if (usr->lock==1) { - (void) note_status(contact,EXPIRED,rcptto,"5.6.1 <%s> account lock",rcptto); + (void) note_status(contact,EXPIRED,rcptto, + " 5.6.1 <%s> account lock", + rcptto); phase=999; //No user found in database } break; @@ -990,22 +991,19 @@ while (proceed==true) { break; case spf_fail : //Bad SPF (void) note_status(contact,FAILED,rcptto, - "%d 5.6.6 %s from IP=[%s]", - FAILED, + " 5.6.6 %s from IP=[%s]", "Relaying not allowed", contact->peerip); break; case spf_softfail : //Bad SPF (void) note_status(contact,FAILED,rcptto, - "%d 5.6.7 %s from IP=[%s]", - FAILED, + " 5.6.7 %s from IP=[%s]", "SPF soft fail not allowed", contact->peerip); break; default : //trouble trouble (void) note_status(contact,FAILED,rcptto, - "%d 5.6.8 %s (<%s> SPF unknown)", - FAILED, + " 5.6.8 %s (<%s> SPF unknown)", "Originator domain BAD SPF definition", contact->mailfrom); break; @@ -1092,7 +1090,7 @@ while (proceed==true) { char *rcptto; (void) rou_asprintf(&rcptto,"%s@%s",rmtusr->userid,rmtusr->domain); - (void) note_status(contact,NORELAY,rcptto,"2.8.0 %s for domain <%s>", + (void) note_status(contact,NORELAY,rcptto," 2.8.0 %s for domain <%s>", cmt,rmtusr->domain); rcptto=rou_freestr(rcptto); } @@ -1874,13 +1872,13 @@ while (proceed==true) { break; case 1 : //do we have an originator if ((rcptto==(char *)0)||(strlen(rcptto)==0)) { - (void) note_status(contact,BADPAR,rcptto,"5.6.1 recipient not specified"); + (void) note_status(contact,BADPAR,rcptto," 5.6.1 recipient not specified"); phase=999; //no need to go further } break; case 2 : //check rcpt format if ((rcptto[0]!='<')||(rcptto[strlen(rcptto)-1]!='>')) { - (void) note_status(contact,BADPAR,rcptto,"5.6.2 '%s' bad Format error", + (void) note_status(contact,BADPAR,rcptto," 5.6.2 '%s' bad Format error", rcptto); phase=999; //no need to go further } @@ -1890,14 +1888,14 @@ while (proceed==true) { case 3 : //checking rcptto format neu=eml_isemailok(rcptto,&report); if (neu==(RCPTYP *)0) { - (void) note_status(contact,NOTEML,rcptto,"5.6.3 %s",report); + (void) note_status(contact,NOTEML,rcptto," 5.6.3 %s",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) note_status(contact,MISSMX,rcptto,"5.6.4 %s (domain=%s)", + (void) note_status(contact,MISSMX,rcptto," 5.6.4 %s (domain=%s)", "No valid MX found for recipient " "domain name",neu->domain); phase=999; //no need to go further @@ -1914,7 +1912,7 @@ while (proceed==true) { phase=999; break; default : - (void) eml_transmit(contact,true,"%d 5.6.5 %s (domain=%s,code='%c')", + (void) eml_transmit(contact,true," 5.6.5 %s (domain=%s,code='%c')", FAILED, "system error with domain status", neu->domain,neu->code); @@ -1929,7 +1927,7 @@ while (proceed==true) { } break; case 7 : //everything ok - (void) note_status(contact,CMDOK,rcptto,"5.6.7 %s <%s>",detail,rcptto); + (void) note_status(contact,CMDOK,rcptto," 5.6.7 %s <%s>",detail,rcptto); success=true; break; default : //SAFE guard