ldap_set_rebind_proc

Sets the process that is used to bind when following referrals.

Library:*ldapsdk.*
NDS Version:7.xx or higher
Platform:NLM, Windows (NT, 95, 98, 2000, XP, Vista 32-bit and 64-bit ), Linux (32-bit and 64-bit), Solaris, AIX, and HP-UX

Syntax

  #include <ldap.h>
  
  int ldap_set_rebind_proc (
     LDAP               *ld,
     LDAP_REBIND_PROC   *ldap_proc);
  
  

Parameters

ld

(IN) Points to the session handle. If this is NULL, the function sets the rebind process globally.

ldap_proc

(IN) Specifies the rebind function.

Return Values

0x00

LDAP_SUCCESS

Non-zero

Failure. For a complete list, see LDAP Return Codes.

Remarks

The ldap_set_rebind_proc function sets the process to use for binding when an operation returns a referral. The LDAP_OPT_REFERRALS option in the ld must be set to ON for the libraries to use the rebind function. Use the ldap_set_option function to set the value.

The rebind function has the following syntax.

  int LIBCALL rebind_function (
       LDAP        *ld, 
       const char  *url,
       int          request,
       ber_int_t    msgid)
  {
  /* the body must perform a synchronous bind */
  }
  

The ld parameter must be used by the application when binding to the referred server if the application wants the libraries to follow the referral.

The url parameter points to the URL referral string received from the LDAP server. The LDAP application can use the ldap_url_parse function to parse the string into its components.

The request parameter specifies the request operation that generated the referral. For possible values, see Section 6.8, Request Message Types.

The msgid parameter specifies the message ID of the request generating the referral.

The LDAP libraries set all the parameters when they call the rebind function. The application should not attempt to free either the ld or the url structures in the rebind function.

Your application must supply to the rebind function the required authentication information such as user name, password, and certificates. The rebind function must use a synchronous bind method.

  • If an anonymous bind is sufficient for your application, then you do not need to provide a rebind process. The LDAP libraries with the LDAP_OPT_REFERRALS option set to ON (default value) will automatically follow referrals using an anonymous bind.

  • If your application needs stronger authentication than an anonymous bind, you need to provide a rebind process for that authentication method. The bind method must be synchronous.

For sample code, see rebind.c.

See Also

ldap_set_option, ldap_url_parse