db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From be...@apache.org
Subject svn commit: r546217 - in /db/derby/code/trunk/java: client/org/apache/derby/jdbc/ClientBaseDataSource.java drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
Date Mon, 11 Jun 2007 18:33:23 GMT
Author: bernt
Date: Mon Jun 11 11:33:22 2007
New Revision: 546217

URL: http://svn.apache.org/viewvc?view=rev&rev=546217
Log:
DERBY-2795 Unable to bring up server with SSL peer authentication enabled. Code fix.
Checking sslMode values both on server and client.

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientBaseDataSource.java
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientBaseDataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientBaseDataSource.java?view=diff&rev=546217&r1=546216&r2=546217
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientBaseDataSource.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/jdbc/ClientBaseDataSource.java Mon Jun
11 11:33:22 2007
@@ -177,7 +177,10 @@
     public final static int SSL_BASIC = 1;
     public final static int SSL_PEER_AUTHENTICATION = 2;
 
-    public static final int getSSLModeFromString(String s) {
+    public static final int getSSLModeFromString(String s) 
+        throws SqlException
+    {
+        
 		if (s != null){
 			if (s.equalsIgnoreCase("off")) {
 				return SSL_OFF;
@@ -186,8 +189,9 @@
 			} else if (s.equalsIgnoreCase("peerAuthentication")) {
 				return SSL_PEER_AUTHENTICATION;
 			} else {
-				// Default
-				return SSL_OFF;
+                throw new SqlException(null, 
+                                       new ClientMessageId(SQLState.INVALID_ATTRIBUTE),
+                                       Attribute.SSL_ATTR, s, "off, basic, peerAuthentication");
 			}
 		} else {
 			// Default
@@ -196,6 +200,7 @@
     }
     
     public static final int getClientSSLMode(Properties properties)
+        throws SqlException
     {
         return getSSLModeFromString(properties.getProperty(Attribute.SSL_ATTR));
     }
@@ -872,7 +877,9 @@
 
     private int sslMode;
 
-    public void setSsl(String mode) {
+    public void setSsl(String mode) 
+        throws SqlException
+    {
         sslMode = getSSLModeFromString(mode);
     }
 
@@ -1057,7 +1064,9 @@
      * The dataSource keeps individual fields for the values that are relevant to the client.
These need to be updated
      * when set connection attributes is called.
      */
-    void updateDataSourceValues(Properties prop) {
+    void updateDataSourceValues(Properties prop) 
+        throws SqlException
+    {
         if (prop == null) {
             return;
         }

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java?view=diff&rev=546217&r1=546216&r2=546217
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
(original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
Mon Jun 11 11:33:22 2007
@@ -2824,15 +2824,20 @@
 	 **/
 
 	private int getSSLModeValue(String s)
+        throws Exception
 	{
 		if (s != null){
 			if (StringUtil.SQLEqualsIgnoreCase(s,"off")) {
 				return SSL_OFF;
 			} else if (StringUtil.SQLEqualsIgnoreCase(s,"basic")) {
 				return SSL_BASIC;
-			} else if (StringUtil.SQLEqualsIgnoreCase(s,"peerAuthentication")) {				return SSL_PEER_AUTHENTICATION;
+			} else if (StringUtil.SQLEqualsIgnoreCase(s,"peerAuthentication")) {
+                return SSL_PEER_AUTHENTICATION;
 			} else {
-				// Default
+				// Unknown value
+                consolePropertyMessage("DRDA_InvalidValue.U", 
+                                       new String [] {s, Property.DRDA_PROP_SSL_MODE});
+                
 				return SSL_OFF;
 			}
 		} else {



Mime
View raw message