Created
October 11, 2013 12:57
-
-
Save anonymous/6934161 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/libwaitress/waitress.c b/src/libwaitress/waitress.c | |
| index af3cc1a..afd1fd8 100644 | |
| --- a/src/libwaitress/waitress.c | |
| +++ b/src/libwaitress/waitress.c | |
| @@ -731,22 +731,27 @@ static WaitressReturn_t WaitressTlsVerify (const WaitressHandle_t *waith) { | |
| unsigned int certListSize; | |
| const gnutls_datum_t *certList; | |
| gnutls_x509_crt_t cert; | |
| + int ret; | |
| if (gnutls_certificate_type_get (session) != GNUTLS_CRT_X509) { | |
| + printf ("gnutls_certificate_type_get\n"); | |
| return WAITRESS_RET_TLS_HANDSHAKE_ERR; | |
| } | |
| if ((certList = gnutls_certificate_get_peers (session, | |
| &certListSize)) == NULL) { | |
| + printf ("gnutls_certificate_get_peers\n"); | |
| return WAITRESS_RET_TLS_HANDSHAKE_ERR; | |
| } | |
| - if (gnutls_x509_crt_init (&cert) != GNUTLS_E_SUCCESS) { | |
| + if ((ret = gnutls_x509_crt_init (&cert)) != GNUTLS_E_SUCCESS) { | |
| + printf ("gnutls_certificate_get_peers %i, %s\n", ret, gnutls_strerror (ret)); | |
| return WAITRESS_RET_TLS_HANDSHAKE_ERR; | |
| } | |
| - if (gnutls_x509_crt_import (cert, &certList[0], | |
| - GNUTLS_X509_FMT_DER) != GNUTLS_E_SUCCESS) { | |
| + if ((ret = gnutls_x509_crt_import (cert, &certList[0], | |
| + GNUTLS_X509_FMT_DER)) != GNUTLS_E_SUCCESS) { | |
| + printf ("gnutls_x509_crt_import %i, %s\n", ret, gnutls_strerror (ret)); | |
| return WAITRESS_RET_TLS_HANDSHAKE_ERR; | |
| } | |
| @@ -754,11 +759,13 @@ static WaitressReturn_t WaitressTlsVerify (const WaitressHandle_t *waith) { | |
| size_t fingerprintSize = sizeof (fingerprint); | |
| if (gnutls_x509_crt_get_fingerprint (cert, GNUTLS_DIG_SHA1, fingerprint, | |
| &fingerprintSize) != 0) { | |
| + printf ("gnutls_x509_crt_get_fingerprint\n"); | |
| return WAITRESS_RET_TLS_HANDSHAKE_ERR; | |
| } | |
| assert (waith->tlsFingerprint != NULL); | |
| if (memcmp (fingerprint, waith->tlsFingerprint, sizeof (fingerprint)) != 0) { | |
| + printf ("memcmp\n"); | |
| return WAITRESS_RET_TLS_FINGERPRINT_MISMATCH; | |
| } | |
| @@ -873,7 +880,10 @@ static WaitressReturn_t WaitressConnect (WaitressHandle_t *waith) { | |
| } | |
| } | |
| - if (gnutls_handshake (waith->request.tlsSession) != GNUTLS_E_SUCCESS) { | |
| + int iret; | |
| + if ((iret = gnutls_handshake (waith->request.tlsSession)) != | |
| + GNUTLS_E_SUCCESS) { | |
| + printf ("gnutls_handshake failed with %i, %s\n", iret, gnutls_strerror (iret)); | |
| return WAITRESS_RET_TLS_HANDSHAKE_ERR; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment