[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Log TLS errors even harder
Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/tmp/cvs-serv4308/src/common
Modified Files:
tortls.c
Log Message:
Log TLS errors even harder
Index: tortls.c
===================================================================
RCS file: /home/or/cvsroot/src/common/tortls.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- tortls.c 15 Oct 2003 23:42:44 -0000 1.20
+++ tortls.c 15 Oct 2003 23:50:25 -0000 1.21
@@ -49,14 +49,20 @@
crypto_pk_env_t *_crypto_new_pk_env_rsa(RSA *rsa);
static void
-tls_log_error(int severity, const char *doing)
+tls_log_errors(int severity, const char *doing)
{
- const char *msg = (const char*)ERR_reason_error_string(ERR_get_error());
- if (!msg) msg = "(null)";
- if (doing) {
- log(severity, "TLS error while %s: %s", doing, msg);
- } else {
- log(severity, "TLS error: %s", msg);
+ int err;
+ const char *msg, *lib, *func;
+ while ((err = ERR_get_error()) != 0) {
+ msg = (const char*)ERR_reason_error_string(err);
+ lib = (const char*)ERR_lib_error_string(err);
+ func = (const char*)ERR_func_error_string(err);
+ if (!msg) msg = "(null)";
+ if (doing) {
+ log(severity, "TLS error while %s: %s (in %s:%s)", doing, msg, lib,func);
+ } else {
+ log(severity, "TLS error: %s (in %s:%s)", msg, lib, func);
+ }
}
}
@@ -79,17 +85,17 @@
if (extra&CATCH_SYSCALL)
return _TOR_TLS_SYSCALL;
assert(severity != LOG_ERR); /* XXX remove me when the bug is found */
- log(severity, "TLS error: <syscall error>.");
- tls_log_error(severity, doing);
+ log(severity, "TLS error: <syscall error> (errno=%d)",errno);
+ tls_log_errors(severity, doing);
return TOR_TLS_ERROR;
case SSL_ERROR_ZERO_RETURN:
if (extra&CATCH_ZERO)
return _TOR_TLS_ZERORETURN;
log(severity, "TLS error: Zero return");
- tls_log_error(severity, doing);
+ tls_log_errors(severity, doing);
return TOR_TLS_ERROR;
default:
- tls_log_error(severity, doing);
+ tls_log_errors(severity, doing);
return TOR_TLS_ERROR;
}
}