X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fcr.c;h=19c0bfa7cd4b8c1d1af6ba1a5dd4b0a0245519b6;hb=672f8ef3f39ed6008c1ff267847e32de59c5eeaf;hp=0dcf1484a8ab414642fff9655f6ceb51ae3464af;hpb=5d2ba11ad924cfe9be57d7d6a1e6a37e108bbe10;p=openldap diff --git a/servers/slapd/cr.c b/servers/slapd/cr.c index 0dcf1484a8..19c0bfa7cd 100644 --- a/servers/slapd/cr.c +++ b/servers/slapd/cr.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 @@ -127,8 +127,8 @@ cr_insert( cir->cir_name.bv_len = strlen( scr->scr_oid ); cir->cir_cr = scr; - assert( cir->cir_name.bv_val ); - assert( cir->cir_cr ); + assert( cir->cir_name.bv_val != NULL ); + assert( cir->cir_cr != NULL ); if ( avl_insert( &cr_index, (caddr_t) cir, cr_index_cmp, avl_dup_error ) ) @@ -150,8 +150,8 @@ cr_insert( cir->cir_name.bv_len = strlen( *names ); cir->cir_cr = scr; - assert( cir->cir_name.bv_val ); - assert( cir->cir_cr ); + assert( cir->cir_name.bv_val != NULL ); + assert( cir->cir_cr != NULL ); if ( avl_insert( &cr_index, (caddr_t) cir, cr_index_cmp, avl_dup_error ) ) @@ -372,38 +372,44 @@ cr_add( scr->scr_sclass = oc_find(cr->cr_oid); if ( !scr->scr_sclass ) { *err = cr->cr_oid; - return SLAP_SCHERR_CLASS_NOT_FOUND; + code = SLAP_SCHERR_CLASS_NOT_FOUND; + goto fail; } /* check object class usage */ if( scr->scr_sclass->soc_kind != LDAP_SCHEMA_STRUCTURAL ) { *err = cr->cr_oid; - return SLAP_SCHERR_CR_BAD_STRUCT; + code = SLAP_SCHERR_CR_BAD_STRUCT; + goto fail; } if( scr->scr_sclass->soc_flags & SLAP_OC_OPERATIONAL ) op++; code = cr_add_auxiliaries( scr, &op, err ); - if ( code != 0 ) return code; + if ( code != 0 ) goto fail; code = cr_create_required( scr, &op, err ); - if ( code != 0 ) return code; + if ( code != 0 ) goto fail; code = cr_create_allowed( scr, &op, err ); - if ( code != 0 ) return code; + if ( code != 0 ) goto fail; code = cr_create_precluded( scr, &op, err ); - if ( code != 0 ) return code; + if ( code != 0 ) goto fail; if( user && op ) { - return SLAP_SCHERR_CR_BAD_AUX; + code = SLAP_SCHERR_CR_BAD_AUX; + goto fail; } code = cr_insert(scr,err); if ( code == 0 && rscr ) *rscr = scr; return code; +fail: + ch_free( scr ); + return code; } void