From 1a9ef3b4eab272b4a9e9381b77a29217f6053e1e Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Tue, 2 Feb 2010 14:43:21 +0000 Subject: [PATCH] ITS#6465, don't unparse empty uri string --- servers/slapd/config.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 55de738df3..056838f10b 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -1545,23 +1545,31 @@ slap_cf_aux_table_unparse( void *src, struct berval *bv, slap_cf_aux_table *tab0 break; case 'x': - *ptr++ = ' '; - ptr = lutil_strcopy( ptr, tab->key.bv_val ); - if ( tab->quote ) *ptr++ = '"'; - if ( tab->aux != NULL ) { - struct berval value; - slap_cf_aux_table_parse_x *func = (slap_cf_aux_table_parse_x *)tab->aux; - int rc; + { + char *saveptr=ptr; + *ptr++ = ' '; + ptr = lutil_strcopy( ptr, tab->key.bv_val ); + if ( tab->quote ) *ptr++ = '"'; + if ( tab->aux != NULL ) { + struct berval value; + slap_cf_aux_table_parse_x *func = (slap_cf_aux_table_parse_x *)tab->aux; + int rc; - value.bv_val = ptr; - value.bv_len = buf + sizeof( buf ) - ptr; + value.bv_val = ptr; + value.bv_len = buf + sizeof( buf ) - ptr; - rc = func( &value, (void *)((char *)src + tab->off), tab, "(unparse)", 1 ); - if ( rc == 0 ) { - ptr += value.bv_len; + rc = func( &value, (void *)((char *)src + tab->off), tab, "(unparse)", 1 ); + if ( rc == 0 ) { + if (value.bv_len) { + ptr += value.bv_len; + } else { + ptr = saveptr; + break; + } + } } + if ( tab->quote ) *ptr++ = '"'; } - if ( tab->quote ) *ptr++ = '"'; break; default: -- 2.39.5