25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

* src/tls/tls_drv.c: Report OpenSSL error messages (thanks to

Magnus Henoch)

SVN Revision: 593
This commit is contained in:
Alexey Shchepin 2006-08-04 02:25:10 +00:00
parent 81f9ffcd45
commit cc4d404364
2 changed files with 22 additions and 2 deletions

View File

@ -1,5 +1,8 @@
2006-08-04 Alexey Shchepin <alexey@sevcom.net> 2006-08-04 Alexey Shchepin <alexey@sevcom.net>
* src/tls/tls_drv.c: Report OpenSSL error messages (thanks to
Magnus Henoch)
* src/mod_muc/mod_muc_room.erl: Use standardized MUC room * src/mod_muc/mod_muc_room.erl: Use standardized MUC room
configuration fields (thanks to Magnus Henoch and Andy Turner) configuration fields (thanks to Magnus Henoch and Andy Turner)

View File

@ -64,10 +64,26 @@ static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
#define die_unless(cond, errstr) \ #define die_unless(cond, errstr) \
if (!(cond)) \ 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 = driver_alloc_binary(rlen); \
b->orig_bytes[0] = 1; \ 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; \ *rbuf = (char *)b; \
return rlen; \ return rlen; \
} }
@ -84,6 +100,7 @@ static int tls_drv_control(ErlDrvData handle,
ErlDrvBinary *b; ErlDrvBinary *b;
X509 *cert; X509 *cert;
ERR_clear_error();
switch (command) switch (command)
{ {
case SET_CERTIFICATE_FILE_ACCEPT: case SET_CERTIFICATE_FILE_ACCEPT: