add freebsd crl-monitor support

This commit is contained in:
toddouska 2012-11-16 13:25:45 -08:00
parent dd259b12c7
commit d4035e5f62
2 changed files with 14 additions and 5 deletions

View File

@ -613,10 +613,10 @@ AC_ARG_ENABLE(crl-monitor,
if test "$ENABLED_CRL_MONITOR" = "yes" if test "$ENABLED_CRL_MONITOR" = "yes"
then then
case $host_os in case $host_os in
*linux* | *darwin*) *linux* | *darwin* | *freebsd*)
AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR" ;; AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR" ;;
*) *)
AC_MSG_ERROR([crl monitor only allowed on linux or OS X]) ;; AC_MSG_ERROR([crl monitor only allowed on linux, OS X, or freebsd]) ;;
esac esac
fi fi
@ -787,6 +787,7 @@ echo " * LEANPSK: $ENABLED_LEANPSK"
echo " * ECC: $ENABLED_ECC" echo " * ECC: $ENABLED_ECC"
echo " * OCSP: $ENABLED_OCSP" echo " * OCSP: $ENABLED_OCSP"
echo " * CRL: $ENABLED_CRL" echo " * CRL: $ENABLED_CRL"
echo " * CRL-MONITOR: $ENABLED_CRL_MONITOR"
echo " * NTRU: $ENABLED_NTRU" echo " * NTRU: $ENABLED_NTRU"
echo "" echo ""
echo "---" echo "---"

View File

@ -328,12 +328,20 @@ static int SwapLists(CYASSL_CRL* crl)
} }
#ifdef __MACH__ #if (defined(__MACH__) || defined(__FreeBSD__))
#include <sys/types.h>
#include <sys/event.h> #include <sys/event.h>
#include <sys/time.h> #include <sys/time.h>
#include <fcntl.h> #include <fcntl.h>
#ifdef __MACH__
#define XEVENT_MODE O_EVTONLY
#elif defined(__FreeBSD__)
#define XEVENT_MODE EVFILT_VNODE
#endif
/* OS X monitoring */ /* OS X monitoring */
static void* DoMonitor(void* arg) static void* DoMonitor(void* arg)
{ {
@ -354,7 +362,7 @@ static void* DoMonitor(void* arg)
fDER = -1; fDER = -1;
if (crl->monitors[0].path) { if (crl->monitors[0].path) {
fPEM = open(crl->monitors[0].path, O_EVTONLY); fPEM = open(crl->monitors[0].path, XEVENT_MODE);
if (fPEM == -1) { if (fPEM == -1) {
CYASSL_MSG("PEM event dir open failed"); CYASSL_MSG("PEM event dir open failed");
return NULL; return NULL;
@ -362,7 +370,7 @@ static void* DoMonitor(void* arg)
} }
if (crl->monitors[1].path) { if (crl->monitors[1].path) {
fDER = open(crl->monitors[1].path, O_EVTONLY); fDER = open(crl->monitors[1].path, XEVENT_MODE);
if (fDER == -1) { if (fDER == -1) {
CYASSL_MSG("DER event dir open failed"); CYASSL_MSG("DER event dir open failed");
return NULL; return NULL;