summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-10-05 13:35:30 -0700
committerslioch <slioch@eng-140.vyatta.com>2009-10-05 13:35:30 -0700
commit6e318082cb9cbc01924159a051ae67feac20dea5 (patch)
tree70b1b3c9c001a02e1d25167b6d69c098e69c95f5
parent9a5213be7829fa69a100ddb2a61ebfa020577fbd (diff)
downloadvyatta-cfg-6e318082cb9cbc01924159a051ae67feac20dea5.tar.gz
vyatta-cfg-6e318082cb9cbc01924159a051ae67feac20dea5.zip
escape value slash in leaf value--followon fix to suppression of leaf value with slash in
jenner.
-rw-r--r--src/common/unionfs.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/common/unionfs.c b/src/common/unionfs.c
index 3f42e5b..6642c05 100644
--- a/src/common/unionfs.c
+++ b/src/common/unionfs.c
@@ -1034,15 +1034,23 @@ dlist_test_func(GQuark key_id,gpointer data,gpointer user_data)
//g_node_insert(node, -1, new_node);
insert_sibling_in_order(node,new_node);
new_vn->_config._def = vn->_config._def;
- // strcat(new_vn->_data._path,"/value");
}
else {
new_vn = vn;
- // strcat(new_vn->_data._path,"/");
strcat(new_vn->_data._path,"/value:");
if (vn_parent->_config._def.multi == FALSE) {
char *tmp = (char*)g_quark_to_string(key_id);
- if (strchr(tmp,'/') == NULL) {
+ char *slash = strchr(tmp,'/');
+ if (slash == NULL) {
+ strcat(new_vn->_data._path,tmp);
+ }
+ else {
+ do { //escape '/' to %2F
+ strncat(new_vn->_data._path,tmp,slash - tmp);
+ strncat(new_vn->_data._path,"%2F",3);
+ ++slash;
+ tmp = slash;
+ } while ((slash = strchr(slash,'/')) != NULL);
strcat(new_vn->_data._path,tmp);
}
}