Share this page

# mldap_logon

Listing Directory Functions (mldap)

Performs a login to an LDAP server.

    int mldap_logon( char *transaction, char *url, [<List of Attributes>,]LAST );

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://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 function performs a login to an LDAP server.

This function is for use with global sessions. For multiple sessions, use the mldap_logon_ex function, which allows you to specify a 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.

Copy code

    // Logon to the LDAP server
    mldap_logon("Login", "URL=ldap://johnsmith:tiger@ldap1:80", LAST );
    // Logout from the LDAP server
    mldap_logoff();

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: