OpenLDAP Change Log
+Changes included in OpenLDAP 1.1.x
+ CVS Tag: OPENLDAP_REL_ENG_1_1
+ Fixed misc. overlapping strcpy bugs
+ Fixed misc. memory leaks
+
Changes included in OpenLDAP 1.1.1
CVS Tag: OPENLDAP_REL_ENG_1_1_1
Updated INSTALL, README, hints, and devel documents.
rbuf = NULL;
} else {
if ( *(p-1) == '\\' ) { /* lines ending in '\' are continued */
- strcpy( p - 1, p );
+ SAFEMEMCPY( p - 1, p, strlen( p ) + 1 );
rbuf = p;
continue;
}
timestr[ strlen( timestr ) - 1 ] = zone; /* replace trailing newline */
if ( dateonly ) {
- strcpy( timestr + 11, timestr + 20 );
+ SAFEMEMCPY( timestr + 11, timestr + 20, strlen( timestr + 20 ) + 1 );
}
Free ( ldtimestr );
if ( isprint( *p )) {
++p;
} else {
- strcpy( p, p + 1 );
+ SAFEMEMCPY( p, p + 1, strlen( p + 1 ) + 1 );
}
}
timestr[ strlen( timestr ) - 1 ] = zone; /* replace trailing newline */
if ( dateonly ) {
- strcpy( timestr + 11, timestr + 20 );
+ SAFEMEMCPY( timestr + 11, timestr + 20, strlen( timestr + 20 ) + 1 );
}
return( timestr );
if ( (quote = strrchr( ufncomp[ncomp], '"' )) != NULL )
*quote = '\0';
- strcpy( ufncomp[ncomp], ufncomp[ncomp] + 1 );
+ SAFEMEMCPY( ufncomp[ncomp], ufncomp[ncomp] + 1,
+ strlen( ufncomp[ncomp] + 1 ) + 1 );
}
if ( ncomp == 0 )
phase = 3;
if ( ber_scanf( ber, "{a{V}}", &type, &vals ) == LBER_ERROR ) {
send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR,
NULL, "decoding error" );
+ free( dn );
entry_free( e );
return;
}
0, 0 );
send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR, NULL,
NULL );
+ free( type );
+ free( dn );
entry_free( e );
return;
}
* appropriate one, or send a referral to our "referral server"
* if we don't hold it.
*/
- if ( (be = select_backend( dn )) == NULL ) {
+ be = select_backend( dn );
+ free( dn );
+ if ( be == NULL ) {
entry_free( e );
send_ldap_result( conn, op, LDAP_PARTIAL_RESULTS, NULL,
default_referral );
/* XXX delete from parent's id2children entry XXX */
pdn = dn_parent( be, dn );
p = dn2entry_r( be, pdn, &matched );
+ free( pdn );
if ( id2children_remove( be, p, e ) != 0 ) {
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "","" );
goto error_return;
if ( (pdn = dn_parent( be, dn )) != NULL ) {
/* get entry with reader lock */
if ( (e = dn2entry_r( be, pdn, matched )) != NULL ) {
+ if(*matched != NULL) {
+ free(*matched);
+ }
*matched = pdn;
/* free entry with reader lock */
cache_return_entry_r( &li->li_cache, e );
Filter *f
)
{
- IDList *result;
+ IDList *result, *tmp1, *tmp2;
Debug( LDAP_DEBUG_TRACE, "=> filter_candidates\n", 0, 0, 0 );
case LDAP_FILTER_NOT:
Debug( LDAP_DEBUG_FILTER, "\tNOT\n", 0, 0, 0 );
- result = idl_notin( be, idl_allids( be ), filter_candidates( be,
- f->f_not ) );
+ tmp1 = idl_allids( be );
+ tmp2 = filter_candidates( be, f->f_not );
+ result = idl_notin( be, tmp1, tmp2 );
+ idl_free( tmp2 );
+ idl_free( tmp1 );
break;
}
nrefs > 0 ? rbuf : NULL, nentries );
idl_free( candidates );
free( rbuf );
+
+ if( realBase != NULL) {
+ free( realBase );
+ }
return( 0 );
}
cache_return_entry_r( &li->li_cache, e );
idl_free( candidates );
free( rbuf );
+
+ if( realBase != NULL) {
+ free( realBase );
+ }
return( 0 );
}
}
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
- Filter *f;
+ Filter *f, **filterarg_ptr;
IDList *candidates;
Debug(LDAP_DEBUG_TRACE, "subtree_candidates: base: %s\n",
/* Patch to use normalized uppercase */
f->f_or->f_avvalue.bv_val = ch_strdup( "REFERRAL" );
f->f_or->f_avvalue.bv_len = strlen( "REFERRAL" );
- f->f_or->f_next = filter;
+ filterarg_ptr = &f->f_or->f_next;
+ *filterarg_ptr = filter;
filter = f;
if ( ! be_issuffix( be, base ) ) {
/* free up just the parts we allocated above */
if ( f != NULL ) {
- f->f_and->f_next = NULL;
+ *filterarg_ptr = NULL;
filter_free( f );
}
} else {
inquote = 1;
}
- strcpy( next, next + 1 );
+ SAFEMEMCPY( next, next + 1, strlen( next + 1 ) + 1 );
break;
case '\\':
- strcpy( next, next + 1 );
+ SAFEMEMCPY( next, next + 1, strlen( next + 1 ) + 1 );
break;
default:
s ? s : "NULL", 0, 0 );
e = (Entry *) ch_calloc( 1, sizeof(Entry) );
- /* initialize reader/writer lock */
- entry_rdwr_init(e);
/* check to see if there's an id included */
next = s;
Debug( LDAP_DEBUG_TRACE,
"<= str2entry NULL (missing newline after id)\n",
0, 0, 0 );
+ free( e );
return( NULL );
}
}
+ /* initialize reader/writer lock */
+ entry_rdwr_init(e);
+
/* dn + attributes */
e->e_attrs = NULL;
vals[0] = &bval;
!= 0 ) {
Debug( LDAP_DEBUG_TRACE,
"<= str2entry NULL (attr_merge)\n", 0, 0, 0 );
+ entry_free( e );
return( NULL );
}
nvals++;
/* log and send error */
Debug( LDAP_DEBUG_ANY,
"ber_get_int returns 0x%lx\n", tag, 0, 0 );
+ ber_free( &ber, 1 );
return 1;
}
* is provided ``as is'' without express or implied warranty.
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+
#include <quipu/commonarg.h>
#include <quipu/attrvalue.h>
#include <quipu/ds_error.h>
char *p;
if ( strncmp( s, "{CRYPT}", 7 ) == 0 ) {
- strcpy( s, s + 7 ); /* strip off "{CRYPT}" */
+ SAFEMEMCPY( s, s + 7, strlen( s + 7 ) + 1 ); /* strip off "{CRYPT}" */
for ( p = s; *p != '\0'; ++p) { /* "decrypt" each byte */
if ( *p != CRYPT_MASK ) {
line[0] = '\0';
}
}
+ if ( buf )
+ free( buf );
/*
* next, make the id2children index
} else {
inquote = 1;
}
- strcpy( next, next + 1 );
+ SAFEMEMCPY( next, next + 1, strlen( next + 1 ) + 1 );
break;
case '\\':
- strcpy( next, next + 1 );
+ SAFEMEMCPY( next, next + 1, strlen( next + 1 ) + 1 );
break;
default: