Don't unparse empty uri string.
Resolves: #628726
Upstream ITS: #6465 (http://www.openldap.org/its/index.cgi/Software%20Bugs?id=6465)
diff -urpNP openldap-2.4.21/servers/slapd/config.c openldap-2.4.21.new/servers/slapd/config.c
--- openldap-2.4.21/servers/slapd/config.c 2009-12-12 07:18:52.000000000 +0100
+++ openldap-2.4.21.new/servers/slapd/config.c 2010-09-16 13:44:43.574647921 +0200
@@ -1458,23 +1458,31 @@ slap_cf_aux_table_unparse( void *src, st
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;
-
- 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;
+ {
+ 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;
+
+ 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: