use GOto::Common qw(:ldap);
use GOto::LDAP qw(ldap_get_object);
my $ldapinfo = goto_ldap_parse_config_ex(); #ref to hash
my ($ldapbase,$ldapuris) = ($ldapinfo->{"LDAP_BASE"}, $ldapinfo->{"LDAP_URIS"});
my $ldap = Net::LDAP->new( $ldapuris, timeout => $timeout ) or die;
$ldap->bind() ; # anonymous bind
# list context
my @results = ldap_get_object(ldap => $ldap,
basedn => $ldapbase,
user => $user,
timeout => $timeout,
filter => $filter,
debug => $debug,
objectClass => $objectClass,
cnou => $cn,
subquery => $subquery,
sublevel => $sublevel,
subconflict => $subconflict,
attributeSelectionRegexes => \@attributeSelectionRegexes,
enctrigger => $enctrigger,
format => $format,
dups => $dups,
mergeResults => $mergeResults
);
@results or die;
# scalar context
my $result = ldap_get_object(...);
$result or die;
If you pass "cnou", then you must also pass "objectClass" and "ldap_get_object()" will search for an object with the given "objectClass" and a "cn" equal to the value passed as "cnou". If no such object is found, it will attempt to find an object with the given "objectClass" and "ou" equal to the value of "cnou".
Each regex selects all attributes with matching names.
If the regex starts with the character "@" (which is ignored for the matching), then attribute values from different sources will be merged (i.e. the result will include all values).
If attributeRegex does NOT start with "@", then an attribute from the queried object's own node beats a posix group, which beats an object group (=gosaGroupOfNames) that includes the object directly which beats an object group that contains a posix group containing the object. Object groups containing other object groups are not supported by GOsa, so this case cannot occur.
If 2 sources with the same precedence (e.g. 2 posix groups) provide an attribute of the same name, selected by a regex that doesn not start with "@", then a WARNING is signalled and the program picks one of the conflicting attributes.
If multiple attribute regexes match the same attribute, the 1st matching attribute regex's presence or absence of "@" determines conflict resolution.
Matching is always performed against the complete attribute name as if the regex had been enclosed in "^...$", i.e. an attribute regex "name" will NOT match an attribute called "surname". Neither will the regex "sur".
Matching is always performed case-insensitive.
If the parameter "attributeSelectionRegexes" is not passed, it defaults to "@.*".
Attributes selected with a non-"@" regex, i.e. those for which only one source is permitted, are always found in the first entry and only there. For these attributes all conflicting values from lower precedence levels are always discarded, so "mergeResults=false" only makes sense when requesting merged attributes via "@".
If "mergeResults" is "true" (the default) or if "ldap_get_object()" is evaluated in scalar context, then only one Net::LDAP::Entry will be returned that contains all of the requested attributes.
Default timeout is 10s.
Use this to filter by "gosaUnitTag".
Default "sublevel" is 9999.
Note: attribute regex matching is performed on the full name with all slashes.
If no "enctrigger" is specified, the default "[\x00-\x1f]" is used (i.e. base64 encoding will be used whenever a value contains a control character). If you pass "enctrigger=none", encoding will be completely disabled.