Changed back return values in API methods to match what documentation says

This commit is contained in:
Francisco R. Santos 2012-04-18 20:11:11 +02:00
parent 51597eae9a
commit d6aa24ebea

View file

@ -519,15 +519,17 @@ class Net::LDAP
# response codes instead of a simple numeric code. # response codes instead of a simple numeric code.
#++ #++
def get_operation_result def get_operation_result
result = @result
result = result.result if result.is_a?(Net::LDAP::PDU)
os = OpenStruct.new os = OpenStruct.new
if @result.is_a?(Hash) if result.is_a?(Hash)
# We might get a hash of LDAP response codes instead of a simple # We might get a hash of LDAP response codes instead of a simple
# numeric code. # numeric code.
os.code = (@result[:resultCode] || "").to_i os.code = (result[:resultCode] || "").to_i
os.error_message = @result[:errorMessage] os.error_message = result[:errorMessage]
os.matched_dn = @result[:matchedDN] os.matched_dn = result[:matchedDN]
elsif @result elsif result
os.code = @result os.code = result
else else
os.code = 0 os.code = 0
end end
@ -649,7 +651,7 @@ class Net::LDAP
if return_result_set if return_result_set
(!@result.nil? && @result.result_code == 0) ? result_set : nil (!@result.nil? && @result.result_code == 0) ? result_set : nil
else else
@result @result.success?
end end
end end
@ -723,7 +725,7 @@ class Net::LDAP
end end
end end
@result @result.success?
end end
# #bind_as is for testing authentication credentials. # #bind_as is for testing authentication credentials.
@ -825,7 +827,7 @@ class Net::LDAP
conn.close if conn conn.close if conn
end end
end end
@result @result.success?
end end
# Modifies the attribute values of a particular entry on the LDAP # Modifies the attribute values of a particular entry on the LDAP
@ -924,7 +926,7 @@ class Net::LDAP
end end
end end
@result @result.success?
end end
# Add a value to an attribute. Takes the full DN of the entry to modify, # Add a value to an attribute. Takes the full DN of the entry to modify,
@ -995,7 +997,7 @@ class Net::LDAP
conn.close if conn conn.close if conn
end end
end end
@result @result.success?
end end
alias_method :modify_rdn, :rename alias_method :modify_rdn, :rename
@ -1023,7 +1025,7 @@ class Net::LDAP
conn.close conn.close
end end
end end
@result @result.success?
end end
# Delete an entry from the LDAP directory along with all subordinate entries. # Delete an entry from the LDAP directory along with all subordinate entries.