Share this page

# mldap_search_ex

Example: mldap_search_ex | Listing Directory Vuser Functions (MLDAP)

Performs a search on an LDAP server for a specific session.

    int mldap_search_ex(MLDAP *pldap, const char *transaction, const char *base, const char *scope, const char *filter, [const char *timeout,] [const char *mode,] [const char *SaveAsParam,] [<List of Attributes>,] LAST );

pldap | A session identifier.
transaction | A transaction name for this step. To instruct VuGen not to create a transaction for this step, use a NULL string, "".
base | The base Distinguished Name entry. Use the following format: `"Base=`RDN1`,` RDN2`,..."`
scope | The scope of the search: `Base` (default), or `Onelevel`, or `Subtree`. Use the following format: `"Scope=Base."`
filter | The name of an attribute of the entry, by which to filter the search. Use the following format: `"Filter=(`attribute_name`=`value)`".` You can indicate a specific value, or a wildcard, *, to retrieve all values of that attribute name.
timeout | The timeout in seconds. After the timeout is reached, VuGen aborts the search. The default is 30 seconds. Use the following format: `"Timeout=`value`"`
mode | The search mode: synchronous (default) or asynchronous. Use the following format: `"Mode=SYNC | ASYNC"`
SaveAsParam | If SaveAsParam is true, the attributes are saved as parameters. If Attrs is not passed, all attributes are saved to parameters. If Attrs is passed, only the attributes listed are saved to parameters. The format is "`SaveAsParam=True`"
List of Attributes | An optional filter to define the set of attributes fetched from the server. Attrs is a comma separated list. For example, "`Attrs=uid,mail`"
LAST | A marker indicating the end of the argument list.

The mldap_search_ex function searches an LDAP for a specific attribute. You indicate a DN which VuGen uses as a base for a search. The scope can be the base itself (base), one level beneath the base (Onelevel), or all levels beneath the base (subtree). You can specify an attribute and its value, or a wildcard. If you use a wildcard, VuGen returns all values for the specified attribute.

If SaveAsParam is used, the parameters are named mldap_attribute_<AttributeName>_<EntryID>. For example, `mldap_attribute_uid_2.`

Note that the use of the Attrs argument affects the load on the server. The more attributes retrieved, the higher the load on the server created by this call.

This function is for use with multiple sessions. For global or single sessions, use the mldap_search function, which leaves out the session identifier.

## Return Values

If this function succeeds, it returns E_OK. Otherwise, it returns a negative value.

## Parameterization

The following argument(s) can be parameterized with standard parameterization: base, scope, filter, mode

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: