Correct indentation and format.
This commit is contained in:
parent
2835ecd82d
commit
ec47390431
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# LDAP PDU support classes
|
||||
#
|
||||
#
|
||||
#----------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (C) 2006 by Francis Cianfrocca. All Rights Reserved.
|
||||
|
@ -24,17 +23,12 @@
|
|||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
#---------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
|
||||
|
||||
module Net
|
||||
|
||||
class LdapPduError < StandardError; end
|
||||
|
||||
class LdapPduError < StandardError; end
|
||||
|
||||
|
||||
class LdapPdu
|
||||
class LdapPdu
|
||||
|
||||
BindRequest = 0
|
||||
BindResult = 1
|
||||
|
@ -55,8 +49,6 @@ class LdapPdu
|
|||
attr_reader :search_referrals
|
||||
attr_reader :search_parameters, :bind_parameters
|
||||
|
||||
#
|
||||
# initialize
|
||||
# An LDAP PDU always looks like a BerSequence with
|
||||
# at least two elements: an integer (message-id number), and
|
||||
# an application-specific sequence.
|
||||
|
@ -132,8 +124,6 @@ class LdapPdu
|
|||
@ldap_result || {}
|
||||
end
|
||||
|
||||
#
|
||||
# result_code
|
||||
# This returns an LDAP result code taken from the PDU,
|
||||
# but it will be nil if there wasn't a result code.
|
||||
# That can easily happen depending on the type of packet.
|
||||
|
@ -155,17 +145,15 @@ class LdapPdu
|
|||
@ldap_result && @ldap_result[:serverSaslCreds]
|
||||
end
|
||||
|
||||
#
|
||||
# parse_ldap_result
|
||||
#
|
||||
def parse_ldap_result sequence
|
||||
sequence.length >= 3 or raise LdapPduError
|
||||
@ldap_result = {:resultCode => sequence[0], :matchedDN => sequence[1], :errorMessage => sequence[2]}
|
||||
end
|
||||
|
||||
private :parse_ldap_result
|
||||
|
||||
#
|
||||
# parse_bind_response
|
||||
# A Bind Response may have an additional field, ID [7], serverSaslCreds, per RFC 2251 pgh 4.2.3.
|
||||
#
|
||||
def parse_bind_response sequence
|
||||
|
@ -174,10 +162,9 @@ class LdapPdu
|
|||
@ldap_result[:serverSaslCreds] = sequence[3] if sequence.length >= 4
|
||||
@ldap_result
|
||||
end
|
||||
|
||||
private :parse_bind_response
|
||||
|
||||
#
|
||||
# parse_search_return
|
||||
# Definition from RFC 1777 (we're handling application-4 here)
|
||||
#
|
||||
# Search Response ::=
|
||||
|
@ -210,7 +197,6 @@ class LdapPdu
|
|||
}
|
||||
end
|
||||
|
||||
#
|
||||
# A search referral is a sequence of one or more LDAP URIs.
|
||||
# Any number of search-referral replies can be returned by the server, interspersed
|
||||
# with normal replies in any order.
|
||||
|
@ -220,7 +206,6 @@ class LdapPdu
|
|||
@search_referrals = uris
|
||||
end
|
||||
|
||||
|
||||
# Per RFC 2251, an LDAP "control" is a sequence of tuples, each consisting
|
||||
# of an OID, a boolean criticality flag defaulting FALSE, and an OPTIONAL
|
||||
# Octet String. If only two fields are given, the second one may be
|
||||
|
@ -239,8 +224,8 @@ class LdapPdu
|
|||
o
|
||||
end
|
||||
end
|
||||
private :parse_controls
|
||||
|
||||
private :parse_controls
|
||||
|
||||
# (provisional, must document)
|
||||
def parse_ldap_search_request sequence
|
||||
|
@ -265,14 +250,9 @@ class LdapPdu
|
|||
@bind_parameters = s
|
||||
end
|
||||
|
||||
|
||||
# (provisional, must document)
|
||||
# UnbindRequest has no content so this is a no-op.
|
||||
def parse_unbind_request sequence
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end # module Net
|
||||
|
||||
|
|
Loading…
Reference in a new issue