]> git.sur5r.net Git - openldap/commitdiff
ITS#7964 avoid double-unescaping rewrite rules
authorRyan Tandy <ryan@nardis.ca>
Mon, 7 Sep 2015 04:09:51 +0000 (21:09 -0700)
committerRyan Tandy <ryan@nardis.ca>
Mon, 7 Sep 2015 04:34:03 +0000 (21:34 -0700)
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
servers/slapd/config.h
servers/slapd/overlays/rwm.c

index 8345dcfd30c6f4592e56ae36f4ea5cf513febf1c..4000a9e44fa8aa7b63777e0abf533f98e8cceeaa 100644 (file)
@@ -628,7 +628,7 @@ strtok_quote_ldif( char **line )
        return beg;
 }
 
-static void
+void
 config_parse_ldif( ConfigArgs *c )
 {
        char *next;
index 0beb62976bb293436f4f67f4102d4e215aedecf2..ce7c953b8d0bf93963d8f1fe41e89b2d88cd9536 100644 (file)
@@ -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,
index 56004e2af8e21fc98e01af1c951149591e851a52..da254b69c25ed3b3989465859d1b88944cc8e97f 100644 (file)
@@ -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];