directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r437586 - /directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequestGrammar.java
Date Mon, 28 Aug 2006 07:18:50 GMT
Author: elecharny
Date: Mon Aug 28 00:18:49 2006
New Revision: 437586

URL: http://svn.apache.org/viewvc?rev=437586&view=rev
Log:
Fixed DIRSERVER-711 for BindRequest. We now return a INVALID_DN_SYNTAX
 or a INVALID_CREDENTIAL instead of a PROTOCOL_ERROR in some 
error conditions.

Modified:
    directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequestGrammar.java

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequestGrammar.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequestGrammar.java?rev=437586&r1=437585&r2=437586&view=diff
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequestGrammar.java
(original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequestGrammar.java
Mon Aug 28 00:18:49 2006
@@ -130,6 +130,8 @@
                     {
                         String msg = "The BindRequest must not be null";
                         log.error( msg );
+                     
+                        // This will generate a PROTOCOL_ERROR
                         throw new DecoderException( msg );
                     }
 
@@ -184,6 +186,7 @@
                         log.error( "The version {} is invalid : {}. The version must be between
(0 .. 127)",
                             StringTools.dumpBytes( value.getData() ), ide.getMessage() );
 
+                        // This will generate a PROTOCOL_ERROR
                         throw new DecoderException( ide.getMessage() );
                     }
 
@@ -235,16 +238,9 @@
                                 + ") is invalid";
                             log.error( "{} : {}", msg, ine.getMessage() );
                         
-                            BindResponseImpl message = new BindResponseImpl( ldapMessage.getMessageId()
);
-                            message.getLdapResult().setErrorMessage( msg );
-                            message.getLdapResult().setResultCode( ResultCodeEnum.INVALIDDNSYNTAX
);
-                            message.getLdapResult().setMatchedDn( LdapDN.EMPTY_LDAPDN );
+                            BindResponseImpl response = new BindResponseImpl( ldapMessage.getMessageId()
);
                         
-                            ResponseCarryingException exception = new ResponseCarryingException(
msg, ine );
-                        
-                            exception.setResponse( message );
-                        
-                            throw exception;
+                            throw new ResponseCarryingException( msg, response, ResultCodeEnum.INVALIDDNSYNTAX,
LdapDN.EMPTY_LDAPDN, ine );
                         }
 
                         bindRequestMessage.setName( name );
@@ -360,7 +356,8 @@
                 {
 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
container;
-                    BindRequest bindRequestMessage = ldapMessageContainer.getLdapMessage().getBindRequest();
+                    LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+                    BindRequest bindRequestMessage = ldapMessage.getBindRequest();
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
 
                     // We will check that the sasl is not null
@@ -368,7 +365,10 @@
                     {
                         String msg = "The SaslCredential must not be null";
                         log.error( msg );
-                        throw new DecoderException( msg );
+                        
+                        BindResponseImpl response = new BindResponseImpl( ldapMessage.getMessageId()
);
+                    
+                        throw new ResponseCarryingException( msg, response, ResultCodeEnum.INVALIDCREDENTIALS,
LdapDN.EMPTY_LDAPDN, null );
                     }
 
                     // Create the SaslCredentials Object



Mime
View raw message