Author: rjung
Date: Sun Jul 10 16:41:15 2011
New Revision: 1144900

URL: http://svn.apache.org/viewvc?rev=1144900&view=rev
Log:
Backport of r114138.
Replaces r1141392.

Modified:
    tomcat/native/branches/1.1.x/native/src/sslcontext.c

Modified: tomcat/native/branches/1.1.x/native/src/sslcontext.c
URL: 
http://svn.apache.org/viewvc/tomcat/native/branches/1.1.x/native/src/sslcontext.c?rev=1144900&r1=1144899&r2=1144900&view=diff
==============================================================================
--- tomcat/native/branches/1.1.x/native/src/sslcontext.c (original)
+++ tomcat/native/branches/1.1.x/native/src/sslcontext.c Sun Jul 10 16:41:15 
2011
@@ -476,7 +476,6 @@ static X509 *load_pem_cert(tcn_ssl_ctxt_
     BIO *bio = NULL;
     X509 *cert = NULL;
     tcn_pass_cb_t *cb_data = c->cb_data;
-    int i;
 
     if ((bio = BIO_new(BIO_s_file())) == NULL) {
         return NULL;
@@ -485,14 +484,14 @@ static X509 *load_pem_cert(tcn_ssl_ctxt_
         BIO_free(bio);
         return NULL;
     }
-    for (i = 0; i < 3; i++) {
-        cert = PEM_read_bio_X509_AUX(bio, NULL,
-                    (pem_password_cb *)SSL_password_callback,
-                    (void *)cb_data);
-        if (cert)
-            break;
-        cb_data->password[0] = '\0';
+    cert = PEM_read_bio_X509_AUX(bio, NULL,
+                (pem_password_cb *)SSL_password_callback,
+                (void *)cb_data);
+    if (cert == NULL &&
+       (ERR_GET_REASON(ERR_peek_last_error()) == PEM_R_NO_START_LINE)) {
+        ERR_clear_error();
         BIO_ctrl(bio, BIO_CTRL_RESET, 0, NULL);
+        cert = d2i_X509_bio(bio, NULL);
     }
     BIO_free(bio);
     return cert;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to