mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-27 10:07:19 +02:00
Code Cleanup
- Removed debugging and redundant code. - Removed socket cast. - Added diagnostic message on handshake fail.
This commit is contained in:
parent
88b94ac2fc
commit
40dd95ddfb
1 changed files with 5 additions and 6 deletions
|
@ -64,9 +64,6 @@ static int verify_certificate_callback (gnutls_session_t session)
|
||||||
if (trust_override)
|
if (trust_override)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Get the hostname from the session.
|
|
||||||
const char* hostname = (const char*) gnutls_session_get_ptr (session);
|
|
||||||
|
|
||||||
// This verification function uses the trusted CAs in the credentials
|
// This verification function uses the trusted CAs in the credentials
|
||||||
// structure. So you must have installed one or more CA certificates.
|
// structure. So you must have installed one or more CA certificates.
|
||||||
unsigned int status = 0;
|
unsigned int status = 0;
|
||||||
|
@ -85,8 +82,6 @@ static int verify_certificate_callback (gnutls_session_t session)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return GNUTLS_E_CERTIFICATE_ERROR;
|
return GNUTLS_E_CERTIFICATE_ERROR;
|
||||||
|
|
||||||
//std::cout << "c: INFO " << out.data << "\n";
|
|
||||||
|
|
||||||
gnutls_free (out.data);
|
gnutls_free (out.data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -258,7 +253,7 @@ void TLSClient::connect (const std::string& host, const std::string& port)
|
||||||
#if GNUTLS_VERSION_NUMBER >= 0x030109
|
#if GNUTLS_VERSION_NUMBER >= 0x030109
|
||||||
gnutls_transport_set_int (_session, _socket);
|
gnutls_transport_set_int (_session, _socket);
|
||||||
#else
|
#else
|
||||||
gnutls_transport_set_ptr (_session, (gnutls_transport_ptr_t) (long) _socket);
|
gnutls_transport_set_ptr (_session, (gnutls_transport_ptr_t) _socket);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Perform the TLS handshake
|
// Perform the TLS handshake
|
||||||
|
@ -278,7 +273,11 @@ void TLSClient::connect (const std::string& host, const std::string& port)
|
||||||
// manually after the gnutls handshake.
|
// manually after the gnutls handshake.
|
||||||
ret = verify_certificate_callback(_session);
|
ret = verify_certificate_callback(_session);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
if (_debug)
|
||||||
|
std::cout << "c: ERROR Certificate verification failed.\n";
|
||||||
throw std::string (STRING_TLS_INIT_FAIL);
|
throw std::string (STRING_TLS_INIT_FAIL);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_debug)
|
if (_debug)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue