From 0b0aab9f4a3d7852a8f2dd6c5a1c85f41654e23d Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Sun, 22 Jun 2025 07:46:43 -0400 Subject: [PATCH] Trying to change mailleur.conf SMTPPORTS format --- Makefile.dbg | 2 +- conf/mailleur.conf | 18 +++++++++--------- conf/mailleur.conf.dvl | 18 +++++++++--------- lib/devsoc.c | 2 +- lib/lvleml.c | 2 +- lib/modrec.c | 8 +++++--- lib/subafn.c | 4 +++- 7 files changed, 29 insertions(+), 25 deletions(-) diff --git a/Makefile.dbg b/Makefile.dbg index 98ab507..b27fc4d 100644 --- a/Makefile.dbg +++ b/Makefile.dbg @@ -18,7 +18,7 @@ EMLPAR = \ -r $(TESTDIR) \ -c ./conf/$(APPNAME).conf.dvl \ -d 2 \ - $(TESTPROT):$(TESTIP):$(TESTPORT): + $(TESTPROT)|$(TESTIP)|$(TESTPORT)| #==================================================================== #area to start components receiver,sorter,sender once at a time diff --git a/conf/mailleur.conf b/conf/mailleur.conf index 6e21209..d11aa2a 100644 --- a/conf/mailleur.conf +++ b/conf/mailleur.conf @@ -7,18 +7,18 @@ DFLTDOMAIN="localdomain" #------------------------------------------------ #list of listening port to do SMTP protocole #format -#protocol:ipnum:port:iteration[,protocol:ipnum:port:iteration]++ +#protocol|ipnum|port|iteration[,protocol|ipnum|port|iteration]++ #example -#stmtps:ipnum:465:5 -> protocol smtps:IP number:port 465:5 iterations -#:ipnum::: -> smtp:ipnum:25:2 -#::,smtps::465:2 -> smtp:0.0.0.0:25:2 + smtps::465:2 -#:: -> smtp:0.0.0.0:25:2 +#stmtps|ipnum|465|5 -> protocol smtps|IP number|port 465|5 iterations +#|ipnum||| -> smtp|ipnum|25|2 +#||,smtps||465|2 -> smtp|0.0.0.0|25|2 + smtps||465|2 +#|| -> smtp|0.0.0.0|25|2 #Examples -#SMTPPORTS=":127.127.10.25:1025:,smtps:127.127.10.25:1026:1" -#SMTPPORTS=":127.127.10.25:1025:" -#SMTPPORTS="smtps:127.127.10.25:1065:1" +#SMTPPORTS="|127.127.10.25|1025|,smtps|127.127.10.25|1026|1" +#SMTPPORTS="|127.127.10.25|1025|" +#SMTPPORTS="smtps|127.127.10.25|1065|1" #Defaults -SMTPPORTS=":::5,smtps::465:3,smtp::587:2" +SMTPPORTS="|||5,smtps||465|3,smtp||587|2" #------------------------------------------------ #Defining SERVER mode Certificate data CA_ROOT_SRV="/etc/pki/mailleur/root-safe_CA.pem" diff --git a/conf/mailleur.conf.dvl b/conf/mailleur.conf.dvl index d5d7b7d..5811162 100644 --- a/conf/mailleur.conf.dvl +++ b/conf/mailleur.conf.dvl @@ -8,16 +8,16 @@ DFLTDOMAIN="example.com"" #------------------------------------------------ #list of listening port to do SMTP protocole #format -#protocol:ipnum:port:iteration[,protocol:ipnum:port:iteration]++ +#protocol|ipnum|port|iteration[,protocol|ipnum|port|iteration]++ #example -#stmtps:ipnum:465:5 -> protocol smtps:IP number:port 465:5 iterations -#:ipnum::: -> smtp:ipnum:25:2 -#::,smtps::465:2 -> smtp:0.0.0.0:25:2 + smtps::465:2 -#:: -> smtp:0.0.0.0:25:2 -#SMTPPORTS="::1025" -#SMTPPORTS=":127.127.10.25:1025:,smtps:127.127.10.25:1026:1" -#SMTPPORTS=":127.127.10.25:1025:" -#SMTPPORTS="smtps:127.127.10.25:1065:1" +#stmtps|ipnum|465|5 -> protocol smtps|IP number|port 465|5 iterations +#|ipnum||| -> smtp|ipnum|25|2 +#||,smtps||465|2 -> smtp|0.0.0.0|25|2 + smtps||465|2 +#|| -> smtp|0.0.0.0|25|2 +#SMTPPORTS="||1025" +#SMTPPORTS="|127.127.10.25|1025|,smtps|127.127.10.25|1026|1" +#SMTPPORTS="|127.127.10.25|1025|" +#SMTPPORTS="smtps|127.127.10.25|1065|1" #------------------------------------------------ #Defining SERVER mode Certificate data CA_ROOT_SRV="./certs/root-safe_CA.pem" diff --git a/lib/devsoc.c b/lib/devsoc.c index 77f0cfe..379511b 100644 --- a/lib/devsoc.c +++ b/lib/devsoc.c @@ -1414,7 +1414,7 @@ if (soc!=(SOCTYP *)0) { case false : char local[NI_MAXHOST+NI_MAXSERV+1]; - (void) snprintf(local,sizeof(local),"%s:%s",host,serv); + (void) snprintf(local,sizeof(local),"%s|%s",host,serv); data=strdup(local); break; } diff --git a/lib/lvleml.c b/lib/lvleml.c index fff9583..b9e7c32 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -1606,7 +1606,7 @@ while (proceed==true) { char *ptr; //extracting service port number - if ((ptr=strrchr(contact->locip,':'))!=(char *)0) { + if ((ptr=strrchr(contact->locip,'|'))!=(char *)0) { *ptr='\000'; contact->locserv=strdup(ptr+1); } diff --git a/lib/modrec.c b/lib/modrec.c index e326672..03a789d 100644 --- a/lib/modrec.c +++ b/lib/modrec.c @@ -61,11 +61,11 @@ for (int i=0;i",OPEP,i,argv[i]); + (void) rou_alert(0,"%s JMPDBG argv[%d]=<%s>",OPEP,i,argv[i]); for (int j=0;j<3;j++) { char *sofar; - if ((sofar=strchr(ptr,':'))==(char *)0) + if ((sofar=strchr(ptr,'|'))==(char *)0) break; *sofar='\000'; sofar++; @@ -319,6 +319,7 @@ PUBLIC void rec_handlesmtp(int argc,char *argv[]) { #define OPEP "modrec.c:rec_handlesmtp" #define RELAX 5 //Relax time between process checking +#define DFLTSET "smtp|0.0.0.0|25|2" pid_t *childs; char *locargv[2]; @@ -332,7 +333,7 @@ childs=(pid_t)0; (void) memset(locargv,'\000',sizeof(locargv)); locargv[0]=getenv("SMTPPORTS"); if (locargv[0]==(char *)0) - locargv[0]="smtp:0.0.0.0:25:2"; //default configuration + locargv[0]=DFLTSET; //default configuration if (argc==0) { argc=1; argv=locargv; @@ -418,6 +419,7 @@ while (proceed==true) { phase++; } +#undef DFLTSET #undef RELAX #undef OPEP } diff --git a/lib/subafn.c b/lib/subafn.c index 9e1fefd..1d0c450 100644 --- a/lib/subafn.c +++ b/lib/subafn.c @@ -160,12 +160,14 @@ afnnum=(AFNTYP *)0; phase=0; proceed=true; while (proceed==true) { + (void) fprintf(stderr,"%s JMPDBG phase='%d', onecleanipstr=<%s>", + OPEP,phase,onecleanipstr); switch (phase) { case 0 : /*lets say ip format ok */ afnnum=(AFNTYP *)calloc(1,sizeof(AFNTYP)); afnnum->afntype=AF_INET; afnnum->afnmask=32; - if (strchr(onecleanipstr,':')==(char *)0) + if (strchr(onecleanipstr,'|')==(char *)0) phase++; //This is an IPV4 number break; case 1 : //IP is an IPV6 format -- 2.47.3