From f5100665e34b18817e545063b7ca49f79a15b6d6 Mon Sep 17 00:00:00 2001 From: Ryan Tandy Date: Sun, 6 Sep 2015 21:09:51 -0700 Subject: [PATCH] ITS#7964 avoid double-unescaping rewrite rules config_fp_parse_line processes backslash escapes. When existing rewrite rules were reloaded while inserting a new rule, this caused backslashes to be lost from every rule except the most recently inserted one. config_parse_ldif performs similar splitting, but leaves backslashes alone. --- servers/slapd/config.c | 2 +- servers/slapd/config.h | 1 + servers/slapd/overlays/rwm.c | 18 ++++++++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 8345dcfd30..4000a9e44f 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -628,7 +628,7 @@ strtok_quote_ldif( char **line ) return beg; } -static void +void config_parse_ldif( ConfigArgs *c ) { char *next; diff --git a/servers/slapd/config.h b/servers/slapd/config.h index 0beb62976b..ce7c953b8d 100644 --- a/servers/slapd/config.h +++ b/servers/slapd/config.h @@ -196,6 +196,7 @@ int config_add_vals(ConfigTable *ct, ConfigArgs *c); void init_config_argv( ConfigArgs *c ); int init_config_attrs(ConfigTable *ct); int init_config_ocs( ConfigOCs *ocs ); +void config_parse_ldif( ConfigArgs *c ); int config_parse_vals(ConfigTable *ct, ConfigArgs *c, int valx); int config_parse_add(ConfigTable *ct, ConfigArgs *c, int valx); int read_config_file(const char *fname, int depth, ConfigArgs *cf, diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index 56004e2af8..da254b69c2 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -2179,7 +2179,8 @@ rwm_cf_gen( ConfigArgs *c ) ca.line = rwmap->rwm_bva_rewrite[ i ].bv_val; ca.argc = 0; - config_fp_parse_line( &ca ); + init_config_argv( &ca ); + config_parse_ldif( &ca ); argv0 = ca.argv[ 0 ]; ca.argv[ 0 ] += STRLENOF( "rwm-" ); @@ -2248,7 +2249,8 @@ rwm_cf_gen( ConfigArgs *c ) ca.line = rwmap->rwm_bva_map[ cnt ].bv_val; ca.argc = 0; - config_fp_parse_line( &ca ); + init_config_argv( &ca ); + config_parse_ldif( &ca ); argv[1] = ca.argv[0]; argv[2] = ca.argv[1]; @@ -2342,7 +2344,8 @@ rwm_cf_gen( ConfigArgs *c ) ca.line = rwmap->rwm_bva_rewrite[ i ].bv_val; ca.argc = 0; - config_fp_parse_line( &ca ); + init_config_argv( &ca ); + config_parse_ldif( &ca ); argv0 = ca.argv[ 0 ]; ca.argv[ 0 ] += STRLENOF( "rwm-" ); @@ -2392,7 +2395,8 @@ rwm_cf_gen( ConfigArgs *c ) ca.line = rwmap->rwm_bva_rewrite[ i ].bv_val; ca.argc = 0; - config_fp_parse_line( &ca ); + init_config_argv( &ca ); + config_parse_ldif( &ca ); argv0 = ca.argv[ 0 ]; ca.argv[ 0 ] += STRLENOF( "rwm-" ); @@ -2491,7 +2495,8 @@ rwm_cf_gen( ConfigArgs *c ) ca.line = rwmap->rwm_bva_map[ cnt ].bv_val; ca.argc = 0; - config_fp_parse_line( &ca ); + init_config_argv( &ca ); + config_parse_ldif( &ca ); argv[1] = ca.argv[0]; argv[2] = ca.argv[1]; @@ -2524,7 +2529,8 @@ rwm_cf_gen( ConfigArgs *c ) ca.line = rwmap->rwm_bva_map[ cnt ].bv_val; ca.argc = 0; - config_fp_parse_line( &ca ); + init_config_argv( &ca ); + config_parse_ldif( &ca ); argv[1] = ca.argv[0]; argv[2] = ca.argv[1]; -- 2.39.5