diff options
author | Tim Potter <tpot@samba.org> | 2002-05-20 08:09:19 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-05-20 08:09:19 +0000 |
commit | ac15442579848f145dbdce6d51207321c4150c25 (patch) | |
tree | f834e1600255a8634cdcd89bf003358c1f0deb2c | |
parent | 274679d8ce33aaf664ffaaa6834d506f7b196fc6 (diff) | |
download | samba-ac15442579848f145dbdce6d51207321c4150c25.tar.gz samba-ac15442579848f145dbdce6d51207321c4150c25.tar.xz samba-ac15442579848f145dbdce6d51207321c4150c25.zip |
Remove level and name fields from dictionary copy in py_to_FORM()
-rw-r--r-- | source/python/py_spoolss_forms_conv.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/python/py_spoolss_forms_conv.c b/source/python/py_spoolss_forms_conv.c index 604777adcd4..1b006cbf51b 100644 --- a/source/python/py_spoolss_forms_conv.c +++ b/source/python/py_spoolss_forms_conv.c @@ -55,16 +55,21 @@ BOOL py_from_FORM_1(PyObject **dict, FORM_1 *form) BOOL py_to_FORM(FORM *form, PyObject *dict) { - PyObject *obj; + PyObject *obj, *dict_copy = PyDict_Copy(dict); char *name; - if (!to_struct(form, dict, py_FORM)) - return False; - if (!(obj = PyDict_GetItemString(dict, "name")) || !PyString_Check(obj)) return False; + PyDict_DelItemString(dict_copy, "level"); + PyDict_DelItemString(dict_copy, "name"); + + if (!to_struct(form, dict_copy, py_FORM)) { + Py_DECREF(dict_copy); + return False; + } + name = PyString_AsString(obj); init_unistr2(&form->name, name, strlen(name) + 1); |