LDAP Library Functions ldap_get_option(3LDAP)
NAME
ldap_get_option, ldap_set_option - get or set session
preferences in the ldap structure.SYNOPSIS
cc [ flag... ] file... -lldap [ library... ]
#include
#include
LDAP ldap_set_option(LDAP *ld, int option, void *optdata[]);
LDAP ldap_get_option(LDAP *ld, int option, void optdata[]);
DESCRIPTION
These functions provide an LDAP structure with access tosession preferences. The ldap_get_option() function gets
session preferences from the LDAP structure. Theldap_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.PARAMETERS
The following values can be specified for the option parame-
ter:LDAP_OPT_API_INFO
Retrieves basic information about the LDAP API implemen-
tation at execution time. The data type for the optdataparameter is (LDAPAPIInfo *). This option is READ-ONLY
and cannot be set.LDAP_OPT_DEREF
Determines how aliases are handled during a search. Thedata type for the optdata parameter is (int *). The fol-
lowing values can be specified for the optdata parame-
ter:LDAP_DEREF_NEVER Specifies that aliases are never
dereferenced.SunOS 5.11 Last change: 15 Jan 2004 1
LDAP Library Functions ldap_get_option(3LDAP)
LDAP_DEREF_SEARCHING Specifies that aliases are
dereferenced when searching under the base object, but not when finding the base object.LDAP_DEREF_FINDING Specifies that aliases are
dereferenced when finding the base object, but not when searching under the base object.LDAP_DEREF_ALWAYS Specifies that aliases are
always dereferenced when finding the base object and searching under the base object.LDAP_OPT_SIZELIMIT
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 toLDAP_NO_LIMIT removes any size limit enforced by the
client.LDAP_OPT_TIMELIMIT
Specifies the maximum number of seconds spent by the server when answering a search request. The data typefor the optdata parameter is (int *). Setting the opt-
data parameter to LDAP_NO_LIMIT removes any time limit
enforced by the client.LDAP_OPT_REFERRALS
Determines whether the client should follow referrals. The data type for the optdata parameter is (int *). Thefollowing values can be specified for the optdata param-
eter:LDAP_OPT_ON Specifies that the client should follow
referrals.LDAP_OPT_OFF Specifies that the client should not
follow referrals. By default, the client follows referrals.SunOS 5.11 Last change: 15 Jan 2004 2
LDAP Library Functions ldap_get_option(3LDAP)
LDAP_OPT_RESTART
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.
LDAP_OPT_PROTOCOL_VERSION
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 versionLDAP_VERSION2 is set. To use LDAP v3 features, set the
protocol version to LDAP_VERSION3.
LDAP_OPT_SERVER_CONTROLS
Specifies a pointer to an array of LDAPControl struc-
tures that represent the LDAP v3 server controls sent bydefault with every request. The data type for the opt-
data parameter for ldap_set_option() is (LDAPControl
**). For ldap_get_option(), the data type is (LDAPCon-
trol ***).LDAP_OPT_CLIENT_CONTROLS
Specifies a pointer to an array of LDAPControl struc-
tures that represent the LDAP v3 client controls sent bydefault with every request. The data type for the opt-
data parameter for ldap_set_option() is (LDAPControl
**). For ldap_get_option(), the data type is (LDAPCon-
trol ***).LDAP_OPT_API_FEATURE_INFO
Retrieves version information at execution time about extended features of the LDAP API. The data type for the optdata parameter is (LDAPAPIFeatureInfo *). This optionis READ-ONLY and cannot be set.
LDAP_OPT_HOST_NAME
Sets the host name or a list of hosts for the primary LDAP server. The data type for the optdata parameter forldap_set_option() is (char *). For ldap_get_option(),
the data type is (char **).SunOS 5.11 Last change: 15 Jan 2004 3
LDAP Library Functions ldap_get_option(3LDAP)
LDAP_OPT_ERROR_NUMBER
Specifies the code of the most recent LDAP error that occurred for this session. The data type for the optdata parameter is (int *).LDAP_OPT_ERROR_STRING
Specifies the message returned with the most recent LDAP error that occurred for this session. The data type forthe optdata parameter for ldap_set_option() is (char *)
and for ldap_get_option() is (char **).
LDAP_OPT_MATCHED_DN
Specifies the matched DN value returned with the most recent LDAP error that occurred for this session. The data type for the optdata parameter forldap_set_option() is (char *) and for ldap_get_option()
is (char **).LDAP_OPT_REBIND_ARG
Sets the last argument passed to the routine specifiedby 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 * ).LDAP_OPT_REBIND_FN
Sets the routine to be called to authenticate a connec-
tion 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 theldap_set_rebind_proc() function. The data type for the
optdata parameter is (LDAP_REBINDPROC_CALLBACK *).
LDAP_OPT_X_SASL_MECH
Sets the default SASL mechanism to callldap_interactive_bind_s(). The data type for the optdata
parameter is (char * ).LDAP_OPT_X_SASL_REALM
Sets the default SASL_REALM. The default SASL_REALM
SunOS 5.11 Last change: 15 Jan 2004 4
LDAP Library Functions ldap_get_option(3LDAP)
should be used during a SASL challenge in response to aSASL_CB_GETREALM request when using the
ldap_interactive_bind_s() function. The data type for
the optdata parameter is (char * ).LDAP_OPT_X_SASL_AUTHCID
Sets the default SASL_AUTHNAME used during a SASL chal-
lenge 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 * ).LDAP_OPT_X_SASL_AUTHZID
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 * ).LDAP_OPT_X_SASL_SSF
A read-only option used exclusively with the
ldap_get_option() function. The ldap_get_option() func-
tion 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 * ).
LDAP_OPT_X_SASL_SSF_EXTERNAL
A write-only option used exclusively with the
ldap_set_option() function. The ldap_set_option() func-
tion 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 * ).
LDAP_OPT_X_SASL_SECPROPS
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 anldap_interactive_bind_s() operation. The data type for
the optdata parameter is (char * ), a comma delimited string containing text values for any of theSASL_SEC_PROPS that should be set. The text values are:
SunOS 5.11 Last change: 15 Jan 2004 5
LDAP Library Functions ldap_get_option(3LDAP)
noanonymous Sets the SASL_SEC_NOANONYMOUS flag
nodict Sets the SASL_SEC_NODICTIONARY flag
noplain Sets the SASL_SEC_NOPLAINTEXT flag
forwardsec Sets the SASL_SEC_FORWARD_SECRECY flag
passcred Sets the SASL_SEC_PASS_CREDENTIALS flag
minssf=N Sets minssf to the integer value N maxssf=N Sets maxssf to the integer value N maxbufsize=N Sets maxbufsize to the integer value NLDAP_OPT_X_SASL_SSF_MIN
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.LDAP_OPT_X_SASL_SSF_MAX
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.LDAP_OPT_X_SASL_MAXBUFSIZE
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.RETURN VALUES
The ldap_set_option() and ldap_get_option() functions
return:LDAP_SUCCESS If successful
SunOS 5.11 Last change: 15 Jan 2004 6
LDAP Library Functions ldap_get_option(3LDAP)
-1 If unsuccessful
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Interface Stability | Committed ||_____________________________|_____________________________|
| MT-Level | Safe |
|_____________________________|_____________________________|
SEE ALSO
ldap_init(3LDAP), sasl_setprop(3SASL), attributes(5)
NOTES 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.SunOS 5.11 Last change: 15 Jan 2004 7