diff -uNr ruby-ldap-0.8.3.orig/conn.c ruby-ldap-0.8.3/conn.c --- ruby-ldap-0.8.3.orig/conn.c 2004-11-11 18:47:46.269222632 -0800 +++ ruby-ldap-0.8.3/conn.c 2004-11-11 18:27:48.758271968 -0800 @@ -1286,6 +1286,7 @@ rb_ldap_conn_define_method("err", rb_ldap_conn_err, 0); #if defined(HAVE_LDAPCONTROL) + rb_require("ldap/control"); #if defined(HAVE_LDAP_SEARCH_EXT_S) rb_ldap_conn_define_method("search_ext", rb_ldap_conn_search_ext_s, -1); rb_ldap_conn_define_method("search_ext2", rb_ldap_conn_search_ext2_s, -1); diff -uNr ruby-ldap-0.8.3.orig/lib/ldap/control.rb ruby-ldap-0.8.3/lib/ldap/control.rb --- ruby-ldap-0.8.3.orig/lib/ldap/control.rb 1969-12-31 16:00:00.000000000 -0800 +++ ruby-ldap-0.8.3/lib/ldap/control.rb 2004-11-11 18:46:07.339262272 -0800 @@ -0,0 +1,46 @@ +# Manipulation of LDAP control data. +# +# Copyright (C) 2004 Ian Macdonald +# + +module LDAP + class Control + + require 'openssl' + + # Produce an Array of values in ASN.1 format and then convert + # the Array to DER. + # + def Control.encode( *vals ) + encoded_vals = [] + + vals.each do |val| + encoded_vals << + case val + when Integer + OpenSSL::ASN1::Integer( val ) + when String + OpenSSL::ASN1::OctetString.new( val ) + else + # What other types may exist? + end + end + + OpenSSL::ASN1::Sequence.new( encoded_vals ).to_der + end + + + # Take an Array of ASN.1 data and return an Array of decoded values. + # + def decode + values = [] + + OpenSSL::ASN1::decode( self.value ).value.each do |val| + values << val.value + end + + values + end + + end +end