Added a new filter type bineq that will create an equality filter and NOT force

convert data to UTF-8. This is required for proper binary data filters in Microsoft
Active Directory.
This commit is contained in:
David J. Lee 2012-02-24 09:55:17 -06:00 committed by David Lee
parent 3345c58dfb
commit c46c93777e
4 changed files with 37 additions and 1 deletions

View file

@ -16,6 +16,14 @@ module Net::BER::Extensions::String
[code].pack('C') + raw_string.length.to_ber_length_encoding + raw_string
end
##
# Converts a string to a BER string but does *not* encode to UTF-8 first.
# This is required for proper representation of binary data for Microsoft
# Active Directory
def to_ber_bin(code = 0x04)
[code].pack('C') + length.to_ber_length_encoding + self
end
def raw_utf8_encoded
if self.respond_to?(:encode)
# Strings should be UTF-8 encoded according to LDAP.