X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Fapitest.c;h=62c1c1d6bec8bfe37e9ca3905dcf206ca8bdfd6d;hb=fff5d3de601a7a980cf7554e3f2e6f4d7ceda834;hp=0274f392800b7bb755c9436cf46487c51ab33c90;hpb=5176f4e3560743db5573f07328506e9c021c6d0b;p=openldap diff --git a/libraries/libldap/apitest.c b/libraries/libldap/apitest.c index 0274f39280..62c1c1d6be 100644 --- a/libraries/libldap/apitest.c +++ b/libraries/libldap/apitest.c @@ -1,5 +1,6 @@ +/* $OpenLDAP$ */ /* - * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved. + * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ /* @@ -12,11 +13,11 @@ */ #include "portable.h" +#include + #include -#include -#include "lber.h" -#include "ldap.h" +#include int main(int argc, char **argv) @@ -126,8 +127,8 @@ main(int argc, char **argv) #else printf(" %s\n", api.ldapai_extensions[i]); - #endif + ldap_memfree(api.ldapai_extensions[i]); } ldap_memfree(api.ldapai_extensions); @@ -162,15 +163,13 @@ main(int argc, char **argv) fprintf(stderr, "%s: ldap_get_option(referrals) failed\n", argv[0]); return EXIT_FAILURE; } - printf(" REFERRALS: %s\n", - ival == (int) LDAP_OPT_ON ? "on" : "off"); + printf(" REFERRALS: %s\n", ival ? "on" : "off"); if(ldap_get_option(NULL, LDAP_OPT_RESTART, &ival) != LDAP_SUCCESS) { fprintf(stderr, "%s: ldap_get_option(restart) failed\n", argv[0]); return EXIT_FAILURE; } - printf(" RESTART: %s\n", - ival == (int) LDAP_OPT_ON ? "on" : "off"); + printf(" RESTART: %s\n", ival ? "on" : "off"); if(ldap_get_option(NULL, LDAP_OPT_PROTOCOL_VERSION, &ival) != LDAP_SUCCESS) { fprintf(stderr, "%s: ldap_get_option(protocol version) failed\n", argv[0]); @@ -186,8 +185,50 @@ main(int argc, char **argv) printf(" HOST NAME: %s\n", sval); ldap_memfree(sval); } else { - printf(" HOST NAME: \n", sval); + puts(" HOST NAME: "); + } + +#if 0 + /* API tests */ + { /* bindless unbind */ + LDAP *ld; + int rc; + + ld = ldap_init( "localhost", 389 ); + if( ld == NULL ) { + perror("ldap_init"); + return EXIT_FAILURE; + } + + rc = ldap_unbind( ld ); + if( rc != LDAP_SUCCESS ) { + perror("ldap_unbind"); + return EXIT_FAILURE; + } + } + { /* bindless unbind */ + LDAP *ld; + int rc; + + ld = ldap_init( "localhost", 389 ); + if( ld == NULL ) { + perror("ldap_init"); + return EXIT_FAILURE; + } + + rc = ldap_abandon_ext( ld, 0, NULL, NULL ); + if( rc != LDAP_SERVER_DOWN ) { + ldap_perror( ld, "ldap_abandon"); + return EXIT_FAILURE; + } + + rc = ldap_unbind( ld ); + if( rc != LDAP_SUCCESS ) { + perror("ldap_unbind"); + return EXIT_FAILURE; + } } +#endif return EXIT_SUCCESS; }