-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix-paged-search
- Loading branch information
Showing
6 changed files
with
62 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -502,6 +502,40 @@ def test_search_net_ldap_connection_event | |
assert unread.empty?, "should not have any leftover unread messages" | ||
end | ||
|
||
def test_add_with_controls | ||
dacl_flag = 0x4 # DACL_SECURITY_INFORMATION | ||
control_values = [dacl_flag].map(&:to_ber).to_ber_sequence.to_s.to_ber | ||
controls = [] | ||
# LDAP_SERVER_SD_FLAGS constant definition, taken from https://ldapwiki.com/wiki/LDAP_SERVER_SD_FLAGS_OID | ||
ldap_server_sd_flags = '1.2.840.113556.1.4.801'.freeze | ||
controls << [ldap_server_sd_flags.to_ber, true.to_ber, control_values].to_ber_sequence | ||
|
||
ber = Net::BER::BerIdentifiedArray.new([Net::LDAP::ResultCodeSuccess, "", ""]) | ||
ber.ber_identifier = Net::LDAP::PDU::AddResponse | ||
@tcp_socket.should_receive(:read_ber).and_return([1, ber]) | ||
|
||
result = @connection.add(:dn => "uid=added-user1,ou=People,dc=rubyldap,dc=com", :controls => controls) | ||
assert result.success?, "should be success" | ||
assert_equal "", result.error_message | ||
end | ||
|
||
def test_modify_with_controls | ||
dacl_flag = 0x4 # DACL_SECURITY_INFORMATION | ||
control_values = [dacl_flag].map(&:to_ber).to_ber_sequence.to_s.to_ber | ||
controls = [] | ||
# LDAP_SERVER_SD_FLAGS constant definition, taken from https://ldapwiki.com/wiki/LDAP_SERVER_SD_FLAGS_OID | ||
ldap_server_sd_flags = '1.2.840.113556.1.4.801'.freeze | ||
controls << [ldap_server_sd_flags.to_ber, true.to_ber, control_values].to_ber_sequence | ||
|
||
ber = Net::BER::BerIdentifiedArray.new([Net::LDAP::ResultCodeSuccess, "", ""]) | ||
ber.ber_identifier = Net::LDAP::PDU::ModifyResponse | ||
@tcp_socket.should_receive(:read_ber).and_return([1, ber]) | ||
|
||
result = @connection.modify(:dn => "1", :operations => [[:replace, "mail", "[email protected]"]], :controls => controls) | ||
assert result.success?, "should be success" | ||
assert_equal "", result.error_message | ||
end | ||
|
||
def test_search_with_controls | ||
# search data | ||
search_data_ber = Net::BER::BerIdentifiedArray.new([1, [ | ||
|