From: Pierangelo Masarati Date: Sat, 11 Aug 2007 09:28:33 +0000 (+0000) Subject: fix previous commit (crash if no rewrite but just mapping is present) X-Git-Tag: OPENLDAP_REL_ENG_2_4_MP~240 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d354844cf9d7d0b9f20a6b4f67ec2f1091bb9a29;p=openldap fix previous commit (crash if no rewrite but just mapping is present) --- diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index e8cd82073f..82a15e00de 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -1572,10 +1572,10 @@ enum { /* rewrite */ RWM_CF_REWRITE = 1, RWM_CF_SUFFIXMASSAGE, - RWM_CF_T_F_SUPPORT, /* map */ RWM_CF_MAP, + RWM_CF_T_F_SUPPORT, RWM_CF_NORMALIZE_MAPPED, RWM_CF_LAST @@ -1706,8 +1706,15 @@ rwm_cf_gen( ConfigArgs *c ) switch ( c->type ) { case RWM_CF_REWRITE: - slap_rewrite_unparse( rwmap->rwm_bva_rewrite, &c->rvalue_vals ); - if ( !c->rvalue_vals ) rc = 1; + if ( rwmap->rwm_bva_rewrite == NULL ) { + rc = 1; + + } else { + slap_rewrite_unparse( rwmap->rwm_bva_rewrite, &c->rvalue_vals ); + if ( !c->rvalue_vals ) { + rc = 1; + } + } break; case RWM_CF_T_F_SUPPORT: @@ -1749,8 +1756,9 @@ rwm_cf_gen( ConfigArgs *c ) /* single modification is not allowed */ rc = 1; - } else { + } else if ( rwmap->rwm_rw != NULL ) { rewrite_info_delete( &rwmap->rwm_rw ); + assert( rwmap->rwm_rw == NULL ); ber_bvarray_free( rwmap->rwm_bva_rewrite ); rwmap->rwm_bva_rewrite = NULL; @@ -1895,12 +1903,6 @@ rwm_cf_gen( ConfigArgs *c ) return rc; } - - - - - - static int rwm_db_init( BackendDB *be,