File tree Expand file tree Collapse file tree 2 files changed +28
-9
lines changed Expand file tree Collapse file tree 2 files changed +28
-9
lines changed Original file line number Diff line number Diff line change @@ -1324,15 +1324,17 @@ def next_msgid
1324
1324
end
1325
1325
1326
1326
def bind ( auth )
1327
- meth = auth [ :method ]
1328
- if [ :simple , :anonymous , :anon ] . include? ( meth )
1329
- bind_simple auth
1330
- elsif meth == :sasl
1331
- bind_sasl ( auth )
1332
- elsif meth == :gss_spnego
1333
- bind_gss_spnego ( auth )
1334
- else
1335
- raise Net ::LDAP ::LdapError , "Unsupported auth method (#{ meth } )"
1327
+ instrument "bind.net_ldap_connection" do |payload |
1328
+ payload [ :method ] = meth = auth [ :method ]
1329
+ if [ :simple , :anonymous , :anon ] . include? ( meth )
1330
+ bind_simple auth
1331
+ elsif meth == :sasl
1332
+ bind_sasl ( auth )
1333
+ elsif meth == :gss_spnego
1334
+ bind_gss_spnego ( auth )
1335
+ else
1336
+ raise Net ::LDAP ::LdapError , "Unsupported auth method (#{ meth } )"
1337
+ end
1336
1338
end
1337
1339
end
1338
1340
Original file line number Diff line number Diff line change 175
175
result . should == read_result
176
176
end
177
177
178
+ it "should publish a bind.net_ldap_connection event" do
179
+ ber = Net ::BER ::BerIdentifiedArray . new ( [ 0 , "" , "" ] )
180
+ ber . ber_identifier = Net ::LDAP ::PDU ::BindResult
181
+ bind_result = [ 2 , ber ]
182
+ @tcp_socket . should_receive ( :read_ber ) . and_return ( bind_result )
183
+
184
+ events = @service . subscribe "bind.net_ldap_connection"
185
+
186
+ result = subject . bind ( method : :anon )
187
+ result . should be_success
188
+
189
+ # a read event
190
+ payload , result = events . pop
191
+ payload . should have_key ( :result )
192
+ result . should be_success
193
+ end
194
+
178
195
it "should publish a search.net_ldap_connection event" do
179
196
# search data
180
197
search_data_ber = Net ::BER ::BerIdentifiedArray . new ( [ 2 , [
You can’t perform that action at this time.
0 commit comments