]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/unbind.c
Updates for MSVC 5.0. Fix libraries names to be ol{ber,dap,..}32.lib.
[openldap] / libraries / libldap / unbind.c
index 449026ce7e7b4be2b8217ef66e80e5c20638c86b..63237ba8e236a16ec555a228c1bd9fcdca5b4b50 100644 (file)
@@ -1,4 +1,8 @@
 /*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*  Portions
  *  Copyright (c) 1990 Regents of the University of Michigan.
  *  All rights reserved.
  *
@@ -7,10 +11,6 @@
 
 #include "portable.h"
 
-#ifndef lint 
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -18,8 +18,6 @@ static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of
 #include <ac/string.h>
 #include <ac/time.h>
 
-#include "lber.h"
-#include "ldap.h"
 #include "ldap-int.h"
 
 
@@ -37,12 +35,12 @@ ldap_ld_free( LDAP *ld, int close )
 {
        LDAPMessage     *lm, *next;
        int             err = LDAP_SUCCESS;
-#ifdef LDAP_REFERRALS
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
        LDAPRequest     *lr, *nextlr;
-#endif /* LDAP_REFERRALS */
+#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
 
        if ( ld->ld_sb.sb_naddr == 0 ) {
-#ifdef LDAP_REFERRALS
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
                /* free LDAP structure and outstanding requests/responses */
                for ( lr = ld->ld_requests; lr != NULL; lr = nextlr ) {
                        nextlr = lr->lr_next;
@@ -53,12 +51,12 @@ ldap_ld_free( LDAP *ld, int close )
                while ( ld->ld_conns != NULL ) {
                        ldap_free_connection( ld, ld->ld_conns, 1, close );
                }
-#else /* LDAP_REFERRALS */
+#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
                if ( close ) {
                        err = ldap_send_unbind( ld, &ld->ld_sb );
                        ldap_close_connection( &ld->ld_sb );
                }
-#endif /* LDAP_REFERRALS */
+#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
        } else {
                int     i;
 
@@ -88,23 +86,28 @@ ldap_ld_free( LDAP *ld, int close )
                free( ld->ld_ufnprefix );
        if ( ld->ld_filtd != NULL )
                ldap_getfilter_free( ld->ld_filtd );
-#ifndef LDAP_REFERRALS
+#ifndef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
        if ( ld->ld_sb.sb_ber.ber_buf != NULL )
                free( ld->ld_sb.sb_ber.ber_buf );
-#endif /* !LDAP_REFERRALS */
+#endif /* !LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
        if ( ld->ld_abandoned != NULL )
                free( ld->ld_abandoned );
 
-#ifdef LDAP_REFERRALS
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
        if ( ld->ld_selectinfo != NULL )
                ldap_free_select_info( ld->ld_selectinfo );
-#endif /* LDAP_REFERRALS */
+#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
 
-       if ( ld->ld_defhost != NULL )
-               free( ld->ld_defhost );
+       if ( ld->ld_options.ldo_defbase != NULL )
+               free( ld->ld_options.ldo_defbase );
+
+       if ( ld->ld_options.ldo_defhost != NULL )
+               free( ld->ld_options.ldo_defhost );
 
        free( (char *) ld );
 
+       WSACleanup();
+
        return( err );
 }