Skip to content

Commit 95ba94f

Browse files
author
Luiz Angelo Daros de Luca
committed
- turn initial cred optional in bind_sasl. It is missing for some methods.
this fixes a wireshark warning that ldap packet was corrupted
1 parent bbef82f commit 95ba94f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/net/ldap.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,12 +1299,16 @@ def bind_simple(auth)
12991299
def bind_sasl(auth)
13001300
mech, cred, chall = auth[:mechanism], auth[:initial_credential],
13011301
auth[:challenge_response]
1302-
raise Net::LDAP::LdapError, "Invalid binding information" unless (mech && cred && chall)
1302+
raise Net::LDAP::LdapError, "Invalid binding information" unless (mech && chall)
13031303

13041304
n = 0
13051305
loop {
13061306
msgid = next_msgid.to_ber
1307-
sasl = [mech.to_ber, cred.to_ber].to_ber_contextspecific(3)
1307+
if cred
1308+
sasl = [mech.to_ber, cred.to_ber].to_ber_contextspecific(3)
1309+
else
1310+
sasl = [mech.to_ber].to_ber_contextspecific(3)
1311+
end
13081312
request = [LdapVersion.to_ber, "".to_ber, sasl].to_ber_appsequence(0)
13091313
request_pkt = [msgid, request].to_ber_sequence
13101314
@conn.write request_pkt

0 commit comments

Comments
 (0)