From bf7ca61cb4af4b156d954098ffa04cfa14a25641 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 27 May 2002 06:29:58 +0000 Subject: Honour return value of to_struct() when converting to Samba structures. (This used to be commit 1ef99e76632f6f6b866de491db8722c94f75a8c2) --- source3/python/py_spoolss_jobs_conv.c | 3 +-- source3/python/py_spoolss_printers_conv.c | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'source3') diff --git a/source3/python/py_spoolss_jobs_conv.c b/source3/python/py_spoolss_jobs_conv.c index 3481e96485..cb04ec6713 100644 --- a/source3/python/py_spoolss_jobs_conv.c +++ b/source3/python/py_spoolss_jobs_conv.c @@ -98,6 +98,5 @@ BOOL py_from_DOC_INFO_1(PyObject **dict, DOC_INFO_1 *info) BOOL py_to_DOC_INFO_1(DOC_INFO_1 *info, PyObject *dict) { - to_struct(info, dict, py_DOC_INFO_1); - return True; + return to_struct(info, dict, py_DOC_INFO_1); } diff --git a/source3/python/py_spoolss_printers_conv.c b/source3/python/py_spoolss_printers_conv.c index 676e21e99e..247db65b1e 100644 --- a/source3/python/py_spoolss_printers_conv.c +++ b/source3/python/py_spoolss_printers_conv.c @@ -163,7 +163,8 @@ BOOL py_to_DEVICEMODE(DEVICEMODE *devmode, PyObject *dict) { PyObject *obj; - to_struct(devmode, dict, py_DEVICEMODE); + if (!to_struct(devmode, dict, py_DEVICEMODE)) + return False; if (!(obj = PyDict_GetItemString(dict, "private"))) return False; @@ -203,7 +204,14 @@ BOOL py_from_PRINTER_INFO_1(PyObject **dict, PRINTER_INFO_1 *info) BOOL py_to_PRINTER_INFO_1(PRINTER_INFO_1 *info, PyObject *dict) { - return False; + PyObject *dict_copy = PyDict_Copy(dict); + BOOL result; + + PyDict_DelItemString(dict_copy, "level"); + result = to_struct(info, dict_copy, py_PRINTER_INFO_1); + + Py_DECREF(dict_copy); + return result; } /* @@ -232,7 +240,8 @@ BOOL py_to_PRINTER_INFO_2(PRINTER_INFO_2 *info, PyObject *dict, { PyObject *obj; - to_struct(info, dict, py_PRINTER_INFO_2); + if (!to_struct(info, dict, py_PRINTER_INFO_2)) + return False; if (!(obj = PyDict_GetItemString(dict, "security_descriptor"))) return False; @@ -274,7 +283,8 @@ BOOL py_to_PRINTER_INFO_3(PRINTER_INFO_3 *info, PyObject *dict, { PyObject *obj; - to_struct(info, dict, py_PRINTER_INFO_3); + if (!to_struct(info, dict, py_PRINTER_INFO_3)) + return False; if (!(obj = PyDict_GetItemString(dict, "security_descriptor"))) return False; -- cgit