You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by km...@apache.org on 2006/03/03 19:56:00 UTC

svn commit: r382911 - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/ testing/org/apache/derbyTesting/functionTests/master/DerbyNet/ testing/org/apache/derbyTesting/functionTests/master/DerbyNet/ibm14/ testing/org/apache/derbyTesting/f...

Author: kmarsden
Date: Fri Mar  3 10:55:58 2006
New Revision: 382911

URL: http://svn.apache.org/viewcvs?rev=382911&view=rev
Log:
DERBY-1055 Security.AccessControlException in client under SecurityManager when trying to connect using EUSRIDPWD security mechanism

Contributed by Sunitha Kambhampati

Patch
- removes the unnecessary addProvider call in EncryptionManager that was causing
the Security.AccessControlException.
- enables test to connect using EUSRIDPWD mechanism and updates necessary masters



Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/ibm14/
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/ibm14/testSecMec.out   (with props)
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ibm14/
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ibm14/testSecMec.out   (with props)
Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/EncryptionManager.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/testSecMec.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/testSecMec.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testSecMec.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/EncryptionManager.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/EncryptionManager.java?rev=382911&r1=382910&r2=382911&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/EncryptionManager.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/EncryptionManager.java Fri Mar  3 10:55:58 2006
@@ -98,9 +98,6 @@
             }
             provider = list[0];
             providerName = provider.getName();
-
-            java.security.Security.addProvider((java.security.Provider) provider);
-
             paramSpec_ = new javax.crypto.spec.DHParameterSpec(modulus__, base__, exponential_length__);
             keyPairGenerator_ = java.security.KeyPairGenerator.getInstance("DH", providerName);
             keyPairGenerator_.initialize(paramSpec_);

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/ibm14/testSecMec.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/ibm14/testSecMec.out?rev=382911&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/ibm14/testSecMec.out (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/ibm14/testSecMec.out Fri Mar  3 10:55:58 2006
@@ -0,0 +1,51 @@
+-----
+Testing with derby.drda.securityMechanism=null
+Checking security mechanism authentication with DriverManager
+T4: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;create=true:user=neelima;password=lee;securityMechanism=3;
+T1: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat - EXCEPTION null userid not supported
+T2: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=max; - EXCEPTION null password not supported
+T3: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;
+T5: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=9;
+T6: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;securityMechanism=4;
+T8: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=4;
+SECMEC_USRIDPWD: OK
+-----
+Testing with derby.drda.securityMechanism=USER_ONLY_SECURITY
+Checking security mechanism authentication with DriverManager
+T4: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=3; - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T1: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat - EXCEPTION null userid not supported
+T2: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=max; - EXCEPTION null password not supported
+T3: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee; - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T5: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=9; - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T6: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;securityMechanism=4;
+T8: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=4;
+SECMEC_USRIDPWD:EXCEPTION testSecurityMechanism()  Connection authorization failure occurred.  Reason: security mechanism not supported
+-----
+Testing with derby.drda.securityMechanism=CLEAR_TEXT_PASSWORD_SECURITY
+Checking security mechanism authentication with DriverManager
+T4: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=3;
+T1: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat - EXCEPTION null userid not supported
+T2: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=max; - EXCEPTION null password not supported
+T3: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;
+T5: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=9; - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T6: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;securityMechanism=4; - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T8: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=4; - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+SECMEC_USRIDPWD: OK
+-----
+Testing with derby.drda.securityMechanism=ENCRYPTED_USER_AND_PASSWORD_SECURITY
+Checking security mechanism authentication with DriverManager
+T4: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=3; - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T1: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat - EXCEPTION null userid not supported
+T2: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=max; - EXCEPTION null password not supported
+T3: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee; - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T5: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=9;
+T6: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;securityMechanism=4; - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T8: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=4; - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+SECMEC_USRIDPWD:EXCEPTION testSecurityMechanism()  Connection authorization failure occurred.  Reason: security mechanism not supported
+-----
+Testing with derby.drda.securityMechanism=INVALID_VALUE
+EXPECTED EXCEPTION DRDA_InvalidValue.U:Invalid value, INVALID_VALUE, for derby.drda.securityMechanism.
+-----
+Testing with derby.drda.securityMechanism=
+EXPECTED EXCEPTION DRDA_InvalidValue.U:Invalid value, , for derby.drda.securityMechanism.
+Completed testSecMec

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/ibm14/testSecMec.out
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/testSecMec.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/testSecMec.out?rev=382911&r1=382910&r2=382911&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/testSecMec.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/testSecMec.out Fri Mar  3 10:55:58 2006
@@ -5,6 +5,7 @@
 T1: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat - EXCEPTION null userid not supported
 T2: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=max; - EXCEPTION null password not supported
 T3: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;
+T5: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=9; - EXCEPTION java.lang.ClassNotFoundException is caught when initializing EncryptionManager 'IBMJCE'
 T6: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;securityMechanism=4;
 T8: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=4;
 SECMEC_USRIDPWD: OK
@@ -15,6 +16,7 @@
 T1: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat - EXCEPTION null userid not supported
 T2: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=max; - EXCEPTION null password not supported
 T3: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee; - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T5: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=9; - EXCEPTION java.lang.ClassNotFoundException is caught when initializing EncryptionManager 'IBMJCE'
 T6: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;securityMechanism=4;
 T8: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=4;
 SECMEC_USRIDPWD:EXCEPTION testSecurityMechanism()  Connection authorization failure occurred.  Reason: security mechanism not supported
@@ -25,6 +27,7 @@
 T1: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat - EXCEPTION null userid not supported
 T2: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=max; - EXCEPTION null password not supported
 T3: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;
+T5: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=9; - EXCEPTION java.lang.ClassNotFoundException is caught when initializing EncryptionManager 'IBMJCE'
 T6: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;securityMechanism=4; - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
 T8: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=4; - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
 SECMEC_USRIDPWD: OK
@@ -35,6 +38,7 @@
 T1: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat - EXCEPTION null userid not supported
 T2: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=max; - EXCEPTION null password not supported
 T3: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee; - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T5: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=9; - EXCEPTION java.lang.ClassNotFoundException is caught when initializing EncryptionManager 'IBMJCE'
 T6: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;securityMechanism=4; - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
 T8: jdbc:derby:net://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat:user=neelima;password=lee;securityMechanism=4; - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
 SECMEC_USRIDPWD:EXCEPTION testSecurityMechanism()  Connection authorization failure occurred.  Reason: security mechanism not supported

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ibm14/testSecMec.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ibm14/testSecMec.out?rev=382911&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ibm14/testSecMec.out (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ibm14/testSecMec.out Fri Mar  3 10:55:58 2006
@@ -0,0 +1,55 @@
+-----
+Testing with derby.drda.securityMechanism=null
+Checking security mechanism authentication with DriverManager
+T4: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;create=true;user=neelima;password=lee;securityMechanism=3
+T1: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat
+T2: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=max
+T3: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee
+T5: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=9
+T6: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;securityMechanism=4
+T8: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=4
+SECMEC_USRIDPWD: OK
+SECMEC_EUSRIDPWD: OK
+-----
+Testing with derby.drda.securityMechanism=USER_ONLY_SECURITY
+Checking security mechanism authentication with DriverManager
+T4: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=3 - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T1: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat
+T2: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=max
+T3: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T5: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=9 - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T6: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;securityMechanism=4
+T8: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=4 - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+SECMEC_USRIDPWD:EXCEPTION testSecurityMechanism()  Connection authorization failure occurred.  Reason: security mechanism not supported
+SECMEC_EUSRIDPWD:EXCEPTION testSecurityMechanism()  Connection authorization failure occurred.  Reason: security mechanism not supported
+-----
+Testing with derby.drda.securityMechanism=CLEAR_TEXT_PASSWORD_SECURITY
+Checking security mechanism authentication with DriverManager
+T4: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=3
+T1: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T2: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=max - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T3: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee
+T5: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=9 - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T6: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;securityMechanism=4 - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T8: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=4
+SECMEC_USRIDPWD: OK
+SECMEC_EUSRIDPWD:EXCEPTION testSecurityMechanism()  Connection authorization failure occurred.  Reason: security mechanism not supported
+-----
+Testing with derby.drda.securityMechanism=ENCRYPTED_USER_AND_PASSWORD_SECURITY
+Checking security mechanism authentication with DriverManager
+T4: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=3 - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T1: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T2: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=max - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T3: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T5: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=9
+T6: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;securityMechanism=4 - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T8: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=4 - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+SECMEC_USRIDPWD:EXCEPTION testSecurityMechanism()  Connection authorization failure occurred.  Reason: security mechanism not supported
+SECMEC_EUSRIDPWD: OK
+-----
+Testing with derby.drda.securityMechanism=INVALID_VALUE
+EXPECTED EXCEPTION DRDA_InvalidValue.U:Invalid value, INVALID_VALUE, for derby.drda.securityMechanism.
+-----
+Testing with derby.drda.securityMechanism=
+EXPECTED EXCEPTION DRDA_InvalidValue.U:Invalid value, , for derby.drda.securityMechanism.
+Completed testSecMec

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ibm14/testSecMec.out
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/testSecMec.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/testSecMec.out?rev=382911&r1=382910&r2=382911&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/testSecMec.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/testSecMec.out Fri Mar  3 10:55:58 2006
@@ -5,9 +5,11 @@
 T1: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat
 T2: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=max
 T3: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee
+T5: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=9 - EXCEPTION Security exception encountered, see next exception for details.
 T6: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;securityMechanism=4
 T8: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=4
 SECMEC_USRIDPWD: OK
+SECMEC_EUSRIDPWD:EXCEPTION testSecurityMechanism()  Security exception encountered, see next exception for details.
 -----
 Testing with derby.drda.securityMechanism=USER_ONLY_SECURITY
 Checking security mechanism authentication with DriverManager
@@ -15,9 +17,11 @@
 T1: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat
 T2: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=max
 T3: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T5: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=9 - EXCEPTION Security exception encountered, see next exception for details.
 T6: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;securityMechanism=4
 T8: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=4 - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
 SECMEC_USRIDPWD:EXCEPTION testSecurityMechanism()  Connection authorization failure occurred.  Reason: security mechanism not supported
+SECMEC_EUSRIDPWD:EXCEPTION testSecurityMechanism()  Security exception encountered, see next exception for details.
 -----
 Testing with derby.drda.securityMechanism=CLEAR_TEXT_PASSWORD_SECURITY
 Checking security mechanism authentication with DriverManager
@@ -25,9 +29,11 @@
 T1: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
 T2: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=max - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
 T3: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee
+T5: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=9 - EXCEPTION Security exception encountered, see next exception for details.
 T6: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;securityMechanism=4 - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
 T8: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=4
 SECMEC_USRIDPWD: OK
+SECMEC_EUSRIDPWD:EXCEPTION testSecurityMechanism()  Security exception encountered, see next exception for details.
 -----
 Testing with derby.drda.securityMechanism=ENCRYPTED_USER_AND_PASSWORD_SECURITY
 Checking security mechanism authentication with DriverManager
@@ -35,9 +41,11 @@
 T1: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
 T2: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=max - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
 T3: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
+T5: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=9 - EXCEPTION Security exception encountered, see next exception for details.
 T6: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;securityMechanism=4 - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
 T8: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=4 - EXCEPTION Connection authorization failure occurred.  Reason: security mechanism not supported
 SECMEC_USRIDPWD:EXCEPTION testSecurityMechanism()  Connection authorization failure occurred.  Reason: security mechanism not supported
+SECMEC_EUSRIDPWD:EXCEPTION testSecurityMechanism()  Security exception encountered, see next exception for details.
 -----
 Testing with derby.drda.securityMechanism=INVALID_VALUE
 EXPECTED EXCEPTION DRDA_InvalidValue.U:Invalid value, INVALID_VALUE, for derby.drda.securityMechanism.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testSecMec.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testSecMec.java?rev=382911&r1=382910&r2=382911&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testSecMec.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testSecMec.java Fri Mar  3 10:55:58 2006
@@ -267,9 +267,14 @@
 		getConnectionUsingDriverManager(getJDBCUrl("wombat",null),"T1:");
 		getConnectionUsingDriverManager(getJDBCUrl("wombat","user=max"),"T2:");
 		getConnectionUsingDriverManager(getJDBCUrl("wombat","user=neelima;password=lee"),"T3:");
-                // Disable because ibm142 doesnt support DiffieHelman prime of 32 bytes
-                // Also Sun JCE doesnt support it.
-		//getConnectionUsingDriverManager(getJDBCUrl("wombat","user=neelima;password=lee;securityMechanism="+SECMEC_EUSRIDPWD),"T5:");
+
+        // Please note: EUSRIDPWD security mechanism in DRDA uses Diffie-Helman for generation of shared keys.
+        // The spec specifies the prime to use for DH which is 32 bytes and this needs to be used as is.
+        // Sun JCE does not support a prime of 32 bytes for Diffie Helman and some 
+        // older versions of IBM JCE ( 1.4.2) also do not support it.
+        // Hence the following call to get connection might not be successful when 
+        // client is running in JVM  where the JCE does not support the DH (32 byte prime)
+		getConnectionUsingDriverManager(getJDBCUrl("wombat","user=neelima;password=lee;securityMechanism="+SECMEC_EUSRIDPWD),"T5:");
 		getConnectionUsingDriverManager(getJDBCUrl("wombat","user=neelima;securityMechanism="+SECMEC_USRIDONL),"T6:");
                 
                 // disable as ibm142 and sun jce doesnt support DH prime of 32 bytes
@@ -290,10 +295,21 @@
 		//testSecurityMechanism("sarah",null,new Short(SECMEC_USRIDONL),"SECMEC_USRIDONL:");
 		testSecurityMechanism("john","sarah",new Short(SECMEC_USRIDPWD),"SECMEC_USRIDPWD:");
                 
-		// Disable this test because ibm142, sun jce does not Diffie Helman prime of 32 bytes
-                // and so this security mechanism wont work in that case
-		//testSecurityMechanism("john","sarah",new Short(SECMEC_EUSRIDPWD),"SECMEC_EUSRIDPWD:");
-
+        // Possible bug in JCC, hence disable this test for JCC framework only
+        // the security mechanism when set on JCC datasource does not seem to 
+        // have an effect. JCC driver is sending a secmec of 3( USRIDPWD) to 
+        // the server even though the security mechanism on datasource is set to 
+        // EUSRIDPWD (9)
+        if (!TestUtil.isJCCFramework())
+        {
+            // Please note: EUSRIDPWD security mechanism in DRDA uses Diffie-Helman for generation of shared keys.
+            // The spec specifies the prime to use for DH which is 32 bytes and this needs to be used as is.
+            // Sun JCE does not support a prime of 32 bytes for Diffie Helman and some 
+            // older versions of IBM JCE ( 1.4.2)  also do not support it.
+            // Hence the following call to get connection might not be successful when 
+            // client is running in JVM  where the JCE does not support the DH (32 byte prime)
+            testSecurityMechanism("john","sarah",new Short(SECMEC_EUSRIDPWD),"SECMEC_EUSRIDPWD:");
+        }
 	}
 
 	public void testSecurityMechanism(String user, String password,Short secmec,String msg)
@@ -313,10 +329,20 @@
 			conn.close();
 			System.out.println(msg +" OK");
 		}
-		catch (Exception e)
+		catch (SQLException sqle)
 		{
-			System.out.println(msg +"EXCEPTION testSecurityMechanism()  " + e.getMessage());
+            // Exceptions expected in certain cases depending on JCE used for 
+            // running the test. hence printing message instead of stack traces
+            // here.
+            System.out.println(msg +"EXCEPTION testSecurityMechanism()  " + sqle.getMessage());
+            dumpSQLException(sqle.getNextException());
 		}
+        catch (Exception e)
+        {
+            System.out.println("UNEXPECTED EXCEPTION!!!" +msg);
+            e.printStackTrace();
+        }
+        
 	}
 
 	public void getConnectionUsingDriverManager(String dbUrl, String msg)
@@ -329,9 +355,29 @@
 		}
 		catch(SQLException sqle)
 		{
+            // Ideally - we would print stack trace of nested SQLException for
+            // any unexpected exception.
+            // But in this testcase, one test can give an exception in one JCE
+            // implementation and in some JCE's the test can pass. 
+            // Hence printing the messages instead of stack traces.
 			System.out.println(msg +" "+dbUrl +" - EXCEPTION "+ sqle.getMessage());
+            dumpSQLException(sqle.getNextException());
 		}
 	}
 
+
+    /**
+     * Dump SQLState and message for the complete nested chain of SQLException 
+     * @param sqle SQLException whose complete chain of exceptions is traversed and sqlstate and 
+     * message is printed out
+     */
+    public static void dumpSQLException(SQLException sqle)
+    {
+        while ( sqle != null)
+        {
+            System.out.println("SQLSTATE("+sqle.getSQLState()+"): " + sqle.getMessage());
+            sqle = sqle.getNextException();
+        }
+    }
 
 }