else
{
ctx = poolingContextsource.getReadWriteContext();
}
DistinguishedName name = new DistinguishedName(dn);
name.removeFirst(new DistinguishedName(ctx.getNameInNamespace()));
Attribute namingAttr = new BasicAttribute("userPassword", newPassword);
ModificationItem[] items = new ModificationItem[1];
items[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, namingAttr);
ctx.modifyAttributes(name, items);
}