Skip to content

Commit

Permalink
lib-ssl-iostream: Add get_compression accessor
Browse files Browse the repository at this point in the history
This is needed by login-common
  • Loading branch information
cmouse authored and Timo Sirainen committed Oct 31, 2017
1 parent 1fea3af commit 48e2439
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lib-ssl-iostream/iostream-openssl.c
Expand Up @@ -710,6 +710,19 @@ static const char *openssl_iostream_get_server_name(struct ssl_iostream *ssl_io)
return ssl_io->host;
}

static const char *
openssl_iostream_get_compression(struct ssl_iostream *ssl_io)
{
#if defined(HAVE_SSL_COMPRESSION) && !defined(OPENSSL_NO_COMP)
const COMP_METHOD *comp;

comp = SSL_get_current_compression(ssl_io->ssl);
return comp == NULL ? NULL : SSL_COMP_get_name(comp);
#else
return NULL;
#endif
}

static const char *
openssl_iostream_get_security_string(struct ssl_iostream *ssl_io)
{
Expand Down Expand Up @@ -764,6 +777,7 @@ static const struct iostream_ssl_vfuncs ssl_vfuncs = {
openssl_iostream_cert_match_name,
openssl_iostream_get_peer_name,
openssl_iostream_get_server_name,
openssl_iostream_get_compression,
openssl_iostream_get_security_string,
openssl_iostream_get_last_error
};
Expand Down
1 change: 1 addition & 0 deletions src/lib-ssl-iostream/iostream-ssl-private.h
Expand Up @@ -32,6 +32,7 @@ struct iostream_ssl_vfuncs {
int (*cert_match_name)(struct ssl_iostream *ssl_io, const char *name);
const char *(*get_peer_name)(struct ssl_iostream *ssl_io);
const char *(*get_server_name)(struct ssl_iostream *ssl_io);
const char *(*get_compression)(struct ssl_iostream *ssl_io);
const char *(*get_security_string)(struct ssl_iostream *ssl_io);
const char *(*get_last_error)(struct ssl_iostream *ssl_io);
};
Expand Down
5 changes: 5 additions & 0 deletions src/lib-ssl-iostream/iostream-ssl.c
Expand Up @@ -200,6 +200,11 @@ const char *ssl_iostream_get_server_name(struct ssl_iostream *ssl_io)
return ssl_vfuncs->get_server_name(ssl_io);
}

const char *ssl_iostream_get_compression(struct ssl_iostream *ssl_io)
{
return ssl_vfuncs->get_compression(ssl_io);
}

const char *ssl_iostream_get_security_string(struct ssl_iostream *ssl_io)
{
return ssl_vfuncs->get_security_string(ssl_io);
Expand Down
1 change: 1 addition & 0 deletions src/lib-ssl-iostream/iostream-ssl.h
Expand Up @@ -71,6 +71,7 @@ int ssl_iostream_check_cert_validity(struct ssl_iostream *ssl_io,
const char *host, const char **error_r);
int ssl_iostream_cert_match_name(struct ssl_iostream *ssl_io, const char *name);
const char *ssl_iostream_get_peer_name(struct ssl_iostream *ssl_io);
const char *ssl_iostream_get_compression(struct ssl_iostream *ssl_io);
const char *ssl_iostream_get_server_name(struct ssl_iostream *ssl_io);
const char *ssl_iostream_get_security_string(struct ssl_iostream *ssl_io);
const char *ssl_iostream_get_last_error(struct ssl_iostream *ssl_io);
Expand Down

0 comments on commit 48e2439

Please sign in to comment.