#include <ldap.h>
typedef struct LDAP_Server_Request {
int search_source; /* Source for server info */
#define LDAP_LSI_CONF_DNS 0 /* Config first, then DNS (def)*/
#define LDAP_LSI_CONF_ONLY 1 /* Local Config file only */
#define LDAP_LSI_DNS_ONLY 2 /* DNS only */
char *conf_filename; /* pathname of config file */
int reserved; /* Reserved, set to zero */
char *service_key; /* Service string */
char *enetwork_domain; /* eNetwork domain (eDomain) */
char **name_servers; /* Array of name server addrs */
char **dns_domains; /* Array of DNS domains */
int connection_type; /* Connection type */
#define LDAP_LSI_UDP_TCP 0 /* Use UDP, then TCP (default)*/
#define LDAP_LSI_UDP 1 /* Use UDP only */
#define LDAP_LSI_TCP 2 /* Use TCP only */
int connection_timeout; /* connect timeout (seconds) */
char *DN_filter; /* DN suffix filter */
unsigned char reserved2[64]; /* reserved fields, set to 0 */
} LDAPServerRequest;
typedef struct LDAP_Server_Info {
char *lsi_host; /* LDAP server's hostname */
unsigned short lsi_port; /* LDAP port */
char *lsi_suffix; /* Server's LDAP suffix */
char *lsi_query_key; /* service_key[.edomain]*/
char *lsi_dns_domain; /* Publishing DNS domain */
int lsi_replica_type;/* master or replica */
#define LDAP_LSI_MASTER 1 /* LDAP Master */
#define LDAP_LSI_REPLICA 2 /* LDAP Replica */
int lsi_sec_type; /* SSL or non-SSL */
#define LDAP_LSI_NOSSL 1 /* Non-SSL */
#define LDAP_LSI_SSL 2 /* Secure Server */
unsigned short lsi_priority; /* Server priority */
unsigned short lsi_weight; /* load balancing weight */
char *lsi_vendor_info; /* vendor information */
char *lsi_info; /* LDAP Info string */
struct LDAP_Server_Info *prev; /* linked list previous ptr */
struct LDAP_Server_Info *next; /* linked list next ptr */
} LDAPServerInfo;
int ldap_server_locate (
LDAPServerRequest *server_request,
LDAPServerInfo **server_info_listpp);
|
The ldap_server_locate() API is used to locate one or more suitable LDAP servers. In general, an application will use the ldap_server_locate() API as follows:
No OS/400 authority is required. All authority checking is done by the LDAP server.
If enetwork_domain is set to zero, the following steps are taken to determine the enetwork_domain:
Note that domain names supplied here can take the following forms:
With respect to providing a domain name, these are equivalent. Both result in a domain name of "austin.ibm.com". This approach makes it easier for an application to locate LDAP servers to which it needs to bind (based on a user name space mapped into the DNS name space).
DNS DOMAINS and CONFIGURATION FILE
The local configuration file may contain server information for combinations of the following:
When the application sets search_source to LDAP_LSI_CONFIG_DNS, the ldap_server_locate() API will attempt to find server information in the configuration file for the designated service key, eNetwork domain and DNS domain(s).
If the configuration file does not contain information that matches this criteria, the locator API will search DNS, using the specified service key, eNetwork domain and DNS domain(s). For example:
In other words, the resulting list of servers will contain all the austin.ibm.com servers first, followed by the raleigh.ibm.com servers, followed by the miami.ibm.com servers. Within each grouping of servers (by DNS domain), the entries are sorted by priority and weight.
If set to zero, the default is to use UDP first (then TCP).
UDP is the preferred connection type, and typically performs well. You might want to consider using TCP/IP if:
Upon successful return from ldap_server_locate(), server_info_listpp points to a linked list of LDAPServerInfo structures. The LDAPServerInfo structure (as defined above), contains the following fields:
If ldap_server_locate() is not successful, an error code will be returned. See LDAP Client API Error Conditions for possible LDAP error code values.
The following message may be set from this function.
CPF3CF2 E Error(s) occurred during running of ldap_server_locate API.
ldap_server_conf_save() -- Store Server Information into Local Configuration.
ldap_server_free_list() -- Free the List of LDAP Servers.
|
Top
| LDAP APIs List APIs by category |
| [Information Center Home Page | Feedback ] | [Legal | AS/400 Glossary] |