def search_subschema_entry
rs = search(
:ignore_server_caps=>true,
:base=>"",
:scope=>SearchScope_BaseObject,
:attributes=>[:subschemaSubentry]
)
return Entry.new unless (rs and rs.first)
subschema_name = rs.first.subschemasubentry
return Entry.new unless (subschema_name and subschema_name.first)
rs = search(
:ignore_server_caps=>true,
:base=>subschema_name.first,
:scope=>SearchScope_BaseObject,
:filter=>"objectclass=subschema",
:attributes=>[:objectclasses, :attributetypes]
)
(rs and rs.first) or Entry.new
end