directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1446107 - /directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
Date Thu, 14 Feb 2013 10:38:13 GMT
Author: elecharny
Date: Thu Feb 14 10:38:13 2013
New Revision: 1446107

URL: http://svn.apache.org/r1446107
Log:
Don't add the authenticator if it's disabled, otherwise we get a NPE later.

Modified:
    directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java

Modified: directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java?rev=1446107&r1=1446106&r2=1446107&view=diff
==============================================================================
--- directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
(original)
+++ directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
Thu Feb 14 10:38:13 2013
@@ -540,7 +540,10 @@ public class ServiceBuilder
 
         for ( AuthenticatorBean authenticatorBean : list )
         {
-            authenticators[i++] = createAuthenticator( authenticatorBean );
+            if ( authenticatorBean.isEnabled() )
+            {
+                authenticators[i++] = createAuthenticator( authenticatorBean );
+            }
         }
 
         return authenticators;
@@ -584,7 +587,7 @@ public class ServiceBuilder
         for ( String encryptionType : encryptionTypes )
         {
             EncryptionType et = EncryptionType.getByName( encryptionType );
-            if( et == EncryptionType.UNKNOWN )
+            if ( et == EncryptionType.UNKNOWN )
             {
                 LOG.warn( "Unknown encryption type {}", encryptionType );
             }
@@ -594,7 +597,7 @@ public class ServiceBuilder
             }
         }
 
-        return types.toArray(new EncryptionType[0]);
+        return types.toArray( new EncryptionType[0] );
     }
 
 
@@ -662,10 +665,11 @@ public class ServiceBuilder
      * @return Instance of KdcServer
      * @throws org.apache.directory.api.ldap.model.exception.LdapException
      */
-    public static KdcServer createKdcServer( DirectoryServiceBean directoryServiceBean, DirectoryService
directoryService ) throws LdapException
+    public static KdcServer createKdcServer( DirectoryServiceBean directoryServiceBean,
+        DirectoryService directoryService ) throws LdapException
     {
         KdcServerBean kdcServerBean = directoryServiceBean.getKdcServerBean();
-        
+
         // Fist, do nothing if the KdcServer is disabled
         if ( ( kdcServerBean == null ) || kdcServerBean.isDisabled() )
         {
@@ -673,50 +677,51 @@ public class ServiceBuilder
         }
 
         KerberosConfig kdcConfig = new KerberosConfig();
-        
+
         // AllowableClockSkew
         kdcConfig.setAllowableClockSkew( kdcServerBean.getKrbAllowableClockSkew() );
-        
+
         // BodyChecksumVerified
         kdcConfig.setBodyChecksumVerified( kdcServerBean.isKrbBodyChecksumVerified() );
-        
+
         // EmptyAddressesAllowed
         kdcConfig.setEmptyAddressesAllowed( kdcServerBean.isKrbEmptyAddressesAllowed() );
-        
+
         // EncryptionType
         EncryptionType[] encryptionTypes = createEncryptionTypes( kdcServerBean.getKrbEncryptionTypes()
);
         kdcConfig.setEncryptionTypes( encryptionTypes );
-        
+
         // ForwardableAllowed
         kdcConfig.setForwardableAllowed( kdcServerBean.isKrbForwardableAllowed() );
-        
+
         // KdcPrincipal
-        kdcConfig.setServicePrincipal( "krbtgt/" + kdcServerBean.getKrbPrimaryRealm() + "@"
+ kdcServerBean.getKrbPrimaryRealm() );
-        
+        kdcConfig.setServicePrincipal( "krbtgt/" + kdcServerBean.getKrbPrimaryRealm() + "@"
+            + kdcServerBean.getKrbPrimaryRealm() );
+
         // MaximumRenewableLifetime
         kdcConfig.setMaximumRenewableLifetime( kdcServerBean.getKrbMaximumRenewableLifetime()
);
-        
+
         // MaximumTicketLifetime
         kdcConfig.setMaximumTicketLifetime( kdcServerBean.getKrbMaximumTicketLifetime() );
-        
+
         // PaEncTimestampRequired
         kdcConfig.setPaEncTimestampRequired( kdcServerBean.isKrbPaEncTimestampRequired()
);
-        
+
         // PostdatedAllowed
         kdcConfig.setPostdatedAllowed( kdcServerBean.isKrbPostdatedAllowed() );
-        
+
         // PrimaryRealm
         kdcConfig.setPrimaryRealm( kdcServerBean.getKrbPrimaryRealm() );
-        
+
         // ProxiableAllowed
         kdcConfig.setProxiableAllowed( kdcServerBean.isKrbProxiableAllowed() );
 
         // RenewableAllowed
         kdcConfig.setRenewableAllowed( kdcServerBean.isKrbRenewableAllowed() );
-        
+
         // searchBaseDn
         kdcConfig.setSearchBaseDn( kdcServerBean.getSearchBaseDn().getName() );
-        
+
         KdcServer kdcServer = new KdcServer( kdcConfig );
 
         kdcServer.setDirectoryService( directoryService );
@@ -730,18 +735,18 @@ public class ServiceBuilder
         kdcServer.setTransports( transports );
 
         ChangePasswordServerBean changePasswordServerBean = directoryServiceBean.getChangePasswordServerBean();
-        
+
         // Fist, do nothing if the ChangePasswordServer is disabled
         if ( ( changePasswordServerBean != null ) && !changePasswordServerBean.isDisabled()
)
         {
             ChangePasswordServer changePasswordServer = new ChangePasswordServer( new ChangePasswordConfig(
kdcConfig ) );
             changePasswordServer.setEnabled( true );
             changePasswordServer.setDirectoryService( directoryService );
-            
+
             // Transports
             Transport[] chngPwdTransports = createTransports( changePasswordServerBean.getTransports()
);
             changePasswordServer.setTransports( chngPwdTransports );
-            
+
             kdcServer.setChangePwdServer( changePasswordServer );
         }
 



Mime
View raw message