Return-Path: X-Original-To: apmail-directory-dev-archive@www.apache.org Delivered-To: apmail-directory-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BE263DD4E for ; Sat, 25 May 2013 00:08:20 +0000 (UTC) Received: (qmail 82040 invoked by uid 500); 25 May 2013 00:08:20 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 81989 invoked by uid 500); 25 May 2013 00:08:20 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 81937 invoked by uid 99); 25 May 2013 00:08:20 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 25 May 2013 00:08:20 +0000 Date: Sat, 25 May 2013 00:08:20 +0000 (UTC) From: "James C. Wu (JIRA)" To: dev@directory.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Reopened] (DIRSERVER-1829) bug in initializing authenticators for AuthenticatorInterceptor MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DIRSERVER-1829?page=3Dcom.atla= ssian.jira.plugin.system.issuetabpanels:all-tabpanel ] James C. Wu reopened DIRSERVER-1829: ------------------------------------ this bug is still there. =20 > bug in initializing authenticators for AuthenticatorInterceptor > --------------------------------------------------------------- > > Key: DIRSERVER-1829 > URL: https://issues.apache.org/jira/browse/DIRSERVER-1829 > Project: Directory ApacheDS > Issue Type: Bug > Affects Versions: 2.0.0-M11 > Reporter: James C. Wu > Priority: Minor > Fix For: 2.0.0-RC1 > > > Le 4/16/13 8:05 PM, Wu, James C. a =C3=A9crit : > > Hi, > > > > I am looking at this two method definition in the AuthenticationInterce= ptor.java class. This two method should both set to the authenticators for= the interceptor to the input given in the parameter given both are a sette= r. However, the logic of method body of these two methods are quite differ= ent. The first method just set the member variable (authenticators) to the = input parameters, while the second method will register the authenticator a= nd strangely enough, it does not set the member variable (authenticators) t= o the input parameter. > > > > /** > > * @param authenticators authenticators to be used by this Authenti= cationInterceptor > > */ > > public void setAuthenticators( Set authenticators ) > > { > > if ( authenticators =3D=3D null ) > > { > > this.authenticators.clear(); > > } > > else > > { > > this.authenticators =3D authenticators; > > } > > } > > > > > > /** > > * @param authenticators authenticators to be used by this Authenti= cationInterceptor > > */ > > public void setAuthenticators( Authenticator[] authenticators ) > > { > > if ( authenticators =3D=3D null ) > > { > > throw new IllegalArgumentException( "The given authenticato= rs set is null" ); > > } > > > > this.authenticators.clear(); > > this.authenticatorsMapByType.clear(); > > > > for ( Authenticator authenticator : authenticators ) > > { > > try > > { > > register( authenticator, directoryService ); > > } > > catch ( LdapException le ) > > { > > LOG.error( "Cannot register authenticator {}", authenti= cator ); > > } > > } > > } > > > > > > I traced the execution of the start of the apacheds service. During the= startup of the apacheds service, three authenticators will be created, and= the setAuthenticators( Authenticator[] authenticators ) method will be cal= led. But due to the fact that, the member variable authenticators is not se= t, when the execution gets to init method of the authenticatorinterceptor, = three new default authenticator will be created because the authenticators = is null and default authenticators are created. Now we have six authenticat= ors. Three of them (Simple, Strong, Anonymous) created by the setDefaultAut= henticators are in the authenticators list, the other three (Simple, Strong= , Anonymous) created by createInterceptors in the ServiceBuilder class are= in the authenticatorsMapByType map. > > > > I am thinking this is a bug. First of all, these two methods should beh= ave in the same way. Second, we should not have duplicated authenticators, = plus the three authenticators created by the createInterceptors method in= the ServiceBuilder class is not properly initialized. Their directoryServi= ce field is null. > This is clearly a wrong initialization. My understanding is that we have = stacked layers on top of layers during years, but never cleaned up the clas= s. > I also modified this code 8 weeks ago, I don't remember why I change it t= his way (cf http://svn.apache.org/viewvc/directory/apacheds/trunk/intercept= ors/authn/src/main/java/org/apache/directory/server/core/authn/Authenticati= onInterceptor.java?r1=3D1424688&r2=3D1446503&diff_format=3Dh), > but this is clearly wrong... -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs For more information on JIRA, see: http://www.atlassian.com/software/jira