mirror of
https://github.com/samba-team/samba.git
synced 2025-02-21 01:59:07 +03:00
Fix some argument checking bugs found by testsuite.
(This used to be commit 93306f581e3fa37d1aea67e93dc83d5a6d2fcb3f)
This commit is contained in:
parent
01063e8845
commit
0de32d4533
@ -217,10 +217,8 @@ BOOL py_to_PRINTER_INFO_1(PRINTER_INFO_1 *info, PyObject *dict)
|
|||||||
PyObject *obj, *dict_copy = PyDict_Copy(dict);
|
PyObject *obj, *dict_copy = PyDict_Copy(dict);
|
||||||
BOOL result = False;
|
BOOL result = False;
|
||||||
|
|
||||||
if (!(obj = PyDict_GetItemString(dict_copy, "level")))
|
if (!(obj = PyDict_GetItemString(dict_copy, "level")) ||
|
||||||
goto done;
|
!PyInt_Check(obj))
|
||||||
|
|
||||||
if (!PyInt_Check(obj))
|
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
PyDict_DelItemString(dict_copy, "level");
|
PyDict_DelItemString(dict_copy, "level");
|
||||||
@ -272,25 +270,25 @@ BOOL py_to_PRINTER_INFO_2(PRINTER_INFO_2 *info, PyObject *dict,
|
|||||||
PyObject *obj, *dict_copy = PyDict_Copy(dict);
|
PyObject *obj, *dict_copy = PyDict_Copy(dict);
|
||||||
BOOL result = False;
|
BOOL result = False;
|
||||||
|
|
||||||
/* Convert security descriptor */
|
/* Convert security descriptor - may be NULL */
|
||||||
|
|
||||||
if (!(obj = PyDict_GetItemString(dict_copy, "security_descriptor")))
|
info->secdesc = NULL;
|
||||||
goto done;
|
|
||||||
|
|
||||||
if (!PyDict_Check(obj))
|
if ((obj = PyDict_GetItemString(dict_copy, "security_descriptor"))) {
|
||||||
goto done;
|
|
||||||
|
|
||||||
if (!py_to_SECDESC(&info->secdesc, obj, mem_ctx))
|
if (!PyDict_Check(obj))
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
PyDict_DelItemString(dict_copy, "security_descriptor");
|
if (!py_to_SECDESC(&info->secdesc, obj, mem_ctx))
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
PyDict_DelItemString(dict_copy, "security_descriptor");
|
||||||
|
}
|
||||||
|
|
||||||
/* Convert device mode */
|
/* Convert device mode */
|
||||||
|
|
||||||
if (!(obj = PyDict_GetItemString(dict_copy, "device_mode")))
|
if (!(obj = PyDict_GetItemString(dict_copy, "device_mode"))
|
||||||
goto done;
|
|| !PyDict_Check(obj))
|
||||||
|
|
||||||
if (!PyDict_Check(obj))
|
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
info->devmode = talloc(mem_ctx, sizeof(DEVICEMODE));
|
info->devmode = talloc(mem_ctx, sizeof(DEVICEMODE));
|
||||||
@ -300,6 +298,14 @@ BOOL py_to_PRINTER_INFO_2(PRINTER_INFO_2 *info, PyObject *dict,
|
|||||||
|
|
||||||
PyDict_DelItemString(dict_copy, "device_mode");
|
PyDict_DelItemString(dict_copy, "device_mode");
|
||||||
|
|
||||||
|
/* Check info level */
|
||||||
|
|
||||||
|
if (!(obj = PyDict_GetItemString(dict_copy, "level")) ||
|
||||||
|
!PyInt_Check(obj))
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
PyDict_DelItemString(dict_copy, "level");
|
||||||
|
|
||||||
/* Convert remaining elements of dictionary */
|
/* Convert remaining elements of dictionary */
|
||||||
|
|
||||||
if (!to_struct(info, dict_copy, py_PRINTER_INFO_2))
|
if (!to_struct(info, dict_copy, py_PRINTER_INFO_2))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user