@@ -311,7 +311,7 @@ class Net::LDAP
311311 0 => :array , # RFC-2251 Control and Filter-AND
312312 1 => :array , # SearchFilter-OR
313313 2 => :array , # SearchFilter-NOT
314- 3 => :array , # Seach referral
314+ 3 => :array , # Search referral
315315 4 => :array , # unknown use in Microsoft Outlook
316316 5 => :array , # SearchFilter-GE
317317 6 => :array , # SearchFilter-LE
@@ -325,7 +325,7 @@ class Net::LDAP
325325
326326 universal = {
327327 constructed : {
328- 107 => :array , #ExtendedResponse (PasswdModifyResponseValue)
328+ 107 => :string , # ExtendedResponse
329329 } ,
330330 }
331331
@@ -341,6 +341,7 @@ class Net::LDAP
341341
342342 StartTlsOid = '1.3.6.1.4.1.1466.20037'
343343 PasswdModifyOid = '1.3.6.1.4.1.4203.1.11.1'
344+ WhoamiOid = '1.3.6.1.4.1.4203.1.11.3'
344345
345346 # https://tools.ietf.org/html/rfc4511#section-4.1.9
346347 # https://tools.ietf.org/html/rfc4511#appendix-A
@@ -1200,6 +1201,23 @@ def delete_tree(args)
12001201 end
12011202 end
12021203
1204+ # Return the authorization identity of the client that issues the
1205+ # ldapwhoami request. The method does not support any arguments.
1206+ #
1207+ # Returns True or False to indicate whether the request was successfull.
1208+ # The result is available in the extended status information when calling
1209+ # #get_operation_result.
1210+ #
1211+ # ldap.ldapwhoami
1212+ # puts ldap.get_operation_result.extended_response
1213+ def ldapwhoami ( args = { } )
1214+ instrument "ldapwhoami.net_ldap" , args do |payload |
1215+ @result = use_connection ( args , &:ldapwhoami )
1216+ @result . success? ? @result . extended_response : nil
1217+ end
1218+ end
1219+ alias_method :whoami , :ldapwhoami
1220+
12031221 # This method is experimental and subject to change. Return the rootDSE
12041222 # record from the LDAP server as a Net::LDAP::Entry, or an empty Entry if
12051223 # the server doesn't return the record.
0 commit comments