Fix compiling without TLS.

pull/793/merge
Roger A. Light 8 years ago
parent 51ec5601c2
commit 6c7ecd7e97

@ -443,9 +443,9 @@ int net__socket_connect_tls(struct mosquitto *mosq)
#endif
#ifdef WITH_TLS
static int net__init_ssl_ctx(struct mosquitto *mosq)
{
#ifdef WITH_TLS
int ret;
if(mosq->ssl_ctx){
@ -582,9 +582,9 @@ static int net__init_ssl_ctx(struct mosquitto *mosq)
}
}
#endif
return MOSQ_ERR_SUCCESS;
}
#endif
int net__socket_connect_step3(struct mosquitto *mosq, const char *host, uint16_t port, const char *bind_address, bool blocking)

@ -268,15 +268,19 @@ int mosquitto_opts_set(struct mosquitto *mosq, enum mosq_opt_t option, void *val
}
break;
case MOSQ_OPT_SSL_CTX:
#ifdef WITH_TLS
mosq->ssl_ctx = (SSL_CTX *)value;
if(mosq->ssl_ctx){
#if defined(WITH_TLS) && OPENSSL_VERSION_NUMBER >= 0x10100000L
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
SSL_CTX_up_ref(mosq->ssl_ctx);
#else
CRYPTO_add(&(mosq->ssl_ctx)->references, 1, CRYPTO_LOCK_SSL_CTX);
#endif
}
break;
#else
return MOSQ_ERR_NOT_SUPPORTED;
#endif
case MOSQ_OPT_SSL_CTX_WITH_DEFAULTS:
#if defined(WITH_TLS) && OPENSSL_VERSION_NUMBER >= 0x10100000L
mosq->ssl_ctx_defaults = true;

@ -31,9 +31,9 @@ static int psk__file_parse(struct mosquitto_db *db, struct mosquitto__unpwd **ps
#ifdef WITH_TLS
static int pw__digest(const char *password, const unsigned char *salt, unsigned int salt_len, unsigned char *hash, unsigned int *hash_len);
static int base64__decode(char *in, unsigned char **decoded, unsigned int *decoded_len);
static int mosquitto__memcmp_const(const void *ptr1, const void *b, size_t len);
#endif
static int mosquitto__memcmp_const(const void *ptr1, const void *b, size_t len);
int mosquitto_security_init_default(struct mosquitto_db *db, bool reload)
@ -749,6 +749,7 @@ static int psk__file_parse(struct mosquitto_db *db, struct mosquitto__unpwd **ps
}
#ifdef WITH_TLS
static int mosquitto__memcmp_const(const void *a, const void *b, size_t len)
{
int i;
@ -763,6 +764,7 @@ static int mosquitto__memcmp_const(const void *a, const void *b, size_t len)
}
return rc;
}
#endif
int mosquitto_unpwd_check_default(struct mosquitto_db *db, struct mosquitto *context, const char *username, const char *password)

Loading…
Cancel
Save