]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Improving debug within unidns.c
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Fri, 16 Aug 2024 05:12:43 +0000 (01:12 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Fri, 16 Aug 2024 05:12:43 +0000 (01:12 -0400)
lib/subrou.c
lib/unidns.c

index bb907d853526e472f046571b44204ca62eec7d89..6286fee336416aaa7e983c3181581fcd65409dde 100644 (file)
@@ -21,7 +21,7 @@
 
 //version definition 
 #define VERSION "0.4.2"
-#define RELEASE "13"
+#define RELEASE "14"
 
 //Public variables
 PUBLIC  int debug=0;            //debug level
index 8234a26ca3c6ba9379a4270fa57c02a73dbc38c3..394abab8c556549c1fc392f8f8092105ffa07c25 100644 (file)
@@ -50,12 +50,15 @@ static  _Bool modopen;          //module open/close status
 /*     Procedure to display SPF debug information      */
 /*                                                      */
 /********************************************************/
-static void dbgspf(int dbg,AFNTYP *afnnum,char *seq,SPFENU status)
+static void dbgspf(int dbg,char *proc,char *domain,AFNTYP *afnnum,char *seq,SPFENU status)
 
 {
 if (debug>-dbg) {
-  (void) rou_alert(dbg,"Current SPF Value <%s>\n\tIP=[%s]\n\tSPF=<%s>",
-                        dns_spfASCII(status),afnnum->strnumip,seq);
+  (void) rou_alert(dbg,"Origin=\"%s\"\n"
+                       "\tCurrent SPF Value <%s>\n"
+                       "\tPeer IP=[%s]\n"
+                       "\tdomain=<%s> SPF=<%s>",
+                       proc,dns_spfASCII(status),afnnum->strnumip,domain,seq);
   }
 }
 /*
@@ -161,6 +164,24 @@ return seq;
 */
 /********************************************************/
 /*                                                      */
+/*     Procedure to check the SPF MX values againt the */
+/*      current afnnum.                                 */
+/*      return true if successful.                      */
+/*                                                      */
+/********************************************************/
+static _Bool checkmx(char *domain,AFNTYP *afnnum,char *seq)
+
+{
+_Bool found;
+
+found=false;
+return found;
+}
+/*
+\f
+*/
+/********************************************************/
+/*                                                      */
 /*     Procedure to check ip peerip is within an       */
 /*      spf sequence                                    */
 /*                                                      */
@@ -284,10 +305,15 @@ while (proceed==true) {
         case mch_all            :       //usually last in sequence
           spf=locspf;
           break;
+        case mch_mx             :       //This is a MX refrence
+          if (checkmx(domain,afnnum,seq+1)==true)
+            spf=locspf;
+          break;
         case mch_ip4            :       //This is IPV4 number
         case mch_ip6            :       //This is IPV6 number
           if (checkip(domain,afnnum,seq+1)==true)
             spf=locspf;
+          (void) dbgspf(2,"checkip",domain,afnnum,seq+1,spf);
           break;
         case mch_include        :       //include sub domain
           if (seq[0]==':') {
@@ -594,18 +620,20 @@ while (proceed==true) {
       break;
     case 2      :       //making sure spfrec is an SPF1
       spfrec+=strlen(SPF1);
-      (void) dbgspf(2,afnnum,spfrec,spf);
       if (strlen(spfrec)>0) {
         char *seq;
+        char *ref;
 
+        ref=spfrec;
         while ((seq=getspfseq(spfrec))!=(char *)0) {
           spfrec=strstr(spfrec,seq);
           spfrec+=strlen(seq);
           spf=checkseq(try,domain,seq,afnnum,spf);
           seq=rou_freestr(seq);
           if (spf!=spf_neutral)
-            break;      //Found a status breaking loop
+            break;      //Found a pass status,  breaking loop
           }
+        (void) dbgspf(2,"is_peerip_ok",domain,afnnum,ref,spf);
         }
       break;
     default     :       //SAFE Guard