mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-09-25 02:33:51 +08:00
Add mosquitto_ssl_get().
This allow clients to access their SSL structure and perform additional verification.
This commit is contained in:
@@ -37,6 +37,8 @@ Client library:
|
||||
setting the retain bit.
|
||||
- Added MOSQ_OPT_TCP_NODELAY, to allow disabling Nagle's algorithm on client
|
||||
sockets. Closes #1526.
|
||||
- Add `mosquitto_ssl_get()` to allow clients to access their SSL structure and
|
||||
perform additional verification.
|
||||
|
||||
Clients:
|
||||
- Add timeout return code (27) for `mosquitto_sub -W <secs>` and
|
||||
|
||||
@@ -138,4 +138,5 @@ MOSQ_1.7 {
|
||||
mosquitto_property_identifier;
|
||||
mosquitto_property_identifier_to_string;
|
||||
mosquitto_property_next;
|
||||
mosquitto_ssl_get;
|
||||
} 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);
|
||||
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
@@ -1174,3 +1174,14 @@ int net__socketpair(mosq_sock_t *pairR, mosq_sock_t *pairW)
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef WITH_BROKER
|
||||
void *mosquitto_ssl_get(struct mosquitto *mosq)
|
||||
{
|
||||
#ifdef WITH_TLS
|
||||
return mosq->ssl;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user