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.
18 main(int argc, char **argv)
24 #ifdef LDAP_API_INFO_VERSION
25 api.ldapai_info_version = LDAP_API_INFO_VERSION;
27 api.ldapai_info_version = 1;
30 printf("Compile time API Information\n");
31 printf(" API Info version: %d\n", api.ldapai_info_version);
32 printf(" API version: %d\n", LDAP_API_VERSION);
34 printf(" Protocol Version: %d\n", LDAP_VERSION);
36 printf(" Protocol Version: unknown\n");
38 #ifdef LDAP_VERSION_MIN
39 printf(" Protocol Min: %d\n", LDAP_VERSION_MIN);
41 printf(" Protocol Min: unknown\n");
43 #ifdef LDAP_VERSION_MAX
44 printf(" Protocol Max: %d\n", LDAP_VERSION_MAX);
46 printf(" Protocol Max: unknown\n");
48 #ifdef LDAP_VENDOR_NAME
49 printf(" Vendor Name: %s\n", LDAP_VENDOR_NAME);
51 printf(" Vendor Name: unknown\n");
53 #ifdef LDAP_VENDOR_VERSION
54 printf(" Vendor Version: %d\n", LDAP_VENDOR_VERSION);
56 printf(" Vendor Version: unknown\n");
59 if(ldap_get_option(NULL, LDAP_OPT_API_INFO, &api) != LDAP_SUCCESS) {
60 fprintf(stderr, "%s: ldap_get_option(api) failed\n", argv[0]);
64 printf("\nExecution time API Information\n");
65 printf(" API Info version: %d\n", api.ldapai_info_version);
67 if (api.ldapai_info_version != LDAP_API_INFO_VERSION) {
68 printf(" API INFO version mismatch!\n");
72 printf(" API Version: %d\n", api.ldapai_api_version);
73 printf(" Protocol Max: %d\n", api.ldapai_protocol_version);
75 if(api.ldapai_extensions == NULL) {
76 printf(" Extensions: none\n");
80 for(i=0; api.ldapai_extensions[i] != NULL; i++) /* empty */;
81 printf(" Extensions: %d\n", i);
82 for(i=0; api.ldapai_extensions[i] != NULL; i++) {
83 #ifndef LDAP_API_FEATURE_INFO
85 api.ldapai_extensions[i]);
87 LDAPAPIFeatureInfo fi;
88 fi.ldapaif_name = api.ldapai_extensions[i];
89 fi.ldapaif_version = 0;
91 ldap_get_option(NULL, LDAP_OPT_API_FEATURE_INFO, &fi);
94 api.ldapai_extensions[i], fi.ldapaif_version);
99 printf(" Vendor Name: %s\n", api.ldapai_vendor_name);
100 printf(" Vendor Version: %d\n", api.ldapai_vendor_version);
102 printf("\nExecution time Default Options\n");
104 if(ldap_get_option(NULL, LDAP_OPT_DEREF, &ival) != LDAP_SUCCESS) {
105 fprintf(stderr, "%s: ldap_get_option(api) failed\n", argv[0]);
108 printf(" DEREF: %d\n", ival);
110 if(ldap_get_option(NULL, LDAP_OPT_SIZELIMIT, &ival) != LDAP_SUCCESS) {
111 fprintf(stderr, "%s: ldap_get_option(sizelimit) failed\n", argv[0]);
114 printf(" SIZELIMIT: %d\n", ival);
116 if(ldap_get_option(NULL, LDAP_OPT_TIMELIMIT, &ival) != LDAP_SUCCESS) {
117 fprintf(stderr, "%s: ldap_get_option(timelimit) failed\n", argv[0]);
120 printf(" TIMELIMIT: %d\n", ival);
122 if(ldap_get_option(NULL, LDAP_OPT_REFERRALS, &ival) != LDAP_SUCCESS) {
123 fprintf(stderr, "%s: ldap_get_option(referrals) failed\n", argv[0]);
126 printf(" REFERRALS: %s\n",
127 ival == (int) LDAP_OPT_ON ? "on" : "off");
129 if(ldap_get_option(NULL, LDAP_OPT_RESTART, &ival) != LDAP_SUCCESS) {
130 fprintf(stderr, "%s: ldap_get_option(restart) failed\n", argv[0]);
133 printf(" RESTART: %s\n",
134 ival == (int) LDAP_OPT_ON ? "on" : "off");
136 if(ldap_get_option(NULL, LDAP_OPT_PROTOCOL_VERSION, &ival) != LDAP_SUCCESS) {
137 fprintf(stderr, "%s: ldap_get_option(protocol version) failed\n", argv[0]);
140 printf(" PROTOCOL VERSION: %d\n", ival);
142 if(ldap_get_option(NULL, LDAP_OPT_HOST_NAME, &sval) != LDAP_SUCCESS) {
143 fprintf(stderr, "%s: ldap_get_option(host name) failed\n", argv[0]);
146 printf(" HOST NAME: %s\n", sval);