From: Jean-Marc Pigeon (Delson) Date: Sat, 26 Jul 2025 23:45:16 +0000 (-0400) Subject: Detecting very local email seems to be working X-Git-Tag: tag-0.14~4 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=a886458ecf9b76e9ffbffac29f5dbe8992ce3d63;p=jmp%2Fmailleur Detecting very local email seems to be working --- diff --git a/data-feed/feed009.tst b/data-feed/feed009.tst index a52d16d..5e2db7b 100644 --- a/data-feed/feed009.tst +++ b/data-feed/feed009.tst @@ -12,20 +12,19 @@ R:250-AUTH DIGEST-MD5 R:250-SIZE 52428800 R:250-8BITMIME R:250 ENHANCEDSTATUSCODES -S:MAIL FROM: SIZE=2958 -R:250 2.1.3 jmrcpn@gmail.com sender ok +S:MAIL FROM: SIZE=2958 +R:250 2.1.3 nobody@gmail.com sender ok S:RCPT TO: R:250 2.6.4 Address accepted #------------------------------------------------------------------------- #-sending data C:DATA 354 3.5.0 End data with . D:Subject: (feed008) sending email to local only -D:From: Maitre Post -D:To: Maitre WEB +D:From: A Nobody +D:To: A simple very local user D: -D:.single dot, next is an empty line starting with a '.' -D:. -D:This email is sent to 3 domain X 1 users +D:this ia an email "from" gmail. +D:test text text D: C:. #------------------------------------------------------------------------- diff --git a/lib/unidns.c b/lib/unidns.c index 876d4e9..85803b8 100644 --- a/lib/unidns.c +++ b/lib/unidns.c @@ -384,7 +384,7 @@ return blklist; /* Procedure to extract IPs from an hostname */ /* */ /********************************************************/ -PUBLIC char **dns_get_ip_list(char *hostname) +PUBLIC char **dns_get_ip_list(const char *hostname) { char **iplst; @@ -657,15 +657,31 @@ while (proceed==true) { phase=999; //No domain (Bug?) break; case 1 : //getting MX list - if ((dns=dns_getmx(domain))==(MXTYP **)0) - phase=999; //domain without MX? + if ((dns=dns_getmx(domain))!=(MXTYP **)0) + phase++; //Ok, we have an MX list break; - case 2 : //establishing MX IP + case 2 : { //what is the domain IP + char **ipl; + + if ((ipl=dns_get_ip_list(domain))!=(char **)0) { + MXTYP *mx0; + + ipl=(char **)rou_freelist((void **)ipl,(genfree_t)rou_freestr); + mx0=(MXTYP *)calloc(1,sizeof(MXTYP *)); + mx0->preference=0; + mx0->mxname=strdup(domain); + dns=(MXTYP **)rou_addlist((void **)dns,(void *)mx0); + } + else + phase=999; //no MX, no IP! + } + break; + case 3 : //establishing MX IP status=dns_remote; if (afns==(AFNTYP **)0) //No local IP? phase=999; break; - case 3 : //checking best MX with local interface + case 4 : //checking best MX with local interface while (*afns!=(AFNTYP *)0) { _Bool ismx; diff --git a/lib/unidns.h b/lib/unidns.h index 4d38a4c..3a7860c 100644 --- a/lib/unidns.h +++ b/lib/unidns.h @@ -39,7 +39,7 @@ extern BLKTYP *dns_freeblk(BLKTYP *blk); extern BLKTYP **dns_addblklist(BLKTYP **blklist,char *entry); //Procedure to get a list of IP related to a hostname -extern char **dns_get_ip_list(char *hostname); +extern char **dns_get_ip_list(const char *hostname); //Procedure to get ONE SPF entry within domain dns extern char *dns_getspf(char *domain);