directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1125878 - in /directory: apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/ shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/
Date Sun, 22 May 2011 07:56:11 GMT
Author: kayyagari
Date: Sun May 22 07:56:10 2011
New Revision: 1125878

URL: http://svn.apache.org/viewvc?rev=1125878&view=rev
Log:
o fail the attempt to start TLS when useSsl flag is set to true (DIRSHARED-117)

Modified:
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java?rev=1125878&r1=1125877&r2=1125878&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapSSLConnectionTest.java
Sun May 22 07:56:10 2011
@@ -27,6 +27,8 @@ import static org.junit.Assert.assertTru
 import java.io.IOException;
 import java.util.List;
 
+import javax.naming.ConfigurationException;
+
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.LdapConnectionConfig;
 import org.apache.directory.ldap.client.api.LdapNetworkConnection;
@@ -43,6 +45,7 @@ import org.apache.directory.server.ldap.
 import org.apache.directory.server.ldap.handlers.bind.plain.PlainMechanismHandler;
 import org.apache.directory.server.ldap.handlers.extended.StartTlsHandler;
 import org.apache.directory.shared.ldap.model.constants.SupportedSaslMechanisms;
+import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.junit.Before;
 import org.junit.Test;
@@ -186,4 +189,16 @@ public class LdapSSLConnectionTest exten
 
         connection.close();
     }
+    
+    
+    @Test( expected = LdapException.class)
+    public void testFailsStartTLSWhenSSLIsInUse() throws Exception
+    {
+        LdapNetworkConnection connection = new LdapNetworkConnection( tlsConfig );
+        tlsConfig.setUseSsl( true );
+        tlsConfig.setLdapPort( ldapServer.getPortSSL() );
+        connection.connect();
+        connection.startTls();
+    }
+
 }

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=1125878&r1=1125877&r2=1125878&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Sun May 22 07:56:10 2011
@@ -358,7 +358,6 @@ public class LdapNetworkConnection exten
     {
         this.config = config;
         messageId = new AtomicInteger( 0 );
-
     }
 
 
@@ -3725,6 +3724,11 @@ public class LdapNetworkConnection exten
     {
         try
         {
+            if ( config.isUseSsl() )
+            {
+                throw new LdapException( "Cannot use TLS when the useSsl flag is set true
in the configuration" );
+            }
+
             checkSession();
 
             ExtendedResponse resp = extended( START_TLS_REQ_OID );



Mime
View raw message