tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r883196 - in /tomcat/trunk/java/org/apache/tomcat/util/net: AbstractEndpoint.java NioEndpoint.java jsse/JSSESocketFactory.java
Date Mon, 23 Nov 2009 00:11:12 GMT
Author: markt
Date: Mon Nov 23 00:11:11 2009
New Revision: 883196

URL: http://svn.apache.org/viewvc?rev=883196&view=rev
Log:
Fix failing SSL test
Prevent NPE in NIO connector when using SSL and the default keystore password

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
    tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
    tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java?rev=883196&r1=883195&r2=883196&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java Mon Nov 23 00:11:11
2009
@@ -26,6 +26,7 @@
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.IntrospectionUtils;
+import org.apache.tomcat.util.net.jsse.JSSESocketFactory;
 import org.apache.tomcat.util.res.StringManager;
 import org.apache.tomcat.util.threads.ResizableExecutor;
 import org.apache.tomcat.util.threads.TaskQueue;
@@ -503,7 +504,7 @@
     public String getKeyAlias() { return keyAlias;}
     public void setKeyAlias(String s ) { keyAlias = s;}
     
-    private String keyPass = "changeit";
+    private String keyPass = JSSESocketFactory.DEFAULT_KEY_PASS;
     public String getKeyPass() { return keyPass;}
     public void setKeyPass(String s ) { this.keyPass = s;}
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=883196&r1=883195&r2=883196&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Mon Nov 23 00:11:11 2009
@@ -53,6 +53,7 @@
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.IntrospectionUtils;
 import org.apache.tomcat.util.net.SecureNioChannel.ApplicationBufferHandler;
+import org.apache.tomcat.util.net.jsse.JSSESocketFactory;
 import org.apache.tomcat.util.net.jsse.NioX509KeyManager;
 
 /**
@@ -504,7 +505,11 @@
         // Initialize SSL if needed
         if (isSSLEnabled()) {
             // Initialize SSL
-            char[] passphrase = getKeystorePass().toCharArray();
+            String keystorePass = getKeystorePass();
+            if (keystorePass == null) {
+                keystorePass = JSSESocketFactory.DEFAULT_KEY_PASS;
+            }
+            char[] passphrase = keystorePass.toCharArray();
 
             char[] tpassphrase = (getTruststorePass()!=null)?getTruststorePass().toCharArray():passphrase;
             String ttype = (getTruststoreType()!=null)?getTruststoreType():getKeystoreType();

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java?rev=883196&r1=883195&r2=883196&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java Mon Nov 23 00:11:11
2009
@@ -84,15 +84,15 @@
     private static final StringManager sm =
         StringManager.getManager("org.apache.tomcat.util.net.jsse.res");
 
-    // defaults
+    // Defaults - made public where re-used
     static String defaultProtocol = "TLS";
     static boolean defaultClientAuth = false;
     static String defaultKeystoreType = "JKS";
     private static final String defaultKeystoreFile
         = System.getProperty("user.home") + "/.keystore";
-    private static final String defaultKeyPass = "changeit";
     private static final int defaultSessionCacheSize = 0;
     private static final int defaultSessionTimeout = 86400;
+    public static final String DEFAULT_KEY_PASS = "changeit";
     
     static final org.apache.juli.logging.Log log =
         org.apache.juli.logging.LogFactory.getLog(JSSESocketFactory.class);
@@ -259,7 +259,7 @@
         String keyPass = (String)attributes.get(
                 AbstractEndpoint.SSL_ATTR_KEY_PASS);
         if (keyPass == null) {
-            keyPass = defaultKeyPass;
+            keyPass = DEFAULT_KEY_PASS;
         }
         String keystorePass = (String)attributes.get(
                 AbstractEndpoint.SSL_ATTR_KEYSTORE_PASS);



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


Mime
View raw message