Skip to content

Commit 3f9556c

Browse files
committed
Add explicit notes around passwordless simple auth
See: https://tools.ietf.org/html/rfc4513#section-5.1.2
1 parent 78e97ed commit 3f9556c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/net/ldap.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,12 @@ def search(args = {})
814814
# unrecognized usernames and incorrect passwords. Use
815815
# #get_operation_result to find out what happened in case of failure.
816816
#
817+
# Note: When using the simple authentication method, some A/D configurations
818+
# will return success for a bind when no password is supplied! (this is the
819+
# "Unauthenticated Authentication Mechanism of Simple Bind" covered under
820+
# RFC4513 section 5.1.2). It's recommended to validate the presence of the
821+
# password supplied when assuming a bind is authenticated.
822+
#
817823
# Here's a typical example using #bind to authenticate a credential which
818824
# was (perhaps) solicited from the user of a web site:
819825
#
@@ -823,7 +829,11 @@ def search(args = {})
823829
# ldap.port = 389
824830
# ldap.auth your_user_name, your_user_password
825831
# if ldap.bind
826-
# # authentication succeeded
832+
# if your_user_password.size > 0
833+
# # authentication succeeded
834+
# else
835+
# # unauthenticated bind succeeded
836+
# end
827837
# else
828838
# # authentication failed
829839
# p ldap.get_operation_result

0 commit comments

Comments
 (0)