Sortix main manual
This manual documents Sortix main. You can instead view this document in the latest official manual.
NAME
SSL_set1_host, SSL_set_hostflags, SSL_get0_peername — SSL server verification parametersSYNOPSIS
#include <openssl/ssl.h>SSL_set1_host(SSL *ssl, const char *hostname);
SSL_set_hostflags(SSL *ssl, unsigned int flags);
SSL_get0_peername(SSL *ssl);
DESCRIPTION
SSL_set1_host() configures a server hostname check in the ssl client, setting the expected DNS hostname to hostname and clearing any previously specified hostname. If hostname is NULL or the empty string, name checks are not performed on the peer certificate. If a nonempty hostname is specified, certificate verification automatically checks the peer hostname via X509_check_host(3) with flags set to 0.RETURN VALUES
SSL_set1_host() returns 1 for success or 0 for failure.EXAMPLES
The calls below check the hostname. Wildcards are supported, but they must match the entire label. The actual name matched in the certificate (which might be a wildcard) is retrieved, and must be copied by the application if it is to be retained beyond the lifetime of the SSL connection.if (!SSL_set1_host(ssl, "smtp.example.com")) /* error */ /* XXX: Perform SSL_connect() handshake and handle errors here */ if (SSL_get_verify_result(ssl) == X509_V_OK) { const char *peername = SSL_get0_peername(ssl); if (peername != NULL) /* Name checks were in scope and matched the peername */ }