#include <ldap.h>
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_conf_save(
char *filename,
unsigned long ttl,
LDAPServerInfo *server_info_listp));
|
Theldap_server_conf_save() API is used to store server information into local configuration. The format for specifying the server information is identical to the format returned from the locator API.
The application that writes information into the configuration file can specify an optional time-to-live for the information stored in the file. When an application uses the locator API to access DNS server information, the configuration file is considered to be stale if:
<date/time_file_last_updated + ttl> current_date/time
If the application uses the default behavior for using the configuration file, it will bypass a stale configuration file and attempt to find all needed information from DNS. Otherwise, the ttl should be set to zero (indefinite ttl), in which case the information is considered to be good indefinitely.
Setting a non-zero ttl is most useful when an application (or other mechanism) exists for refreshing the local configuration file on a periodic basis.
Note that sub-second response time can be expected in many cases, when using UDP to query DNS. Since most applications will get the server information during initialization, repetitive invocation of the locator API is usually unnecessary.
By default, the configuration file is stored at /QIBM/UserData/OS400/DirSrv/ldap_server_info.conf
Object Authorities
The caller must have Execute (*X) authority to each directory in the path
name preceding the name of the configuration file.
The caller must have write (*W) authority to the configuration file.
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:
When the ldap_server_locate() API is used to access the configuration file with search_source set to LDAP_LSI_CONF_ONLY, and the configuration file has not been refreshed in ttl minutes, then LDAP_TIMEOUT error code is returned.
When the ldap_server_locate() API is used to access the configuration file with search_source set to LDAP_LSI_CONF_DNS, and the configuration file has not been refreshed in ttl minutes, then network DNS is accessed to obtain server information.
If ldap_server_conf_save() 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_conf_save API.
ldap_server_locate() -- Locate Suitable LDAP Servers.
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] |