Permalink
Browse files

Merge pull request #39 from aspgems/master

Changed back return values in API methods to match what documentation says
  • Loading branch information...
Rory O'Connell
Rory O'Connell committed Aug 28, 2012
2 parents 8ddb2d7 + d6aa24e commit 8acd4acc5bf319603a854c68d0ce70ecfd6241ac
Showing with 14 additions and 12 deletions.
  1. +14 −12 lib/net/ldap.rb
View
@@ -523,15 +523,17 @@ def self.open(args)
# response codes instead of a simple numeric code.
#++
def get_operation_result
+ result = @result
+ result = result.result if result.is_a?(Net::LDAP::PDU)
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
# numeric code.
- os.code = (@result[:resultCode] || "").to_i
- os.error_message = @result[:errorMessage]
- os.matched_dn = @result[:matchedDN]
- elsif @result
- os.code = @result
+ os.code = (result[:resultCode] || "").to_i
+ os.error_message = result[:errorMessage]
+ os.matched_dn = result[:matchedDN]
+ elsif result
+ os.code = result
else
os.code = 0
end
@@ -653,7 +655,7 @@ def search(args = {})
if return_result_set
(!@result.nil? && @result.result_code == 0) ? result_set : nil
else
- @result
+ @result.success?
end
end
@@ -727,7 +729,7 @@ def bind(auth = @auth)
end
end
- @result
+ @result.success?
end
# #bind_as is for testing authentication credentials.
@@ -829,7 +831,7 @@ def add(args)
conn.close if conn
end
end
- @result
+ @result.success?
end
# Modifies the attribute values of a particular entry on the LDAP
@@ -928,7 +930,7 @@ def modify(args)
end
end
- @result
+ @result.success?
end
# Add a value to an attribute. Takes the full DN of the entry to modify,
@@ -999,7 +1001,7 @@ def rename(args)
conn.close if conn
end
end
- @result
+ @result.success?
end
alias_method :modify_rdn, :rename
@@ -1027,7 +1029,7 @@ def delete(args)
conn.close
end
end
- @result
+ @result.success?
end
# Delete an entry from the LDAP directory along with all subordinate entries.

0 comments on commit 8acd4ac

Please sign in to comment.