Add `mosquitto_ssl_get()`.

This allow clients to access their SSL structure and
perform additional verification.
pull/1639/head
Roger A. Light 5 years ago
parent e2123b2561
commit 56ba1b99db

@ -37,6 +37,8 @@ Client library:
setting the retain bit. setting the retain bit.
- Added MOSQ_OPT_TCP_NODELAY, to allow disabling Nagle's algorithm on client - Added MOSQ_OPT_TCP_NODELAY, to allow disabling Nagle's algorithm on client
sockets. Closes #1526. sockets. Closes #1526.
- Add `mosquitto_ssl_get()` to allow clients to access their SSL structure and
perform additional verification.
Clients: Clients:
- Add timeout return code (27) for `mosquitto_sub -W <secs>` and - Add timeout return code (27) for `mosquitto_sub -W <secs>` and

@ -138,4 +138,5 @@ MOSQ_1.7 {
mosquitto_property_identifier; mosquitto_property_identifier;
mosquitto_property_identifier_to_string; mosquitto_property_identifier_to_string;
mosquitto_property_next; mosquitto_property_next;
mosquitto_ssl_get;
} MOSQ_1.6; } MOSQ_1.6;

@ -1743,6 +1743,23 @@ libmosq_EXPORT int mosquitto_tls_opts_set(struct mosquitto *mosq, int cert_reqs,
libmosq_EXPORT int mosquitto_tls_psk_set(struct mosquitto *mosq, const char *psk, const char *identity, const char *ciphers); libmosq_EXPORT int mosquitto_tls_psk_set(struct mosquitto *mosq, const char *psk, const char *identity, const char *ciphers);
/*
* Function: mosquitto_ssl_get
*
* Retrieve a pointer to the SSL structure used for TLS connections in this
* client. This can be used in e.g. the connect callback to carry out
* additional verification steps.
*
* Parameters:
* mosq - a valid mosquitto instance
*
* Returns:
* A valid pointer to an openssl SSL structure - if the client is using TLS.
* NULL - if the client is not using TLS, or TLS support is not compiled in.
*/
libmosq_EXPORT void *mosquitto_ssl_get(struct mosquitto *mosq);
/* ====================================================================== /* ======================================================================
* *
* Section: Callbacks * Section: Callbacks

@ -1174,3 +1174,14 @@ int net__socketpair(mosq_sock_t *pairR, mosq_sock_t *pairW)
#endif #endif
} }
#endif #endif
#ifndef WITH_BROKER
void *mosquitto_ssl_get(struct mosquitto *mosq)
{
#ifdef WITH_TLS
return mosq->ssl;
#else
return NULL;
#endif
}
#endif

Loading…
Cancel
Save