X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Fapitest.c;h=9b893e2da9a7f32a5bdcaae4e43fe4433c9b0674;hb=de01a6e3d791d3458549d2ceeccf4d7e0477ff78;hp=94ba779400adfb3f8163fedee11d4d1ce9d943a9;hpb=2ae08eecad09b21737f6146bcea994f8f287648f;p=openldap diff --git a/libraries/libldap/apitest.c b/libraries/libldap/apitest.c index 94ba779400..9b893e2da9 100644 --- a/libraries/libldap/apitest.c +++ b/libraries/libldap/apitest.c @@ -1,14 +1,22 @@ -/* - * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved. - * COPYING RESTRICTIONS APPLY, see COPYRIGHT file - */ -/* - * OpenLDAP API Test - * Written by: Kurt Zeilenga +/* apitest.c -- OpenLDAP API Test Program */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software . + * + * Copyright 1998-2007 The OpenLDAP Foundation. + * Portions Copyright 1998-2003 Kurt D. Zeilenga. + * All rights reserved. * - * This program is designed to test API features of implementations - * of the IETF draft specifications. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. * + * A copy of this license is available in the file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * . + */ +/* ACKNOWLEDGEMENTS: + * This program was orignally developed by Kurt D. Zeilenga for inclusion in + * OpenLDAP Software. */ #include "portable.h" @@ -187,5 +195,47 @@ main(int argc, char **argv) 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; }