From d354844cf9d7d0b9f20a6b4f67ec2f1091bb9a29 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 11 Aug 2007 09:28:33 +0000 Subject: [PATCH] fix previous commit (crash if no rewrite but just mapping is present) --- servers/slapd/overlays/rwm.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) 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, -- 2.39.5