]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Detecting very local email seems to be working
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sat, 26 Jul 2025 23:45:16 +0000 (19:45 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sat, 26 Jul 2025 23:45:16 +0000 (19:45 -0400)
data-feed/feed009.tst
lib/unidns.c
lib/unidns.h

index a52d16d5a532072659d038a43739669b3995d925..5e2db7b48af3b32bfa7119901bdda76c36efdb0a 100644 (file)
@@ -12,20 +12,19 @@ R:250-AUTH DIGEST-MD5
 R:250-SIZE 52428800
 R:250-8BITMIME
 R:250 ENHANCEDSTATUSCODES
-S:MAIL FROM:<jmrcpn@gmail.com> SIZE=2958
-R:250 2.1.3 jmrcpn@gmail.com sender ok
+S:MAIL FROM:<nobody@gmail.com> SIZE=2958
+R:250 2.1.3 nobody@gmail.com sender ok
 S:RCPT TO:<user1@mailleur.example.com>
 R:250 2.6.4 Address accepted <user1@mailleur.example.com>
 #-------------------------------------------------------------------------
 #-sending data
 C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
 D:Subject: (feed008) sending email to local only
-D:From: Maitre Post <postmaster@example.com>
-D:To: Maitre WEB <webmaster@example.com>
+D:From: A Nobody <nobody@gmail.com>
+D:To: A simple very local user <user1@mailleur.example.com>
 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:.
 #-------------------------------------------------------------------------
index 876d4e93b046488f6bdb63345dbd451ff5132e61..85803b8d50f07efc5fae26bbb62a4786cd34371e 100644 (file)
@@ -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;
 
index 4d38a4c362e1b19b164b603f99a38bd8608d387f..3a7860c8627b45457b68fcd042445dd81322562d 100644 (file)
@@ -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);