3 * Written by: Kurt Zeilenga
5 * This program is designed to test libldap API for conformance
6 * to draft-api-ldapext-ldap-c-api-01.txt.
17 main(int argc, char **argv)
23 #ifdef LDAP_API_INFO_VERSION
24 api.ldapai_info_version = LDAP_API_INFO_VERSION;
26 api.ldapai_info_version = 1;
29 printf("Compile time API Information\n");
30 printf(" API Info version: %d\n", api.ldapai_info_version);
31 printf(" API version: %d\n", LDAP_API_VERSION);
33 printf(" Protocol Version: %d\n", LDAP_VERSION);
35 printf(" Protocol Version: unknown\n");
37 #ifdef LDAP_VERSION_MIN
38 printf(" Protocol Min: %d\n", LDAP_VERSION_MIN);
40 printf(" Protocol Min: unknown\n");
42 #ifdef LDAP_VERSION_MAX
43 printf(" Protocol Max: %d\n", LDAP_VERSION_MAX);
45 printf(" Protocol Max: unknown\n");
47 #ifdef LDAP_VENDOR_NAME
48 printf(" Vendor Name: %s\n", LDAP_VENDOR_NAME);
50 printf(" Vendor Name: unknown\n");
52 #ifdef LDAP_VENDOR_VERSION
53 printf(" Vendor Version: %d\n", LDAP_VENDOR_VERSION);
55 printf(" Vendor Version: unknown\n");
58 if(ldap_get_option(NULL, LDAP_OPT_API_INFO, &api) != LDAP_SUCCESS) {
59 fprintf(stderr, "%s: ldap_get_option(api) failed\n", argv[0]);
63 printf("\nExecution time API Information\n");
64 printf(" API Info version: %d\n", api.ldapai_info_version);
66 if (api.ldapai_info_version != LDAP_API_INFO_VERSION) {
67 printf(" API INFO version mismatch!\n");
71 printf(" API Version: %d\n", api.ldapai_api_version);
72 printf(" Protocol Max: %d\n", api.ldapai_protocol_version);
74 if(api.ldapai_extensions == NULL) {
75 printf(" Extensions: none\n");
79 for(i=0; api.ldapai_extensions[i] != NULL; i++) /* empty */;
80 printf(" Extensions: %d\n", i);
81 for(i=0; api.ldapai_extensions[i] != NULL; i++) {
83 api.ldapai_extensions[i]);
87 printf(" Vendor Name: %s\n", api.ldapai_vendor_name);
88 printf(" Vendor Version: %d\n", api.ldapai_vendor_version);
90 printf("\nExecution time Default Options\n");
92 if(ldap_get_option(NULL, LDAP_OPT_DEREF, &ival) != LDAP_SUCCESS) {
93 fprintf(stderr, "%s: ldap_get_option(api) failed\n", argv[0]);
96 printf(" DEREF: %d\n", ival);
98 if(ldap_get_option(NULL, LDAP_OPT_SIZELIMIT, &ival) != LDAP_SUCCESS) {
99 fprintf(stderr, "%s: ldap_get_option(sizelimit) failed\n", argv[0]);
102 printf(" SIZELIMIT: %d\n", ival);
104 if(ldap_get_option(NULL, LDAP_OPT_TIMELIMIT, &ival) != LDAP_SUCCESS) {
105 fprintf(stderr, "%s: ldap_get_option(timelimit) failed\n", argv[0]);
108 printf(" TIMELIMIT: %d\n", ival);
110 if(ldap_get_option(NULL, LDAP_OPT_REFERRALS, &ival) != LDAP_SUCCESS) {
111 fprintf(stderr, "%s: ldap_get_option(referrals) failed\n", argv[0]);
114 printf(" REFERRALS: %s\n",
115 ival == (int) LDAP_OPT_ON ? "on" : "off");
117 if(ldap_get_option(NULL, LDAP_OPT_RESTART, &ival) != LDAP_SUCCESS) {
118 fprintf(stderr, "%s: ldap_get_option(restart) failed\n", argv[0]);
121 printf(" RESTART: %s\n",
122 ival == (int) LDAP_OPT_ON ? "on" : "off");
124 if(ldap_get_option(NULL, LDAP_OPT_PROTOCOL_VERSION, &ival) != LDAP_SUCCESS) {
125 fprintf(stderr, "%s: ldap_get_option(protocol version) failed\n", argv[0]);
128 printf(" PROTOCOL VERSION: %d\n", ival);
130 if(ldap_get_option(NULL, LDAP_OPT_HOST_NAME, &sval) != LDAP_SUCCESS) {
131 fprintf(stderr, "%s: ldap_get_option(host name) failed\n", argv[0]);
134 printf(" HOST NAME: %s\n", sval);