Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.0.0-M21
-
None
-
None
-
CentOS 7
Description
I wrote the following unit test to change password and home directory (contrived from looking at code) and it fails to update: -
@Test public void testUpdatePasswordAndHome() throws Exception { Dn dnUser1 = new Dn("uid=x135_Y246,ou=users,dc=intervoice,dc=int"); Attribute newPassword = new DefaultAttribute("userPassword"); newPassword.clear(); newPassword.add("five5five%"); Modification mod = new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, newPassword); Attribute newHome = new DefaultAttribute("homeDirectory"); newHome.clear(); newHome.add("/transfer"); Modification homeMod = new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, newHome); BindOperationContext bindContext = new BindOperationContext( null ); bindContext.setCredentials( DEFAULT_PASSWORD.getBytes() ); bindContext.setDn( dnUser1.apply( service.getSchemaManager() ) ); bindContext.setInterceptors( service.getInterceptors( OperationEnum.BIND ) ); bindContext.addRequestControl(new PasswordPolicyImpl()); service.getOperationManager().bind( bindContext ); bindContext.getSession().modify(dnUser1, mod, homeMod); }
The following stacktrace happens: -
org.apache.directory.api.ldap.model.exception.LdapNoPermissionException: Password should be reset before making any changes to this entry at org.apache.directory.server.core.authn.AuthenticationInterceptor.checkPwdMustChange(AuthenticationInterceptor.java:1208) at org.apache.directory.server.core.authn.AuthenticationInterceptor.processPasswordPolicydModify(AuthenticationInterceptor.java:939) at org.apache.directory.server.core.authn.AuthenticationInterceptor.modify(AuthenticationInterceptor.java:889) at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:506) at org.apache.directory.server.core.normalization.NormalizationInterceptor.modify(NormalizationInterceptor.java:216) at org.apache.directory.server.core.DefaultOperationManager.modify(DefaultOperationManager.java:886) at org.apache.directory.server.core.shared.DefaultCoreSession.modify(DefaultCoreSession.java:625) at org.apache.directory.server.core.shared.DefaultCoreSession.modify(DefaultCoreSession.java:590) at com.intervoice.platform.apacheds.password.test.JunitCracklibPasswordValidator.testUpdatePasswordAndHome(JunitCracklibPasswordValidator.java:154) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:239) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)