//removing head space
while (line[0]==' ')
- (void) memmove(line,line+1,strlen(line+1));
+ (void) memmove(line,line+1,strlen(line+1)+1);
//Extracting keyword
(void) strcpy(keyword,line);
if ((ptr=strchr(keyword,' '))!=(char *)0)
*ptr='\000';
-if ((ptr=strchr(keyword,'\n'))!=(char *)0)
- *ptr='\000';
-
//cleaning line
ptr=line+strlen(keyword);
-(void) memmove(line,ptr,strlen(ptr));
+(void) memmove(line,ptr,strlen(ptr)+1);
while (line[0]==' ')
- (void) memmove(line,line+1,strlen(line+1));
+ (void) memmove(line,line+1,strlen(line+1)+1);
return strlen(keyword);
}
/*
{
#define MAX 300
+static char *noneed="#\n\r";
+
int status;
int num;
char line[MAX];
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';
+ for (int i=0;i<strlen(noneed);i++) {
+ if ((ptr=strchr(line,noneed[i]))!=(char *)0)
+ *ptr='\000';
+ }
if (strlen(line)==0)
continue;
//replacing HT by space
}
break;
case 1 : //getting the list of MX for mxdomain
- (void) printf("JMPDBG, checkaddr got <%s> cidr='%d'",addrdom,cidr);
+ (void) printf("JMPDBG, checkaddr got <%s> ip<%s> cidr='%d'\n",
+ addrdom,afnnum->strnumip,cidr);
break;
default : //SAFE guard
proceed=false;
OPEP,mxlist[i]->mxname);
continue;
}
- (void) printf("JMPDBG addr=<%s> peer=<%s> cidr='%d'\n",
- addrnum->strnumip,afnnum->strnumip,cidr);
switch (afn_cmpipnum(addrnum,afnnum,cidr)) {
case false : //not found
break;
spf=spf_neutral;
locspf=spf_pass;
-(void) printf("JMPDBG checkseq seq=<%s>\n",seq);
phase=0;
proceed=true;
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
}
phase++;
}
-(void) printf("JMPDBG checkseq status='%s'\n",spf_spfASCII(spf));
return spf;
#undef OPEP
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;
areequal=false;
}
}
-(void) printf("res='%d'\n", areequal); //JMPDBG
return areequal;
}
/*
cleanipstr=ZIPV4;
break;
case 4 : //lets convert it
- if (inet_pton(afnnum->afntype,cleanipstr,afnnum->ip)<=0) {
- afnnum=afn_freeipnum(afnnum);
- phase=999; //no need to go further
+ switch (inet_pton(afnnum->afntype,cleanipstr,afnnum->ip)) {
+ case 1 : //success
+ break;
+ case 0 : //Invalid IP number
+ (void) fprintf(stderr,"Unable to convert IP <%s> (Invalid IP number)\n",
+ cleanipstr);
+ afnnum=afn_freeipnum(afnnum);
+ phase=999; //no need to go further
+ break;
+ case -1 : //Invalid IP number
+ (void) fprintf(stderr,"Unable to convert IP <%s> (error=<%s>)\n",
+ cleanipstr,strerror(errno));
+ afnnum=afn_freeipnum(afnnum);
+ phase=999; //no need to go further
+ break;
+ default : //Unexpected Result
+ (void) fprintf(stderr,"Unexpected status to convert IP <%s> "
+ "(error=<%s> BUG!?)\n",
+ cleanipstr,strerror(errno));
+ afnnum=afn_freeipnum(afnnum);
+ phase=999; //no need to go further
}
break;
case 5 : //lets convert it
afnnum->strnumip=afn_getstrip(afnnum);
+ //(void) printf("JMPDBG <%s> -> converted to <%s>\n",
+ //cleanipstr,afnnum->strnumip);
break;
default : /*SAFE guard */
proceed=false;
//version definition
#define VERSION "0.4.2"
-#define RELEASE "24"
+#define RELEASE "25"
//Public variables
PUBLIC int debug=0; //debug level