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