commit - 84ed46d4c1caaa4ec79a6223c35785afcf1c9d53
commit + 51231ac8d45bf329f4724a145e6bc7a3ea118570
blob - 059e871ddaa38af341e995f577225fad84940091
blob + a97896758cc30c2f63724ab5396e797e064763da
--- src/ngircd/conn-ssl.c
+++ src/ngircd/conn-ssl.c
ConnSSL_Init_SSL(CONNECTION *c)
{
int ret;
+
+ LogDebug("Initializing SSL ...");
assert(c != NULL);
+
#ifdef HAVE_LIBSSL
if (!ssl_ctx) {
Log(LOG_ERR,
LogOpenSSLError("Failed to create SSL structure", NULL);
return false;
}
+ Conn_OPTION_ADD(c, CONN_SSL);
ret = SSL_set_fd(c->ssl_state.ssl, c->sock);
if (ret != 1) {
}
#endif
#ifdef HAVE_LIBGNUTLS
+ Conn_OPTION_ADD(c, CONN_SSL);
ret = gnutls_set_default_priority(c->ssl_state.gnutls_session);
- if (ret < 0) {
+ if (ret != 0) {
Log(LOG_ERR, "Failed to set GnuTLS default priority: %s",
gnutls_strerror(ret));
ConnSSL_Free(c);
* There doesn't seem to be an alternate GNUTLS API we could use instead, see e.g.
* http://www.mail-archive.com/help-gnutls@gnu.org/msg00286.html
*/
- gnutls_transport_set_ptr(c->ssl_state.gnutls_session, (gnutls_transport_ptr_t) (long) c->sock);
- gnutls_certificate_server_set_request(c->ssl_state.gnutls_session, GNUTLS_CERT_REQUEST);
- ret = gnutls_credentials_set(c->ssl_state.gnutls_session, GNUTLS_CRD_CERTIFICATE, x509_cred);
- if (ret < 0) {
- Log(LOG_ERR, "Failed to set SSL credentials: %s", gnutls_strerror(ret));
+ gnutls_transport_set_ptr(c->ssl_state.gnutls_session,
+ (gnutls_transport_ptr_t) (long) c->sock);
+ gnutls_certificate_server_set_request(c->ssl_state.gnutls_session,
+ GNUTLS_CERT_REQUEST);
+ ret = gnutls_credentials_set(c->ssl_state.gnutls_session,
+ GNUTLS_CRD_CERTIFICATE, x509_cred);
+ if (ret != 0) {
+ Log(LOG_ERR, "Failed to set SSL credentials: %s",
+ gnutls_strerror(ret));
ConnSSL_Free(c);
return false;
}
gnutls_dh_set_prime_bits(c->ssl_state.gnutls_session, DH_BITS_MIN);
#endif
- Conn_OPTION_ADD(c, CONN_SSL);
return true;
}
return false;
}
#endif
- LogDebug("Initializing SSL data ...");
if (!ConnSSL_Init_SSL(c))
return -1;
}