From: Jean-Marc Pigeon (Delson) Date: Wed, 16 Jul 2025 14:26:21 +0000 (-0400) Subject: relayable afn list should be ready to be used X-Git-Tag: tag-0.14~82 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=ccbf1a1a521220ffe751e413aa717a339d1901c9;p=jmp%2Fmailleur relayable afn list should be ready to be used --- diff --git a/lib/Makefile b/lib/Makefile index 2824fc1..7e79c7e 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -159,7 +159,9 @@ devsql.h: \ uniprc.h: \ subrou.h -unitls.h: \ +unieml.h \ +unitls.h \ + : \ subafn.h libpos.a: unimar.o \ diff --git a/lib/lvleml.c b/lib/lvleml.c index 892f3bb..b5b9443 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -88,8 +88,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->relayok=(AFNTYP **)rou_freelist((void **)contact->relayok, + (genfree_t)afn_freeipnum); contact->recipients=(RCPTYP **)rou_freelist((void **)contact->recipients, (genfree_t)eml_freerecipient); contact->authname=rou_freestr(contact->authname); @@ -2345,6 +2345,7 @@ while (proceed==true) { } break; case 2 : //loading the relayable IP list + //contact->relayok=eml_load_relayed(getenv(RELAYS)); contact->relayok=eml_load_relayed(getenv(RELAYS)); break; case 3 : //waiting from contact diff --git a/lib/lvleml.h b/lib/lvleml.h index 41c11ee..095cf7e 100644 --- a/lib/lvleml.h +++ b/lib/lvleml.h @@ -28,7 +28,7 @@ typedef struct { char *locserv; //local service port char *peername; //socket remote peer FQDN char *peerip; //socket remote peer IP - char **relayok; //List of IP which are relayable + AFNTYP **relayok; //List of IP which are relayable int numreset; //number of SMTP reset received char *mainsesid; //session main ID SESTYP *session; //SMTP current session information diff --git a/lib/unieml.c b/lib/unieml.c index 320de79..930b2f0 100644 --- a/lib/unieml.c +++ b/lib/unieml.c @@ -17,6 +17,7 @@ #include #include +#include "subafn.h" #include "subrou.h" #include "unieml.h" @@ -432,18 +433,18 @@ return qfile; /* relayed. */ /* */ /********************************************************/ -PUBLIC char **eml_load_relayed(char *relayedfile) +PUBLIC AFNTYP **eml_load_relayed(char *relayedfile) { #define OPEP "unieml.c:eml_load_relayed," -char **list; +AFNTYP **list; char *filename; FILE *relays; int phase; _Bool proceed; -list=(char **)0; +list=(AFNTYP **)0; filename=(char *)0; relays=(FILE *)0; phase=0; @@ -470,24 +471,19 @@ while (proceed==true) { num=0; while (fgets(line,sizeof(line)-1,relays)!=(char *)0) { - char *mask; - struct sockaddr_in sa; + AFNTYP *afn; 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) { + if ((afn=afn_getoneipnum(line))==(AFNTYP *)0) { (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)); + list=(AFNTYP **)rou_addlist((void **)list,(void *)afn); } } break; diff --git a/lib/unieml.h b/lib/unieml.h index a29c913..5e24048 100644 --- a/lib/unieml.h +++ b/lib/unieml.h @@ -10,6 +10,8 @@ #include +#include "subafn.h" + #define HFROM "From: " //Then email header header from #define HTITLE "Subject: " //Then email subject entry @@ -140,7 +142,7 @@ extern FILE *eml_closeqfile(FILE *qfile); //Procedure to load the list of IP/Network from //which incoming email can be relayed to another domain MX -extern char **eml_load_relayed(char *relayedfile); +extern AFNTYP **eml_load_relayed(char *relayedfile); //Procedure to list all file within queue directory //and with a specific extenstion