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
#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
*/
}
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;
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;
#---------------------------------------------------------------------
#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
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";