This question is OT from the original post.
I've a question about the authentication method you describe. What were the reasons to retrieve the password using an anonymous bind versus trying to bind with the username/password pair given?
I'm doing similar work but our dir server does not allow an anonymous bind to retrieve the
attribute.