[ https://issues.apache.org/jira/browse/DIRSERVER-2134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15189184#comment-15189184 ]
Kiran Ayyagari commented on DIRSERVER-2134: ------------------------------------------- Currently when ads-pwdmustchange is set to true then the list of modifications sent should not contain anything other than a password modification. Try updating the home after changing the password. > cannot modify password and home if ads-pwdmustchange true > --------------------------------------------------------- > > Key: DIRSERVER-2134 > URL: https://issues.apache.org/jira/browse/DIRSERVER-2134 > Project: Directory ApacheDS > Issue Type: Bug > Components: core > Affects Versions: 2.0.0-M21 > Environment: CentOS 7 > Reporter: Peter Jamieson > > I wrote the following unit test to change password and home directory > (contrived from looking at code) and it fails to update: - > {code} > @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); > } > {code} > The following stacktrace happens: - > {noformat} > 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) > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)