00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "python/py_samr.h"
00022 #include "python/py_conv.h"
00023
00024
00025
00026
00027
00028 struct pyconv py_SAM_USER_INFO_16[] = {
00029 { "acb_info", PY_UINT32, offsetof(SAM_USER_INFO_16, acb_info) },
00030 { NULL }
00031 };
00032
00033 BOOL py_from_SAM_USER_INFO_16(PyObject **dict, SAM_USER_INFO_16 *info)
00034 {
00035 *dict = from_struct(info, py_SAM_USER_INFO_16);
00036 PyDict_SetItemString(*dict, "level", PyInt_FromLong(16));
00037 return True;
00038 }
00039
00040 BOOL py_to_SAM_USER_INFO_16(SAM_USER_INFO_16 *info, PyObject *dict)
00041 {
00042 PyObject *obj, *dict_copy = PyDict_Copy(dict);
00043 BOOL result = False;
00044
00045 if (!(obj = PyDict_GetItemString(dict_copy, "level")) ||
00046 !PyInt_Check(obj))
00047 goto done;
00048
00049 PyDict_DelItemString(dict_copy, "level");
00050
00051 if (!to_struct(info, dict_copy, py_SAM_USER_INFO_16))
00052 goto done;
00053
00054 result = True;
00055
00056 done:
00057 Py_DECREF(dict_copy);
00058 return result;
00059 }
00060
00061
00062
00063
00064
00065 struct pyconv py_SAM_USER_INFO_21[] = {
00066 { NULL }
00067 };
00068
00069 BOOL py_from_SAM_USER_INFO_21(PyObject **dict, SAM_USER_INFO_21 *info)
00070 {
00071 *dict = from_struct(info, py_SAM_USER_INFO_21);
00072 PyDict_SetItemString(*dict, "level", PyInt_FromLong(21));
00073 return True;
00074 }
00075
00076 BOOL py_to_SAM_USER_INFO_21(SAM_USER_INFO_21 *info, PyObject *dict)
00077 {
00078 PyObject *obj, *dict_copy = PyDict_Copy(dict);
00079 BOOL result = False;
00080
00081 if (!(obj = PyDict_GetItemString(dict_copy, "level")) ||
00082 !PyInt_Check(obj))
00083 goto done;
00084
00085 PyDict_DelItemString(dict_copy, "level");
00086
00087 if (!to_struct(info, dict_copy, py_SAM_USER_INFO_21))
00088 goto done;
00089
00090 result = True;
00091
00092 done:
00093 Py_DECREF(dict_copy);
00094 return result;
00095 }
00096
00097
00098
00099
00100
00101 BOOL py_from_acct_info(PyObject **array, struct acct_info *info, int num_accts)
00102 {
00103 int i;
00104
00105 *array = PyList_New(num_accts);
00106
00107 for (i = 0; i < num_accts; i++) {
00108 PyObject *obj;
00109
00110 obj = PyDict_New();
00111
00112 PyDict_SetItemString(
00113 obj, "name", PyString_FromString(info[i].acct_name));
00114
00115 PyDict_SetItemString(
00116 obj, "description",
00117 PyString_FromString(info[i].acct_desc));
00118
00119 PyDict_SetItemString(obj, "rid", PyInt_FromLong(info[i].rid));
00120
00121 PyList_SetItem(*array, i, obj);
00122 }
00123
00124 return True;
00125 }
00126
00127 BOOL py_to_acct_info(PRINTER_INFO_3 *info, PyObject *dict,
00128 TALLOC_CTX *mem_ctx)
00129 {
00130 return False;
00131 }