+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
#include "portable.h"
#include <stdio.h>
result = (char **) realloc( result,
sizeof(char *) * (num + 1) );
- result[num++] = (char *) ldap_strdup( buf );
+ result[num++] = (char *) strdup( buf );
}
if ( result == (char **) 0 )
return( NULL );
getline( buf, sizeof(buf), stdin, prompt2 );
if ( buf[0] == '\0' )
break;
- tmp.mod_type = ldap_strdup( buf );
+ tmp.mod_type = strdup( buf );
tmp.mod_values = get_list( prompt3 );
case 'd':
#ifdef LDAP_DEBUG
ldap_debug = atoi( optarg );
+#ifdef LBER_DEBUG
if ( ldap_debug & LDAP_DEBUG_PACKETS ) {
lber_debug = ldap_debug;
}
+#endif
#else
printf( "Compile with -DLDAP_DEBUG for debugging\n" );
#endif
break;
case 't': /* copy ber's to given file */
- copyfname = ldap_strdup( optarg );
+ copyfname = strdup( optarg );
copyoptions = LBER_TO_FILE;
break;
case 'T': /* only output ber's to given file */
- copyfname = ldap_strdup( optarg );
+ copyfname = strdup( optarg );
copyoptions = (LBER_TO_FILE | LBER_TO_FILE_ONLY);
break;
#ifdef LDAP_DEBUG
getline( line, sizeof(line), stdin, "debug level? " );
ldap_debug = atoi( line );
+#ifdef LBER_DEBUG
if ( ldap_debug & LDAP_DEBUG_PACKETS ) {
lber_debug = ldap_debug;
}
+#endif
#else
printf( "Compile with -DLDAP_DEBUG for debugging\n" );
#endif
static void
print_search_entry( LDAP *ld, LDAPMessage *res )
{
- BerElement *ber;
- char *a, *dn, *ufn;
- struct berval **vals;
- int i;
LDAPMessage *e;
for ( e = ldap_first_entry( ld, res ); e != NULLMSG;
- e = ldap_next_entry( ld, e ) ) {
+ e = ldap_next_entry( ld, e ) )
+ {
+ BerElement *ber = NULL;
+ char *a, *dn, *ufn;
+
if ( e->lm_msgtype == LDAP_RES_SEARCH_RESULT )
break;
free( ufn );
for ( a = ldap_first_attribute( ld, e, &ber ); a != NULL;
- a = ldap_next_attribute( ld, e, ber ) ) {
+ a = ldap_next_attribute( ld, e, ber ) )
+ {
+ struct berval **vals;
+
printf( "\t\tATTR: %s\n", a );
if ( (vals = ldap_get_values_len( ld, e, a ))
== NULL ) {
printf( "\t\t\t(no values)\n" );
} else {
+ int i;
for ( i = 0; vals[i] != NULL; i++ ) {
int j, nonascii;
ber_bvecfree( vals );
}
}
+
+ if(ber != NULL) {
+ ber_free( ber, 0 );
+ }
}
if ( res->lm_msgtype == LDAP_RES_SEARCH_RESULT