...
 
Commits (7)
    https://gitcode.net/awesome-mirrors/eclipse/mosquitto/-/commit/105e30ff5bedd8d4ffe8bf0cc618378df7ca966f Fix engine support. 2023-06-02T19:11:50+02:00 Bart Desplanques bart.desplanques@gmail.com Do not try to open keyfile when keyform is "engine": this is not necessarily a real file. Dynamic engines require init with OPENSSL_INIT_ENGINE_DYNAMIC before they can be loaded. Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:bart.desplanques@gmail.com" title="bart.desplanques@gmail.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg5" style="text-decoration: none">N</a><a href="mailto:bart.desplanques@gmail.com" title="bart.desplanques@gmail.com">Bart Desplanques</a> &lt;<a href="mailto:bart.desplanques@gmail.com" title="bart.desplanques@gmail.com">bart.desplanques@gmail.com</a>&gt;</span> https://gitcode.net/awesome-mirrors/eclipse/mosquitto/-/commit/18ea97c468047da56bbf3eea5146130a87163254 Fixes sub_count is not decreased when client ubsubscribe 2023-06-30T11:29:40+08:00 linkkzz jk588592@163.com Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:jk588592@163.com" title="jk588592@163.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg4" style="text-decoration: none">N</a><a href="mailto:jk588592@163.com" title="jk588592@163.com">linkkzz</a> &lt;<a href="mailto:jk588592@163.com" title="jk588592@163.com">jk588592@163.com</a>&gt;</span> https://gitcode.net/awesome-mirrors/eclipse/mosquitto/-/commit/c749ed6fd58c77e36319ba0adcb84d31e8edab50 Do not add outgoing bridge connection context to session expiry list on disco... 2023-07-03T11:16:38+00:00 Norbert Heusser norbert.heusser@cedalo.com Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:norbert.heusser@cedalo.com" title="norbert.heusser@cedalo.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg1" style="text-decoration: none">N</a><a href="mailto:norbert.heusser@cedalo.com" title="norbert.heusser@cedalo.com">Norbert Heusser</a> &lt;<a href="mailto:norbert.heusser@cedalo.com" title="norbert.heusser@cedalo.com">norbert.heusser@cedalo.com</a>&gt;</span> https://gitcode.net/awesome-mirrors/eclipse/mosquitto/-/commit/2f2307f68480c782cd69d3aeca318126354875bb Merge pull request #2834 from linkkzz/fix-subcount 2023-08-11T23:03:35+01:00 Roger Light roger@atchoo.org Fix sub_count is not decreased when client ubsubscribe https://gitcode.net/awesome-mirrors/eclipse/mosquitto/-/commit/9c295efe985cb70b27e175547651f87686756bea Merge pull request #2838 from NorbertHeusser/fix-no-expiry-on-outgoing-bridge 2023-08-11T23:35:43+01:00 Roger Light roger@atchoo.org Do not add outgoing bridge connection context to session expiry list https://gitcode.net/awesome-mirrors/eclipse/mosquitto/-/commit/cb90e911267b0c49b5b693a99b1b573c18b1b03b Add missing mosquitto_strerror entries. 2023-08-12T10:12:52+01:00 Roger A. Light roger@atchoo.org Closes #2799. Thanks to n00b42 https://gitcode.net/awesome-mirrors/eclipse/mosquitto/-/commit/4093dad058c7cf7f751efe8d51fa9952b0275b97 Merge pull request #2827 from bdesplanq/fix-engine-support 2023-08-15T14:09:01+01:00 Roger Light roger@atchoo.org Fix engine keyfile support.
......@@ -593,6 +593,11 @@ int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg)
return 1;
}
#ifdef WITH_TLS
if(cfg->keyform && mosquitto_string_option(mosq, MOSQ_OPT_TLS_KEYFORM, cfg->keyform)){
fprintf(stderr, "Error: Problem setting key form, it must be one of 'pem' or 'engine'.\n");
mosquitto_lib_cleanup();
return 1;
}
if(cfg->cafile || cfg->capath){
rc = mosquitto_tls_set(mosq, cfg->cafile, cfg->capath, cfg->certfile, cfg->keyfile, NULL);
if(rc){
......@@ -615,11 +620,6 @@ int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg)
mosquitto_lib_cleanup();
return 1;
}
if(cfg->keyform && mosquitto_string_option(mosq, MOSQ_OPT_TLS_KEYFORM, cfg->keyform)){
fprintf(stderr, "Error: Problem setting key form, it must be one of 'pem' or 'engine'.\n");
mosquitto_lib_cleanup();
return 1;
}
if(cfg->tls_engine_kpass_sha1 && mosquitto_string_option(mosq, MOSQ_OPT_TLS_ENGINE_KPASS_SHA1, cfg->tls_engine_kpass_sha1)){
fprintf(stderr, "Error: Problem setting TLS engine key pass sha, is it a 40 character hex string?\n");
mosquitto_lib_cleanup();
......
......@@ -1253,6 +1253,11 @@ int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg)
return 1;
}
#ifdef WITH_TLS
if(cfg->keyform && mosquitto_string_option(mosq, MOSQ_OPT_TLS_KEYFORM, cfg->keyform)){
err_printf(cfg, "Error: Problem setting key form, it must be one of 'pem' or 'engine'.\n");
mosquitto_lib_cleanup();
return 1;
}
if(cfg->cafile || cfg->capath){
rc = mosquitto_tls_set(mosq, cfg->cafile, cfg->capath, cfg->certfile, cfg->keyfile, NULL);
if(rc){
......@@ -1289,11 +1294,6 @@ int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg)
mosquitto_lib_cleanup();
return 1;
}
if(cfg->keyform && mosquitto_string_option(mosq, MOSQ_OPT_TLS_KEYFORM, cfg->keyform)){
err_printf(cfg, "Error: Problem setting key form, it must be one of 'pem' or 'engine'.\n");
mosquitto_lib_cleanup();
return 1;
}
if(cfg->tls_engine_kpass_sha1 && mosquitto_string_option(mosq, MOSQ_OPT_TLS_ENGINE_KPASS_SHA1, cfg->tls_engine_kpass_sha1)){
err_printf(cfg, "Error: Problem setting TLS engine key pass sha, is it a 40 character hex string?\n");
mosquitto_lib_cleanup();
......
......@@ -179,19 +179,21 @@ int mosquitto_tls_set(struct mosquitto *mosq, const char *cafile, const char *ca
mosquitto__free(mosq->tls_keyfile);
mosq->tls_keyfile = NULL;
if(keyfile){
fptr = mosquitto__fopen(keyfile, "rt", false);
if(fptr){
fclose(fptr);
}else{
mosquitto__free(mosq->tls_cafile);
mosq->tls_cafile = NULL;
if(mosq->tls_keyform == mosq_k_pem){
fptr = mosquitto__fopen(keyfile, "rt", false);
if(fptr){
fclose(fptr);
}else{
mosquitto__free(mosq->tls_cafile);
mosq->tls_cafile = NULL;
mosquitto__free(mosq->tls_capath);
mosq->tls_capath = NULL;
mosquitto__free(mosq->tls_capath);
mosq->tls_capath = NULL;
mosquitto__free(mosq->tls_certfile);
mosq->tls_certfile = NULL;
return MOSQ_ERR_INVAL;
mosquitto__free(mosq->tls_certfile);
mosq->tls_certfile = NULL;
return MOSQ_ERR_INVAL;
}
}
mosq->tls_keyfile = mosquitto__strdup(keyfile);
if(!mosq->tls_keyfile){
......@@ -290,6 +292,11 @@ int mosquitto_string_option(struct mosquitto *mosq, enum mosq_opt_t option, cons
#if defined(WITH_TLS) && !defined(OPENSSL_NO_ENGINE)
mosquitto__free(mosq->tls_engine);
if(value){
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
/* The "Dynamic" OpenSSL engine is not initialized by default but
is required by ENGINE_by_id() to find dynamically loadable engines */
OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_DYNAMIC, NULL);
#endif
eng = ENGINE_by_id(value);
if(!eng){
return MOSQ_ERR_INVAL;
......
......@@ -75,6 +75,10 @@ const char *mosquitto_strerror(int mosq_errno)
return "Proxy error.";
case MOSQ_ERR_MALFORMED_UTF8:
return "Malformed UTF-8";
case MOSQ_ERR_KEEPALIVE:
return "Keepalive exceeded";
case MOSQ_ERR_LOOKUP:
return "DNS Lookup failed";
case MOSQ_ERR_DUPLICATE_PROPERTY:
return "Duplicate property in property list";
case MOSQ_ERR_TLS_HANDSHAKE:
......
......@@ -1391,9 +1391,12 @@ openssl dhparam -out dhparam.pem 2048</programlisting>
<term><option>keyfile</option> <replaceable>file path</replaceable></term>
<listitem>
<para>
Path to the PEM encoded server key. This
option and <option>certfile</option> must be present
to enable certificate based TLS encryption.
If <option>tls_keyform</option> equals "pem" this is the
path to the PEM encoded server key. This option
and <option>certfile</option> must be present
to enable certificate based TLS encryption. If
<option>tls_keyform</option> is "engine" this represents
the engine handle of the private key.
</para>
<para>
The private key pointed to by this option will be
......
......@@ -214,19 +214,20 @@ void context__disconnect(struct mosquitto *context)
context__send_will(context);
net__socket_close(context);
if(context->session_expiry_interval == 0){
/* Client session is due to be expired now */
#ifdef WITH_BRIDGE
if(context->bridge == NULL)
if(context->bridge == NULL)
/* Outgoing bridge connection never expire */
#endif
{
{
if(context->session_expiry_interval == 0){
/* Client session is due to be expired now */
if(context->will_delay_interval == 0){
/* This will be done later, after the will is published for delay>0. */
context__add_to_disused(context);
}
}else{
session_expiry__add(context);
}
}else{
session_expiry__add(context);
}
keepalive__remove(context);
mosquitto__set_state(context, mosq_cs_disconnected);
......
......@@ -389,6 +389,7 @@ static int sub__remove_normal(struct mosquitto *context, struct mosquitto__subhi
if(context->subs[i] && context->subs[i]->hier == subhier){
mosquitto__free(context->subs[i]);
context->subs[i] = NULL;
context->sub_count--;
break;
}
}
......@@ -429,6 +430,7 @@ static int sub__remove_shared(struct mosquitto *context, struct mosquitto__subhi
mosquitto__free(context->subs[i]);
context->subs[i] = NULL;
context->sub_count--;
break;
}
}
......