Commit ba076763 authored by Sergei Golubchik's avatar Sergei Golubchik

remove ssl debugging report_errors() function that was sometimes destroying the state

parent 4e9e04b2
...@@ -40,41 +40,6 @@ ...@@ -40,41 +40,6 @@
#define SSL_errno(X,Y) ERR_get_error() #define SSL_errno(X,Y) ERR_get_error()
#endif #endif
#ifndef DBUG_OFF
static void
report_errors(SSL* ssl)
{
unsigned long l;
const char *file;
const char *data;
int line, flags;
char buf[512];
DBUG_ENTER("report_errors");
while ((l= ERR_get_error_line_data(&file,&line,&data,&flags)))
{
DBUG_PRINT("error", ("OpenSSL: %s:%s:%d:%s\n", ERR_error_string(l,buf),
file,line,(flags&ERR_TXT_STRING)?data:"")) ;
}
if (ssl)
{
#ifndef DBUG_OFF
ulong error= SSL_errno(ssl, l);
DBUG_PRINT("error", ("error: %s (%lu)",
ERR_error_string(error, buf), error));
#endif
}
DBUG_PRINT("info", ("socket_errno: %d", socket_errno));
DBUG_VOID_RETURN;
}
#endif
/** /**
Obtain the equivalent system error status for the last SSL I/O operation. Obtain the equivalent system error status for the last SSL I/O operation.
...@@ -157,9 +122,6 @@ static my_bool ssl_should_retry(Vio *vio, int ret, enum enum_vio_io_event *event ...@@ -157,9 +122,6 @@ static my_bool ssl_should_retry(Vio *vio, int ret, enum enum_vio_io_event *event
*event= VIO_IO_EVENT_WRITE; *event= VIO_IO_EVENT_WRITE;
break; break;
default: default:
#ifndef DBUG_OFF
report_errors(ssl);
#endif
should_retry= FALSE; should_retry= FALSE;
ssl_set_sys_error(ssl_error); ssl_set_sys_error(ssl_error);
break; break;
...@@ -195,10 +157,6 @@ size_t vio_ssl_read(Vio *vio, uchar *buf, size_t size) ...@@ -195,10 +157,6 @@ size_t vio_ssl_read(Vio *vio, uchar *buf, size_t size)
} }
} }
#ifndef DBUG_OFF
if (ret < 0)
report_errors((SSL*) vio->ssl_arg);
#endif
DBUG_PRINT("exit", ("%d", (int) ret)); DBUG_PRINT("exit", ("%d", (int) ret));
DBUG_RETURN(ret < 0 ? -1 : ret); DBUG_RETURN(ret < 0 ? -1 : ret);
...@@ -233,10 +191,6 @@ size_t vio_ssl_write(Vio *vio, const uchar *buf, size_t size) ...@@ -233,10 +191,6 @@ size_t vio_ssl_write(Vio *vio, const uchar *buf, size_t size)
} }
} }
#ifndef DBUG_OFF
if (ret < 0)
report_errors((SSL*) vio->ssl_arg);
#endif
DBUG_RETURN(ret < 0 ? -1 : ret); DBUG_RETURN(ret < 0 ? -1 : ret);
} }
......
...@@ -51,27 +51,6 @@ static DH *get_dh512(void) ...@@ -51,27 +51,6 @@ static DH *get_dh512(void)
} }
static void
report_errors()
{
unsigned long l;
const char* file;
const char* data;
int line,flags;
DBUG_ENTER("report_errors");
while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0)
{
#ifndef DBUG_OFF /* Avoid warning */
char buf[200];
DBUG_PRINT("error", ("OpenSSL: %s:%s:%d:%s\n", ERR_error_string(l,buf),
file,line,(flags & ERR_TXT_STRING) ? data : "")) ;
#endif
}
DBUG_VOID_RETURN;
}
static const char* static const char*
ssl_error_string[] = ssl_error_string[] =
{ {
...@@ -198,7 +177,6 @@ new_VioSSLFd(const char *key_file, const char *cert_file, ...@@ -198,7 +177,6 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
{ {
*error= SSL_INITERR_MEMFAIL; *error= SSL_INITERR_MEMFAIL;
DBUG_PRINT("error", ("%s", sslGetErrString(*error))); DBUG_PRINT("error", ("%s", sslGetErrString(*error)));
report_errors();
my_free(ssl_fd); my_free(ssl_fd);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -215,7 +193,6 @@ new_VioSSLFd(const char *key_file, const char *cert_file, ...@@ -215,7 +193,6 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
{ {
*error= SSL_INITERR_CIPHERS; *error= SSL_INITERR_CIPHERS;
DBUG_PRINT("error", ("%s", sslGetErrString(*error))); DBUG_PRINT("error", ("%s", sslGetErrString(*error)));
report_errors();
SSL_CTX_free(ssl_fd->ssl_context); SSL_CTX_free(ssl_fd->ssl_context);
my_free(ssl_fd); my_free(ssl_fd);
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -232,7 +209,6 @@ new_VioSSLFd(const char *key_file, const char *cert_file, ...@@ -232,7 +209,6 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
*error= SSL_INITERR_BAD_PATHS; *error= SSL_INITERR_BAD_PATHS;
DBUG_PRINT("error", ("SSL_CTX_load_verify_locations failed : %s", DBUG_PRINT("error", ("SSL_CTX_load_verify_locations failed : %s",
sslGetErrString(*error))); sslGetErrString(*error)));
report_errors();
SSL_CTX_free(ssl_fd->ssl_context); SSL_CTX_free(ssl_fd->ssl_context);
my_free(ssl_fd); my_free(ssl_fd);
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -243,7 +219,6 @@ new_VioSSLFd(const char *key_file, const char *cert_file, ...@@ -243,7 +219,6 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
{ {
*error= SSL_INITERR_BAD_PATHS; *error= SSL_INITERR_BAD_PATHS;
DBUG_PRINT("error", ("%s", sslGetErrString(*error))); DBUG_PRINT("error", ("%s", sslGetErrString(*error)));
report_errors();
SSL_CTX_free(ssl_fd->ssl_context); SSL_CTX_free(ssl_fd->ssl_context);
my_free(ssl_fd); my_free(ssl_fd);
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -266,7 +241,6 @@ new_VioSSLFd(const char *key_file, const char *cert_file, ...@@ -266,7 +241,6 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
DBUG_PRINT("warning", ("X509_STORE_load_locations for CRL failed")); DBUG_PRINT("warning", ("X509_STORE_load_locations for CRL failed"));
*error= SSL_INITERR_BAD_PATHS; *error= SSL_INITERR_BAD_PATHS;
DBUG_PRINT("error", ("%s", sslGetErrString(*error))); DBUG_PRINT("error", ("%s", sslGetErrString(*error)));
report_errors();
SSL_CTX_free(ssl_fd->ssl_context); SSL_CTX_free(ssl_fd->ssl_context);
my_free(ssl_fd); my_free(ssl_fd);
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -277,7 +251,6 @@ new_VioSSLFd(const char *key_file, const char *cert_file, ...@@ -277,7 +251,6 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
if (vio_set_cert_stuff(ssl_fd->ssl_context, cert_file, key_file, error)) if (vio_set_cert_stuff(ssl_fd->ssl_context, cert_file, key_file, error))
{ {
DBUG_PRINT("error", ("vio_set_cert_stuff failed")); DBUG_PRINT("error", ("vio_set_cert_stuff failed"));
report_errors();
SSL_CTX_free(ssl_fd->ssl_context); SSL_CTX_free(ssl_fd->ssl_context);
my_free(ssl_fd); my_free(ssl_fd);
DBUG_RETURN(0); DBUG_RETURN(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment