shevek / libspf2

Implementation of the Sender Policy Framework for SMTP authorization
http://www.libspf2.net/
37 stars 32 forks source link

Local Policy #19

Open mutexl0ck opened 7 years ago

mutexl0ck commented 7 years ago

While attempting to setup a local policy on my production Postfix server to allow improperly used mailing list messages to come through, I could not get a local policy working. After troubleshooting with the spfquery tool and looking at the code I realized the local policy would never work because spf_request->use_local_policy is never set.

spf_interprect.c performs a check against spf_request->use_local_policy on line 671. It looks like use_local_policy is never used outside of this not null check.

if ( spf_request->use_local_policy ) {

Should it be up to the calling code (Postfix, etc) to set this? If so, shouldn't spfquery set it when the -local option is used on the command line?

My fix for my environment was to simply remove the conditional on line 671 in spf_interprect.c. After doing so, both the spfquery tool and Postfix began working as expected using the local policy I defined.