Libspf2 is a new generation SPF library which may be included into milter-greylist.

Version 1.2.9 of libspf2 became available in November 2008 and covers all shortcomings of version 1.2.5 (for which the stability patches below are for).

Make libspf2 1.2.5 stable for use with milter-greylist

The (older) version is 1.2.5 which is pretty stable but has some issues depending on the specific operating system environment (especially regarding memory allocation and the resolver library, header file handling). Several patches exists on the net. I took some of these and provided some of my own to form a collection which makes libspf2 stable for use with mitler-greylist at least on following platforms (tested):

  • Linux Fedora 6/x86_64
  • Solaris 8/SPARC
  • Solaris 9/x86

Some Linux or BSD distributions may also provide well patched sources to turn libspf2 into a usable state.

All these patches referenced here should be taken into a future official release of libspf2 but I was not able to post a bug report to the development crew via :-( Their bug tracker application seems to be broken …
The improvements and fixes got there anyway at least since version 1.2.9.


Applicable to libspf2 1.2.5

All these patches are currently incorporated into the Redhat/Fedora RPMs provided at (release 1.2.5-4 and greater).

libspf2-1.2.5-64bit.patch fixes int/size_t problem, taken from
libspf2-1.2.5-bogus-header.patch fixes unused header file reference, taken from
libspf2-1.2.5-malloc.patch fixes malloc error handling
libspf2-1.2.5-res_ninit.patch fixes correct initialisation and usage of res_ninit()

ad libspf2-1.2.5-res_ninit.patch:

The static data structure for res_ninit() will be correctly initialized to 0. Otherwise some newer resolver libraries (e.g. Solaris resolver derived from ISC Bind V8) try to clean up the state if not already set to zero and may find spurious pointer values which in turn will be tried to free up allocated memory … leading sometimes to segmentation faults :(

Building RPMs


libspf2.spec RPM Spec file, which includes all the patches given above.
cp -p libspf2-1.2.5-*.patch /usr/src/redhat/SOURCES/
cp -p libspf2.spec /usr/src/redhat/SPECS/

rpmbuild -ba libspf2.spec

Usage by milter-greylist

Call configure with option --with-libspf2 or specify the base path of the libspf2 in a non-standard directory like --with-libspf2=/opt/libspf2


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License