Share this page

# mldap_logon_ex

Listing Directory Functions (mldap)

Logs onto an LDAP server for a specific session.

    int mldap_logon_ex( MLDAP *pldap, char *transaction, char *url, [<List of Attributes>,] 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, "".
URL | The URL of the LDAP server, including the server name: `"URL=`ldap path`"`The LDAP path should have the following format: `ldap`[s]`://[username][:password]@[server][:port]`
List of Attributes | Optional: A comma-separated list of attributes. See the list below. Each argument is a quoted key-value pair, for example, "KeyName=Value".
LAST | A marker indicating the end of the argument list.

The mldap_logon_ex function logs onto an LDAP server for a specific session.

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

Possible attribute arguments:

Argument | Description
--- | ---
Mode=<mode> | The LDAP call mode. Either Sync or Async
Timeout=<seconds> | The LDAP search timeout.
Version=<n> | The LDAP protocol version. For example,1,2,or 3.
SSLCertDir=<path> | The path to the SSL certificates database file (cert8.db). The SSLCertDir parameter is required if an SSL connection is going to be established.
SSLKeysDir=<path> | The path to the SSL keys database file (key3.db)
SSLKeyNickname=<nickname> | The SSL key nickname in keys database file
SSLKeyCertNickname=<nickname> | The SSL key's certificate nickname in the certificates database file
SSLKeysPassword=<password> | The SSL key's password
SSLSecModule=<path> | The path to the SSL security module file (secmod.db)
StartTLS | Passing StartTLS specifies that the StartTLS extension's specific command must be issued to switch the connection to TLS(SSL) mode. If StartTLS is used, then the URL parameter can be empty (URL=ldaps://). That means that TLS will be established on the existing session (pldap) without reconnecting to the server. This is equivalent to calling mldap_set_option with TLS=ON.

Examples of different URLs:

URL | Effect
--- | ---
ldap://usr_name:pwd@server.com:389 | Connects to the server (port 389) then binds with username usr_name , password pwd.
ldap://:@server.com | Connects to server (default unsecured port 389) then binds anonymously : username = NULL, password = NULL.
ldaps://usr_name:@server.com | Connects to server (default secured port 636) then binds with username usr_name, password "".
ldap://@server.com | Connects to server, skips bind.
ldap://server.com | Connects to server, skips bind.
ldap://usr_name:pwd@ | Binds on existing session with username usr_name, password pwd, without reconnecting.
ldap://:@ | Binds anonymously on existing session with username = NULL, password = NULL, without reconnecting.
ldap://:pwd@server.com" | Not allowed.

## Return Values

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

## Parameterization

No parameterization is available for this function.

## Example

In the following example, the mldap_logon function logs on to the LDAP server ldap1.

    // Logon to the LDAP server
    mldap_logon_ex(pldap, "Login", "URL=ldap://johnsmith:tiger@ldap1:80", LAST );

    // Logout from the LDAP server
        mldap_logoff_ex(pldap);

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