Author: mturk
Date: Mon Feb 27 14:56:07 2012
New Revision: 1294171

URL: http://svn.apache.org/viewvc?rev=1294171&view=rev
Log:
Ensure that cert_file is present. Key can be null in which case it'll get the 
cert_file value, but cer must be provided

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=1294171&r1=1294170&r2=1294171&view=diff
==============================================================================
--- tomcat/native/branches/1.1.x/native/src/sslcontext.c (original)
+++ tomcat/native/branches/1.1.x/native/src/sslcontext.c Mon Feb 27 14:56:07 
2012
@@ -590,19 +590,19 @@ TCN_IMPLEMENT_CALL(jboolean, SSLContext,
     cert_file = J2S(cert);
     if (!key_file)
         key_file = cert_file;
-    if (!key_file) {
+    if (!key_file || !cert_file) {
         tcn_Throw(e, "No Certificate file specified or invalid file format");
         rv = JNI_FALSE;
         goto cleanup;
     }
-    if ((p = strrchr(cert_file, '.')) != NULL && strcmp(p, ".pkcs12") == 0) {  
      
+    if ((p = strrchr(cert_file, '.')) != NULL && strcmp(p, ".pkcs12") == 0) {
         if (!ssl_load_pkcs12(c, cert_file, &c->keys[idx], &c->certs[idx], 0)) {
             ERR_error_string(ERR_get_error(), err);
             tcn_Throw(e, "Unable to load certificate %s (%s)",
                       cert_file, err);
             rv = JNI_FALSE;
-            goto cleanup;        
-        }    
+            goto cleanup;
+        }
     }
     else {
         if ((c->keys[idx] = load_pem_key(c, key_file)) == NULL) {



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

Reply via email to