From: Sebastian B. <sb...@us...> - 2014-02-23 13:21:56
|
Update of /cvsroot/simplemail/simplemail In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv24169 Modified Files: tcp.c Log Message: Record the fail state in the verify hook. Index: tcp.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/tcp.c,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -r1.57 -r1.58 --- tcp.c 23 Feb 2014 13:19:57 -0000 1.57 +++ tcp.c 23 Feb 2014 13:21:54 -0000 1.58 @@ -243,6 +243,13 @@ static int tcp_make_secure_verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx) #endif { + if (!preverify_ok) + { + /* Get ssl object associated to the x509 context */ + SSL *ssl = X509_STORE_CTX_get_ex_data(x509_ctx, SSL_get_ex_data_X509_STORE_CTX_idx()); + int *failed = SSL_get_app_data(ssl); + *failed = 1; + } return preverify_ok; } @@ -257,6 +264,7 @@ { #ifndef NO_SSL int rc; + int failed = 0; if (!open_ssl_lib()) return 0; if (!(conn->ssl = SSL_new(ssl_context()))) @@ -264,6 +272,7 @@ close_ssl_lib(); return 0; } + SSL_set_app_data(conn->ssl, &failed); SSL_set_verify(conn->ssl, SSL_VERIFY_PEER, tcp_make_secure_verify_callback); /* Associate a socket with ssl structure */ |