]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/getattr.c
Add lber_log_print support to libldap.
[openldap] / libraries / libldap / getattr.c
index 6e95b7d5f39161d36330079d2fb1ac5e0f8089ca..8e655da12efea0cb1aeb4a518ccc0f9f5b7780c2 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.
  *
 
 #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>
-#include <ctype.h>
 
+#include <ac/ctype.h>
 #include <ac/socket.h>
 #include <ac/string.h>
 #include <ac/time.h>
 
-#include "lber.h"
-#include "ldap.h"
 #include "ldap-int.h"
 
 char *
@@ -31,6 +29,7 @@ ldap_first_attribute( LDAP *ld, LDAPMessage *entry, BerElement **ber )
        Debug( LDAP_DEBUG_TRACE, "ldap_first_attribute\n", 0, 0, 0 );
 
        if ( (*ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
+               *ber = NULL;
                return( NULL );
        }
 
@@ -47,6 +46,7 @@ ldap_first_attribute( LDAP *ld, LDAPMessage *entry, BerElement **ber )
            == LBER_ERROR ) {
                ld->ld_errno = LDAP_DECODING_ERROR;
                ber_free( *ber, 0 );
+               *ber = NULL;
                return( NULL );
        }
 
@@ -66,7 +66,7 @@ ldap_next_attribute( LDAP *ld, LDAPMessage *entry, BerElement *ber )
        if ( ber_scanf( ber, "{sx}", ld->ld_attrbuffer, &len ) 
            == LBER_ERROR ) {
                ld->ld_errno = LDAP_DECODING_ERROR;
-               ber_free( ber, 0 );
+               /* ber_free( ber, 0 ); *//* don't free the BerElement */
                return( NULL );
        }