diff options
author | Michael Larson <mike@ft1.vyatta.com> | 2009-10-05 13:59:14 -0700 |
---|---|---|
committer | Michael Larson <mike@ft1.vyatta.com> | 2009-10-05 13:59:14 -0700 |
commit | 6fb487a39a7fab3d568122caf4b1c1d9a17adad8 (patch) | |
tree | 70b1b3c9c001a02e1d25167b6d69c098e69c95f5 /src/common/unionfs.c | |
parent | 9a5213be7829fa69a100ddb2a61ebfa020577fbd (diff) | |
download | vyatta-cfg-6fb487a39a7fab3d568122caf4b1c1d9a17adad8.tar.gz vyatta-cfg-6fb487a39a7fab3d568122caf4b1c1d9a17adad8.zip |
escape value slash in leaf value--followon fix to suppression of leaf value with slash in
jenner.
Diffstat (limited to 'src/common/unionfs.c')
-rw-r--r-- | src/common/unionfs.c | 14 |
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); } } |