Skip to content

Commit af27b55

Browse files
author
blackhedd
committed
Factored out BindResponse handling, to support SASL server creds.
1 parent 54d929d commit af27b55

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/net/ldap/pdu.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def initialize ber_object
8282

8383
case @app_tag
8484
when BindResult
85-
parse_ldap_result ber_object[1]
85+
parse_bind_response ber_object[1]
8686
when SearchReturnedData
8787
parse_search_return ber_object[1]
8888
when SearchResultReferral
@@ -129,6 +129,18 @@ def parse_ldap_result sequence
129129
end
130130
private :parse_ldap_result
131131

132+
#
133+
# parse_bind_response
134+
# A Bind Response may have an additional field, ID [7], serverSaslCreds, per RFC 2251 pgh 4.2.3.
135+
#
136+
def parse_bind_response sequence
137+
sequence.length >= 3 or raise LdapPduError
138+
@ldap_result = {:resultCode => sequence[0], :matchedDN => sequence[1], :errorMessage => sequence[2]}
139+
@ldap_result[:serverSaslCreds] = sequence[3] if sequence.length >= 4
140+
@ldap_result
141+
end
142+
private :parse_bind_response
143+
132144
#
133145
# parse_search_return
134146
# Definition from RFC 1777 (we're handling application-4 here)

0 commit comments

Comments
 (0)