From: Jean-Marc Pigeon (Delson) Date: Fri, 16 Aug 2024 05:12:43 +0000 (-0400) Subject: Improving debug within unidns.c X-Git-Tag: tag-0.4.2-end~22 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=024c3549c30b0f8eaa456f57a0fc55acdd058a0d;p=jmp%2Fmailleur Improving debug within unidns.c --- diff --git a/lib/subrou.c b/lib/subrou.c index bb907d8..6286fee 100644 --- a/lib/subrou.c +++ b/lib/subrou.c @@ -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 diff --git a/lib/unidns.c b/lib/unidns.c index 8234a26..394abab 100644 --- a/lib/unidns.c +++ b/lib/unidns.c @@ -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; +} +/* + +*/ +/********************************************************/ +/* */ /* 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