Fixing some documentation formatting.

This commit is contained in:
Austin Ziegler 2010-03-24 23:27:54 -04:00
parent 8e9a8a48d7
commit 1589556dd2

View file

@ -343,7 +343,6 @@ class Net::LDAP
PagedResults = "1.2.840.113556.1.4.319" # Microsoft evil from RFC 2696
end
# LDAP::result2string
def self.result2string(code) #:nodoc:
ResultStrings[code] || "unknown result (#{code})"
end
@ -428,9 +427,14 @@ class Net::LDAP
# ldap.host = server_ip_address
# psw = proc { your_psw_function }
# ldap.authenticate "cn=Your Username, cn=Users, dc=example, dc=com", psw
#
def authenticate(username, password)
password = password.call if password.respond_to?(:call)
@auth = {:method => :simple, :username => username, :password => password}
@auth = {
:method => :simple,
:username => username,
:password => password
}
end
alias_method :auth, :authenticate
@ -510,6 +514,11 @@ class Net::LDAP
# members of the object returned from #get_operation_result. Check
# #get_operation_result.error_message and
# #get_operation_result.matched_dn.
#
#--
# Modified the implementation, 20Mar07. We might get a hash of LDAP
# response codes instead of a simple numeric code.
#++
def get_operation_result
os = OpenStruct.new
if @result.is_a?(Hash)
@ -705,7 +714,6 @@ class Net::LDAP
begin
conn = Connection.new(:host => @host, :port => @port,
:encryption => @encryption)
@result = conn.bind(auth)
ensure
conn.close if conn
@ -753,11 +761,9 @@ class Net::LDAP
# ldap.port = 389
# ldap.auth "cn=manager, dc=yourcompany, dc=com", "topsecret"
#
# result = ldap.bind_as(
# :base => "dc=yourcompany, dc=com",
# result = ldap.bind_as(:base => "dc=yourcompany, dc=com",
# :filter => "(mail=#{user})",
# :password => psw
# )
# :password => psw)
# if result
# puts "Authenticated #{result.first.dn}"
# else
@ -1164,8 +1170,7 @@ class Net::LDAP::Connection #:nodoc:
# go here.
when :start_tls
msgid = next_msgid.to_ber
request =
[StartTlsOid.to_ber].to_ber_appsequence(Net::LdapPdu::ExtendedRequest)
request = [StartTlsOid.to_ber].to_ber_appsequence(Net::LdapPdu::ExtendedRequest)
request_pkt = [msgid, request].to_ber_sequence
@conn.write request_pkt
be = @conn.read_ber(AsnSyntax)