]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1843] half-related cleanup; return copies of spec parts
authorJelte Jansen <jelte@isc.org>
Wed, 18 Apr 2012 22:31:19 +0000 (00:31 +0200)
committerJelte Jansen <jelte@isc.org>
Wed, 18 Apr 2012 22:31:19 +0000 (00:31 +0200)
so that if they have nested default values, which may be set to 'local', and modified later, the original isn't changed. (technically it should be enough to do the copy when setting, but it's safer to copy them entirely for now)

src/lib/python/isc/config/config_data.py

index 346585b458b4d7e8a882e58585ef9548b6b1c109..19d9673bc002911c844967b8a3d79a08fd525966 100644 (file)
@@ -23,6 +23,7 @@ two through the classes in ccsession)
 import isc.cc.data
 import isc.config.module_spec
 import ast
+import copy
 
 class ConfigDataError(Exception): pass
 
@@ -210,7 +211,8 @@ def find_spec_part(element, identifier, strict_identifier = True):
         cur_el = _get_map_or_list(cur_el)
 
     cur_el = _find_spec_part_single(cur_el, id_parts[-1])
-    return cur_el
+    # Due to the raw datatypes we use, it is safer to return a deep copy here
+    return copy.deepcopy(cur_el)
 
 def spec_name_list(spec, prefix="", recurse=False):
     """Returns a full list of all possible item identifiers in the