ldapvalue

Table of Contents

This function is only available in CFEngine Enterprise.

Prototype: ldapvalue(uri, dn, filter, record, scope, security)

Return type: string

The return value is cached.

Description: Returns the first matching named value from ldap.

This function retrieves a single field from a single LDAP record identified by the search parameters. The first matching value it taken.

Arguments:

  • uri: string, in the range: .*
  • dn: string, in the range: .*
  • filter: string, in the range: .*
  • record: string, in the range: .*
  • scope: one of
    • subtree
    • onelevel
    • base
  • security: one of
    • none
    • ssl
    • sasl

dn specifies the distinguished name, an ldap formatted name built from components, e.g. "dc=cfengine,dc=com". filter is an ldap search, e.g. "(sn=User)", and record is the name of the single record to be retrieved, e.g. uid. Which security values are supported depends on machine and server capabilities.

Example:

vars:

   # Get the first matching value for "uid" in schema

  "value" string => ldapvalue(
                             "ldap://ldap.example.org",
                             "dc=cfengine,dc=com",
                             "(sn=User)",
                             "uid",
                             "subtree",
                             "none"
                             );