You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2019/05/09 22:40:20 UTC

[directory-server] branch master updated (770a8ab -> 9f3401f)

This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git.


    from 770a8ab  DIRAPI-342: Add tests to demostrate the problem
     new ae298c1  o Call the unbind method in a finally o Added some LOG message
     new 4a932a3  Merge branch 'master' of https://gitbox.apache.org/repos/asf/directory-server
     new 9f3401f  Slightly improve the test that loop on bind/unbind to avoid printing thousands of lines

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../server/core/authn/DelegatingAuthenticator.java          | 13 ++++++++++---
 .../client/api/operations/bind/SimpleBindRequestTest.java   |  7 +++++--
 .../directory/server/operations/bind/SimpleBindIT.java      | 13 ++++++++++---
 3 files changed, 25 insertions(+), 8 deletions(-)


[directory-server] 01/03: o Call the unbind method in a finally o Added some LOG message

Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git

commit ae298c1ee22c0b1d16d5a9a2930415aabd18b149
Author: emmanuel lecharny <el...@apache.org>
AuthorDate: Wed May 8 00:56:24 2019 +0200

    o Call the unbind method in a finally
    o Added some LOG message
---
 .../server/core/authn/DelegatingAuthenticator.java          | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java b/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java
index 1dd8773..b58e6c5 100644
--- a/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java
+++ b/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java
@@ -283,9 +283,6 @@ public class DelegatingAuthenticator extends AbstractAuthenticator
             try
             {
                 ldapConnection.bind( bindDn, Strings.utf8ToString( bindContext.getCredentials() ) );
-
-                // no need to remain bound to delegate host
-                ldapConnection.unBind();
             }
             catch ( LdapException le )
             {
@@ -293,6 +290,16 @@ public class DelegatingAuthenticator extends AbstractAuthenticator
                 LOG.info( message );
                 throw new LdapAuthenticationException( message );
             }
+            finally
+            {
+                // no need to remain bound to delegate host
+                ldapConnection.unBind();
+
+                if ( IS_DEBUG )
+                {
+                    LOG.debug( "Authenticated successfully {}", bindContext.getDn() );
+                }
+            }
 
             // Create the new principal
             principal = new LdapPrincipal( getDirectoryService().getSchemaManager(), bindDn,


[directory-server] 02/03: Merge branch 'master' of https://gitbox.apache.org/repos/asf/directory-server

Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git

commit 4a932a37019d655ee5114454dc19145984bcff3d
Merge: ae298c1 770a8ab
Author: emmanuel lecharny <el...@apache.org>
AuthorDate: Wed May 8 00:58:01 2019 +0200

    Merge branch 'master' of https://gitbox.apache.org/repos/asf/directory-server

 .../api/operations/bind/SimpleBindRequestTest.java | 22 +++++++++++++++++++++
 .../server/operations/bind/DelegatedAuthIT.java    |  7 +++++++
 .../server/operations/bind/SimpleBindIT.java       | 23 ++++++++++++++++++++++
 3 files changed, 52 insertions(+)


[directory-server] 03/03: Slightly improve the test that loop on bind/unbind to avoid printing thousands of lines

Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git

commit 9f3401f320781998c1b091424d110884dc6c3f59
Author: emmanuel lecharny <el...@apache.org>
AuthorDate: Fri May 10 00:40:15 2019 +0200

    Slightly improve the test that loop on bind/unbind to avoid printing
    thousands of lines
---
 .../client/api/operations/bind/SimpleBindRequestTest.java   |  7 +++++--
 .../directory/server/operations/bind/SimpleBindIT.java      | 13 ++++++++++---
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java b/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
index f2a6bce..102e4c7 100644
--- a/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
+++ b/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
@@ -658,9 +658,12 @@ public class SimpleBindRequestTest extends AbstractLdapTestUnit
     @Test
     public void testSimpleBindAndUnbindLoop() throws Exception
     {
-        for ( int i = 0; i < 10000; i++ )
+        for ( int i = 0; i < 1000; i++ )
         {
-            System.out.println( i );
+            if ( i % 100 == 0 )
+            {
+                System.out.println( i );
+            }
 
             connection.bind( "uid=admin,ou=system", "secret" );
             assertTrue( connection.isAuthenticated() );
diff --git a/server-integ/src/test/java/org/apache/directory/server/operations/bind/SimpleBindIT.java b/server-integ/src/test/java/org/apache/directory/server/operations/bind/SimpleBindIT.java
index cdc3ad8..30a3ad8 100644
--- a/server-integ/src/test/java/org/apache/directory/server/operations/bind/SimpleBindIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/bind/SimpleBindIT.java
@@ -523,12 +523,16 @@ public class SimpleBindIT extends AbstractLdapTestUnit
     @Test
     public void testSimpleBindAndUnbindLoop() throws Exception
     {
+        long t0 = System.currentTimeMillis();
         try ( LdapNetworkConnection connection = new LdapNetworkConnection( Network.LOOPBACK_HOSTNAME,
             getLdapServer().getPort() ) )
         {
-            for ( int i = 0; i < 10000; i++ )
+            for ( int i = 0; i < 1000; i++ )
             {
-                System.out.println( i );
+                if ( i % 100 == 0 )
+                {
+                    System.out.println( i );
+                }
 
                 connection.bind( "uid=admin,ou=system", "secret" );
                 assertTrue( connection.isAuthenticated() );
@@ -536,9 +540,12 @@ public class SimpleBindIT extends AbstractLdapTestUnit
                 connection.unBind();
                 assertFalse( connection.isAuthenticated() );
 
-                // Thread.sleep( 10L );
+                // Thread.sleep( 2L );
             }
         }
+        long t1 = System.currentTimeMillis();
+        
+        System.out.println( "Delta = " + ( t1 - t0 ) );
     }
 
 }