directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "lucas theisen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DIRSERVER-1528) revert operation fails when password policy is active
Date Wed, 04 Dec 2013 18:44:35 GMT

    [ https://issues.apache.org/jira/browse/DIRSERVER-1528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13839188#comment-13839188
] 

lucas theisen commented on DIRSERVER-1528:
------------------------------------------

Perhaps this patch to FrameworkRunner:

{code}
@@ -466,10 +480,30 @@
         }

         ChangeLog cl = dirService.getChangeLog();
-        if ( cl.isEnabled() && ( revision < cl.getCurrentRevision() ) )
+        if ( cl.isEnabled() && (revision < cl.getCurrentRevision()) )
         {
             LOG.debug( "Revert revision {}", revision );
-            dirService.revert( revision );
+
+            PasswordPolicyConfiguration disabledConfiguration = new PasswordPolicyConfiguration();
+            disabledConfiguration.setPwdCheckQuality( CheckQualityEnum.NO_CHECK );
+            PpolicyConfigContainer disabledContainer = new PpolicyConfigContainer();
+            disabledContainer.setDefaultPolicy( disabledConfiguration );
+
+            AuthenticationInterceptor authenticationInterceptor = null;
+            PpolicyConfigContainer policyContainer = null;
+            for ( Interceptor interceptor : dirService.getInterceptors() ) {
+                if ( interceptor instanceof AuthenticationInterceptor ) {
+                    authenticationInterceptor = (AuthenticationInterceptor) interceptor;
+                    policyContainer = authenticationInterceptor.getPwdPolicyContainer();
+                    authenticationInterceptor.setPwdPolicies( disabledContainer );
+                }
+            }
+            try {
+                dirService.revert( revision );
+            }
+            finally {
+                authenticationInterceptor.setPwdPolicies( policyContainer );
+            }
         }
     }
 }
{code}

Could be optimized by holding a reference to the disabled policy container in the runner,
but this should do it...

> revert operation fails when password policy is active
> -----------------------------------------------------
>
>                 Key: DIRSERVER-1528
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1528
>             Project: Directory ApacheDS
>          Issue Type: Bug
>            Reporter: Kiran Ayyagari
>             Fix For: 2.0.0
>
>
> When password policy is activated then revert operation might fail especially when reverting
a modify operation.
> (This will happen for sure if the password history is enabled and any entry's password
gets modified)
> Currently the only known workaround in tests is to disable the ChangeLog.
> Another possible option is to disable the passwordpolicy related checks(one way to acheive
this is to set the policyConfig object to null) during 
> a revert operation and restore it after completing the revert operation.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message