summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Makefile.am10
-rw-r--r--lib/configure.ac22
-rw-r--r--lib/packet.c6
3 files changed, 22 insertions, 16 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index ca7de1f..fb1f0ae 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -14,15 +14,19 @@ libradsec_la_SOURCES = \
err.c \
packet.c \
radsec.c \
- request.c \
- tls.c
+ request.c
libradsec_la_SOURCES += \
rsp_debug.c \
rsp_hash.c \
rsp_list.c \
- rsp_tlscommon.c \
rsp_util.c
+if RS_ENABLE_TLS
+libradsec_la_SOURCES += \
+ tls.c \
+ rsp_tlscommon.c
+endif
+
libradsec_la_LDFLAGS = -version-info 0:0:0
libradsec_la_CFLAGS = $(CFLAGS) -DDEBUG -DDEBUG_LEVENT
diff --git a/lib/configure.ac b/lib/configure.ac
index 2039233..de02a4e 100644
--- a/lib/configure.ac
+++ b/lib/configure.ac
@@ -11,13 +11,6 @@ AC_PROG_LIBTOOL
# Checks for programs.
AC_PROG_CC
-# Enable-knobs.
-AH_TEMPLATE([RS_ENABLE_TLS], [TLS (RadSec) enabled])
-AH_TEMPLATE([RADPROT_TLS], [])
-AC_ARG_ENABLE([tls], AS_HELP_STRING([--enable-tls], [enable TLS (RadSec)]),
- [AC_DEFINE([RS_ENABLE_TLS])
- AC_DEFINE([RADPROT_TLS])])
-
# Checks for libraries.
AC_CHECK_LIB([confuse], [cfg_init],,
AC_MSG_ERROR([required library libconfuse not found]))
@@ -25,11 +18,16 @@ AC_CHECK_LIB([event_core], [event_get_version],,
AC_MSG_ERROR([required library libevent_core not found]))
AC_CHECK_LIB([freeradius-radius], [rad_alloc],,
AC_MSG_ERROR([required library libfreeradius-radius not found]))
-dnl TODO: Only do this if --enable-tls or --enable-dtls.
-#AC_CHECK_LIB([ssl], [SSL_new],,
-# AC_MSG_ERROR([required library libssl not found]))
-AC_CHECK_LIB([event_openssl], [bufferevent_openssl_socket_new],,
- AC_MSG_ERROR([required library event_openssl not found]))
+
+# Enable-knobs.
+AH_TEMPLATE([RS_ENABLE_TLS], [TLS (RadSec) enabled])
+AH_TEMPLATE([RADPROT_TLS], [])
+AC_ARG_ENABLE([tls], AS_HELP_STRING([--enable-tls], [enable TLS (RadSec)]),
+ [AC_CHECK_LIB([event_openssl], [bufferevent_openssl_socket_new],,
+ AC_MSG_ERROR([required library event_openssl not found]))
+ AC_DEFINE([RS_ENABLE_TLS])
+ AC_DEFINE([RADPROT_TLS])])
+AM_CONDITIONAL([RS_ENABLE_TLS], [test "${enable_tls+set}" = set])
# Checks for header files.
AC_CHECK_HEADERS(
diff --git a/lib/packet.c b/lib/packet.c
index 154abc8..f0593dc 100644
--- a/lib/packet.c
+++ b/lib/packet.c
@@ -99,7 +99,9 @@ _event_cb (struct bufferevent *bev, short events, void *ctx)
struct rs_packet *pkt = (struct rs_packet *)ctx;
struct rs_connection *conn;
struct rs_peer *p;
+#if defined RS_ENABLE_TLS
unsigned long err;
+#endif
assert (pkt);
assert (pkt->conn);
@@ -137,7 +139,7 @@ _event_cb (struct bufferevent *bev, short events, void *ctx)
"%d", err);
}
}
-#endif
+#endif /* RS_ENABLE_TLS */
rs_err_conn_push_fl (pkt->conn, RSE_CONNERR, __FILE__, __LINE__, NULL);
fprintf (stderr, "%s: BEV_EVENT_ERROR\n", __func__); /* DEBUG, until verified that pushed errors will actually be handled */
}
@@ -339,6 +341,7 @@ _init_bev (struct rs_connection *conn, struct rs_peer *peer)
return rs_err_conn_push_fl (conn, RSE_EVENT, __FILE__, __LINE__,
"bufferevent_socket_new");
break;
+#if defined RS_ENABLE_TLS
case RS_CONN_TYPE_TLS:
if (rs_tls_init (conn))
return -1;
@@ -356,6 +359,7 @@ _init_bev (struct rs_connection *conn, struct rs_peer *peer)
case RS_CONN_TYPE_DTLS:
return rs_err_conn_push_fl (conn, RSE_NOSYS, __FILE__, __LINE__,
"%s: NYI", __func__);
+#endif /* RS_ENABLE_TLS */
default:
return rs_err_conn_push_fl (conn, RSE_INTERNAL, __FILE__, __LINE__,
"%s: invalid connection type: %d", __func__,