This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "python/py_spoolss.h"
PyDict_SetItemString(*dict, "private",
PyString_FromStringAndSize(
- devmode->private, devmode->driverextra));
+ devmode->dev_private, devmode->driverextra));
return True;
}
if (!PyString_Check(obj))
goto done;
- devmode->private = PyString_AsString(obj);
+ devmode->dev_private = PyString_AsString(obj);
devmode->driverextra = PyString_Size(obj);
PyDict_DelItemString(dict_copy, "private");
PyObject *obj, *dict_copy = PyDict_Copy(dict);
BOOL result = False;
- if (!(obj = PyDict_GetItemString(dict_copy, "level")))
- goto done;
-
- if (!PyInt_Check(obj))
+ if (!(obj = PyDict_GetItemString(dict_copy, "level")) ||
+ !PyInt_Check(obj))
goto done;
PyDict_DelItemString(dict_copy, "level");
PyObject *obj, *dict_copy = PyDict_Copy(dict);
BOOL result = False;
- /* Convert security descriptor */
+ /* Convert security descriptor - may be NULL */
- if (!(obj = PyDict_GetItemString(dict_copy, "security_descriptor")))
- goto done;
+ info->secdesc = NULL;
- if (!PyDict_Check(obj))
- goto done;
+ if ((obj = PyDict_GetItemString(dict_copy, "security_descriptor"))) {
- if (!py_to_SECDESC(&info->secdesc, obj, mem_ctx))
- goto done;
+ if (!PyDict_Check(obj))
+ goto done;
- PyDict_DelItemString(dict_copy, "security_descriptor");
+ if (!py_to_SECDESC(&info->secdesc, obj, mem_ctx))
+ goto done;
- /* Convert device mode */
+ PyDict_DelItemString(dict_copy, "security_descriptor");
+ }
- if (!(obj = PyDict_GetItemString(dict_copy, "device_mode")))
- goto done;
+ /* Convert device mode */
- if (!PyDict_Check(obj))
+ if (!(obj = PyDict_GetItemString(dict_copy, "device_mode"))
+ || !PyDict_Check(obj))
goto done;
- info->devmode = talloc(mem_ctx, sizeof(DEVICEMODE));
+ info->devmode = _talloc(mem_ctx, sizeof(DEVICEMODE));
if (!py_to_DEVICEMODE(info->devmode, obj))
goto done;
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 */
if (!to_struct(info, dict_copy, py_PRINTER_INFO_2))