X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fad.c;h=c81422bda8030e4e95b1097259bc7b99bbdba286;hb=08fe5e7026a6ea7ab301f6ab9bd383b85f1e2149;hp=48b4b272194f6f6bd5f29bf092d229472b96651d;hpb=8050701f56da9637e2c1d79313734c9f9132420e;p=openldap diff --git a/servers/slapd/ad.c b/servers/slapd/ad.c index 48b4b27219..c81422bda8 100644 --- a/servers/slapd/ad.c +++ b/servers/slapd/ad.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2005 The OpenLDAP Foundation. + * Copyright 1998-2006 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -177,7 +177,7 @@ int slap_bv2ad( memset( &desc, 0, sizeof( desc ) ); desc.ad_cname = *bv; name = bv->bv_val; - options = strchr( name, ';' ); + options = ber_bvchr( bv, ';' ); if ( options != NULL && (unsigned) ( options - name ) < bv->bv_len ) { /* don't go past the end of the berval! */ desc.ad_cname.bv_len = options - name; @@ -1029,9 +1029,8 @@ anlist2attrs( AttributeName * anlist ) i = 0; while ( attrs && attrs[i] ) { if ( *attrs[i] == '@' ) { + ch_free( attrs[i] ); for ( j = i; attrs[j]; j++ ) { - if ( j == i ) - ch_free( attrs[i] ); attrs[j] = attrs[j+1]; } } else { @@ -1043,9 +1042,8 @@ anlist2attrs( AttributeName * anlist ) j = i + 1; while ( attrs && attrs[j] ) { if ( !strcmp( attrs[i], attrs[j] )) { + ch_free( attrs[j] ); for ( k = j; attrs && attrs[k]; k++ ) { - if ( k == j ) - ch_free( attrs[j] ); attrs[k] = attrs[k+1]; } } else {