From 4afa187f9a7c1d981855a085e3a14e8f2df1a524 Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Thu, 6 Aug 2009 23:05:53 +0200 Subject: [PATCH] Expose SSL/TLS related config variables. --- GNUmakefile | 2 +- src/core/config.c | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 0496325..a7800ce 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -13,7 +13,7 @@ USE_SSL ?= NO USE_BIGENDIAN ?= AUTO BITS ?= AUTO SILENT ?= YES -LDLIBS += -levent +LDLIBS += -lev TERSE ?= NO STACK_PROTECT ?= NO diff --git a/src/core/config.c b/src/core/config.c index 88b6513..92f08e5 100644 --- a/src/core/config.c +++ b/src/core/config.c @@ -137,6 +137,10 @@ #define DEF_LIMIT_MAX_SHARE 0 #define DEF_LIMIT_MIN_SLOTS 0 #define DEF_LIMIT_MAX_SLOTS 0 +#define DEF_TLS_ENABLE 0 +#define DEF_TLS_REQUIRE 1 +#define DEF_TLS_PRIVATE_KEY "" +#define DEF_TLS_CERTIFICATE "" #define DEF_MSG_HUB_FULL "Hub is full" #define DEF_MSG_HUB_DISABLED "Hub is disabled" #define DEF_MSG_HUB_REGISTERED_USERS_ONLY "Hub is for registered users only" @@ -232,10 +236,10 @@ void config_defaults(struct hub_config* config) DEFAULT_STRING (msg_user_hub_limit_low, DEF_MSG_USER_HUB_LIMIT_LOW); DEFAULT_STRING (msg_user_hub_limit_high, DEF_MSG_USER_HUB_LIMIT_HIGH); - DEFAULT_INTEGER(tls_enable, 0); - DEFAULT_INTEGER(tls_require, 0); - DEFAULT_STRING (tls_certificate, ""); - DEFAULT_STRING (tls_private_key, ""); + DEFAULT_INTEGER(tls_enable, DEF_TLS_ENABLE); + DEFAULT_INTEGER(tls_require, DEF_TLS_REQUIRE); + DEFAULT_STRING (tls_certificate, DEF_TLS_CERTIFICATE); + DEFAULT_STRING (tls_private_key, DEF_TLS_PRIVATE_KEY); } @@ -408,6 +412,13 @@ void dump_config(struct hub_config* config, int ignore_defaults) DUMP_BOOL(low_bandwidth_mode, DEF_LOW_BANDWIDTH_MODE); DUMP_BOOL(registered_users_only, DEF_REGISTERED_USERS_ONLY); +#ifdef SSL_SUPPORT + DUMP_BOOL(tls_enable, DEF_TLS_ENABLE); + DUMP_BOOL(tls_require, DEF_TLS_REQUIRE); + DUMP_STR (tls_certificate, DEF_TLS_CERTIFICATE); + DUMP_STR (tls_private_key, DEF_TLS_PRIVATE_KEY); +#endif + /* Limits enforced on users */ DUMP_INT(limit_max_hubs_user, DEF_LIMIT_MAX_HUBS_USER); DUMP_INT(limit_max_hubs_reg, DEF_LIMIT_MAX_HUBS_REG);