Pike v8.1 release 6

Method Protocols.LDAP.client()->search()


Method search

result|int search(string|object|void filter, array(string)|void attrs, int|void attrsonly, void|mapping(string:array(int|string)) controls, void|int flags)

Description

Search LDAP directory.

Parameter filter

Search filter to override the one from the LDAP URL. It's either a string with the format specified in RFC 2254, or an object returned by Protocols.LDAP.make_filter.

Parameter attrs

The array of attribute names which will be returned by server for every entry.

Parameter attrsonly

This flag causes server return only the attribute types (aka names) but not their values. The values will instead be empty arrays or - if Protocols.LDAP.SEARCH_MULTIVAL_ARRAYS_ONLY is given - zeroes for single-valued attributes.

Parameter controls

Extra controls to send in the search query, to modify how the server executes the search in various ways. The value is a mapping with an entry for each control.

object_identifier : string

The index is the object identifier in string form for the control type. There are constants in Protocols.LDAP for the object identifiers for some known controls.

The mapping value is an array of two elements:

Array
int 0

The first element is an integer flag that specifies whether the control is critical or not. If it is nonzero, the server returns an error if it doesn't understand the control. If it is zero, the server ignores it instead.

string|int(0..0) 1

The second element is the string value to pass with the control. It may also be zero to not pass any value at all.

Parameter flags

Bitfield with flags to control various behavior at the client side of the search operation. See the Protocol.LDAP.SEARCH_* constants for details.

Returns

Returns object LDAP.client.result on success, 0 otherwise.

Note

The API change: the returning code was changed in Pike 7.3+ to follow his logic better.

See also

result, result.fetch, read, get_supported_controls, Protocols.LDAP.ldap_encode_string, Protocols.LDAP.make_filter