Correct indentation and format.

This commit is contained in:
emiel 2009-02-27 22:43:21 +00:00
parent 2835ecd82d
commit ec47390431

View file

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