You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by xu...@apache.org on 2009/12/23 09:52:53 UTC

svn commit: r893433 - /geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/LDAPLoginModule.java

Author: xuhaihong
Date: Wed Dec 23 08:52:52 2009
New Revision: 893433

URL: http://svn.apache.org/viewvc?rev=893433&view=rev
Log:
GERONIMO-4997 Can not connect to a ldap server in an anonymous way

Modified:
    geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/LDAPLoginModule.java

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/LDAPLoginModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/LDAPLoginModule.java?rev=893433&r1=893432&r2=893433&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/LDAPLoginModule.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/LDAPLoginModule.java Wed Dec 23 08:52:52 2009
@@ -448,10 +448,10 @@
         try {
             Hashtable<String, String> env = new Hashtable<String, String>();
             env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
-            if (connectionUsername != null || !"".equals(connectionUsername)) {
+            if (connectionUsername != null && connectionUsername.length() > 0) {
                 env.put(Context.SECURITY_PRINCIPAL, connectionUsername);
             }
-            if (connectionPassword != null || !"".equals(connectionPassword)) {
+            if (connectionPassword != null && connectionPassword.length() > 0) {
                 env.put(Context.SECURITY_CREDENTIALS, connectionPassword);
             }
             env.put(Context.SECURITY_PROTOCOL, connectionProtocol == null ? "" : connectionProtocol);