Example: mldap_searchListing Directory Vuser Functions (MLDAP)

Performs a search on an LDAP server.

int mldap_search( char *transaction, char *base, char *scope, char *filter, [char *timeout,] [char *mode,] [const char *SaveAsParam,] [const char *Attrs,] LAST );
transactionA transaction name for this step. To instruct VuGen not to create a transaction for this step, use a NULL string, "".
baseThe base Distinguished Name entry. Use the following format: "Base=RDN1, RDN2,..."
scopeThe scope of the search: Base (default), or Onelevel, or Subtree. Use the following format: "Scope=Base."
filterThe 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:
SaveAsParamIf 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"
AttrsAn 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 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 global sessions. For multiple sessions, use the mldap_search_ex function, which allows you to specify a session identifier.

Return Values

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


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