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++) {
84 api.ldapai_extensions[i]);
88 printf(" Vendor Name: %s\n", api.ldapai_vendor_name);
89 printf(" Vendor Version: %d\n", api.ldapai_vendor_version);
91 printf("\nExecution time Default Options\n");
93 if(ldap_get_option(NULL, LDAP_OPT_DEREF, &ival) != LDAP_SUCCESS) {
94 fprintf(stderr, "%s: ldap_get_option(api) failed\n", argv[0]);
97 printf(" DEREF: %d\n", ival);
99 if(ldap_get_option(NULL, LDAP_OPT_SIZELIMIT, &ival) != LDAP_SUCCESS) {
100 fprintf(stderr, "%s: ldap_get_option(sizelimit) failed\n", argv[0]);
103 printf(" SIZELIMIT: %d\n", ival);
105 if(ldap_get_option(NULL, LDAP_OPT_TIMELIMIT, &ival) != LDAP_SUCCESS) {
106 fprintf(stderr, "%s: ldap_get_option(timelimit) failed\n", argv[0]);
109 printf(" TIMELIMIT: %d\n", ival);
111 if(ldap_get_option(NULL, LDAP_OPT_REFERRALS, &ival) != LDAP_SUCCESS) {
112 fprintf(stderr, "%s: ldap_get_option(referrals) failed\n", argv[0]);
115 printf(" REFERRALS: %s\n",
116 ival == (int) LDAP_OPT_ON ? "on" : "off");
118 if(ldap_get_option(NULL, LDAP_OPT_RESTART, &ival) != LDAP_SUCCESS) {
119 fprintf(stderr, "%s: ldap_get_option(restart) failed\n", argv[0]);
122 printf(" RESTART: %s\n",
123 ival == (int) LDAP_OPT_ON ? "on" : "off");
125 if(ldap_get_option(NULL, LDAP_OPT_PROTOCOL_VERSION, &ival) != LDAP_SUCCESS) {
126 fprintf(stderr, "%s: ldap_get_option(protocol version) failed\n", argv[0]);
129 printf(" PROTOCOL VERSION: %d\n", ival);
131 if(ldap_get_option(NULL, LDAP_OPT_HOST_NAME, &sval) != LDAP_SUCCESS) {
132 fprintf(stderr, "%s: ldap_get_option(host name) failed\n", argv[0]);
135 printf(" HOST NAME: %s\n", sval);