[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch for gettign SPF config from CP structure



Matti,

I think this should accomodate SPF code to the config parameters moved
into a structure.  Please take a look.

Eugene

P.S. I probably should also use more modern API flavor...  When I have a
minute...
Index: smtpserver/policytest.c
===================================================================
RCS file: /cvsroot/zmailer/smtpserver/policytest.c,v
retrieving revision 1.122
diff -u -r1.122 policytest.c
--- smtpserver/policytest.c	2 Jul 2005 01:19:38 -0000	1.122
+++ smtpserver/policytest.c	2 Sep 2005 12:07:21 -0000
@@ -43,12 +43,6 @@
 	state->message = state->messages[(attrib)];	\
 	state->messages[(attrib)] = NULL
 
-int use_spf;
-int spf_received;
-int spf_threshold;
-char *spf_localpolicy;
-int spf_whitelist_use_default;
-
 static int resolveattributes __((struct policytest *, int, struct policystate *, const unsigned char *, int));
 static int  check_domain __((struct policystate *, const unsigned char *, int));
 static int  check_user __((struct policystate *, const unsigned char *, int));
@@ -444,20 +438,16 @@
 
     SPF_init_c_results(&state->local_policy);
     if (SPF_compile_local_policy(state->spfcid,
-				 spf_localpolicy,
-				 spf_whitelist_use_default,
+				 CP->spf_localpolicy,
+				 CP->spf_whitelist_use_default,
 				 &state->local_policy)) {
 	type(NULL,0,NULL," SPF_compile_local_policy() failed: %s",
 	     state->local_policy.err_msg);
-	free(spf_localpolicy);
 	state->check_spf=0;
 	return;
     }
     if (debug)
-	type(NULL,0,NULL," SPF local_policy: %s",spf_localpolicy);
-#warning "strange looking  free(spf_localpolicy)  call here!"
-    free(spf_localpolicy); /* FIXME??FIXME??FIXME?? */
-
+	type(NULL,0,NULL," SPF local_policy: %s",CP->spf_localpolicy);
     SPF_set_local_policy(state->spfcid,state->local_policy);
 }
 #endif
@@ -1945,9 +1935,9 @@
       if (debug)
 	type(NULL,0,NULL,
 	     "rejecting if spf_level(%d) < spf_threshold(%d)",
-	     spf_level,spf_threshold);
+	     spf_level,CP->spf_threshold);
 
-      if (spf_level < spf_threshold) {
+      if (spf_level < CP->spf_threshold) {
 	if (spf_output.smtp_comment) {
 	  state->message = strdup(spf_output.smtp_comment);
 	} else {

OpenPGP digital signature