From: Jean-Marc Pigeon (Delson) Date: Mon, 19 Aug 2024 06:46:46 +0000 (-0400) Subject: SPF test seems to be working X-Git-Tag: tag-0.4.2-end~12 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=acd039e5fae0be409f701312d4f875cd164e87f6;p=jmp%2Fmailleur SPF test seems to be working --- diff --git a/app/chkdns.c b/app/chkdns.c index cfa8553..750bbca 100644 --- a/app/chkdns.c +++ b/app/chkdns.c @@ -104,7 +104,12 @@ num=0; while (fgets(line,sizeof(line),fichier)!=(char *)0) { char *ptr; + (void) printf("JMPDBG line=<%s>\n",line); num++; + if ((ptr=strchr(line,'\n'))!=(char *)0) + *ptr='\000'; + if ((ptr=strchr(line,'\r'))!=(char *)0) + *ptr='\000'; if ((ptr=strchr(line,'#'))!=(char *)0) *ptr='\000'; if (strlen(line)==0) diff --git a/lib/gesspf.c b/lib/gesspf.c index be272da..224394a 100644 --- a/lib/gesspf.c +++ b/lib/gesspf.c @@ -126,14 +126,10 @@ while (proceed==true) { if (strlen(fullspf)==0) phase=999; //no need to go further break; - case 2 : //detecting specific char + case 2 : //we got a sequence seq=strdup(fullspf); - if (strchr("?~-+",fullspf[0])!=(char *)0) { - seq[1]='\000'; //on char only - phase=999; //no need to go further - } break; - case 3 : //cleaning sequence + case 3 : //sync sequence if (seq!=(char *)0) { //always char *ptr; @@ -411,12 +407,13 @@ _Bool proceed; spf=spf_neutral; locspf=spf_pass; +(void) printf("JMPDBG checkseq seq=<%s>\n",seq); phase=0; proceed=true; while (proceed==true) { switch (phase) { case 0 : //is the sequence an SPF Mechanisms - if (strlen(seq)==1) { + if (strchr("?~-+",seq[0])!=(char *)0) { switch (seq[0]) { case '?' : locspf=spf_neutral; @@ -430,12 +427,8 @@ while (proceed==true) { case '-' : locspf=spf_fail; break; - default : - (void) rou_alert(0,"%s <%s> is not an expected SPF Prefix (Bug?)", - OPEP,seq); - break; } - phase=999; //no need to go further + seq++; } break; case 1 : //check directive @@ -450,6 +443,7 @@ while (proceed==true) { case mch_mx : //This is a MX refrence if (checkmx(domain,afnnum,seq)==true) spf=locspf; + (void) printf("JMPDBG checkmsx status='%s'\n",spf_spfASCII(spf)); break; case mch_ip4 : //This is IPV4 number case mch_ip6 : //This is IPV6 number @@ -483,6 +477,7 @@ while (proceed==true) { } phase++; } +(void) printf("JMPDBG checkseq status='%s'\n",spf_spfASCII(spf)); return spf; #undef OPEP @@ -630,7 +625,7 @@ while (proceed==true) { if ((list=dns_getspf(domain))==(char *)0) phase=999; //trouble trouble break; - case 3 : //gett the spf LIST related to SPF + case 3 : //get the spf LIST related to SPF spf=is_peerip_ok(try,domain,afnnum,list); list=rou_freestr(list); break; diff --git a/lib/subafn.c b/lib/subafn.c index 8da9840..2c0fc15 100644 --- a/lib/subafn.c +++ b/lib/subafn.c @@ -36,6 +36,8 @@ areequal=false; if (mask>128) mask=128; maskbyt=mask/8; +(void) printf("JMPDBG mask='%d' compare <%s> et <%s>", + mask,ipnum1->strnumip,ipnum2->strnumip); if (memcmp(ipnum1->ip,ipnum2->ip,maskbyt)==0) { areequal=true; mask%=8; @@ -51,6 +53,7 @@ if (memcmp(ipnum1->ip,ipnum2->ip,maskbyt)==0) { areequal=false; } } +(void) printf("res='%d'\n", areequal); //JMPDBG return areequal; } /* diff --git a/lib/subrou.c b/lib/subrou.c index a88f64c..f30e326 100644 --- a/lib/subrou.c +++ b/lib/subrou.c @@ -21,7 +21,7 @@ //version definition #define VERSION "0.4.2" -#define RELEASE "23" +#define RELEASE "24" //Public variables PUBLIC int debug=0; //debug level