lib/net: Improve name of showCertificate() to reflect what it does
This commit is contained in:
parent
133e447fb6
commit
82b8fa905e
|
@ -499,7 +499,7 @@ SecureSocket::secureConnect(int socket)
|
||||||
m_secureReady = true;
|
m_secureReady = true;
|
||||||
if (verify_cert_fingerprint(barrier::DataDirectories::trusted_servers_ssl_fingerprints_path())) {
|
if (verify_cert_fingerprint(barrier::DataDirectories::trusted_servers_ssl_fingerprints_path())) {
|
||||||
LOG((CLOG_INFO "connected to secure socket"));
|
LOG((CLOG_INFO "connected to secure socket"));
|
||||||
if (!showCertificate()) {
|
if (!ensure_peer_certificate()) {
|
||||||
disconnect();
|
disconnect();
|
||||||
return -1;// Cert fail, error
|
return -1;// Cert fail, error
|
||||||
}
|
}
|
||||||
|
@ -518,7 +518,7 @@ SecureSocket::secureConnect(int socket)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SecureSocket::showCertificate()
|
SecureSocket::ensure_peer_certificate()
|
||||||
{
|
{
|
||||||
X509* cert;
|
X509* cert;
|
||||||
char* line;
|
char* line;
|
||||||
|
@ -527,12 +527,12 @@ SecureSocket::showCertificate()
|
||||||
cert = SSL_get_peer_certificate(m_ssl->m_ssl);
|
cert = SSL_get_peer_certificate(m_ssl->m_ssl);
|
||||||
if (cert != NULL) {
|
if (cert != NULL) {
|
||||||
line = X509_NAME_oneline(X509_get_subject_name(cert), 0, 0);
|
line = X509_NAME_oneline(X509_get_subject_name(cert), 0, 0);
|
||||||
LOG((CLOG_INFO "server ssl certificate info: %s", line));
|
LOG((CLOG_INFO "peer ssl certificate info: %s", line));
|
||||||
OPENSSL_free(line);
|
OPENSSL_free(line);
|
||||||
X509_free(cert);
|
X509_free(cert);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
showError("server has no ssl certificate");
|
showError("peer has no ssl certificate");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ private:
|
||||||
void createSSL();
|
void createSSL();
|
||||||
int secureAccept(int s);
|
int secureAccept(int s);
|
||||||
int secureConnect(int s);
|
int secureConnect(int s);
|
||||||
bool showCertificate();
|
bool ensure_peer_certificate();
|
||||||
void checkResult(int n, int& retry);
|
void checkResult(int n, int& retry);
|
||||||
void showError(const std::string& reason);
|
void showError(const std::string& reason);
|
||||||
std::string getError();
|
std::string getError();
|
||||||
|
|
Loading…
Reference in New Issue