From 7eb86a7dbb44ee9c170acaa79d21cd79c83ed863 Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Mon, 10 Mar 2025 07:18:46 -0400 Subject: [PATCH] adjusting SPF test sequence --- Makefile | 5 ++++- app/chkspf.c | 27 ++------------------------- shell/test-spf.sh | 5 +++++ 3 files changed, 11 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index bc31c82..577e37e 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,10 @@ test : clean debug DATA = chkaddr.spf.example.com 127.0.1.255 dbgtst : debug @ echo "doing chkspf with \"$(DATA)\"" - @ ./bin/chkspf $(DATA) + @ valgrind \ + --leak-check=full \ + --show-leak-kinds=all \ + ./bin/chkspf $(DATA) #-------------------------------------------------------------------- #Installation procedure diff --git a/app/chkspf.c b/app/chkspf.c index bf98826..89d4c08 100644 --- a/app/chkspf.c +++ b/app/chkspf.c @@ -18,23 +18,8 @@ #include "uniprc.h" #include "gesspf.h" -#define VALNAME "emlval" //validator application +#define CHKSPF "chkspf" //SPF field validator -//vocabulary enum -typedef enum { - voc_start, //"start" - voc_end, //"end" - voc_include, //"include" - voc_unknown //unknown keys - }voc_enum; - -//vocabulary (Must be in sync withvoc_enum list) -char *vocable[]={ - "start", - "end", - "include", - (char *)0 - }; /* */ @@ -95,12 +80,8 @@ while (proceed==true) { } break; case 2 : - (void) rou_setappname(VALNAME); - (void) afn_modesubafn(true); (void) rou_modesubrou(true); - (void) par_modeunipar(true); - (void) prc_modeuniprc(true); - (void) spf_modegesspf(true); + (void) rou_setappname(CHKSPF); (void) prc_preptitle(argc,argv,environ); foreground=true; break; @@ -110,11 +91,7 @@ while (proceed==true) { case 4 : //task completed (void) prc_cleantitle(); params=par_freeparams(params); - (void) spf_modegesspf(false); - (void) prc_modeuniprc(false); - (void) par_modeunipar(false); (void) rou_modesubrou(false); - (void) afn_modesubafn(false); break; default : //end of task proceed=false; diff --git a/shell/test-spf.sh b/shell/test-spf.sh index 0bfafe7..1ea0d79 100755 --- a/shell/test-spf.sh +++ b/shell/test-spf.sh @@ -2,9 +2,12 @@ #--------------------------------------------------------------------- #shell script to test SPF directive #--------------------------------------------------------------------- +numfile=0; +numerr=0; while [ $# -gt 0 ] do filename=$1 + numfile=$((numfile+1)) numline=0 echo "scanning \"$1\" test file" cat $1 | while read line @@ -20,7 +23,9 @@ while [ $# -gt 0 ] result=`bin/chkspf $domain $ipnum` if [ "$result" != "$expect" ] ; then echo "error: line $numline, Expected:=$expect Result:=$result" + numerr=$((numerr+1)) fi done shift done +echo "number of test file scanned: $numfile, total error reported: $numerr"; -- 2.47.3