aboutsummaryrefslogtreecommitdiff
path: root/src/tls
diff options
context:
space:
mode:
authorAlexey Shchepin <alexey@process-one.net>2006-08-04 02:25:10 +0000
committerAlexey Shchepin <alexey@process-one.net>2006-08-04 02:25:10 +0000
commitcc4d4043641b62a4bb1b0dcfd2ffcdce24d498fc (patch)
treece83750077afaa00df0accdc11e7493956125987 /src/tls
parent* src/mod_muc/mod_muc_room.erl: Use standardized MUC room (diff)
* src/tls/tls_drv.c: Report OpenSSL error messages (thanks to
Magnus Henoch) SVN Revision: 593
Diffstat (limited to 'src/tls')
-rw-r--r--src/tls/tls_drv.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/tls/tls_drv.c b/src/tls/tls_drv.c
index 742eda8f0..5d3530360 100644
--- a/src/tls/tls_drv.c
+++ b/src/tls/tls_drv.c
@@ -64,10 +64,26 @@ static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
#define die_unless(cond, errstr) \
if (!(cond)) \
{ \
- rlen = strlen(errstr) + 1; \
+ int errstrlen = strlen(errstr); \
+ unsigned long error_code = ERR_get_error(); \
+ char *error_string = error_code ? \
+ ERR_error_string(error_code, NULL) : \
+ NULL; \
+ int error_string_length = error_string ? \
+ strlen(error_string) : 0; \
+ if (error_code) \
+ rlen = errstrlen + error_string_length + 3; \
+ else \
+ rlen = errstrlen + 1; \
b = driver_alloc_binary(rlen); \
b->orig_bytes[0] = 1; \
- strncpy(b->orig_bytes + 1, errstr, rlen - 1); \
+ strncpy(b->orig_bytes + 1, errstr, errstrlen); \
+ if (error_code) { \
+ strncpy(b->orig_bytes + 1 + errstrlen, \
+ ": ", 2); \
+ strncpy(b->orig_bytes + 3 + errstrlen, \
+ error_string, error_string_length); \
+ } \
*rbuf = (char *)b; \
return rlen; \
}
@@ -84,6 +100,7 @@ static int tls_drv_control(ErlDrvData handle,
ErlDrvBinary *b;
X509 *cert;
+ ERR_clear_error();
switch (command)
{
case SET_CERTIFICATE_FILE_ACCEPT: