//version definition
#define VERSION "0.4.2"
-#define RELEASE "3"
+#define RELEASE "4"
//Public variables
PUBLIC int debug=0; //debug level
return found;
}
/*
+\f
+*/
+/********************************************************/
+/* */
+/* Procedure to free all list entries, return a */
+/* NULL pointer. */
+/* */
+/********************************************************/
+PUBLIC void **rou_freelist(void **list,freehandler_t handler)
+
+{
+if (list!=(void **)0) {
+ void **ptr;
+
+ ptr=list;
+ while (*ptr!=(void *)0) {
+ (void) handler(*ptr);
+ ptr++;
+ }
+ (void) free(list);
+ list=(void **)0;
+ }
+return list;
+}
+/*
^L
*/
/********************************************************/
extern void **rou_addlist(void **list,void *entry);
//Procedure to free one entry part of list
-// return true if found, false otherwize.
+//return true if found, false otherwise.
extern _Bool rou_rmlist(void **list,void *entry,freehandler_t handler);
+//Procedure to free all entries of list
+extern void **rou_freelist(void **list,freehandler_t handler);
+
//change the application name
extern char *rou_setappname(const char *newname);
dynbuf=(char *)calloc(10,sizeof(char));
while (collected<dlen) {
u_int taille;
- char *newdynbuf;
(void) memset(buf,'\000',sizeof(buf));
taille=((u_int)(txtptr[0]))&0X0FF;
txtptr++;
(void) snprintf(buf,sizeof(buf),"%.*s ",taille,txtptr);
- if ((newdynbuf=(char *)realloc(dynbuf,strlen(dynbuf)+strlen(buf)+5))!=(char *)0) {
- dynbuf=newdynbuf;
- (void) strcat(dynbuf,buf);
- }
+ dynbuf=(char *)realloc(dynbuf,strlen(dynbuf)+strlen(buf)+5);
+ (void) strcat(dynbuf,buf);
collected+=taille+1;
txtptr+=taille;
}
static char **getspf(char *domain)
{
-char **inftxt;
+char **infspf;
+
+if ((infspf=gettxt(domain,T_SPF,"SPF"))==(char **)0) {
+ char **inftxt;
-if ((inftxt=gettxt(domain,T_SPF,"SPF"))==(char **)0)
inftxt=gettxt(domain,T_TXT,"TXT");
-return inftxt;
+ if (inftxt!=(char **)0) {
+ char **ptr;
+
+ ptr=inftxt;
+ while (*ptr!=(char *)0) {
+ if (strstr(*ptr,"v=spf1")==*ptr) {
+ char *dup;
+
+ dup=strdup(*ptr);
+ infspf=(char **)rou_addlist((void **)infspf,(void *)dup);
+ }
+ ptr++;
+ }
+ inftxt=(char **)rou_freelist((void **)inftxt,(freehandler_t)rou_freestr);
+ }
+ }
+return infspf;
}
/*
^L
(void) printf("JMPDBG <%s>\n",*ptr);
ptr++;
}
+ list=(char **)rou_freelist((void **)list,(freehandler_t)rou_freestr);
}
break;
default : //SAFE guard