class LDAP::Conn

Public Instance Methods

root_dse(attrs = nil, sec = 0, usec = 0) click to toggle source

Fetch the root DSE (DSA-specific Entry) for the connection. DSA stands for Directory System Agent and simply refers to the LDAP server you are using.

attrs, if given, is an array of attributes that should be returned from the server. The default list is subschemaSubentry, namingContexts, monitorContext, altServer, supportedControl, supportedExtension, supportedFeatures, supportedSASLMechanisms and supportedLDAPVersion.

sec and usec can be used to specify a time-out for the search in seconds and microseconds, respectively.

# File lib/ldap/schema.rb, line 114
def root_dse(attrs = nil, sec = 0, usec = 0)
  attrs ||= [
    'subschemaSubentry',
    'namingContexts',
    'monitorContext',
    'altServer',
    'supportedControl',
    'supportedExtension',
    'supportedFeatures',
    'supportedSASLMechanisms',
    'supportedLDAPVersion',
  ]

  entries = search2('', LDAP_SCOPE_BASE, '(objectClass=*)',
    attrs, false, sec, usec)

  return entries
end
schema(base = nil, attrs = nil, sec = 0, usec = 0) click to toggle source

Fetch the schema data for the connection.

If base is given, it gives the base DN for the search. attrs, if given, is an array of attributes that should be returned from the server. The default list is objectClasses, attributeTypes, matchingRules, matchingRuleUse, dITStructureRules, dITContentRules, nameForms and ldapSyntaxes.

sec and usec can be used to specify a time-out for the search in seconds and microseconds, respectively.

# File lib/ldap/schema.rb, line 82
def schema(base = nil, attrs = nil, sec = 0, usec = 0)
  attrs ||= [
    'objectClasses',
    'attributeTypes',
    'matchingRules',
    'matchingRuleUse',
    'dITStructureRules',
    'dITContentRules',
    'nameForms',
    'ldapSyntaxes',
  ]
  base ||= root_dse(['subschemaSubentry'], sec, usec)[0]['subschemaSubentry'][0]
  base ||= 'cn=schema'
  entries = search2(base, LDAP_SCOPE_BASE, '(objectClass=subschema)',
    attrs, false, sec, usec)

  return Schema.new(entries[0])
end