From 96e70748e541face1478f75b3117b1933fcb2355 Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Tue, 15 Jul 2025 19:01:43 -0400 Subject: [PATCH] Able to charge the list of relayed IP --- conf/mailleur.conf | 2 +- conf/mailleur.conf.dvl | 2 +- lib/lvleml.c | 13 +++++++++---- lib/unieml.c | 15 ++++++++++++--- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/conf/mailleur.conf b/conf/mailleur.conf index f7471a4..9af1829 100644 --- a/conf/mailleur.conf +++ b/conf/mailleur.conf @@ -54,5 +54,5 @@ DOV_MAILDIR="/var/spool/mailleur/mails" #The list of public blacklist serveur BLACKLISTER=/etc/mailleur/blacklister.conf #the list of IP from which we accept to releay email -RELAYABLE=/etc/mailleur/relayable.conf +RELAYABLE=/etc/mailleur/relayed.conf #------------------------------------------------ diff --git a/conf/mailleur.conf.dvl b/conf/mailleur.conf.dvl index ee6d312..5badbb3 100644 --- a/conf/mailleur.conf.dvl +++ b/conf/mailleur.conf.dvl @@ -58,5 +58,5 @@ SMTPPORTS="|127.127.10.25|1025|5,smtps|127.127.10.26|1465|3,smtp|127.127.10.26|1 #The list of public blacklist serveur BLACKLISTER=/etc/mailleur/blacklister.conf #the list of IP from which we accept to releay email -RELAYABLE=/etc/mailleur/relayable.conf +RELAYABLE=/etc/mailleur/relayed.conf #------------------------------------------------ diff --git a/lib/lvleml.c b/lib/lvleml.c index f71b107..9e5eef1 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -87,6 +87,8 @@ if (contact!=(CONTYP *)0) { (void) freesessid(contact); contact->sqlptr=sql_closesql(contact->sqlptr); contact->logptr=log_closelog(contact->logptr); + contact->relayok=(char **)rou_freelist((void **)contact->relayok, + (genfree_t)rou_freestr); contact->recipients=(RCPTYP **)rou_freelist((void **)contact->recipients, (genfree_t)eml_freerecipient); contact->authname=rou_freestr(contact->authname); @@ -2323,14 +2325,17 @@ while (proceed==true) { phase=999; //no contact possible. } break; - case 2 : //waiting from contact + case 2 : //loading the relayable IP list + contact->relayok=eml_load_relayed(getenv("RELAYABLE")); + break; + case 3 : //waiting from contact if ((contact->socptr=soc_accept(socptr,pos))==(SOCPTR *)0) { (void) rou_alert(3,"%s Unable to open contact",OPEP); contact=freecontact(contact); phase=999; //no contact } break; - case 3 : //Preparing contact + case 4 : //Preparing contact contact->mainsesid=eml_getmainsesid(); contact->delay=MXDELAY; if (debug>1) @@ -2354,14 +2359,14 @@ while (proceed==true) { (void) rou_alert(0,"Contact from peer <%s> to port <%s> started", contact->peerip,contact->locserv); break; - case 4 : //check contact validity + case 5 : //check contact validity if ((contact->locname==(char *)0)||(contact->peerip==(char *)0)) { (void) rou_alert(0,"%s Unable to establish contact entities",OPEP); contact=freecontact(contact); phase=999; //no identity } break; - case 5 : //contact is good, then sending a signon + case 6 : //contact is good, then sending a signon (void) log_fprintlog(contact->logptr,false,"opening connection CNT=%s", contact->mainsesid); break; diff --git a/lib/unieml.c b/lib/unieml.c index 935a0c8..320de79 100644 --- a/lib/unieml.c +++ b/lib/unieml.c @@ -465,19 +465,28 @@ while (proceed==true) { } break; case 2 : { //scanning relayable contents + int num; char line[300]; - + + num=0; while (fgets(line,sizeof(line)-1,relays)!=(char *)0) { + char *mask; struct sockaddr_in sa; + num++; (void) rou_clean_conf_line(line); if (strlen(line)==0) continue; + if ((mask=strrchr(line,'/'))!=(char *)0) + *mask='\000'; if (inet_pton(AF_INET,line,&(sa.sin_addr))<=0) { - (void) rou_alert(0,"%s <%s> not a valie IP (error=<%s>, config?)", - OPEP,line,strerror(errno)); + (void) rou_alert(0,"%s line='%03d' <%s> not a valid IP " + "(error=<%s>, config?)", + OPEP,num,line,strerror(errno)); continue; } + if (mask!=(char *)0) + *mask='/'; list=(char **)rou_addlist((void **)list,strdup(line)); } } -- 2.47.3