mirror of
https://github.com/samba-team/samba.git
synced 2025-12-14 20:23:54 +03:00
Add level field when converting FORM_1 to dict.
More error checking when converting from dict to FORM_1.
This commit is contained in:
@@ -47,11 +47,27 @@ struct pyconv py_FORM_1[] = {
|
||||
BOOL py_from_FORM_1(PyObject **dict, FORM_1 *form)
|
||||
{
|
||||
*dict = from_struct(form, py_FORM_1);
|
||||
|
||||
PyDict_SetItemString(*dict, "level", PyInt_FromLong(1));
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
BOOL py_to_FORM(FORM *form, PyObject *dict)
|
||||
{
|
||||
to_struct(form, dict, py_FORM);
|
||||
PyObject *obj;
|
||||
char *name;
|
||||
|
||||
if (!to_struct(form, dict, py_FORM))
|
||||
return False;
|
||||
|
||||
if (!(obj = PyDict_GetItemString(dict, "name")) ||
|
||||
!PyString_Check(obj))
|
||||
return False;
|
||||
|
||||
name = PyString_AsString(obj);
|
||||
|
||||
init_unistr2(&form->name, name, strlen(name) + 1);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user