]> SAFE projects GIT repository - jmp/mailleur/commitdiff
adjusting SPF test sequence
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Mon, 10 Mar 2025 11:18:46 +0000 (07:18 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Mon, 10 Mar 2025 11:18:46 +0000 (07:18 -0400)
Makefile
app/chkspf.c
shell/test-spf.sh

index bc31c82f79bbf877345c69fa72db9dfc2b7a3dac..577e37ec2c50db28f60df887f2d71ebe9a1757cf 100644 (file)
--- 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
index bf988267c512579235e9cf6a3bbee525ad02c1bf..89d4c0872f4a8558b80d22d499b17adfbbe05351 100644 (file)
 #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
-      };
 /*
 \f
 */
@@ -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;
index 0bfafe7b689006d4a8ecab0c4882c2a9ce8550b2..1ea0d7976c8b3ce0cee067e5082f1d7d9c24a72c 100755 (executable)
@@ -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";