]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Starting to have chkspf script working
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 11 Feb 2025 14:04:10 +0000 (09:04 -0500)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 11 Feb 2025 14:04:10 +0000 (09:04 -0500)
Makefile
data-tst/spf.tst
lib/subrou.c
shell/test-spf.sh [changed mode: 0644->0755]

index a37a63b71c22c0e90319fbbb2c904fb054686698..00a84e0d1d1434f0a23ba520c35728b5de57801c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,7 @@ clean :
 #test procedure
 #--------------------------------------------------------------------
 test   :  clean debug
-          @ bin/valide data-tst/spf.tst
+          @ shell/test-spf.sh data-tst/spf.tst
                
 #--------------------------------------------------------------------
 #Installation procedure
index 15b0e0ebcb1ed2e2cb2a4156c50b50fb23189215..fdf459f867e5a37cb2a24cb745e4f109c639e65d 100644 (file)
@@ -1,9 +1,8 @@
 #========================================================
 #data to check if SPF are properly seen
-chkmx.spf.example.com#NOTE: this test rely on the fact
-#"spf.example.com" is accessible via DNS request.
+#NOTE: this test rely on the fact
+#"spf.example.com" is accessible via DNS request.
 #========================================================
-#--------------------------------------------------------
 #Checking MX
 #Acceptable IP number
 spf_pass       chkmx.spf.example.com           127.0.0.255
index 5994aa9e8c1655c22b6fb3d3be7b57cd37757565..4ff8ccd8721097fe3592cec8916e117e6579516c 100644 (file)
@@ -21,7 +21,7 @@
 
 //version definition 
 #define VERSION "0.4.2"
-#define RELEASE "34"
+#define RELEASE "35"
 
 //Public variables
 PUBLIC  int debug=0;            //debug level
old mode 100644 (file)
new mode 100755 (executable)
index 7211144..0bfafe7
@@ -2,3 +2,25 @@
 #---------------------------------------------------------------------
 #shell script to test SPF directive
 #---------------------------------------------------------------------
+while [ $# -gt 0 ] 
+  do
+  filename=$1
+  numline=0
+  echo "scanning \"$1\" test file"
+  cat $1 | while read line
+    do
+    numline=$((numline+1))
+    data=`echo $line | grep -o '^[^#]*'`
+    if [ -z "$data" ] ; then
+      continue;
+      fi
+    expect=`echo $data | cut -d ' ' -f1`
+    domain=`echo $data | cut -d ' ' -f2`
+    ipnum=`echo $data | cut -d ' ' -f3`
+    result=`bin/chkspf $domain $ipnum`
+    if [ "$result" != "$expect" ] ; then
+      echo "error: line $numline, Expected:=$expect Result:=$result"
+      fi
+    done 
+  shift
+  done