Share this page

# mldap_set_option_ex

Listing Directory Functions (mldap)

Sets a specific option for an LDAP session.

    int mldap_set_option_ex( MLDAP *pldap, const char *transaction, const char *Option1, [Option2,...,OptionN,] LAST );

pldap | A session identifier for an LDAP session.
transaction | A transaction name for this step. To instruct VuGen not to create a transaction for this step, use a NULL string, "".
Option | LDAP option to set in following format : Name=Value. See the list below for supported options.
LAST | A marker indicating the end of the argument list.

mldap_set_option_ex sets an option for a specific LDAP session.

This function is for use when there are multiple sessions. For global or single sessions, use the mldap_set_option function.

Supported Options:

Argument | Description
--- | ---
TLS=<ON|OFF> | Enables or disables TLS(SSL) on the current session. TLS can be switched ON only if the SSLCertDir=<path> parameter was previously specified in the corresponding mldap_logon or mldap_logon_ex call.
RecvSizeLimit=<n> | Specifies the maximum number of entries returned by the server in search results. Value can be any number. This argument is not recorded. It can be added manually.
Timeout=<seconds> | The maximum number of seconds to wait for the server to answering a search request. This argument is not recorded. It can be added manually

## 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

## Example

This example shows mldap_set_option_ex setting TLS to ON before conducting a search.

Copy code

    mldap1 = 0;
    mldap_logon_ex(&mldap1,
        "LdapLogon",
        "URL=ldap://100.100.100.100",
        "Version=3",
        "SSLCertDir=e:\\LdapServerCertificates\\",
        LAST );
    mldap_search_ex(&mldap1,
        "LdapSearch",
        "Base=",
        "Scope=Base",
        "Filter=objectclass=*",
        LAST );
    //Enables TLS on a current session.
    mldap_set_option_ex(&mldap1, "TLS=ON", LAST );
    mldap_search_ex(&mldap1,
        "LdapSearch",
        "Base=cn=Recipients,ou=qalab,o=qalab",
        "Scope=Subtree",
        "Filter=(rdn=QAtest)",
        LAST );
    mldap_logoff(&mldap1);LAST );

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