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 2006/08/28 14:17:18 UTC

svn commit: r437682 - /directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequestGrammar.java

Author: elecharny
Date: Mon Aug 28 05:17:18 2006
New Revision: 437682

URL: http://svn.apache.org/viewvc?rev=437682&view=rev
Log:
Deleted dead code commented
Thrown a ResponseCaryingException instead of a DecoderException for mechanism

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=437682&r1=437681&r2=437682&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 05:17:18 2006
@@ -167,13 +167,6 @@
                     {
                         int version = IntegerDecoder.parse( value, 1, 127 );
 
-                        // will handle this in higher layers: bind handler
-//                        if ( version != 3 )
-//                        {
-//                            log.error( "The version {} is invalid : it must be 3", new Integer( version ) );
-//                            throw new DecoderException( "Ldap Version " + version + " is not supported" );
-//                        }
-
                         if ( IS_DEBUG )
                         {
                             log.debug( "Ldap version ", new Integer( version ) );
@@ -368,7 +361,8 @@
                         
                         BindResponseImpl response = new BindResponseImpl( ldapMessage.getMessageId() );
                     
-                        throw new ResponseCarryingException( msg, response, ResultCodeEnum.INVALIDCREDENTIALS, LdapDN.EMPTY_LDAPDN, null );
+                        throw new ResponseCarryingException( msg, response, ResultCodeEnum.INVALIDCREDENTIALS, 
+                            bindRequestMessage.getName(), null );
                     }
 
                     // Create the SaslCredentials Object
@@ -415,7 +409,8 @@
                 {
 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-                    BindRequest bindRequestMessage = ldapMessageContainer.getLdapMessage().getBindRequest();
+                    LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+                    BindRequest bindRequestMessage = ldapMessage.getBindRequest();
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
 
                     // Get the SaslCredentials Object
@@ -435,9 +430,12 @@
                         }
                         catch ( LdapStringEncodingException lsee )
                         {
-                            log.error( "Invalid mechanism : {} : {}",
-                                StringTools.dumpBytes( tlv.getValue().getData() ), lsee.getMessage() );
-                            throw new DecoderException( lsee.getMessage() );
+                            String msg = "Invalid mechanism : " + StringTools.dumpBytes( tlv.getValue().getData() );
+                            log.error( "{} : {}", msg, lsee.getMessage() );
+                            BindResponseImpl response = new BindResponseImpl( ldapMessage.getMessageId() );
+                            
+                            throw new ResponseCarryingException( msg, response, ResultCodeEnum.INAPPROPRIATEAUTHENTICATION, 
+                                bindRequestMessage.getName(), lsee );
                         }
                     }