commit - 57aa64e1176b47830801cec8615affcc24cfb142
commit + 5196e9bcb17111c43a71df2d11634b0705600b9f
blob - 46f1c9d0a584007707336f46b86bbea2b5632992
blob + fbf796c79ab3f41da09269abb1d615f06810eb64
--- src/ngircd/conn-ssl.c
+++ src/ngircd/conn-ssl.c
int ret;
assert(c != NULL);
#ifdef HAVE_LIBSSL
- assert(ssl_ctx);
if (!ssl_ctx) /* NULL when library initialization failed */
return false;
bool ret;
#ifdef HAVE_LIBGNUTLS
int err;
-#endif
- assert(c != NULL);
- assert(s != NULL);
-#ifdef HAVE_LIBGNUTLS
+
err = gnutls_init(&c->ssl_state.gnutls_session, GNUTLS_CLIENT);
if (err) {
Log(LOG_ERR, "gnutls_init: %s", gnutls_strerror(err));
unsigned long sslerr;
int real_errno = errno;
- assert( fname );
-
ret = SSL_get_error(c->ssl_state.ssl, code);
switch (ret) {
case SSL_ERROR_WANT_READ:
#ifdef HAVE_LIBSSL
SSL *ssl = c->ssl_state.ssl;
- assert( c );
- assert( ssl );
+ assert(ssl);
Log(LOG_INFO, "New %s connection using cipher %s on socket %d.",
SSL_get_version(ssl), SSL_get_cipher(ssl), c->sock);
ConnSSL_Accept( CONNECTION *c )
{
assert(c != NULL);
-#ifdef HAVE_LIBSSL
- if (!c->ssl_state.ssl) {
-#endif
-#ifdef HAVE_LIBGNUTLS
if (!Conn_OPTION_ISSET(c, CONN_SSL)) {
+#ifdef HAVE_LIBGNUTLS
int err = gnutls_init(&c->ssl_state.gnutls_session, GNUTLS_SERVER);
if (err) {
Log(LOG_ERR, "gnutls_init: %s", gnutls_strerror(err));
#ifdef HAVE_LIBSSL
assert(c->ssl_state.ssl);
#endif
-#ifdef HAVE_LIBGNUTLS
assert(Conn_OPTION_ISSET(c, CONN_SSL));
-#endif
return ConnectAccept(c, true);
}
#endif
#ifdef HAVE_LIBGNUTLS
(void) connect;
- assert(Conn_OPTION_ISSET(c, CONN_SSL));
ret = gnutls_handshake(c->ssl_state.gnutls_session);
if (ret)
return ConnSSL_HandleError(c, ret, "gnutls_handshake");
#ifdef HAVE_LIBGNUTLS
bw = gnutls_write(c->ssl_state.gnutls_session, buf, count);
#endif
- if ( bw > 0 ) return bw;
+ if (bw > 0)
+ return bw;
if (ConnSSL_HandleError( c, bw, "ConnSSL_Write") == 0)
errno = EAGAIN; /* try again */
return -1;
{
#ifdef HAVE_LIBSSL
char *nl;
+ SSL *ssl = c->ssl_state.ssl;
- SSL *ssl;
- assert(c != NULL);
- assert(len >= 128);
- ssl = c->ssl_state.ssl;
if (!ssl)
return false;
*buf = 0;
return true;
#endif
#ifdef HAVE_LIBGNUTLS
- assert(c != NULL);
- assert(len >= 128);
if (Conn_OPTION_ISSET(c, CONN_SSL)) {
const char *name_cipher, *name_mac, *name_proto, *name_keyexchange;
unsigned keysize;