Copyright (C) 1990, Regents of the University of Michigan. All Rights Reserved.
Portions Copyright (C) 2004, Sun Microsystems, Inc. All Rights Reserved.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
cc [ flag... ] file... -lldap [ library... ] #include <lber.h> #include <ldap.h> LDAP ldap_set_option(LDAP *ld, int option, void *optdata[]);
LDAP ldap_get_option(LDAP *ld, int option, void optdata[]);
These functions provide an LDAP structure with access to session preferences. The ldap_get_option() function gets session preferences from the LDAP structure. The ldap_set_option() function sets session preferences in the LDAP structure.
The ld parameter specifies the connection handle, a pointer to an LDAP structure that contains information about the LDAP server connection. The option parameter specifies the name of the option to be read or modified. The optdata parameter serves as a pointer to the value of the option that you set or get.
The following values can be specified for the option parameter: LDAP_OPT_API_INFO
Retrieves basic information about the LDAP API implementation at execution time. The data type for the optdata parameter is (LDAPAPIInfo *). This option is READ-ONLY and cannot be set.
Determines how aliases are handled during a search. The data type for the optdata parameter is (int *). The following values can be specified for the optdata parameter: LDAP_DEREF_NEVER
Specifies that aliases are never dereferenced.
Specifies that aliases are dereferenced when searching under the base object, but not when finding the base object.
Specifies that aliases are dereferenced when finding the base object, but not when searching under the base object.
Specifies that aliases are always dereferenced when finding the base object and searching under the base object.
Specifies the maximum number of entries returned by the server in search results. The data type for the optdata parameter is (int *). Setting the optdata parameter to LDAP_NO_LIMIT removes any size limit enforced by the client.
Specifies the maximum number of seconds spent by the server when answering a search request. The data type for the optdata parameter is (int *). Setting the optdata parameter to LDAP_NO_LIMIT removes any time limit enforced by the client.
Determines whether the client should follow referrals. The data type for the optdata parameter is (int *). The following values can be specified for the optdata parameter: LDAP_OPT_ON
Specifies that the client should follow referrals.
Specifies that the client should not follow referrals.
Determines whether LDAP I/O operations are automatically restarted if aborted prematurely. It can be set to one of the constants LDAP_OPT_ON or LDAP_OPT_OFF.
Specifies the version of the protocol supported by the client. The data type for the optdata parameter is (int *). The version LDAP_VERSION2 or LDAP_VERSION3 can be specified. If no version is set, the default version LDAP_VERSION2 is set. To use LDAP v3 features, set the protocol version to LDAP_VERSION3.
Specifies a pointer to an array of LDAPControl structures that represent the LDAP v3 server controls sent by default with every request. The data type for the optdata parameter for ldap_set_option() is (LDAPControl **). For ldap_get_option(), the data type is (LDAPControl ***).
Specifies a pointer to an array of LDAPControl structures that represent the LDAP v3 client controls sent by default with every request. The data type for the optdata parameter for ldap_set_option() is (LDAPControl **). For ldap_get_option(), the data type is (LDAPControl ***).
Retrieves version information at execution time about extended features of the LDAP API. The data type for the optdata parameter is (LDAPAPIFeatureInfo *). This option is READ-ONLY and cannot be set.
Sets the host name or a list of hosts for the primary LDAP server. The data type for the optdata parameter for ldap_set_option() is (char *). For ldap_get_option(), the data type is (char **).
Specifies the code of the most recent LDAP error that occurred for this session. The data type for the optdata parameter is (int *).
Specifies the message returned with the most recent LDAP error that occurred for this session. The data type for the optdata parameter for ldap_set_option() is (char *) and for ldap_get_option() is (char **).
Specifies the matched DN value returned with the most recent LDAP error that occurred for this session. The data type for the optdata parameter for ldap_set_option() is (char *) and for ldap_get_option() is (char **).
Sets the last argument passed to the routine specified by LDAP_OPT_REBIND_FN. This option can also be set by calling the ldap_set_rebind_proc() function. The data type for the optdata parameter is (void * ).
Sets the routine to be called to authenticate a connection with another LDAP server. For example, the option is used to set the routine called during the course of a referral. This option can also be by calling the ldap_set_rebind_proc() function. The data type for the optdata parameter is (LDAP_REBINDPROC_CALLBACK *).
Sets the default SASL mechanism to call ldap_interactive_bind_s(). The data type for the optdata parameter is (char * ).
Sets the default SASL_REALM. The default SASL_REALM should be used during a SASL challenge in response to a SASL_CB_GETREALM request when using the ldap_interactive_bind_s() function. The data type for the optdata parameter is (char * ).
Sets the default SASL_AUTHNAME used during a SASL challenge in response to a SASL_CB_AUTHNAME request when using the ldap_interactive_bind_s() function. The data type for the optdata parameter is (char * ).
Sets the default SASL_USER that should be used during a SASL challenge in response to a SASL_CB_USER request when using the ldap_interactive_bind_s function. The data type for the optdata parameter is (char * ).
A read-only option used exclusively with the ldap_get_option() function. The ldap_get_option() function performs a sasl_getprop() operation that gets the SASL_SSF value for the current connection. The data type for the optdata parameter is (sasl_ssf_t * ).
A write-only option used exclusively with the ldap_set_option() function. The ldap_set_option() function performs a sasl_setprop() operation to set the SASL_SSF_EXTERNAL value for the current connection. The data type for the optdata parameter is (sasl_ssf_t * ).
A write-only option used exclusively with the ldap_set_option(). This function performs a sasl_setprop(3SASL) operation for the SASL_SEC_PROPS value for the current connection during an ldap_interactive_bind_s() operation. The data type for the optdata parameter is (char * ), a comma delimited string containing text values for any of the SASL_SEC_PROPS that should be set. The text values are: noanonymous
Sets the SASL_SEC_NOANONYMOUS flag
Sets the SASL_SEC_NODICTIONARY flag
Sets the SASL_SEC_NOPLAINTEXT flag
Sets the SASL_SEC_FORWARD_SECRECY flag
Sets the SASL_SEC_PASS_CREDENTIALS flag
Sets minssf to the integer value N
Sets maxssf to the integer value N
Sets maxbufsize to the integer value N
Sets the default SSF_MIN value used during a ldap_interactive_bind_s() operation. The data type for the optdata parameter is (char * ) numeric string.
Sets the default SSF_MAX value used during a ldap_interactive_bind_s() operation. The data type for the optdata parameter is (char * ) numeric string.
Sets the default SSF_MAXBUFSIZE value used during a ldap_interactive_bind_s() operation. The data type for the optdata parameter is (char * ) numeric string.
The ldap_set_option() and ldap_get_option() functions return: LDAP_SUCCESS
If successful
If unsuccessful
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE ATTRIBUTE VALUE |
Interface Stability Evolving |
MT-Level Safe |
ldap_init(3LDAP), sasl_setprop(3SASL), attributes(5)
There are other elements in the LDAP structure that should not be changed. No assumptions should be made about the order of elements in the LDAP structure.