source: trunk/server/source3/librpc/gen_ndr/py_security.c@ 751

Last change on this file since 751 was 751, checked in by Silvan Scherrer, 13 years ago

Samba Server: updated trunk to 3.6.9

File size: 90.5 KB
Line 
1
2/* Python wrapper functions auto-generated by pidl */
3#include <Python.h>
4#include "includes.h"
5#include <pytalloc.h>
6#include "librpc/rpc/pyrpc.h"
7#include "librpc/rpc/pyrpc_util.h"
8#include "librpc/gen_ndr/ndr_security.h"
9#include "librpc/gen_ndr/ndr_security_c.h"
10
11#include "librpc/gen_ndr/misc.h"
12staticforward PyTypeObject dom_sid_Type;
13staticforward PyTypeObject security_ace_object_Type;
14staticforward PyTypeObject security_ace_Type;
15staticforward PyTypeObject security_acl_Type;
16staticforward PyTypeObject security_descriptor_Type;
17staticforward PyTypeObject sec_desc_buf_Type;
18staticforward PyTypeObject security_token_Type;
19staticforward PyTypeObject security_unix_token_Type;
20staticforward PyTypeObject generic_mapping_Type;
21staticforward PyTypeObject standard_mapping_Type;
22
23void initsecurity(void);static PyTypeObject *Object_Type;
24static PyTypeObject *GUID_Type;
25#include "librpc/ndr/py_security.c"
26
27
28static PyObject *py_dom_sid_get_sid_rev_num(PyObject *obj, void *closure)
29{
30 struct dom_sid *object = (struct dom_sid *)py_talloc_get_ptr(obj);
31 PyObject *py_sid_rev_num;
32 py_sid_rev_num = PyInt_FromLong(object->sid_rev_num);
33 return py_sid_rev_num;
34}
35
36static int py_dom_sid_set_sid_rev_num(PyObject *py_obj, PyObject *value, void *closure)
37{
38 struct dom_sid *object = (struct dom_sid *)py_talloc_get_ptr(py_obj);
39 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
40 object->sid_rev_num = PyInt_AsLong(value);
41 return 0;
42}
43
44static PyObject *py_dom_sid_get_num_auths(PyObject *obj, void *closure)
45{
46 struct dom_sid *object = (struct dom_sid *)py_talloc_get_ptr(obj);
47 PyObject *py_num_auths;
48 py_num_auths = PyInt_FromLong(object->num_auths);
49 return py_num_auths;
50}
51
52static int py_dom_sid_set_num_auths(PyObject *py_obj, PyObject *value, void *closure)
53{
54 struct dom_sid *object = (struct dom_sid *)py_talloc_get_ptr(py_obj);
55 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
56 object->num_auths = PyInt_AsLong(value);
57 return 0;
58}
59
60static PyObject *py_dom_sid_get_id_auth(PyObject *obj, void *closure)
61{
62 struct dom_sid *object = (struct dom_sid *)py_talloc_get_ptr(obj);
63 PyObject *py_id_auth;
64 py_id_auth = PyList_New(6);
65 if (py_id_auth == NULL) {
66 return NULL;
67 }
68 {
69 int id_auth_cntr_0;
70 for (id_auth_cntr_0 = 0; id_auth_cntr_0 < 6; id_auth_cntr_0++) {
71 PyObject *py_id_auth_0;
72 py_id_auth_0 = PyInt_FromLong(object->id_auth[id_auth_cntr_0]);
73 PyList_SetItem(py_id_auth, id_auth_cntr_0, py_id_auth_0);
74 }
75 }
76 return py_id_auth;
77}
78
79static int py_dom_sid_set_id_auth(PyObject *py_obj, PyObject *value, void *closure)
80{
81 struct dom_sid *object = (struct dom_sid *)py_talloc_get_ptr(py_obj);
82 PY_CHECK_TYPE(&PyList_Type, value, return -1;);
83 {
84 int id_auth_cntr_0;
85 for (id_auth_cntr_0 = 0; id_auth_cntr_0 < PyList_GET_SIZE(value); id_auth_cntr_0++) {
86 PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, id_auth_cntr_0), return -1;);
87 object->id_auth[id_auth_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, id_auth_cntr_0));
88 }
89 }
90 return 0;
91}
92
93static PyObject *py_dom_sid_get_sub_auths(PyObject *obj, void *closure)
94{
95 struct dom_sid *object = (struct dom_sid *)py_talloc_get_ptr(obj);
96 PyObject *py_sub_auths;
97 py_sub_auths = PyList_New(15);
98 if (py_sub_auths == NULL) {
99 return NULL;
100 }
101 {
102 int sub_auths_cntr_0;
103 for (sub_auths_cntr_0 = 0; sub_auths_cntr_0 < 15; sub_auths_cntr_0++) {
104 PyObject *py_sub_auths_0;
105 py_sub_auths_0 = PyInt_FromLong(object->sub_auths[sub_auths_cntr_0]);
106 PyList_SetItem(py_sub_auths, sub_auths_cntr_0, py_sub_auths_0);
107 }
108 }
109 return py_sub_auths;
110}
111
112static int py_dom_sid_set_sub_auths(PyObject *py_obj, PyObject *value, void *closure)
113{
114 struct dom_sid *object = (struct dom_sid *)py_talloc_get_ptr(py_obj);
115 PY_CHECK_TYPE(&PyList_Type, value, return -1;);
116 {
117 int sub_auths_cntr_0;
118 for (sub_auths_cntr_0 = 0; sub_auths_cntr_0 < PyList_GET_SIZE(value); sub_auths_cntr_0++) {
119 PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, sub_auths_cntr_0), return -1;);
120 object->sub_auths[sub_auths_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, sub_auths_cntr_0));
121 }
122 }
123 return 0;
124}
125
126static PyGetSetDef py_dom_sid_getsetters[] = {
127 { discard_const_p(char, "sid_rev_num"), py_dom_sid_get_sid_rev_num, py_dom_sid_set_sid_rev_num },
128 { discard_const_p(char, "num_auths"), py_dom_sid_get_num_auths, py_dom_sid_set_num_auths },
129 { discard_const_p(char, "id_auth"), py_dom_sid_get_id_auth, py_dom_sid_set_id_auth },
130 { discard_const_p(char, "sub_auths"), py_dom_sid_get_sub_auths, py_dom_sid_set_sub_auths },
131 { NULL }
132};
133
134static PyObject *py_dom_sid_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
135{
136 return py_talloc_new(struct dom_sid, type);
137}
138
139static PyObject *py_dom_sid_ndr_pack(PyObject *py_obj)
140{
141 struct dom_sid *object = (struct dom_sid *)py_talloc_get_ptr(py_obj);
142 DATA_BLOB blob;
143 enum ndr_err_code err;
144 err = ndr_push_struct_blob(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_dom_sid);
145 if (err != NDR_ERR_SUCCESS) {
146 PyErr_SetNdrError(err);
147 return NULL;
148 }
149
150 return PyString_FromStringAndSize((char *)blob.data, blob.length);
151}
152
153static PyObject *py_dom_sid_ndr_unpack(PyObject *py_obj, PyObject *args)
154{
155 struct dom_sid *object = (struct dom_sid *)py_talloc_get_ptr(py_obj);
156 DATA_BLOB blob;
157 enum ndr_err_code err;
158 if (!PyArg_ParseTuple(args, "s#:__ndr_unpack__", &blob.data, &blob.length))
159 return NULL;
160
161 err = ndr_pull_struct_blob_all(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dom_sid);
162 if (err != NDR_ERR_SUCCESS) {
163 PyErr_SetNdrError(err);
164 return NULL;
165 }
166
167 Py_RETURN_NONE;
168}
169
170static PyObject *py_dom_sid_ndr_print(PyObject *py_obj)
171{
172 struct dom_sid *object = (struct dom_sid *)py_talloc_get_ptr(py_obj);
173 PyObject *ret;
174 char *retstr;
175
176 retstr = ndr_print_struct_string(py_talloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_dom_sid, "dom_sid", object);
177 ret = PyString_FromString(retstr);
178 talloc_free(retstr);
179
180 return ret;
181}
182
183static PyMethodDef py_dom_sid_methods[] = {
184 { "__ndr_pack__", (PyCFunction)py_dom_sid_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
185 { "__ndr_unpack__", (PyCFunction)py_dom_sid_ndr_unpack, METH_VARARGS, "S.ndr_unpack(class, blob) -> None\nNDR unpack" },
186 { "__ndr_print__", (PyCFunction)py_dom_sid_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
187 { NULL, NULL, 0, NULL }
188};
189
190
191static PyTypeObject dom_sid_Type = {
192 PyObject_HEAD_INIT(NULL) 0,
193 .tp_name = "security.dom_sid",
194 .tp_getset = py_dom_sid_getsetters,
195 .tp_methods = py_dom_sid_methods,
196 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
197 .tp_basicsize = sizeof(py_talloc_Object),
198 .tp_new = py_dom_sid_new,
199};
200
201PyObject *py_import_security_ace_object_type(TALLOC_CTX *mem_ctx, int level, union security_ace_object_type *in)
202{
203 PyObject *ret;
204
205 switch (level) {
206 case SEC_ACE_OBJECT_TYPE_PRESENT:
207 ret = py_talloc_reference_ex(GUID_Type, mem_ctx, &in->type);
208 return ret;
209
210 default:
211 ret = Py_None;
212 Py_INCREF(ret);
213 return ret;
214
215 }
216 PyErr_SetString(PyExc_TypeError, "unknown union level");
217 return NULL;
218}
219
220union security_ace_object_type *py_export_security_ace_object_type(TALLOC_CTX *mem_ctx, int level, PyObject *in)
221{
222 union security_ace_object_type *ret = talloc_zero(mem_ctx, union security_ace_object_type);
223 switch (level) {
224 case SEC_ACE_OBJECT_TYPE_PRESENT:
225 PY_CHECK_TYPE(GUID_Type, in, talloc_free(ret); return NULL;);
226 if (talloc_reference(mem_ctx, py_talloc_get_mem_ctx(in)) == NULL) {
227 PyErr_NoMemory();
228 talloc_free(ret); return NULL;
229 }
230 ret->type = *(struct GUID *)py_talloc_get_ptr(in);
231 break;
232
233 default:
234 break;
235
236 }
237
238 return ret;
239}
240
241PyObject *py_import_security_ace_object_inherited_type(TALLOC_CTX *mem_ctx, int level, union security_ace_object_inherited_type *in)
242{
243 PyObject *ret;
244
245 switch (level) {
246 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
247 ret = py_talloc_reference_ex(GUID_Type, mem_ctx, &in->inherited_type);
248 return ret;
249
250 default:
251 ret = Py_None;
252 Py_INCREF(ret);
253 return ret;
254
255 }
256 PyErr_SetString(PyExc_TypeError, "unknown union level");
257 return NULL;
258}
259
260union security_ace_object_inherited_type *py_export_security_ace_object_inherited_type(TALLOC_CTX *mem_ctx, int level, PyObject *in)
261{
262 union security_ace_object_inherited_type *ret = talloc_zero(mem_ctx, union security_ace_object_inherited_type);
263 switch (level) {
264 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
265 PY_CHECK_TYPE(GUID_Type, in, talloc_free(ret); return NULL;);
266 if (talloc_reference(mem_ctx, py_talloc_get_mem_ctx(in)) == NULL) {
267 PyErr_NoMemory();
268 talloc_free(ret); return NULL;
269 }
270 ret->inherited_type = *(struct GUID *)py_talloc_get_ptr(in);
271 break;
272
273 default:
274 break;
275
276 }
277
278 return ret;
279}
280
281
282static PyObject *py_security_ace_object_get_flags(PyObject *obj, void *closure)
283{
284 struct security_ace_object *object = (struct security_ace_object *)py_talloc_get_ptr(obj);
285 PyObject *py_flags;
286 py_flags = PyInt_FromLong(object->flags);
287 return py_flags;
288}
289
290static int py_security_ace_object_set_flags(PyObject *py_obj, PyObject *value, void *closure)
291{
292 struct security_ace_object *object = (struct security_ace_object *)py_talloc_get_ptr(py_obj);
293 if (PyLong_Check(value)) {
294 object->flags = PyLong_AsLongLong(value);
295 } else if (PyInt_Check(value)) {
296 object->flags = PyInt_AsLong(value);
297 } else {
298 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
299 PyInt_Type.tp_name, PyLong_Type.tp_name);
300 return -1;
301 }
302 return 0;
303}
304
305static PyObject *py_security_ace_object_get_type(PyObject *obj, void *closure)
306{
307 struct security_ace_object *object = (struct security_ace_object *)py_talloc_get_ptr(obj);
308 PyObject *py_type;
309 py_type = py_import_security_ace_object_type(py_talloc_get_mem_ctx(obj), object->flags & SEC_ACE_OBJECT_TYPE_PRESENT, &object->type);
310 if (py_type == NULL) {
311 return NULL;
312 }
313 return py_type;
314}
315
316static int py_security_ace_object_set_type(PyObject *py_obj, PyObject *value, void *closure)
317{
318 struct security_ace_object *object = (struct security_ace_object *)py_talloc_get_ptr(py_obj);
319 {
320 union security_ace_object_type *type_switch_0;
321 type_switch_0 = py_export_security_ace_object_type(py_talloc_get_mem_ctx(py_obj), object->flags & SEC_ACE_OBJECT_TYPE_PRESENT, value);
322 if (type_switch_0 == NULL) {
323 return -1;
324 }
325 object->type = *type_switch_0;
326 }
327 return 0;
328}
329
330static PyObject *py_security_ace_object_get_inherited_type(PyObject *obj, void *closure)
331{
332 struct security_ace_object *object = (struct security_ace_object *)py_talloc_get_ptr(obj);
333 PyObject *py_inherited_type;
334 py_inherited_type = py_import_security_ace_object_inherited_type(py_talloc_get_mem_ctx(obj), object->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT, &object->inherited_type);
335 if (py_inherited_type == NULL) {
336 return NULL;
337 }
338 return py_inherited_type;
339}
340
341static int py_security_ace_object_set_inherited_type(PyObject *py_obj, PyObject *value, void *closure)
342{
343 struct security_ace_object *object = (struct security_ace_object *)py_talloc_get_ptr(py_obj);
344 {
345 union security_ace_object_inherited_type *inherited_type_switch_0;
346 inherited_type_switch_0 = py_export_security_ace_object_inherited_type(py_talloc_get_mem_ctx(py_obj), object->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT, value);
347 if (inherited_type_switch_0 == NULL) {
348 return -1;
349 }
350 object->inherited_type = *inherited_type_switch_0;
351 }
352 return 0;
353}
354
355static PyGetSetDef py_security_ace_object_getsetters[] = {
356 { discard_const_p(char, "flags"), py_security_ace_object_get_flags, py_security_ace_object_set_flags },
357 { discard_const_p(char, "type"), py_security_ace_object_get_type, py_security_ace_object_set_type },
358 { discard_const_p(char, "inherited_type"), py_security_ace_object_get_inherited_type, py_security_ace_object_set_inherited_type },
359 { NULL }
360};
361
362static PyObject *py_security_ace_object_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
363{
364 return py_talloc_new(struct security_ace_object, type);
365}
366
367
368static PyTypeObject security_ace_object_Type = {
369 PyObject_HEAD_INIT(NULL) 0,
370 .tp_name = "security.ace_object",
371 .tp_getset = py_security_ace_object_getsetters,
372 .tp_methods = NULL,
373 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
374 .tp_basicsize = sizeof(py_talloc_Object),
375 .tp_new = py_security_ace_object_new,
376};
377
378PyObject *py_import_security_ace_object_ctr(TALLOC_CTX *mem_ctx, int level, union security_ace_object_ctr *in)
379{
380 PyObject *ret;
381
382 switch (level) {
383 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
384 ret = py_talloc_reference_ex(&security_ace_object_Type, mem_ctx, &in->object);
385 return ret;
386
387 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
388 ret = py_talloc_reference_ex(&security_ace_object_Type, mem_ctx, &in->object);
389 return ret;
390
391 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
392 ret = py_talloc_reference_ex(&security_ace_object_Type, mem_ctx, &in->object);
393 return ret;
394
395 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
396 ret = py_talloc_reference_ex(&security_ace_object_Type, mem_ctx, &in->object);
397 return ret;
398
399 default:
400 ret = Py_None;
401 Py_INCREF(ret);
402 return ret;
403
404 }
405 PyErr_SetString(PyExc_TypeError, "unknown union level");
406 return NULL;
407}
408
409union security_ace_object_ctr *py_export_security_ace_object_ctr(TALLOC_CTX *mem_ctx, int level, PyObject *in)
410{
411 union security_ace_object_ctr *ret = talloc_zero(mem_ctx, union security_ace_object_ctr);
412 switch (level) {
413 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
414 PY_CHECK_TYPE(&security_ace_object_Type, in, talloc_free(ret); return NULL;);
415 if (talloc_reference(mem_ctx, py_talloc_get_mem_ctx(in)) == NULL) {
416 PyErr_NoMemory();
417 talloc_free(ret); return NULL;
418 }
419 ret->object = *(struct security_ace_object *)py_talloc_get_ptr(in);
420 break;
421
422 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
423 PY_CHECK_TYPE(&security_ace_object_Type, in, talloc_free(ret); return NULL;);
424 if (talloc_reference(mem_ctx, py_talloc_get_mem_ctx(in)) == NULL) {
425 PyErr_NoMemory();
426 talloc_free(ret); return NULL;
427 }
428 ret->object = *(struct security_ace_object *)py_talloc_get_ptr(in);
429 break;
430
431 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
432 PY_CHECK_TYPE(&security_ace_object_Type, in, talloc_free(ret); return NULL;);
433 if (talloc_reference(mem_ctx, py_talloc_get_mem_ctx(in)) == NULL) {
434 PyErr_NoMemory();
435 talloc_free(ret); return NULL;
436 }
437 ret->object = *(struct security_ace_object *)py_talloc_get_ptr(in);
438 break;
439
440 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
441 PY_CHECK_TYPE(&security_ace_object_Type, in, talloc_free(ret); return NULL;);
442 if (talloc_reference(mem_ctx, py_talloc_get_mem_ctx(in)) == NULL) {
443 PyErr_NoMemory();
444 talloc_free(ret); return NULL;
445 }
446 ret->object = *(struct security_ace_object *)py_talloc_get_ptr(in);
447 break;
448
449 default:
450 break;
451
452 }
453
454 return ret;
455}
456
457
458static PyObject *py_security_ace_get_type(PyObject *obj, void *closure)
459{
460 struct security_ace *object = (struct security_ace *)py_talloc_get_ptr(obj);
461 PyObject *py_type;
462 py_type = PyInt_FromLong(object->type);
463 return py_type;
464}
465
466static int py_security_ace_set_type(PyObject *py_obj, PyObject *value, void *closure)
467{
468 struct security_ace *object = (struct security_ace *)py_talloc_get_ptr(py_obj);
469 if (PyLong_Check(value)) {
470 object->type = PyLong_AsLongLong(value);
471 } else if (PyInt_Check(value)) {
472 object->type = PyInt_AsLong(value);
473 } else {
474 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
475 PyInt_Type.tp_name, PyLong_Type.tp_name);
476 return -1;
477 }
478 return 0;
479}
480
481static PyObject *py_security_ace_get_flags(PyObject *obj, void *closure)
482{
483 struct security_ace *object = (struct security_ace *)py_talloc_get_ptr(obj);
484 PyObject *py_flags;
485 py_flags = PyInt_FromLong(object->flags);
486 return py_flags;
487}
488
489static int py_security_ace_set_flags(PyObject *py_obj, PyObject *value, void *closure)
490{
491 struct security_ace *object = (struct security_ace *)py_talloc_get_ptr(py_obj);
492 if (PyLong_Check(value)) {
493 object->flags = PyLong_AsLongLong(value);
494 } else if (PyInt_Check(value)) {
495 object->flags = PyInt_AsLong(value);
496 } else {
497 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
498 PyInt_Type.tp_name, PyLong_Type.tp_name);
499 return -1;
500 }
501 return 0;
502}
503
504static PyObject *py_security_ace_get_size(PyObject *obj, void *closure)
505{
506 struct security_ace *object = (struct security_ace *)py_talloc_get_ptr(obj);
507 PyObject *py_size;
508 py_size = PyInt_FromLong(object->size);
509 return py_size;
510}
511
512static int py_security_ace_set_size(PyObject *py_obj, PyObject *value, void *closure)
513{
514 struct security_ace *object = (struct security_ace *)py_talloc_get_ptr(py_obj);
515 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
516 object->size = PyInt_AsLong(value);
517 return 0;
518}
519
520static PyObject *py_security_ace_get_access_mask(PyObject *obj, void *closure)
521{
522 struct security_ace *object = (struct security_ace *)py_talloc_get_ptr(obj);
523 PyObject *py_access_mask;
524 py_access_mask = PyInt_FromLong(object->access_mask);
525 return py_access_mask;
526}
527
528static int py_security_ace_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
529{
530 struct security_ace *object = (struct security_ace *)py_talloc_get_ptr(py_obj);
531 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
532 object->access_mask = PyInt_AsLong(value);
533 return 0;
534}
535
536static PyObject *py_security_ace_get_object(PyObject *obj, void *closure)
537{
538 struct security_ace *object = (struct security_ace *)py_talloc_get_ptr(obj);
539 PyObject *py_object;
540 py_object = py_import_security_ace_object_ctr(py_talloc_get_mem_ctx(obj), object->type, &object->object);
541 if (py_object == NULL) {
542 return NULL;
543 }
544 return py_object;
545}
546
547static int py_security_ace_set_object(PyObject *py_obj, PyObject *value, void *closure)
548{
549 struct security_ace *object = (struct security_ace *)py_talloc_get_ptr(py_obj);
550 {
551 union security_ace_object_ctr *object_switch_0;
552 object_switch_0 = py_export_security_ace_object_ctr(py_talloc_get_mem_ctx(py_obj), object->type, value);
553 if (object_switch_0 == NULL) {
554 return -1;
555 }
556 object->object = *object_switch_0;
557 }
558 return 0;
559}
560
561static PyObject *py_security_ace_get_trustee(PyObject *obj, void *closure)
562{
563 struct security_ace *object = (struct security_ace *)py_talloc_get_ptr(obj);
564 PyObject *py_trustee;
565 py_trustee = py_talloc_reference_ex(&dom_sid_Type, py_talloc_get_mem_ctx(obj), &object->trustee);
566 return py_trustee;
567}
568
569static int py_security_ace_set_trustee(PyObject *py_obj, PyObject *value, void *closure)
570{
571 struct security_ace *object = (struct security_ace *)py_talloc_get_ptr(py_obj);
572 PY_CHECK_TYPE(&dom_sid_Type, value, return -1;);
573 if (talloc_reference(py_talloc_get_mem_ctx(py_obj), py_talloc_get_mem_ctx(value)) == NULL) {
574 PyErr_NoMemory();
575 return -1;
576 }
577 object->trustee = *(struct dom_sid *)py_talloc_get_ptr(value);
578 return 0;
579}
580
581static PyGetSetDef py_security_ace_getsetters[] = {
582 { discard_const_p(char, "type"), py_security_ace_get_type, py_security_ace_set_type },
583 { discard_const_p(char, "flags"), py_security_ace_get_flags, py_security_ace_set_flags },
584 { discard_const_p(char, "size"), py_security_ace_get_size, py_security_ace_set_size },
585 { discard_const_p(char, "access_mask"), py_security_ace_get_access_mask, py_security_ace_set_access_mask },
586 { discard_const_p(char, "object"), py_security_ace_get_object, py_security_ace_set_object },
587 { discard_const_p(char, "trustee"), py_security_ace_get_trustee, py_security_ace_set_trustee },
588 { NULL }
589};
590
591static PyObject *py_security_ace_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
592{
593 return py_talloc_new(struct security_ace, type);
594}
595
596static PyObject *py_security_ace_ndr_pack(PyObject *py_obj)
597{
598 struct security_ace *object = (struct security_ace *)py_talloc_get_ptr(py_obj);
599 DATA_BLOB blob;
600 enum ndr_err_code err;
601 err = ndr_push_struct_blob(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_security_ace);
602 if (err != NDR_ERR_SUCCESS) {
603 PyErr_SetNdrError(err);
604 return NULL;
605 }
606
607 return PyString_FromStringAndSize((char *)blob.data, blob.length);
608}
609
610static PyObject *py_security_ace_ndr_unpack(PyObject *py_obj, PyObject *args)
611{
612 struct security_ace *object = (struct security_ace *)py_talloc_get_ptr(py_obj);
613 DATA_BLOB blob;
614 enum ndr_err_code err;
615 if (!PyArg_ParseTuple(args, "s#:__ndr_unpack__", &blob.data, &blob.length))
616 return NULL;
617
618 err = ndr_pull_struct_blob_all(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_ace);
619 if (err != NDR_ERR_SUCCESS) {
620 PyErr_SetNdrError(err);
621 return NULL;
622 }
623
624 Py_RETURN_NONE;
625}
626
627static PyObject *py_security_ace_ndr_print(PyObject *py_obj)
628{
629 struct security_ace *object = (struct security_ace *)py_talloc_get_ptr(py_obj);
630 PyObject *ret;
631 char *retstr;
632
633 retstr = ndr_print_struct_string(py_talloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_security_ace, "security_ace", object);
634 ret = PyString_FromString(retstr);
635 talloc_free(retstr);
636
637 return ret;
638}
639
640static PyMethodDef py_security_ace_methods[] = {
641 { "__ndr_pack__", (PyCFunction)py_security_ace_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
642 { "__ndr_unpack__", (PyCFunction)py_security_ace_ndr_unpack, METH_VARARGS, "S.ndr_unpack(class, blob) -> None\nNDR unpack" },
643 { "__ndr_print__", (PyCFunction)py_security_ace_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
644 { NULL, NULL, 0, NULL }
645};
646
647
648static PyTypeObject security_ace_Type = {
649 PyObject_HEAD_INIT(NULL) 0,
650 .tp_name = "security.ace",
651 .tp_getset = py_security_ace_getsetters,
652 .tp_methods = py_security_ace_methods,
653 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
654 .tp_basicsize = sizeof(py_talloc_Object),
655 .tp_new = py_security_ace_new,
656};
657
658
659static PyObject *py_security_acl_get_revision(PyObject *obj, void *closure)
660{
661 struct security_acl *object = (struct security_acl *)py_talloc_get_ptr(obj);
662 PyObject *py_revision;
663 py_revision = PyInt_FromLong(object->revision);
664 return py_revision;
665}
666
667static int py_security_acl_set_revision(PyObject *py_obj, PyObject *value, void *closure)
668{
669 struct security_acl *object = (struct security_acl *)py_talloc_get_ptr(py_obj);
670 if (PyLong_Check(value)) {
671 object->revision = PyLong_AsLongLong(value);
672 } else if (PyInt_Check(value)) {
673 object->revision = PyInt_AsLong(value);
674 } else {
675 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
676 PyInt_Type.tp_name, PyLong_Type.tp_name);
677 return -1;
678 }
679 return 0;
680}
681
682static PyObject *py_security_acl_get_size(PyObject *obj, void *closure)
683{
684 struct security_acl *object = (struct security_acl *)py_talloc_get_ptr(obj);
685 PyObject *py_size;
686 py_size = PyInt_FromLong(object->size);
687 return py_size;
688}
689
690static int py_security_acl_set_size(PyObject *py_obj, PyObject *value, void *closure)
691{
692 struct security_acl *object = (struct security_acl *)py_talloc_get_ptr(py_obj);
693 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
694 object->size = PyInt_AsLong(value);
695 return 0;
696}
697
698static PyObject *py_security_acl_get_num_aces(PyObject *obj, void *closure)
699{
700 struct security_acl *object = (struct security_acl *)py_talloc_get_ptr(obj);
701 PyObject *py_num_aces;
702 py_num_aces = PyInt_FromLong(object->num_aces);
703 return py_num_aces;
704}
705
706static int py_security_acl_set_num_aces(PyObject *py_obj, PyObject *value, void *closure)
707{
708 struct security_acl *object = (struct security_acl *)py_talloc_get_ptr(py_obj);
709 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
710 object->num_aces = PyInt_AsLong(value);
711 return 0;
712}
713
714static PyObject *py_security_acl_get_aces(PyObject *obj, void *closure)
715{
716 struct security_acl *object = (struct security_acl *)py_talloc_get_ptr(obj);
717 PyObject *py_aces;
718 py_aces = PyList_New(object->num_aces);
719 if (py_aces == NULL) {
720 return NULL;
721 }
722 {
723 int aces_cntr_0;
724 for (aces_cntr_0 = 0; aces_cntr_0 < object->num_aces; aces_cntr_0++) {
725 PyObject *py_aces_0;
726 py_aces_0 = py_talloc_reference_ex(&security_ace_Type, object->aces, &object->aces[aces_cntr_0]);
727 PyList_SetItem(py_aces, aces_cntr_0, py_aces_0);
728 }
729 }
730 return py_aces;
731}
732
733static int py_security_acl_set_aces(PyObject *py_obj, PyObject *value, void *closure)
734{
735 struct security_acl *object = (struct security_acl *)py_talloc_get_ptr(py_obj);
736 PY_CHECK_TYPE(&PyList_Type, value, return -1;);
737 {
738 int aces_cntr_0;
739 object->aces = talloc_array_ptrtype(py_talloc_get_mem_ctx(py_obj), object->aces, PyList_GET_SIZE(value));
740 if (!object->aces) { return -1;; }
741 talloc_set_name_const(object->aces, "ARRAY: object->aces");
742 for (aces_cntr_0 = 0; aces_cntr_0 < PyList_GET_SIZE(value); aces_cntr_0++) {
743 PY_CHECK_TYPE(&security_ace_Type, PyList_GET_ITEM(value, aces_cntr_0), return -1;);
744 if (talloc_reference(object->aces, py_talloc_get_mem_ctx(PyList_GET_ITEM(value, aces_cntr_0))) == NULL) {
745 PyErr_NoMemory();
746 return -1;
747 }
748 object->aces[aces_cntr_0] = *(struct security_ace *)py_talloc_get_ptr(PyList_GET_ITEM(value, aces_cntr_0));
749 }
750 }
751 return 0;
752}
753
754static PyGetSetDef py_security_acl_getsetters[] = {
755 { discard_const_p(char, "revision"), py_security_acl_get_revision, py_security_acl_set_revision },
756 { discard_const_p(char, "size"), py_security_acl_get_size, py_security_acl_set_size },
757 { discard_const_p(char, "num_aces"), py_security_acl_get_num_aces, py_security_acl_set_num_aces },
758 { discard_const_p(char, "aces"), py_security_acl_get_aces, py_security_acl_set_aces },
759 { NULL }
760};
761
762static PyObject *py_security_acl_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
763{
764 return py_talloc_new(struct security_acl, type);
765}
766
767static PyObject *py_security_acl_ndr_pack(PyObject *py_obj)
768{
769 struct security_acl *object = (struct security_acl *)py_talloc_get_ptr(py_obj);
770 DATA_BLOB blob;
771 enum ndr_err_code err;
772 err = ndr_push_struct_blob(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_security_acl);
773 if (err != NDR_ERR_SUCCESS) {
774 PyErr_SetNdrError(err);
775 return NULL;
776 }
777
778 return PyString_FromStringAndSize((char *)blob.data, blob.length);
779}
780
781static PyObject *py_security_acl_ndr_unpack(PyObject *py_obj, PyObject *args)
782{
783 struct security_acl *object = (struct security_acl *)py_talloc_get_ptr(py_obj);
784 DATA_BLOB blob;
785 enum ndr_err_code err;
786 if (!PyArg_ParseTuple(args, "s#:__ndr_unpack__", &blob.data, &blob.length))
787 return NULL;
788
789 err = ndr_pull_struct_blob_all(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_acl);
790 if (err != NDR_ERR_SUCCESS) {
791 PyErr_SetNdrError(err);
792 return NULL;
793 }
794
795 Py_RETURN_NONE;
796}
797
798static PyObject *py_security_acl_ndr_print(PyObject *py_obj)
799{
800 struct security_acl *object = (struct security_acl *)py_talloc_get_ptr(py_obj);
801 PyObject *ret;
802 char *retstr;
803
804 retstr = ndr_print_struct_string(py_talloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_security_acl, "security_acl", object);
805 ret = PyString_FromString(retstr);
806 talloc_free(retstr);
807
808 return ret;
809}
810
811static PyMethodDef py_security_acl_methods[] = {
812 { "__ndr_pack__", (PyCFunction)py_security_acl_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
813 { "__ndr_unpack__", (PyCFunction)py_security_acl_ndr_unpack, METH_VARARGS, "S.ndr_unpack(class, blob) -> None\nNDR unpack" },
814 { "__ndr_print__", (PyCFunction)py_security_acl_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
815 { NULL, NULL, 0, NULL }
816};
817
818
819static PyTypeObject security_acl_Type = {
820 PyObject_HEAD_INIT(NULL) 0,
821 .tp_name = "security.acl",
822 .tp_getset = py_security_acl_getsetters,
823 .tp_methods = py_security_acl_methods,
824 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
825 .tp_basicsize = sizeof(py_talloc_Object),
826 .tp_new = py_security_acl_new,
827};
828
829
830static PyObject *py_security_descriptor_get_revision(PyObject *obj, void *closure)
831{
832 struct security_descriptor *object = (struct security_descriptor *)py_talloc_get_ptr(obj);
833 PyObject *py_revision;
834 py_revision = PyInt_FromLong(object->revision);
835 return py_revision;
836}
837
838static int py_security_descriptor_set_revision(PyObject *py_obj, PyObject *value, void *closure)
839{
840 struct security_descriptor *object = (struct security_descriptor *)py_talloc_get_ptr(py_obj);
841 if (PyLong_Check(value)) {
842 object->revision = PyLong_AsLongLong(value);
843 } else if (PyInt_Check(value)) {
844 object->revision = PyInt_AsLong(value);
845 } else {
846 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
847 PyInt_Type.tp_name, PyLong_Type.tp_name);
848 return -1;
849 }
850 return 0;
851}
852
853static PyObject *py_security_descriptor_get_type(PyObject *obj, void *closure)
854{
855 struct security_descriptor *object = (struct security_descriptor *)py_talloc_get_ptr(obj);
856 PyObject *py_type;
857 py_type = PyInt_FromLong(object->type);
858 return py_type;
859}
860
861static int py_security_descriptor_set_type(PyObject *py_obj, PyObject *value, void *closure)
862{
863 struct security_descriptor *object = (struct security_descriptor *)py_talloc_get_ptr(py_obj);
864 if (PyLong_Check(value)) {
865 object->type = PyLong_AsLongLong(value);
866 } else if (PyInt_Check(value)) {
867 object->type = PyInt_AsLong(value);
868 } else {
869 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
870 PyInt_Type.tp_name, PyLong_Type.tp_name);
871 return -1;
872 }
873 return 0;
874}
875
876static PyObject *py_security_descriptor_get_owner_sid(PyObject *obj, void *closure)
877{
878 struct security_descriptor *object = (struct security_descriptor *)py_talloc_get_ptr(obj);
879 PyObject *py_owner_sid;
880 if (object->owner_sid == NULL) {
881 py_owner_sid = Py_None;
882 Py_INCREF(py_owner_sid);
883 } else {
884 py_owner_sid = py_talloc_reference_ex(&dom_sid_Type, object->owner_sid, object->owner_sid);
885 }
886 return py_owner_sid;
887}
888
889static int py_security_descriptor_set_owner_sid(PyObject *py_obj, PyObject *value, void *closure)
890{
891 struct security_descriptor *object = (struct security_descriptor *)py_talloc_get_ptr(py_obj);
892 talloc_unlink(py_talloc_get_mem_ctx(py_obj), object->owner_sid);
893 if (value == Py_None) {
894 object->owner_sid = NULL;
895 } else {
896 object->owner_sid = NULL;
897 PY_CHECK_TYPE(&dom_sid_Type, value, return -1;);
898 if (talloc_reference(py_talloc_get_mem_ctx(py_obj), py_talloc_get_mem_ctx(value)) == NULL) {
899 PyErr_NoMemory();
900 return -1;
901 }
902 object->owner_sid = (struct dom_sid *)py_talloc_get_ptr(value);
903 }
904 return 0;
905}
906
907static PyObject *py_security_descriptor_get_group_sid(PyObject *obj, void *closure)
908{
909 struct security_descriptor *object = (struct security_descriptor *)py_talloc_get_ptr(obj);
910 PyObject *py_group_sid;
911 if (object->group_sid == NULL) {
912 py_group_sid = Py_None;
913 Py_INCREF(py_group_sid);
914 } else {
915 py_group_sid = py_talloc_reference_ex(&dom_sid_Type, object->group_sid, object->group_sid);
916 }
917 return py_group_sid;
918}
919
920static int py_security_descriptor_set_group_sid(PyObject *py_obj, PyObject *value, void *closure)
921{
922 struct security_descriptor *object = (struct security_descriptor *)py_talloc_get_ptr(py_obj);
923 talloc_unlink(py_talloc_get_mem_ctx(py_obj), object->group_sid);
924 if (value == Py_None) {
925 object->group_sid = NULL;
926 } else {
927 object->group_sid = NULL;
928 PY_CHECK_TYPE(&dom_sid_Type, value, return -1;);
929 if (talloc_reference(py_talloc_get_mem_ctx(py_obj), py_talloc_get_mem_ctx(value)) == NULL) {
930 PyErr_NoMemory();
931 return -1;
932 }
933 object->group_sid = (struct dom_sid *)py_talloc_get_ptr(value);
934 }
935 return 0;
936}
937
938static PyObject *py_security_descriptor_get_sacl(PyObject *obj, void *closure)
939{
940 struct security_descriptor *object = (struct security_descriptor *)py_talloc_get_ptr(obj);
941 PyObject *py_sacl;
942 if (object->sacl == NULL) {
943 py_sacl = Py_None;
944 Py_INCREF(py_sacl);
945 } else {
946 py_sacl = py_talloc_reference_ex(&security_acl_Type, object->sacl, object->sacl);
947 }
948 return py_sacl;
949}
950
951static int py_security_descriptor_set_sacl(PyObject *py_obj, PyObject *value, void *closure)
952{
953 struct security_descriptor *object = (struct security_descriptor *)py_talloc_get_ptr(py_obj);
954 talloc_unlink(py_talloc_get_mem_ctx(py_obj), object->sacl);
955 if (value == Py_None) {
956 object->sacl = NULL;
957 } else {
958 object->sacl = NULL;
959 PY_CHECK_TYPE(&security_acl_Type, value, return -1;);
960 if (talloc_reference(py_talloc_get_mem_ctx(py_obj), py_talloc_get_mem_ctx(value)) == NULL) {
961 PyErr_NoMemory();
962 return -1;
963 }
964 object->sacl = (struct security_acl *)py_talloc_get_ptr(value);
965 }
966 return 0;
967}
968
969static PyObject *py_security_descriptor_get_dacl(PyObject *obj, void *closure)
970{
971 struct security_descriptor *object = (struct security_descriptor *)py_talloc_get_ptr(obj);
972 PyObject *py_dacl;
973 if (object->dacl == NULL) {
974 py_dacl = Py_None;
975 Py_INCREF(py_dacl);
976 } else {
977 py_dacl = py_talloc_reference_ex(&security_acl_Type, object->dacl, object->dacl);
978 }
979 return py_dacl;
980}
981
982static int py_security_descriptor_set_dacl(PyObject *py_obj, PyObject *value, void *closure)
983{
984 struct security_descriptor *object = (struct security_descriptor *)py_talloc_get_ptr(py_obj);
985 talloc_unlink(py_talloc_get_mem_ctx(py_obj), object->dacl);
986 if (value == Py_None) {
987 object->dacl = NULL;
988 } else {
989 object->dacl = NULL;
990 PY_CHECK_TYPE(&security_acl_Type, value, return -1;);
991 if (talloc_reference(py_talloc_get_mem_ctx(py_obj), py_talloc_get_mem_ctx(value)) == NULL) {
992 PyErr_NoMemory();
993 return -1;
994 }
995 object->dacl = (struct security_acl *)py_talloc_get_ptr(value);
996 }
997 return 0;
998}
999
1000static PyGetSetDef py_security_descriptor_getsetters[] = {
1001 { discard_const_p(char, "revision"), py_security_descriptor_get_revision, py_security_descriptor_set_revision },
1002 { discard_const_p(char, "type"), py_security_descriptor_get_type, py_security_descriptor_set_type },
1003 { discard_const_p(char, "owner_sid"), py_security_descriptor_get_owner_sid, py_security_descriptor_set_owner_sid },
1004 { discard_const_p(char, "group_sid"), py_security_descriptor_get_group_sid, py_security_descriptor_set_group_sid },
1005 { discard_const_p(char, "sacl"), py_security_descriptor_get_sacl, py_security_descriptor_set_sacl },
1006 { discard_const_p(char, "dacl"), py_security_descriptor_get_dacl, py_security_descriptor_set_dacl },
1007 { NULL }
1008};
1009
1010static PyObject *py_security_descriptor_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1011{
1012 return py_talloc_new(struct security_descriptor, type);
1013}
1014
1015static PyObject *py_security_descriptor_ndr_pack(PyObject *py_obj)
1016{
1017 struct security_descriptor *object = (struct security_descriptor *)py_talloc_get_ptr(py_obj);
1018 DATA_BLOB blob;
1019 enum ndr_err_code err;
1020 err = ndr_push_struct_blob(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_security_descriptor);
1021 if (err != NDR_ERR_SUCCESS) {
1022 PyErr_SetNdrError(err);
1023 return NULL;
1024 }
1025
1026 return PyString_FromStringAndSize((char *)blob.data, blob.length);
1027}
1028
1029static PyObject *py_security_descriptor_ndr_unpack(PyObject *py_obj, PyObject *args)
1030{
1031 struct security_descriptor *object = (struct security_descriptor *)py_talloc_get_ptr(py_obj);
1032 DATA_BLOB blob;
1033 enum ndr_err_code err;
1034 if (!PyArg_ParseTuple(args, "s#:__ndr_unpack__", &blob.data, &blob.length))
1035 return NULL;
1036
1037 err = ndr_pull_struct_blob_all(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
1038 if (err != NDR_ERR_SUCCESS) {
1039 PyErr_SetNdrError(err);
1040 return NULL;
1041 }
1042
1043 Py_RETURN_NONE;
1044}
1045
1046static PyObject *py_security_descriptor_ndr_print(PyObject *py_obj)
1047{
1048 struct security_descriptor *object = (struct security_descriptor *)py_talloc_get_ptr(py_obj);
1049 PyObject *ret;
1050 char *retstr;
1051
1052 retstr = ndr_print_struct_string(py_talloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_security_descriptor, "security_descriptor", object);
1053 ret = PyString_FromString(retstr);
1054 talloc_free(retstr);
1055
1056 return ret;
1057}
1058
1059static PyMethodDef py_security_descriptor_methods[] = {
1060 { "__ndr_pack__", (PyCFunction)py_security_descriptor_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1061 { "__ndr_unpack__", (PyCFunction)py_security_descriptor_ndr_unpack, METH_VARARGS, "S.ndr_unpack(class, blob) -> None\nNDR unpack" },
1062 { "__ndr_print__", (PyCFunction)py_security_descriptor_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
1063 { NULL, NULL, 0, NULL }
1064};
1065
1066
1067static PyTypeObject security_descriptor_Type = {
1068 PyObject_HEAD_INIT(NULL) 0,
1069 .tp_name = "security.descriptor",
1070 .tp_getset = py_security_descriptor_getsetters,
1071 .tp_methods = py_security_descriptor_methods,
1072 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1073 .tp_basicsize = sizeof(py_talloc_Object),
1074 .tp_new = py_security_descriptor_new,
1075};
1076
1077
1078static PyObject *py_sec_desc_buf_get_sd_size(PyObject *obj, void *closure)
1079{
1080 struct sec_desc_buf *object = (struct sec_desc_buf *)py_talloc_get_ptr(obj);
1081 PyObject *py_sd_size;
1082 py_sd_size = PyInt_FromLong(object->sd_size);
1083 return py_sd_size;
1084}
1085
1086static int py_sec_desc_buf_set_sd_size(PyObject *py_obj, PyObject *value, void *closure)
1087{
1088 struct sec_desc_buf *object = (struct sec_desc_buf *)py_talloc_get_ptr(py_obj);
1089 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1090 object->sd_size = PyInt_AsLong(value);
1091 return 0;
1092}
1093
1094static PyObject *py_sec_desc_buf_get_sd(PyObject *obj, void *closure)
1095{
1096 struct sec_desc_buf *object = (struct sec_desc_buf *)py_talloc_get_ptr(obj);
1097 PyObject *py_sd;
1098 if (object->sd == NULL) {
1099 py_sd = Py_None;
1100 Py_INCREF(py_sd);
1101 } else {
1102 py_sd = py_talloc_reference_ex(&security_descriptor_Type, object->sd, object->sd);
1103 }
1104 return py_sd;
1105}
1106
1107static int py_sec_desc_buf_set_sd(PyObject *py_obj, PyObject *value, void *closure)
1108{
1109 struct sec_desc_buf *object = (struct sec_desc_buf *)py_talloc_get_ptr(py_obj);
1110 talloc_unlink(py_talloc_get_mem_ctx(py_obj), object->sd);
1111 if (value == Py_None) {
1112 object->sd = NULL;
1113 } else {
1114 object->sd = NULL;
1115 PY_CHECK_TYPE(&security_descriptor_Type, value, return -1;);
1116 if (talloc_reference(py_talloc_get_mem_ctx(py_obj), py_talloc_get_mem_ctx(value)) == NULL) {
1117 PyErr_NoMemory();
1118 return -1;
1119 }
1120 object->sd = (struct security_descriptor *)py_talloc_get_ptr(value);
1121 }
1122 return 0;
1123}
1124
1125static PyGetSetDef py_sec_desc_buf_getsetters[] = {
1126 { discard_const_p(char, "sd_size"), py_sec_desc_buf_get_sd_size, py_sec_desc_buf_set_sd_size },
1127 { discard_const_p(char, "sd"), py_sec_desc_buf_get_sd, py_sec_desc_buf_set_sd },
1128 { NULL }
1129};
1130
1131static PyObject *py_sec_desc_buf_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1132{
1133 return py_talloc_new(struct sec_desc_buf, type);
1134}
1135
1136static PyObject *py_sec_desc_buf_ndr_pack(PyObject *py_obj)
1137{
1138 struct sec_desc_buf *object = (struct sec_desc_buf *)py_talloc_get_ptr(py_obj);
1139 DATA_BLOB blob;
1140 enum ndr_err_code err;
1141 err = ndr_push_struct_blob(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_sec_desc_buf);
1142 if (err != NDR_ERR_SUCCESS) {
1143 PyErr_SetNdrError(err);
1144 return NULL;
1145 }
1146
1147 return PyString_FromStringAndSize((char *)blob.data, blob.length);
1148}
1149
1150static PyObject *py_sec_desc_buf_ndr_unpack(PyObject *py_obj, PyObject *args)
1151{
1152 struct sec_desc_buf *object = (struct sec_desc_buf *)py_talloc_get_ptr(py_obj);
1153 DATA_BLOB blob;
1154 enum ndr_err_code err;
1155 if (!PyArg_ParseTuple(args, "s#:__ndr_unpack__", &blob.data, &blob.length))
1156 return NULL;
1157
1158 err = ndr_pull_struct_blob_all(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_sec_desc_buf);
1159 if (err != NDR_ERR_SUCCESS) {
1160 PyErr_SetNdrError(err);
1161 return NULL;
1162 }
1163
1164 Py_RETURN_NONE;
1165}
1166
1167static PyObject *py_sec_desc_buf_ndr_print(PyObject *py_obj)
1168{
1169 struct sec_desc_buf *object = (struct sec_desc_buf *)py_talloc_get_ptr(py_obj);
1170 PyObject *ret;
1171 char *retstr;
1172
1173 retstr = ndr_print_struct_string(py_talloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_sec_desc_buf, "sec_desc_buf", object);
1174 ret = PyString_FromString(retstr);
1175 talloc_free(retstr);
1176
1177 return ret;
1178}
1179
1180static PyMethodDef py_sec_desc_buf_methods[] = {
1181 { "__ndr_pack__", (PyCFunction)py_sec_desc_buf_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1182 { "__ndr_unpack__", (PyCFunction)py_sec_desc_buf_ndr_unpack, METH_VARARGS, "S.ndr_unpack(class, blob) -> None\nNDR unpack" },
1183 { "__ndr_print__", (PyCFunction)py_sec_desc_buf_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
1184 { NULL, NULL, 0, NULL }
1185};
1186
1187
1188static PyTypeObject sec_desc_buf_Type = {
1189 PyObject_HEAD_INIT(NULL) 0,
1190 .tp_name = "security.sec_desc_buf",
1191 .tp_getset = py_sec_desc_buf_getsetters,
1192 .tp_methods = py_sec_desc_buf_methods,
1193 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1194 .tp_basicsize = sizeof(py_talloc_Object),
1195 .tp_new = py_sec_desc_buf_new,
1196};
1197
1198
1199static PyObject *py_security_token_get_num_sids(PyObject *obj, void *closure)
1200{
1201 struct security_token *object = (struct security_token *)py_talloc_get_ptr(obj);
1202 PyObject *py_num_sids;
1203 py_num_sids = PyInt_FromLong(object->num_sids);
1204 return py_num_sids;
1205}
1206
1207static int py_security_token_set_num_sids(PyObject *py_obj, PyObject *value, void *closure)
1208{
1209 struct security_token *object = (struct security_token *)py_talloc_get_ptr(py_obj);
1210 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1211 object->num_sids = PyInt_AsLong(value);
1212 return 0;
1213}
1214
1215static PyObject *py_security_token_get_sids(PyObject *obj, void *closure)
1216{
1217 struct security_token *object = (struct security_token *)py_talloc_get_ptr(obj);
1218 PyObject *py_sids;
1219 py_sids = PyList_New(object->num_sids);
1220 if (py_sids == NULL) {
1221 return NULL;
1222 }
1223 {
1224 int sids_cntr_0;
1225 for (sids_cntr_0 = 0; sids_cntr_0 < object->num_sids; sids_cntr_0++) {
1226 PyObject *py_sids_0;
1227 py_sids_0 = py_talloc_reference_ex(&dom_sid_Type, object->sids, &object->sids[sids_cntr_0]);
1228 PyList_SetItem(py_sids, sids_cntr_0, py_sids_0);
1229 }
1230 }
1231 return py_sids;
1232}
1233
1234static int py_security_token_set_sids(PyObject *py_obj, PyObject *value, void *closure)
1235{
1236 struct security_token *object = (struct security_token *)py_talloc_get_ptr(py_obj);
1237 PY_CHECK_TYPE(&PyList_Type, value, return -1;);
1238 {
1239 int sids_cntr_0;
1240 object->sids = talloc_array_ptrtype(py_talloc_get_mem_ctx(py_obj), object->sids, PyList_GET_SIZE(value));
1241 if (!object->sids) { return -1;; }
1242 talloc_set_name_const(object->sids, "ARRAY: object->sids");
1243 for (sids_cntr_0 = 0; sids_cntr_0 < PyList_GET_SIZE(value); sids_cntr_0++) {
1244 PY_CHECK_TYPE(&dom_sid_Type, PyList_GET_ITEM(value, sids_cntr_0), return -1;);
1245 if (talloc_reference(object->sids, py_talloc_get_mem_ctx(PyList_GET_ITEM(value, sids_cntr_0))) == NULL) {
1246 PyErr_NoMemory();
1247 return -1;
1248 }
1249 object->sids[sids_cntr_0] = *(struct dom_sid *)py_talloc_get_ptr(PyList_GET_ITEM(value, sids_cntr_0));
1250 }
1251 }
1252 return 0;
1253}
1254
1255static PyObject *py_security_token_get_privilege_mask(PyObject *obj, void *closure)
1256{
1257 struct security_token *object = (struct security_token *)py_talloc_get_ptr(obj);
1258 PyObject *py_privilege_mask;
1259 py_privilege_mask = PyLong_FromLongLong(object->privilege_mask);
1260 return py_privilege_mask;
1261}
1262
1263static int py_security_token_set_privilege_mask(PyObject *py_obj, PyObject *value, void *closure)
1264{
1265 struct security_token *object = (struct security_token *)py_talloc_get_ptr(py_obj);
1266 if (PyLong_Check(value)) {
1267 object->privilege_mask = PyLong_AsLongLong(value);
1268 } else if (PyInt_Check(value)) {
1269 object->privilege_mask = PyInt_AsLong(value);
1270 } else {
1271 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1272 PyInt_Type.tp_name, PyLong_Type.tp_name);
1273 return -1;
1274 }
1275 return 0;
1276}
1277
1278static PyObject *py_security_token_get_rights_mask(PyObject *obj, void *closure)
1279{
1280 struct security_token *object = (struct security_token *)py_talloc_get_ptr(obj);
1281 PyObject *py_rights_mask;
1282 py_rights_mask = PyInt_FromLong(object->rights_mask);
1283 return py_rights_mask;
1284}
1285
1286static int py_security_token_set_rights_mask(PyObject *py_obj, PyObject *value, void *closure)
1287{
1288 struct security_token *object = (struct security_token *)py_talloc_get_ptr(py_obj);
1289 if (PyLong_Check(value)) {
1290 object->rights_mask = PyLong_AsLongLong(value);
1291 } else if (PyInt_Check(value)) {
1292 object->rights_mask = PyInt_AsLong(value);
1293 } else {
1294 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1295 PyInt_Type.tp_name, PyLong_Type.tp_name);
1296 return -1;
1297 }
1298 return 0;
1299}
1300
1301static PyGetSetDef py_security_token_getsetters[] = {
1302 { discard_const_p(char, "num_sids"), py_security_token_get_num_sids, py_security_token_set_num_sids },
1303 { discard_const_p(char, "sids"), py_security_token_get_sids, py_security_token_set_sids },
1304 { discard_const_p(char, "privilege_mask"), py_security_token_get_privilege_mask, py_security_token_set_privilege_mask },
1305 { discard_const_p(char, "rights_mask"), py_security_token_get_rights_mask, py_security_token_set_rights_mask },
1306 { NULL }
1307};
1308
1309static PyObject *py_security_token_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1310{
1311 return py_talloc_new(struct security_token, type);
1312}
1313
1314static PyObject *py_security_token_ndr_pack(PyObject *py_obj)
1315{
1316 struct security_token *object = (struct security_token *)py_talloc_get_ptr(py_obj);
1317 DATA_BLOB blob;
1318 enum ndr_err_code err;
1319 err = ndr_push_struct_blob(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_security_token);
1320 if (err != NDR_ERR_SUCCESS) {
1321 PyErr_SetNdrError(err);
1322 return NULL;
1323 }
1324
1325 return PyString_FromStringAndSize((char *)blob.data, blob.length);
1326}
1327
1328static PyObject *py_security_token_ndr_unpack(PyObject *py_obj, PyObject *args)
1329{
1330 struct security_token *object = (struct security_token *)py_talloc_get_ptr(py_obj);
1331 DATA_BLOB blob;
1332 enum ndr_err_code err;
1333 if (!PyArg_ParseTuple(args, "s#:__ndr_unpack__", &blob.data, &blob.length))
1334 return NULL;
1335
1336 err = ndr_pull_struct_blob_all(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_token);
1337 if (err != NDR_ERR_SUCCESS) {
1338 PyErr_SetNdrError(err);
1339 return NULL;
1340 }
1341
1342 Py_RETURN_NONE;
1343}
1344
1345static PyObject *py_security_token_ndr_print(PyObject *py_obj)
1346{
1347 struct security_token *object = (struct security_token *)py_talloc_get_ptr(py_obj);
1348 PyObject *ret;
1349 char *retstr;
1350
1351 retstr = ndr_print_struct_string(py_talloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_security_token, "security_token", object);
1352 ret = PyString_FromString(retstr);
1353 talloc_free(retstr);
1354
1355 return ret;
1356}
1357
1358static PyMethodDef py_security_token_methods[] = {
1359 { "__ndr_pack__", (PyCFunction)py_security_token_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1360 { "__ndr_unpack__", (PyCFunction)py_security_token_ndr_unpack, METH_VARARGS, "S.ndr_unpack(class, blob) -> None\nNDR unpack" },
1361 { "__ndr_print__", (PyCFunction)py_security_token_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
1362 { NULL, NULL, 0, NULL }
1363};
1364
1365
1366static PyTypeObject security_token_Type = {
1367 PyObject_HEAD_INIT(NULL) 0,
1368 .tp_name = "security.token",
1369 .tp_getset = py_security_token_getsetters,
1370 .tp_methods = py_security_token_methods,
1371 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1372 .tp_basicsize = sizeof(py_talloc_Object),
1373 .tp_new = py_security_token_new,
1374};
1375
1376
1377static PyObject *py_security_unix_token_get_uid(PyObject *obj, void *closure)
1378{
1379 struct security_unix_token *object = (struct security_unix_token *)py_talloc_get_ptr(obj);
1380 PyObject *py_uid;
1381 py_uid = PyInt_FromLong(object->uid);
1382 return py_uid;
1383}
1384
1385static int py_security_unix_token_set_uid(PyObject *py_obj, PyObject *value, void *closure)
1386{
1387 struct security_unix_token *object = (struct security_unix_token *)py_talloc_get_ptr(py_obj);
1388 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1389 object->uid = PyInt_AsLong(value);
1390 return 0;
1391}
1392
1393static PyObject *py_security_unix_token_get_gid(PyObject *obj, void *closure)
1394{
1395 struct security_unix_token *object = (struct security_unix_token *)py_talloc_get_ptr(obj);
1396 PyObject *py_gid;
1397 py_gid = PyInt_FromLong(object->gid);
1398 return py_gid;
1399}
1400
1401static int py_security_unix_token_set_gid(PyObject *py_obj, PyObject *value, void *closure)
1402{
1403 struct security_unix_token *object = (struct security_unix_token *)py_talloc_get_ptr(py_obj);
1404 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1405 object->gid = PyInt_AsLong(value);
1406 return 0;
1407}
1408
1409static PyObject *py_security_unix_token_get_ngroups(PyObject *obj, void *closure)
1410{
1411 struct security_unix_token *object = (struct security_unix_token *)py_talloc_get_ptr(obj);
1412 PyObject *py_ngroups;
1413 py_ngroups = PyInt_FromLong(object->ngroups);
1414 return py_ngroups;
1415}
1416
1417static int py_security_unix_token_set_ngroups(PyObject *py_obj, PyObject *value, void *closure)
1418{
1419 struct security_unix_token *object = (struct security_unix_token *)py_talloc_get_ptr(py_obj);
1420 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1421 object->ngroups = PyInt_AsLong(value);
1422 return 0;
1423}
1424
1425static PyObject *py_security_unix_token_get_groups(PyObject *obj, void *closure)
1426{
1427 struct security_unix_token *object = (struct security_unix_token *)py_talloc_get_ptr(obj);
1428 PyObject *py_groups;
1429 py_groups = PyList_New(object->ngroups);
1430 if (py_groups == NULL) {
1431 return NULL;
1432 }
1433 {
1434 int groups_cntr_0;
1435 for (groups_cntr_0 = 0; groups_cntr_0 < object->ngroups; groups_cntr_0++) {
1436 PyObject *py_groups_0;
1437 py_groups_0 = PyInt_FromLong(object->groups[groups_cntr_0]);
1438 PyList_SetItem(py_groups, groups_cntr_0, py_groups_0);
1439 }
1440 }
1441 return py_groups;
1442}
1443
1444static int py_security_unix_token_set_groups(PyObject *py_obj, PyObject *value, void *closure)
1445{
1446 struct security_unix_token *object = (struct security_unix_token *)py_talloc_get_ptr(py_obj);
1447 PY_CHECK_TYPE(&PyList_Type, value, return -1;);
1448 {
1449 int groups_cntr_0;
1450 object->groups = talloc_array_ptrtype(py_talloc_get_mem_ctx(py_obj), object->groups, PyList_GET_SIZE(value));
1451 if (!object->groups) { return -1;; }
1452 talloc_set_name_const(object->groups, "ARRAY: object->groups");
1453 for (groups_cntr_0 = 0; groups_cntr_0 < PyList_GET_SIZE(value); groups_cntr_0++) {
1454 PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, groups_cntr_0), return -1;);
1455 object->groups[groups_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, groups_cntr_0));
1456 }
1457 }
1458 return 0;
1459}
1460
1461static PyGetSetDef py_security_unix_token_getsetters[] = {
1462 { discard_const_p(char, "uid"), py_security_unix_token_get_uid, py_security_unix_token_set_uid },
1463 { discard_const_p(char, "gid"), py_security_unix_token_get_gid, py_security_unix_token_set_gid },
1464 { discard_const_p(char, "ngroups"), py_security_unix_token_get_ngroups, py_security_unix_token_set_ngroups },
1465 { discard_const_p(char, "groups"), py_security_unix_token_get_groups, py_security_unix_token_set_groups },
1466 { NULL }
1467};
1468
1469static PyObject *py_security_unix_token_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1470{
1471 return py_talloc_new(struct security_unix_token, type);
1472}
1473
1474static PyObject *py_security_unix_token_ndr_pack(PyObject *py_obj)
1475{
1476 struct security_unix_token *object = (struct security_unix_token *)py_talloc_get_ptr(py_obj);
1477 DATA_BLOB blob;
1478 enum ndr_err_code err;
1479 err = ndr_push_struct_blob(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_security_unix_token);
1480 if (err != NDR_ERR_SUCCESS) {
1481 PyErr_SetNdrError(err);
1482 return NULL;
1483 }
1484
1485 return PyString_FromStringAndSize((char *)blob.data, blob.length);
1486}
1487
1488static PyObject *py_security_unix_token_ndr_unpack(PyObject *py_obj, PyObject *args)
1489{
1490 struct security_unix_token *object = (struct security_unix_token *)py_talloc_get_ptr(py_obj);
1491 DATA_BLOB blob;
1492 enum ndr_err_code err;
1493 if (!PyArg_ParseTuple(args, "s#:__ndr_unpack__", &blob.data, &blob.length))
1494 return NULL;
1495
1496 err = ndr_pull_struct_blob_all(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_unix_token);
1497 if (err != NDR_ERR_SUCCESS) {
1498 PyErr_SetNdrError(err);
1499 return NULL;
1500 }
1501
1502 Py_RETURN_NONE;
1503}
1504
1505static PyObject *py_security_unix_token_ndr_print(PyObject *py_obj)
1506{
1507 struct security_unix_token *object = (struct security_unix_token *)py_talloc_get_ptr(py_obj);
1508 PyObject *ret;
1509 char *retstr;
1510
1511 retstr = ndr_print_struct_string(py_talloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_security_unix_token, "security_unix_token", object);
1512 ret = PyString_FromString(retstr);
1513 talloc_free(retstr);
1514
1515 return ret;
1516}
1517
1518static PyMethodDef py_security_unix_token_methods[] = {
1519 { "__ndr_pack__", (PyCFunction)py_security_unix_token_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1520 { "__ndr_unpack__", (PyCFunction)py_security_unix_token_ndr_unpack, METH_VARARGS, "S.ndr_unpack(class, blob) -> None\nNDR unpack" },
1521 { "__ndr_print__", (PyCFunction)py_security_unix_token_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
1522 { NULL, NULL, 0, NULL }
1523};
1524
1525
1526static PyTypeObject security_unix_token_Type = {
1527 PyObject_HEAD_INIT(NULL) 0,
1528 .tp_name = "security.unix_token",
1529 .tp_getset = py_security_unix_token_getsetters,
1530 .tp_methods = py_security_unix_token_methods,
1531 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1532 .tp_basicsize = sizeof(py_talloc_Object),
1533 .tp_new = py_security_unix_token_new,
1534};
1535
1536
1537static PyObject *py_generic_mapping_get_generic_read(PyObject *obj, void *closure)
1538{
1539 struct generic_mapping *object = (struct generic_mapping *)py_talloc_get_ptr(obj);
1540 PyObject *py_generic_read;
1541 py_generic_read = PyInt_FromLong(object->generic_read);
1542 return py_generic_read;
1543}
1544
1545static int py_generic_mapping_set_generic_read(PyObject *py_obj, PyObject *value, void *closure)
1546{
1547 struct generic_mapping *object = (struct generic_mapping *)py_talloc_get_ptr(py_obj);
1548 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1549 object->generic_read = PyInt_AsLong(value);
1550 return 0;
1551}
1552
1553static PyObject *py_generic_mapping_get_generic_write(PyObject *obj, void *closure)
1554{
1555 struct generic_mapping *object = (struct generic_mapping *)py_talloc_get_ptr(obj);
1556 PyObject *py_generic_write;
1557 py_generic_write = PyInt_FromLong(object->generic_write);
1558 return py_generic_write;
1559}
1560
1561static int py_generic_mapping_set_generic_write(PyObject *py_obj, PyObject *value, void *closure)
1562{
1563 struct generic_mapping *object = (struct generic_mapping *)py_talloc_get_ptr(py_obj);
1564 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1565 object->generic_write = PyInt_AsLong(value);
1566 return 0;
1567}
1568
1569static PyObject *py_generic_mapping_get_generic_execute(PyObject *obj, void *closure)
1570{
1571 struct generic_mapping *object = (struct generic_mapping *)py_talloc_get_ptr(obj);
1572 PyObject *py_generic_execute;
1573 py_generic_execute = PyInt_FromLong(object->generic_execute);
1574 return py_generic_execute;
1575}
1576
1577static int py_generic_mapping_set_generic_execute(PyObject *py_obj, PyObject *value, void *closure)
1578{
1579 struct generic_mapping *object = (struct generic_mapping *)py_talloc_get_ptr(py_obj);
1580 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1581 object->generic_execute = PyInt_AsLong(value);
1582 return 0;
1583}
1584
1585static PyObject *py_generic_mapping_get_generic_all(PyObject *obj, void *closure)
1586{
1587 struct generic_mapping *object = (struct generic_mapping *)py_talloc_get_ptr(obj);
1588 PyObject *py_generic_all;
1589 py_generic_all = PyInt_FromLong(object->generic_all);
1590 return py_generic_all;
1591}
1592
1593static int py_generic_mapping_set_generic_all(PyObject *py_obj, PyObject *value, void *closure)
1594{
1595 struct generic_mapping *object = (struct generic_mapping *)py_talloc_get_ptr(py_obj);
1596 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1597 object->generic_all = PyInt_AsLong(value);
1598 return 0;
1599}
1600
1601static PyGetSetDef py_generic_mapping_getsetters[] = {
1602 { discard_const_p(char, "generic_read"), py_generic_mapping_get_generic_read, py_generic_mapping_set_generic_read },
1603 { discard_const_p(char, "generic_write"), py_generic_mapping_get_generic_write, py_generic_mapping_set_generic_write },
1604 { discard_const_p(char, "generic_execute"), py_generic_mapping_get_generic_execute, py_generic_mapping_set_generic_execute },
1605 { discard_const_p(char, "generic_all"), py_generic_mapping_get_generic_all, py_generic_mapping_set_generic_all },
1606 { NULL }
1607};
1608
1609static PyObject *py_generic_mapping_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1610{
1611 return py_talloc_new(struct generic_mapping, type);
1612}
1613
1614
1615static PyTypeObject generic_mapping_Type = {
1616 PyObject_HEAD_INIT(NULL) 0,
1617 .tp_name = "security.generic_mapping",
1618 .tp_getset = py_generic_mapping_getsetters,
1619 .tp_methods = NULL,
1620 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1621 .tp_basicsize = sizeof(py_talloc_Object),
1622 .tp_new = py_generic_mapping_new,
1623};
1624
1625
1626static PyObject *py_standard_mapping_get_std_read(PyObject *obj, void *closure)
1627{
1628 struct standard_mapping *object = (struct standard_mapping *)py_talloc_get_ptr(obj);
1629 PyObject *py_std_read;
1630 py_std_read = PyInt_FromLong(object->std_read);
1631 return py_std_read;
1632}
1633
1634static int py_standard_mapping_set_std_read(PyObject *py_obj, PyObject *value, void *closure)
1635{
1636 struct standard_mapping *object = (struct standard_mapping *)py_talloc_get_ptr(py_obj);
1637 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1638 object->std_read = PyInt_AsLong(value);
1639 return 0;
1640}
1641
1642static PyObject *py_standard_mapping_get_std_write(PyObject *obj, void *closure)
1643{
1644 struct standard_mapping *object = (struct standard_mapping *)py_talloc_get_ptr(obj);
1645 PyObject *py_std_write;
1646 py_std_write = PyInt_FromLong(object->std_write);
1647 return py_std_write;
1648}
1649
1650static int py_standard_mapping_set_std_write(PyObject *py_obj, PyObject *value, void *closure)
1651{
1652 struct standard_mapping *object = (struct standard_mapping *)py_talloc_get_ptr(py_obj);
1653 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1654 object->std_write = PyInt_AsLong(value);
1655 return 0;
1656}
1657
1658static PyObject *py_standard_mapping_get_std_execute(PyObject *obj, void *closure)
1659{
1660 struct standard_mapping *object = (struct standard_mapping *)py_talloc_get_ptr(obj);
1661 PyObject *py_std_execute;
1662 py_std_execute = PyInt_FromLong(object->std_execute);
1663 return py_std_execute;
1664}
1665
1666static int py_standard_mapping_set_std_execute(PyObject *py_obj, PyObject *value, void *closure)
1667{
1668 struct standard_mapping *object = (struct standard_mapping *)py_talloc_get_ptr(py_obj);
1669 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1670 object->std_execute = PyInt_AsLong(value);
1671 return 0;
1672}
1673
1674static PyObject *py_standard_mapping_get_std_all(PyObject *obj, void *closure)
1675{
1676 struct standard_mapping *object = (struct standard_mapping *)py_talloc_get_ptr(obj);
1677 PyObject *py_std_all;
1678 py_std_all = PyInt_FromLong(object->std_all);
1679 return py_std_all;
1680}
1681
1682static int py_standard_mapping_set_std_all(PyObject *py_obj, PyObject *value, void *closure)
1683{
1684 struct standard_mapping *object = (struct standard_mapping *)py_talloc_get_ptr(py_obj);
1685 PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1686 object->std_all = PyInt_AsLong(value);
1687 return 0;
1688}
1689
1690static PyGetSetDef py_standard_mapping_getsetters[] = {
1691 { discard_const_p(char, "std_read"), py_standard_mapping_get_std_read, py_standard_mapping_set_std_read },
1692 { discard_const_p(char, "std_write"), py_standard_mapping_get_std_write, py_standard_mapping_set_std_write },
1693 { discard_const_p(char, "std_execute"), py_standard_mapping_get_std_execute, py_standard_mapping_set_std_execute },
1694 { discard_const_p(char, "std_all"), py_standard_mapping_get_std_all, py_standard_mapping_set_std_all },
1695 { NULL }
1696};
1697
1698static PyObject *py_standard_mapping_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1699{
1700 return py_talloc_new(struct standard_mapping, type);
1701}
1702
1703
1704static PyTypeObject standard_mapping_Type = {
1705 PyObject_HEAD_INIT(NULL) 0,
1706 .tp_name = "security.standard_mapping",
1707 .tp_getset = py_standard_mapping_getsetters,
1708 .tp_methods = NULL,
1709 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1710 .tp_basicsize = sizeof(py_talloc_Object),
1711 .tp_new = py_standard_mapping_new,
1712};
1713
1714static PyMethodDef security_methods[] = {
1715 { NULL, NULL, 0, NULL }
1716};
1717
1718void initsecurity(void)
1719{
1720 PyObject *m;
1721 PyObject *dep_talloc;
1722 PyObject *dep_samba_dcerpc_misc;
1723
1724 dep_talloc = PyImport_ImportModule("talloc");
1725 if (dep_talloc == NULL)
1726 return;
1727
1728 dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
1729 if (dep_samba_dcerpc_misc == NULL)
1730 return;
1731
1732 Object_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "Object");
1733 if (Object_Type == NULL)
1734 return;
1735
1736 GUID_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "GUID");
1737 if (GUID_Type == NULL)
1738 return;
1739
1740 dom_sid_Type.tp_base = Object_Type;
1741
1742 security_ace_object_Type.tp_base = Object_Type;
1743
1744 security_ace_Type.tp_base = Object_Type;
1745
1746 security_acl_Type.tp_base = Object_Type;
1747
1748 security_descriptor_Type.tp_base = Object_Type;
1749
1750 sec_desc_buf_Type.tp_base = Object_Type;
1751
1752 security_token_Type.tp_base = Object_Type;
1753
1754 security_unix_token_Type.tp_base = Object_Type;
1755
1756 generic_mapping_Type.tp_base = Object_Type;
1757
1758 standard_mapping_Type.tp_base = Object_Type;
1759
1760 if (PyType_Ready(&dom_sid_Type) < 0)
1761 return;
1762 if (PyType_Ready(&security_ace_object_Type) < 0)
1763 return;
1764 if (PyType_Ready(&security_ace_Type) < 0)
1765 return;
1766 if (PyType_Ready(&security_acl_Type) < 0)
1767 return;
1768 if (PyType_Ready(&security_descriptor_Type) < 0)
1769 return;
1770 if (PyType_Ready(&sec_desc_buf_Type) < 0)
1771 return;
1772 if (PyType_Ready(&security_token_Type) < 0)
1773 return;
1774 if (PyType_Ready(&security_unix_token_Type) < 0)
1775 return;
1776 if (PyType_Ready(&generic_mapping_Type) < 0)
1777 return;
1778 if (PyType_Ready(&standard_mapping_Type) < 0)
1779 return;
1780#ifdef PY_DOM_SID_PATCH
1781 PY_DOM_SID_PATCH(&dom_sid_Type);
1782#endif
1783#ifdef PY_ACE_OBJECT_PATCH
1784 PY_ACE_OBJECT_PATCH(&security_ace_object_Type);
1785#endif
1786#ifdef PY_ACE_PATCH
1787 PY_ACE_PATCH(&security_ace_Type);
1788#endif
1789#ifdef PY_ACL_PATCH
1790 PY_ACL_PATCH(&security_acl_Type);
1791#endif
1792#ifdef PY_DESCRIPTOR_PATCH
1793 PY_DESCRIPTOR_PATCH(&security_descriptor_Type);
1794#endif
1795#ifdef PY_SEC_DESC_BUF_PATCH
1796 PY_SEC_DESC_BUF_PATCH(&sec_desc_buf_Type);
1797#endif
1798#ifdef PY_TOKEN_PATCH
1799 PY_TOKEN_PATCH(&security_token_Type);
1800#endif
1801#ifdef PY_UNIX_TOKEN_PATCH
1802 PY_UNIX_TOKEN_PATCH(&security_unix_token_Type);
1803#endif
1804#ifdef PY_GENERIC_MAPPING_PATCH
1805 PY_GENERIC_MAPPING_PATCH(&generic_mapping_Type);
1806#endif
1807#ifdef PY_STANDARD_MAPPING_PATCH
1808 PY_STANDARD_MAPPING_PATCH(&standard_mapping_Type);
1809#endif
1810
1811 m = Py_InitModule3("security", security_methods, "security DCE/RPC");
1812 if (m == NULL)
1813 return;
1814
1815 PyModule_AddObject(m, "NAME_NT_AUTHORITY", PyString_FromString("NT AUTHORITY"));
1816 PyModule_AddObject(m, "SID_BUILTIN_NETWORK_CONF_OPERATORS", PyString_FromString("S-1-5-32-556"));
1817 PyModule_AddObject(m, "SEC_FLAG_MAXIMUM_ALLOWED", PyInt_FromLong(0x02000000));
1818 PyModule_AddObject(m, "DOMAIN_RID_USERS", PyInt_FromLong(513));
1819 PyModule_AddObject(m, "SID_BUILTIN_PREW2K", PyString_FromString("S-1-5-32-554"));
1820 PyModule_AddObject(m, "SEC_ACE_FLAG_INHERIT_ONLY", PyInt_FromLong(SEC_ACE_FLAG_INHERIT_ONLY));
1821 PyModule_AddObject(m, "SID_OWNER_RIGHTS", PyString_FromString("S-1-3-4"));
1822 PyModule_AddObject(m, "BUILTIN_RID_INCOMING_FOREST_TRUST", PyInt_FromLong(557));
1823 PyModule_AddObject(m, "DOMAIN_RID_RODC_DENY", PyInt_FromLong(572));
1824 PyModule_AddObject(m, "SEC_FILE_APPEND_DATA", PyInt_FromLong(0x00000004));
1825 PyModule_AddObject(m, "SEC_RIGHTS_FILE_ALL", PyInt_FromLong(SEC_STD_ALL|SEC_FILE_ALL));
1826 PyModule_AddObject(m, "SID_NT_LOCAL_SERVICE", PyString_FromString("S-1-5-19"));
1827 PyModule_AddObject(m, "SID_NT_ANONYMOUS", PyString_FromString("S-1-5-7"));
1828 PyModule_AddObject(m, "SEC_PRIV_RESTORE", PyInt_FromLong(SEC_PRIV_RESTORE));
1829 PyModule_AddObject(m, "DOMAIN_RID_KRBTGT", PyInt_FromLong(502));
1830 PyModule_AddObject(m, "SID_NT_REMOTE_INTERACTIVE", PyString_FromString("S-1-5-14"));
1831 PyModule_AddObject(m, "SEC_PRIV_DEBUG", PyInt_FromLong(SEC_PRIV_DEBUG));
1832 PyModule_AddObject(m, "SEC_RIGHTS_FILE_WRITE", PyInt_FromLong(SEC_STD_READ_CONTROL|SEC_STD_SYNCHRONIZE|SEC_FILE_WRITE_DATA|SEC_FILE_WRITE_ATTRIBUTE|SEC_FILE_WRITE_EA|SEC_FILE_APPEND_DATA));
1833 PyModule_AddObject(m, "SEC_PRIV_ENABLE_DELEGATION_BIT", PyLong_FromLongLong(SEC_PRIV_ENABLE_DELEGATION_BIT));
1834 PyModule_AddObject(m, "SID_BUILTIN_ADMINISTRATORS", PyString_FromString("S-1-5-32-544"));
1835 PyModule_AddObject(m, "BUILTIN_RID_GUESTS", PyInt_FromLong(546));
1836 PyModule_AddObject(m, "GUID_DRS_CHANGE_INFR_MASTER", PyString_FromString("cc17b1fb-33d9-11d2-97d4-00c04fd8d5cd"));
1837 PyModule_AddObject(m, "SEC_FLAG_SYSTEM_SECURITY", PyInt_FromLong(0x01000000));
1838 PyModule_AddObject(m, "SEC_STD_WRITE_DAC", PyInt_FromLong(0x00040000));
1839 PyModule_AddObject(m, "SID_NT_OTHER_ORGANISATION", PyString_FromString("S-1-5-1000"));
1840 PyModule_AddObject(m, "GUID_DRS_CHANGE_RID_MASTER", PyString_FromString("d58d5f36-0a98-11d1-adbb-00c04fd8d5cd"));
1841 PyModule_AddObject(m, "SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT", PyInt_FromLong(SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT));
1842 PyModule_AddObject(m, "SEC_STD_REQUIRED", PyInt_FromLong(0x000F0000));
1843 PyModule_AddObject(m, "SEC_ADS_CREATE_CHILD", PyInt_FromLong(0x00000001));
1844 PyModule_AddObject(m, "SEC_RIGHTS_DIR_EXECUTE", PyInt_FromLong(SEC_RIGHTS_FILE_EXECUTE));
1845 PyModule_AddObject(m, "BUILTIN_RID_REPLICATOR", PyInt_FromLong(552));
1846 PyModule_AddObject(m, "SEC_ADS_WRITE_PROP", PyInt_FromLong(0x00000020));
1847 PyModule_AddObject(m, "SID_NT_DIGEST_AUTHENTICATION", PyString_FromString("S-1-5-64-21"));
1848 PyModule_AddObject(m, "SEC_DIR_READ_ATTRIBUTE", PyInt_FromLong(0x00000080));
1849 PyModule_AddObject(m, "SEC_DESC_SACL_PRESENT", PyInt_FromLong(SEC_DESC_SACL_PRESENT));
1850 PyModule_AddObject(m, "SECURITY_ACL_REVISION_ADS", PyInt_FromLong(SECURITY_ACL_REVISION_ADS));
1851 PyModule_AddObject(m, "SEC_PRIV_IMPERSONATE_BIT", PyLong_FromLongLong(SEC_PRIV_IMPERSONATE_BIT));
1852 PyModule_AddObject(m, "SEC_RIGHTS_PRIV_BACKUP", PyInt_FromLong(SEC_STD_READ_CONTROL|SEC_FLAG_SYSTEM_SECURITY|SEC_GENERIC_READ));
1853 PyModule_AddObject(m, "SEC_DESC_SACL_AUTO_INHERIT_REQ", PyInt_FromLong(SEC_DESC_SACL_AUTO_INHERIT_REQ));
1854 PyModule_AddObject(m, "SEC_MASK_INVALID", PyInt_FromLong(0x0ce0fe00));
1855 PyModule_AddObject(m, "SEC_PRIV_TAKE_OWNERSHIP_BIT", PyLong_FromLongLong(SEC_PRIV_TAKE_OWNERSHIP_BIT));
1856 PyModule_AddObject(m, "SEC_PRIV_SYSTEM_ENVIRONMENT_BIT", PyLong_FromLongLong(SEC_PRIV_SYSTEM_ENVIRONMENT_BIT));
1857 PyModule_AddObject(m, "BUILTIN_RID_PERFLOG_USERS", PyInt_FromLong(559));
1858 PyModule_AddObject(m, "SID_BUILTIN_SERVER_OPERATORS", PyString_FromString("S-1-5-32-549"));
1859 PyModule_AddObject(m, "SEC_PRIV_SYSTEMTIME", PyInt_FromLong(SEC_PRIV_SYSTEMTIME));
1860 PyModule_AddObject(m, "SID_NT_NTLM_AUTHENTICATION", PyString_FromString("S-1-5-64-10"));
1861 PyModule_AddObject(m, "BUILTIN_RID_REMOTE_DESKTOP_USERS", PyInt_FromLong(555));
1862 PyModule_AddObject(m, "SID_CREATOR_OWNER_DOMAIN", PyString_FromString("S-1-3"));
1863 PyModule_AddObject(m, "SECURITY_DESCRIPTOR_REVISION_1", PyInt_FromLong(SECURITY_DESCRIPTOR_REVISION_1));
1864 PyModule_AddObject(m, "DOMAIN_RID_READONLY_DCS", PyInt_FromLong(521));
1865 PyModule_AddObject(m, "BUILTIN_RID_ADMINISTRATORS", PyInt_FromLong(544));
1866 PyModule_AddObject(m, "SEC_REG_NOTIFY", PyInt_FromLong(0x00000010));
1867 PyModule_AddObject(m, "SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT", PyInt_FromLong(SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT));
1868 PyModule_AddObject(m, "SEC_ACE_TYPE_ACCESS_ALLOWED", PyInt_FromLong(SEC_ACE_TYPE_ACCESS_ALLOWED));
1869 PyModule_AddObject(m, "SEC_DIR_TRAVERSE", PyInt_FromLong(0x00000020));
1870 PyModule_AddObject(m, "SEC_DESC_DACL_AUTO_INHERIT_REQ", PyInt_FromLong(SEC_DESC_DACL_AUTO_INHERIT_REQ));
1871 PyModule_AddObject(m, "SEC_PRIV_BACKUP", PyInt_FromLong(SEC_PRIV_BACKUP));
1872 PyModule_AddObject(m, "SID_NT_TERMINAL_SERVER_USERS", PyString_FromString("S-1-5-13"));
1873 PyModule_AddObject(m, "SID_NT_ENTERPRISE_DCS", PyString_FromString("S-1-5-9"));
1874 PyModule_AddObject(m, "SEC_PRIV_SYSTEM_PROFILE_BIT", PyLong_FromLongLong(SEC_PRIV_SYSTEM_PROFILE_BIT));
1875 PyModule_AddObject(m, "SECINFO_PROTECTED_DACL", PyInt_FromLong(SECINFO_PROTECTED_DACL));
1876 PyModule_AddObject(m, "GUID_DRS_GET_ALL_CHANGES", PyString_FromString("1131f6ad-9c07-11d1-f79f-00c04fc2dcd2"));
1877 PyModule_AddObject(m, "SID_BUILTIN_REMOTE_DESKTOP_USERS", PyString_FromString("S-1-5-32-555"));
1878 PyModule_AddObject(m, "KERB_ENCTYPE_RC4_HMAC_MD5", PyInt_FromLong(KERB_ENCTYPE_RC4_HMAC_MD5));
1879 PyModule_AddObject(m, "KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96", PyInt_FromLong(KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96));
1880 PyModule_AddObject(m, "GUID_DRS_RO_REPL_SECRET_SYNC", PyString_FromString("1131f6ae-9c07-11d1-f79f-00c04fc2dcd2"));
1881 PyModule_AddObject(m, "SEC_ADS_LIST_OBJECT", PyInt_FromLong(0x00000080));
1882 PyModule_AddObject(m, "SEC_PRIV_DEBUG_BIT", PyLong_FromLongLong(SEC_PRIV_DEBUG_BIT));
1883 PyModule_AddObject(m, "SEC_PRIV_PROFILE_SINGLE_PROCESS", PyInt_FromLong(SEC_PRIV_PROFILE_SINGLE_PROCESS));
1884 PyModule_AddObject(m, "SEC_DIR_DELETE_CHILD", PyInt_FromLong(0x00000040));
1885 PyModule_AddObject(m, "GUID_DRS_FORCE_CHANGE_PASSWORD", PyString_FromString("00299570-246d-11d0-a768-00aa006e0529"));
1886 PyModule_AddObject(m, "SEC_ACE_TYPE_SYSTEM_AUDIT", PyInt_FromLong(SEC_ACE_TYPE_SYSTEM_AUDIT));
1887 PyModule_AddObject(m, "SEC_FILE_READ_ATTRIBUTE", PyInt_FromLong(0x00000080));
1888 PyModule_AddObject(m, "SEC_ACE_FLAG_NO_PROPAGATE_INHERIT", PyInt_FromLong(SEC_ACE_FLAG_NO_PROPAGATE_INHERIT));
1889 PyModule_AddObject(m, "BUILTIN_RID_ACCOUNT_OPERATORS", PyInt_FromLong(548));
1890 PyModule_AddObject(m, "SEC_RIGHTS_FILE_EXECUTE", PyInt_FromLong(SEC_STD_SYNCHRONIZE|SEC_STD_READ_CONTROL|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_EXECUTE));
1891 PyModule_AddObject(m, "SECURITY_ACL_REVISION_NT4", PyInt_FromLong(SECURITY_ACL_REVISION_NT4));
1892 PyModule_AddObject(m, "SEC_MASK_STANDARD", PyInt_FromLong(0x00FF0000));
1893 PyModule_AddObject(m, "SEC_ACE_FLAG_SUCCESSFUL_ACCESS", PyInt_FromLong(SEC_ACE_FLAG_SUCCESSFUL_ACCESS));
1894 PyModule_AddObject(m, "SEC_PRIV_INCREASE_BASE_PRIORITY_BIT", PyLong_FromLongLong(SEC_PRIV_INCREASE_BASE_PRIORITY_BIT));
1895 PyModule_AddObject(m, "SID_NT_TRUSTED_INSTALLER", PyString_FromString("S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464"));
1896 PyModule_AddObject(m, "DOMAIN_RID_ADMINS", PyInt_FromLong(512));
1897 PyModule_AddObject(m, "SEC_ACE_FLAG_FAILED_ACCESS", PyInt_FromLong(SEC_ACE_FLAG_FAILED_ACCESS));
1898 PyModule_AddObject(m, "SEC_DACL_AUTO_INHERIT", PyInt_FromLong(SEC_DACL_AUTO_INHERIT));
1899 PyModule_AddObject(m, "SEC_ADS_LIST", PyInt_FromLong(0x00000004));
1900 PyModule_AddObject(m, "DOMAIN_RID_GUESTS", PyInt_FromLong(514));
1901 PyModule_AddObject(m, "KERB_ENCTYPE_DES_CBC_CRC", PyInt_FromLong(KERB_ENCTYPE_DES_CBC_CRC));
1902 PyModule_AddObject(m, "SEC_PRIV_INVALID", PyInt_FromLong(SEC_PRIV_INVALID));
1903 PyModule_AddObject(m, "STANDARD_RIGHTS_REQUIRED_ACCESS", PyInt_FromLong((SEC_STD_DELETE|SEC_STD_READ_CONTROL|SEC_STD_WRITE_DAC|SEC_STD_WRITE_OWNER)));
1904 PyModule_AddObject(m, "LSA_POLICY_MODE_DENY_NETWORK", PyInt_FromLong(LSA_POLICY_MODE_DENY_NETWORK));
1905 PyModule_AddObject(m, "SEC_FILE_WRITE_ATTRIBUTE", PyInt_FromLong(0x00000100));
1906 PyModule_AddObject(m, "SEC_PRIV_ADD_USERS", PyInt_FromLong(SEC_PRIV_ADD_USERS));
1907 PyModule_AddObject(m, "DOMAIN_RID_GUEST", PyInt_FromLong(501));
1908 PyModule_AddObject(m, "BUILTIN_RID_AUTH_ACCESS", PyInt_FromLong(560));
1909 PyModule_AddObject(m, "SEC_PRIV_REMOTE_SHUTDOWN_BIT", PyLong_FromLongLong(SEC_PRIV_REMOTE_SHUTDOWN_BIT));
1910 PyModule_AddObject(m, "SEC_PRIV_MANAGE_VOLUME", PyInt_FromLong(SEC_PRIV_MANAGE_VOLUME));
1911 PyModule_AddObject(m, "SECINFO_UNPROTECTED_DACL", PyInt_FromLong(SECINFO_UNPROTECTED_DACL));
1912 PyModule_AddObject(m, "SEC_REG_QUERY_VALUE", PyInt_FromLong(0x00000001));
1913 PyModule_AddObject(m, "SID_NT_PROXY", PyString_FromString("S-1-5-8"));
1914 PyModule_AddObject(m, "SEC_PRIV_TAKE_OWNERSHIP", PyInt_FromLong(SEC_PRIV_TAKE_OWNERSHIP));
1915 PyModule_AddObject(m, "BUILTIN_RID_TS_LICENSE_SERVERS", PyInt_FromLong(561));
1916 PyModule_AddObject(m, "SECINFO_OWNER", PyInt_FromLong(SECINFO_OWNER));
1917 PyModule_AddObject(m, "SEC_PRIV_CREATE_GLOBAL_BIT", PyLong_FromLongLong(SEC_PRIV_CREATE_GLOBAL_BIT));
1918 PyModule_AddObject(m, "SEC_PRIV_SHUTDOWN_BIT", PyLong_FromLongLong(SEC_PRIV_SHUTDOWN_BIT));
1919 PyModule_AddObject(m, "SEC_ADS_GENERIC_ALL", PyInt_FromLong((SEC_ADS_GENERIC_EXECUTE|SEC_ADS_GENERIC_WRITE|SEC_ADS_GENERIC_READ|SEC_ADS_GENERIC_ALL_DS)));
1920 PyModule_AddObject(m, "NAME_WORLD", PyString_FromString("WORLD"));
1921 PyModule_AddObject(m, "SEC_DEFAULT_DESCRIPTOR", PyInt_FromLong(SEC_DEFAULT_DESCRIPTOR));
1922 PyModule_AddObject(m, "SEC_ACE_FLAG_INHERITED_ACE", PyInt_FromLong(SEC_ACE_FLAG_INHERITED_ACE));
1923 PyModule_AddObject(m, "SEC_PRIV_DISK_OPERATOR", PyInt_FromLong(SEC_PRIV_DISK_OPERATOR));
1924 PyModule_AddObject(m, "SEC_PRIV_SYSTEM_PROFILE", PyInt_FromLong(SEC_PRIV_SYSTEM_PROFILE));
1925 PyModule_AddObject(m, "SEC_FILE_EXECUTE", PyInt_FromLong(0x00000020));
1926 PyModule_AddObject(m, "SID_NT_AUTHORITY", PyString_FromString("S-1-5"));
1927 PyModule_AddObject(m, "SEC_DIR_ADD_SUBDIR", PyInt_FromLong(0x00000004));
1928 PyModule_AddObject(m, "SID_BUILTIN_PERFMON_USERS", PyString_FromString("S-1-5-32-558"));
1929 PyModule_AddObject(m, "DOMAIN_RID_POLICY_ADMINS", PyInt_FromLong(520));
1930 PyModule_AddObject(m, "BUILTIN_RID_PRINT_OPERATORS", PyInt_FromLong(550));
1931 PyModule_AddObject(m, "SID_NULL", PyString_FromString("S-1-0-0"));
1932 PyModule_AddObject(m, "SID_NT_SCHANNEL_AUTHENTICATION", PyString_FromString("S-1-5-64-14"));
1933 PyModule_AddObject(m, "SEC_PRIV_LOAD_DRIVER_BIT", PyLong_FromLongLong(SEC_PRIV_LOAD_DRIVER_BIT));
1934 PyModule_AddObject(m, "SID_BUILTIN_AUTH_ACCESS", PyString_FromString("S-1-5-32-560"));
1935 PyModule_AddObject(m, "SEC_FILE_WRITE_EA", PyInt_FromLong(0x00000010));
1936 PyModule_AddObject(m, "SEC_DIR_LIST", PyInt_FromLong(0x00000001));
1937 PyModule_AddObject(m, "SD_REVISION", PyInt_FromLong(SECURITY_DESCRIPTOR_REVISION_1));
1938 PyModule_AddObject(m, "GUID_DRS_CHANGE_SCHEMA_MASTER", PyString_FromString("e12b56b6-0a95-11d1-adbb-00c04fd8d5cd"));
1939 PyModule_AddObject(m, "SEC_FILE_ALL", PyInt_FromLong(0x000001ff));
1940 PyModule_AddObject(m, "SEC_ADS_GENERIC_EXECUTE", PyInt_FromLong(SEC_STD_READ_CONTROL|SEC_ADS_LIST));
1941 PyModule_AddObject(m, "DOMAIN_RID_ENTERPRISE_ADMINS", PyInt_FromLong(519));
1942 PyModule_AddObject(m, "SEC_MASK_SPECIFIC", PyInt_FromLong(0x0000FFFF));
1943 PyModule_AddObject(m, "DOMAIN_RID_CERT_ADMINS", PyInt_FromLong(517));
1944 PyModule_AddObject(m, "SEC_PRIV_CREATE_PAGEFILE", PyInt_FromLong(SEC_PRIV_CREATE_PAGEFILE));
1945 PyModule_AddObject(m, "SEC_RIGHTS_DIR_READ", PyInt_FromLong(SEC_RIGHTS_FILE_READ));
1946 PyModule_AddObject(m, "SEC_DESC_DACL_PROTECTED", PyInt_FromLong(SEC_DESC_DACL_PROTECTED));
1947 PyModule_AddObject(m, "SEC_DESC_SACL_AUTO_INHERITED", PyInt_FromLong(SEC_DESC_SACL_AUTO_INHERITED));
1948 PyModule_AddObject(m, "SEC_ADS_GENERIC_READ", PyInt_FromLong((SEC_STD_READ_CONTROL|SEC_ADS_LIST|SEC_ADS_READ_PROP|SEC_ADS_LIST_OBJECT)));
1949 PyModule_AddObject(m, "SID_NT_IUSR", PyString_FromString("S-1-5-17"));
1950 PyModule_AddObject(m, "SID_NT_BATCH", PyString_FromString("S-1-5-3"));
1951 PyModule_AddObject(m, "SID_BUILTIN_PRINT_OPERATORS", PyString_FromString("S-1-5-32-550"));
1952 PyModule_AddObject(m, "SEC_OWNER_FROM_PARENT", PyInt_FromLong(SEC_OWNER_FROM_PARENT));
1953 PyModule_AddObject(m, "DOMAIN_RID_RAS_SERVERS", PyInt_FromLong(553));
1954 PyModule_AddObject(m, "SEC_DESC_OWNER_DEFAULTED", PyInt_FromLong(SEC_DESC_OWNER_DEFAULTED));
1955 PyModule_AddObject(m, "SEC_ACE_TYPE_ALLOWED_COMPOUND", PyInt_FromLong(SEC_ACE_TYPE_ALLOWED_COMPOUND));
1956 PyModule_AddObject(m, "SEC_STD_WRITE_OWNER", PyInt_FromLong(0x00080000));
1957 PyModule_AddObject(m, "SECINFO_SACL", PyInt_FromLong(SECINFO_SACL));
1958 PyModule_AddObject(m, "SEC_STD_DELETE", PyInt_FromLong(0x00010000));
1959 PyModule_AddObject(m, "SEC_DESC_SACL_PROTECTED", PyInt_FromLong(SEC_DESC_SACL_PROTECTED));
1960 PyModule_AddObject(m, "SEC_DIR_WRITE_ATTRIBUTE", PyInt_FromLong(0x00000100));
1961 PyModule_AddObject(m, "SID_NT_NETWORK_SERVICE", PyString_FromString("S-1-5-20"));
1962 PyModule_AddObject(m, "SEC_ACE_OBJECT_TYPE_PRESENT", PyInt_FromLong(SEC_ACE_OBJECT_TYPE_PRESENT));
1963 PyModule_AddObject(m, "LSA_POLICY_MODE_INTERACTIVE", PyInt_FromLong(LSA_POLICY_MODE_INTERACTIVE));
1964 PyModule_AddObject(m, "GUID_DRS_DNS_HOST_NAME", PyString_FromString("72e39547-7b18-11d1-adef-00c04fd8d5cd"));
1965 PyModule_AddObject(m, "SEC_PRIV_MANAGE_VOLUME_BIT", PyLong_FromLongLong(SEC_PRIV_MANAGE_VOLUME_BIT));
1966 PyModule_AddObject(m, "KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96", PyInt_FromLong(KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96));
1967 PyModule_AddObject(m, "BUILTIN_RID_PERFMON_USERS", PyInt_FromLong(558));
1968 PyModule_AddObject(m, "SEC_PRIV_CHANGE_NOTIFY_BIT", PyLong_FromLongLong(SEC_PRIV_CHANGE_NOTIFY_BIT));
1969 PyModule_AddObject(m, "BUILTIN_RID_NETWORK_CONF_OPERATORS", PyInt_FromLong(556));
1970 PyModule_AddObject(m, "SID_BUILTIN_GUESTS", PyString_FromString("S-1-5-32-546"));
1971 PyModule_AddObject(m, "SEC_ADS_READ_PROP", PyInt_FromLong(0x00000010));
1972 PyModule_AddObject(m, "SEC_STD_SYNCHRONIZE", PyInt_FromLong(0x00100000));
1973 PyModule_AddObject(m, "SEC_FILE_WRITE_DATA", PyInt_FromLong(0x00000002));
1974 PyModule_AddObject(m, "STANDARD_RIGHTS_ALL_ACCESS", PyInt_FromLong(SEC_STD_ALL));
1975 PyModule_AddObject(m, "SEC_STD_ALL", PyInt_FromLong(0x001F0000));
1976 PyModule_AddObject(m, "SEC_ADS_GENERIC_ALL_DS", PyInt_FromLong((SEC_STD_DELETE|SEC_STD_WRITE_DAC|SEC_STD_WRITE_OWNER|SEC_ADS_CREATE_CHILD|SEC_ADS_DELETE_CHILD|SEC_ADS_DELETE_TREE|SEC_ADS_CONTROL_ACCESS)));
1977 PyModule_AddObject(m, "DOMAIN_RID_ADMINISTRATOR", PyInt_FromLong(500));
1978 PyModule_AddObject(m, "GUID_DRS_SELF_MEMBERSHIP", PyString_FromString("bf9679c0-0de6-11d0-a285-00aa003049e2"));
1979 PyModule_AddObject(m, "SEC_ADS_GENERIC_WRITE", PyInt_FromLong((SEC_STD_READ_CONTROL|SEC_ADS_SELF_WRITE|SEC_ADS_WRITE_PROP)));
1980 PyModule_AddObject(m, "SEC_PRIV_RESTORE_BIT", PyLong_FromLongLong(SEC_PRIV_RESTORE_BIT));
1981 PyModule_AddObject(m, "SEC_RIGHTS_PRIV_RESTORE", PyInt_FromLong(SEC_STD_WRITE_DAC|SEC_STD_WRITE_OWNER|SEC_FLAG_SYSTEM_SECURITY|SEC_STD_DELETE));
1982 PyModule_AddObject(m, "SEC_DESC_DACL_DEFAULTED", PyInt_FromLong(SEC_DESC_DACL_DEFAULTED));
1983 PyModule_AddObject(m, "LSA_POLICY_MODE_DENY_BATCH", PyInt_FromLong(LSA_POLICY_MODE_DENY_BATCH));
1984 PyModule_AddObject(m, "SEC_PRIV_SYSTEM_ENVIRONMENT", PyInt_FromLong(SEC_PRIV_SYSTEM_ENVIRONMENT));
1985 PyModule_AddObject(m, "SEC_PRIV_PRINT_OPERATOR_BIT", PyLong_FromLongLong(SEC_PRIV_PRINT_OPERATOR_BIT));
1986 PyModule_AddObject(m, "SEC_ACE_FLAG_OBJECT_INHERIT", PyInt_FromLong(SEC_ACE_FLAG_OBJECT_INHERIT));
1987 PyModule_AddObject(m, "SID_BUILTIN_REPLICATOR", PyString_FromString("S-1-5-32-552"));
1988 PyModule_AddObject(m, "SID_BUILTIN_TS_LICENSE_SERVERS", PyString_FromString("S-1-5-32-561"));
1989 PyModule_AddObject(m, "SEC_PRIV_UNDOCK_BIT", PyLong_FromLongLong(SEC_PRIV_UNDOCK_BIT));
1990 PyModule_AddObject(m, "SID_NT_SERVICE", PyString_FromString("S-1-5-6"));
1991 PyModule_AddObject(m, "SID_BUILTIN_RAS_SERVERS", PyString_FromString("S-1-5-32-553"));
1992 PyModule_AddObject(m, "GUID_DRS_VALIDATE_SPN", PyString_FromString("f3a64788-5306-11d1-a9c5-0000f80367c1"));
1993 PyModule_AddObject(m, "SID_NT_DIALUP", PyString_FromString("S-1-5-1"));
1994 PyModule_AddObject(m, "BUILTIN_RID_BACKUP_OPERATORS", PyInt_FromLong(551));
1995 PyModule_AddObject(m, "SEC_RIGHTS_FILE_READ", PyInt_FromLong(SEC_STD_READ_CONTROL|SEC_STD_SYNCHRONIZE|SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_READ_EA));
1996 PyModule_AddObject(m, "SEC_PRIV_BACKUP_BIT", PyLong_FromLongLong(SEC_PRIV_BACKUP_BIT));
1997 PyModule_AddObject(m, "SEC_PRIV_CREATE_PAGEFILE_BIT", PyLong_FromLongLong(SEC_PRIV_CREATE_PAGEFILE_BIT));
1998 PyModule_AddObject(m, "SEC_PRIV_REMOTE_SHUTDOWN", PyInt_FromLong(SEC_PRIV_REMOTE_SHUTDOWN));
1999 PyModule_AddObject(m, "STANDARD_RIGHTS_EXECUTE_ACCESS", PyInt_FromLong(SEC_STD_READ_CONTROL));
2000 PyModule_AddObject(m, "SEC_RIGHTS_DIR_PRIV_BACKUP", PyInt_FromLong(SEC_RIGHTS_PRIV_BACKUP|SEC_DIR_TRAVERSE));
2001 PyModule_AddObject(m, "BUILTIN_RID_PRE_2K_ACCESS", PyInt_FromLong(554));
2002 PyModule_AddObject(m, "SEC_PRIV_CREATE_GLOBAL", PyInt_FromLong(SEC_PRIV_CREATE_GLOBAL));
2003 PyModule_AddObject(m, "KERB_ENCTYPE_DES_CBC_MD5", PyInt_FromLong(KERB_ENCTYPE_DES_CBC_MD5));
2004 PyModule_AddObject(m, "GUID_DRS_GET_FILTERED_ATTRIBUTES", PyString_FromString("89e95b76-444d-4c62-991a-0facbeda640c"));
2005 PyModule_AddObject(m, "BUILTIN_RID_RAS_SERVERS", PyInt_FromLong(553));
2006 PyModule_AddObject(m, "DOMAIN_RID_RODC_ALLOW", PyInt_FromLong(571));
2007 PyModule_AddObject(m, "SEC_ADS_DELETE_CHILD", PyInt_FromLong(0x00000002));
2008 PyModule_AddObject(m, "LSA_POLICY_MODE_DENY_REMOTE_INTERACTIVE", PyInt_FromLong(LSA_POLICY_MODE_DENY_REMOTE_INTERACTIVE));
2009 PyModule_AddObject(m, "SEC_DIR_ADD_FILE", PyInt_FromLong(0x00000002));
2010 PyModule_AddObject(m, "SEC_RIGHTS_DIR_WRITE", PyInt_FromLong(SEC_RIGHTS_FILE_WRITE));
2011 PyModule_AddObject(m, "LSA_POLICY_MODE_DENY_INTERACTIVE", PyInt_FromLong(LSA_POLICY_MODE_DENY_INTERACTIVE));
2012 PyModule_AddObject(m, "SEC_GENERIC_WRITE", PyInt_FromLong(0x40000000));
2013 PyModule_AddObject(m, "SEC_GENERIC_ALL", PyInt_FromLong(0x10000000));
2014 PyModule_AddObject(m, "SID_NT_SELF", PyString_FromString("S-1-5-10"));
2015 PyModule_AddObject(m, "DOMAIN_RID_DOMAIN_MEMBERS", PyInt_FromLong(515));
2016 PyModule_AddObject(m, "LSA_POLICY_MODE_SERVICE", PyInt_FromLong(LSA_POLICY_MODE_SERVICE));
2017 PyModule_AddObject(m, "SEC_ACE_FLAG_CONTAINER_INHERIT", PyInt_FromLong(SEC_ACE_FLAG_CONTAINER_INHERIT));
2018 PyModule_AddObject(m, "SEC_PRIV_DISK_OPERATOR_BIT", PyLong_FromLongLong(SEC_PRIV_DISK_OPERATOR_BIT));
2019 PyModule_AddObject(m, "GUID_DRS_MANAGE_TOPOLOGY", PyString_FromString("1131f6ac-9c07-11d1-f79f-00c04fc2dcd2"));
2020 PyModule_AddObject(m, "NAME_NT_SERVICE", PyString_FromString("NT SERVICE"));
2021 PyModule_AddObject(m, "SEC_DIR_READ_EA", PyInt_FromLong(0x00000008));
2022 PyModule_AddObject(m, "SID_CREATOR_OWNER", PyString_FromString("S-1-3-0"));
2023 PyModule_AddObject(m, "SEC_PRIV_ADD_USERS_BIT", PyLong_FromLongLong(SEC_PRIV_ADD_USERS_BIT));
2024 PyModule_AddObject(m, "SID_NT_SYSTEM", PyString_FromString("S-1-5-18"));
2025 PyModule_AddObject(m, "SEC_PRIV_SECURITY_BIT", PyLong_FromLongLong(SEC_PRIV_SECURITY_BIT));
2026 PyModule_AddObject(m, "NAME_BUILTIN", PyString_FromString("BUILTIN"));
2027 PyModule_AddObject(m, "SECINFO_UNPROTECTED_SACL", PyInt_FromLong(SECINFO_UNPROTECTED_SACL));
2028 PyModule_AddObject(m, "SECINFO_DACL", PyInt_FromLong(SECINFO_DACL));
2029 PyModule_AddObject(m, "SECINFO_GROUP", PyInt_FromLong(SECINFO_GROUP));
2030 PyModule_AddObject(m, "NT4_ACL_REVISION", PyInt_FromLong(SECURITY_ACL_REVISION_NT4));
2031 PyModule_AddObject(m, "LSA_POLICY_MODE_DENY_SERVICE", PyInt_FromLong(LSA_POLICY_MODE_DENY_SERVICE));
2032 PyModule_AddObject(m, "SEC_REG_CREATE_LINK", PyInt_FromLong(0x00000020));
2033 PyModule_AddObject(m, "LSA_POLICY_MODE_REMOTE_INTERACTIVE", PyInt_FromLong(LSA_POLICY_MODE_REMOTE_INTERACTIVE));
2034 PyModule_AddObject(m, "SEC_PRIV_INCREASE_QUOTA_BIT", PyLong_FromLongLong(SEC_PRIV_INCREASE_QUOTA_BIT));
2035 PyModule_AddObject(m, "SEC_REG_CREATE_SUBKEY", PyInt_FromLong(0x00000004));
2036 PyModule_AddObject(m, "SEC_DESC_RM_CONTROL_VALID", PyInt_FromLong(SEC_DESC_RM_CONTROL_VALID));
2037 PyModule_AddObject(m, "SEC_FILE_READ_DATA", PyInt_FromLong(0x00000001));
2038 PyModule_AddObject(m, "LSA_POLICY_MODE_ALL_NT4", PyInt_FromLong(LSA_POLICY_MODE_ALL_NT4));
2039 PyModule_AddObject(m, "GUID_DRS_ALLOCATE_RIDS", PyString_FromString("1abd7cf8-0a99-11d1-adbb-00c04fd8d5cd"));
2040 PyModule_AddObject(m, "SECINFO_PROTECTED_SACL", PyInt_FromLong(SECINFO_PROTECTED_SACL));
2041 PyModule_AddObject(m, "SEC_DESC_SACL_DEFAULTED", PyInt_FromLong(SEC_DESC_SACL_DEFAULTED));
2042 PyModule_AddObject(m, "SEC_PRIV_PRINT_OPERATOR", PyInt_FromLong(SEC_PRIV_PRINT_OPERATOR));
2043 PyModule_AddObject(m, "SEC_DESC_DACL_TRUSTED", PyInt_FromLong(SEC_DESC_DACL_TRUSTED));
2044 PyModule_AddObject(m, "GUID_DRS_GET_CHANGES", PyString_FromString("1131f6aa-9c07-11d1-f79f-00c04fc2dcd2"));
2045 PyModule_AddObject(m, "SEC_DESC_SELF_RELATIVE", PyInt_FromLong(SEC_DESC_SELF_RELATIVE));
2046 PyModule_AddObject(m, "SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT", PyInt_FromLong(SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT));
2047 PyModule_AddObject(m, "SEC_ACE_FLAG_VALID_INHERIT", PyInt_FromLong(SEC_ACE_FLAG_VALID_INHERIT));
2048 PyModule_AddObject(m, "SEC_RIGHTS_DIR_ALL", PyInt_FromLong(SEC_RIGHTS_FILE_ALL));
2049 PyModule_AddObject(m, "GUID_DRS_CHANGE_PDC", PyString_FromString("bae50096-4752-11d1-9052-00c04fc2d4cf"));
2050 PyModule_AddObject(m, "SEC_PRIV_MACHINE_ACCOUNT", PyInt_FromLong(SEC_PRIV_MACHINE_ACCOUNT));
2051 PyModule_AddObject(m, "SID_NT_RESTRICTED", PyString_FromString("S-1-5-12"));
2052 PyModule_AddObject(m, "SEC_DESC_GROUP_DEFAULTED", PyInt_FromLong(SEC_DESC_GROUP_DEFAULTED));
2053 PyModule_AddObject(m, "SEC_PRIV_CHANGE_NOTIFY", PyInt_FromLong(SEC_PRIV_CHANGE_NOTIFY));
2054 PyModule_AddObject(m, "GUID_DRS_ADD_DNS_HOST_NAME", PyString_FromString("80863791-dbe9-4eb8-837e-7f0ab55d9ac7"));
2055 PyModule_AddObject(m, "SEC_PRIV_SYSTEMTIME_BIT", PyLong_FromLongLong(SEC_PRIV_SYSTEMTIME_BIT));
2056 PyModule_AddObject(m, "SEC_DESC_DACL_PRESENT", PyInt_FromLong(SEC_DESC_DACL_PRESENT));
2057 PyModule_AddObject(m, "SID_NT_NT_SERVICE", PyString_FromString("S-1-5-80"));
2058 PyModule_AddObject(m, "SID_BUILTIN_PERFLOG_USERS", PyString_FromString("S-1-5-32-559"));
2059 PyModule_AddObject(m, "GUID_DRS_BEHAVIOR_VERSION", PyString_FromString("d31a8757-2447-4545-8081-3bb610cacbf2"));
2060 PyModule_AddObject(m, "SID_NT_INTERACTIVE", PyString_FromString("S-1-5-4"));
2061 PyModule_AddObject(m, "SID_BUILTIN_POWER_USERS", PyString_FromString("S-1-5-32-547"));
2062 PyModule_AddObject(m, "SEC_PRIV_INCREASE_BASE_PRIORITY", PyInt_FromLong(SEC_PRIV_INCREASE_BASE_PRIORITY));
2063 PyModule_AddObject(m, "SEC_FILE_READ_EA", PyInt_FromLong(0x00000008));
2064 PyModule_AddObject(m, "SID_WORLD_DOMAIN", PyString_FromString("S-1-1"));
2065 PyModule_AddObject(m, "SEC_ADS_SELF_WRITE", PyInt_FromLong(0x00000008));
2066 PyModule_AddObject(m, "SEC_PRIV_LOAD_DRIVER", PyInt_FromLong(SEC_PRIV_LOAD_DRIVER));
2067 PyModule_AddObject(m, "SEC_SACL_AUTO_INHERIT", PyInt_FromLong(SEC_SACL_AUTO_INHERIT));
2068 PyModule_AddObject(m, "SID_BUILTIN_INCOMING_FOREST_TRUST", PyString_FromString("S-1-5-32-557"));
2069 PyModule_AddObject(m, "SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT", PyInt_FromLong(SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT));
2070 PyModule_AddObject(m, "SEC_PRIV_ENABLE_DELEGATION", PyInt_FromLong(SEC_PRIV_ENABLE_DELEGATION));
2071 PyModule_AddObject(m, "SID_CREATOR_GROUP", PyString_FromString("S-1-3-1"));
2072 PyModule_AddObject(m, "DOMAIN_RID_DCS", PyInt_FromLong(516));
2073 PyModule_AddObject(m, "SEC_PRIV_MACHINE_ACCOUNT_BIT", PyLong_FromLongLong(SEC_PRIV_MACHINE_ACCOUNT_BIT));
2074 PyModule_AddObject(m, "SEC_PRIV_PROFILE_SINGLE_PROCESS_BIT", PyLong_FromLongLong(SEC_PRIV_PROFILE_SINGLE_PROCESS_BIT));
2075 PyModule_AddObject(m, "LSA_POLICY_MODE_BATCH", PyInt_FromLong(LSA_POLICY_MODE_BATCH));
2076 PyModule_AddObject(m, "SID_NT_AUTHENTICATED_USERS", PyString_FromString("S-1-5-11"));
2077 PyModule_AddObject(m, "SEC_PRIV_UNDOCK", PyInt_FromLong(SEC_PRIV_UNDOCK));
2078 PyModule_AddObject(m, "BUILTIN_RID_SERVER_OPERATORS", PyInt_FromLong(549));
2079 PyModule_AddObject(m, "SEC_REG_SET_VALUE", PyInt_FromLong(0x00000002));
2080 PyModule_AddObject(m, "SID_BUILTIN_ACCOUNT_OPERATORS", PyString_FromString("S-1-5-32-548"));
2081 PyModule_AddObject(m, "GUID_DRS_CHANGE_DOMAIN_MASTER", PyString_FromString("014bf69c-7b3b-11d1-85f6-08002be74fab"));
2082 PyModule_AddObject(m, "SEC_GENERIC_EXECUTE", PyInt_FromLong(0x20000000));
2083 PyModule_AddObject(m, "SEC_ADS_CONTROL_ACCESS", PyInt_FromLong(0x00000100));
2084 PyModule_AddObject(m, "BUILTIN_RID_POWER_USERS", PyInt_FromLong(547));
2085 PyModule_AddObject(m, "STANDARD_RIGHTS_WRITE_ACCESS", PyInt_FromLong((SEC_STD_WRITE_OWNER|SEC_STD_WRITE_DAC|SEC_STD_DELETE)));
2086 PyModule_AddObject(m, "STANDARD_RIGHTS_READ_ACCESS", PyInt_FromLong(SEC_STD_READ_CONTROL));
2087 PyModule_AddObject(m, "SEC_PRIV_INCREASE_QUOTA", PyInt_FromLong(SEC_PRIV_INCREASE_QUOTA));
2088 PyModule_AddObject(m, "LSA_POLICY_MODE_NETWORK", PyInt_FromLong(LSA_POLICY_MODE_NETWORK));
2089 PyModule_AddObject(m, "SEC_ACE_TYPE_SYSTEM_ALARM", PyInt_FromLong(SEC_ACE_TYPE_SYSTEM_ALARM));
2090 PyModule_AddObject(m, "SEC_RIGHTS_DIR_PRIV_RESTORE", PyInt_FromLong(SEC_RIGHTS_PRIV_RESTORE|SEC_DIR_ADD_FILE|SEC_DIR_ADD_SUBDIR));
2091 PyModule_AddObject(m, "SEC_GROUP_FROM_PARENT", PyInt_FromLong(SEC_GROUP_FROM_PARENT));
2092 PyModule_AddObject(m, "DOMAIN_RID_LOGON", PyInt_FromLong(9));
2093 PyModule_AddObject(m, "SID_WORLD", PyString_FromString("S-1-1-0"));
2094 PyModule_AddObject(m, "SEC_STD_READ_CONTROL", PyInt_FromLong(0x00020000));
2095 PyModule_AddObject(m, "SEC_MASK_GENERIC", PyInt_FromLong(0xF0000000));
2096 PyModule_AddObject(m, "SEC_GENERIC_READ", PyInt_FromLong(0x80000000));
2097 PyModule_AddObject(m, "SEC_DIR_WRITE_EA", PyInt_FromLong(0x00000010));
2098 PyModule_AddObject(m, "DOMAIN_RID_SCHEMA_ADMINS", PyInt_FromLong(518));
2099 PyModule_AddObject(m, "SID_BUILTIN_USERS", PyString_FromString("S-1-5-32-545"));
2100 PyModule_AddObject(m, "LSA_POLICY_MODE_ALL", PyInt_FromLong(LSA_POLICY_MODE_ALL));
2101 PyModule_AddObject(m, "SEC_REG_ENUM_SUBKEYS", PyInt_FromLong(0x00000008));
2102 PyModule_AddObject(m, "SECINFO_LABEL", PyInt_FromLong(SECINFO_LABEL));
2103 PyModule_AddObject(m, "SEC_ACE_TYPE_ACCESS_DENIED_OBJECT", PyInt_FromLong(SEC_ACE_TYPE_ACCESS_DENIED_OBJECT));
2104 PyModule_AddObject(m, "GUID_DRS_MONITOR_TOPOLOGY", PyString_FromString("f98340fb-7c5b-4cdb-a00b-2ebdfa115a96"));
2105 PyModule_AddObject(m, "SEC_PRIV_IMPERSONATE", PyInt_FromLong(SEC_PRIV_IMPERSONATE));
2106 PyModule_AddObject(m, "SID_BUILTIN", PyString_FromString("S-1-5-32"));
2107 PyModule_AddObject(m, "SEC_PRIV_SECURITY", PyInt_FromLong(SEC_PRIV_SECURITY));
2108 PyModule_AddObject(m, "SEC_DESC_DACL_AUTO_INHERITED", PyInt_FromLong(SEC_DESC_DACL_AUTO_INHERITED));
2109 PyModule_AddObject(m, "SID_BUILTIN_BACKUP_OPERATORS", PyString_FromString("S-1-5-32-551"));
2110 PyModule_AddObject(m, "DOMAIN_RID_ENTERPRISE_READONLY_DCS", PyInt_FromLong(498));
2111 PyModule_AddObject(m, "STANDARD_RIGHTS_MODIFY_ACCESS", PyInt_FromLong(SEC_STD_READ_CONTROL));
2112 PyModule_AddObject(m, "SEC_MASK_FLAGS", PyInt_FromLong(0x0F000000));
2113 PyModule_AddObject(m, "SEC_ACE_TYPE_ACCESS_DENIED", PyInt_FromLong(SEC_ACE_TYPE_ACCESS_DENIED));
2114 PyModule_AddObject(m, "GUID_DRS_USER_CHANGE_PASSWORD", PyString_FromString("ab721a53-1e2f-11d0-9819-00aa0040529b"));
2115 PyModule_AddObject(m, "LSA_POLICY_MODE_PROXY", PyInt_FromLong(LSA_POLICY_MODE_PROXY));
2116 PyModule_AddObject(m, "SEC_PRIV_SHUTDOWN", PyInt_FromLong(SEC_PRIV_SHUTDOWN));
2117 PyModule_AddObject(m, "SID_NT_NETWORK", PyString_FromString("S-1-5-2"));
2118 PyModule_AddObject(m, "SEC_DESC_SERVER_SECURITY", PyInt_FromLong(SEC_DESC_SERVER_SECURITY));
2119 PyModule_AddObject(m, "BUILTIN_RID_USERS", PyInt_FromLong(545));
2120 PyModule_AddObject(m, "SID_NT_THIS_ORGANISATION", PyString_FromString("S-1-5-15"));
2121 PyModule_AddObject(m, "SEC_ADS_DELETE_TREE", PyInt_FromLong(0x00000040));
2122 PyModule_AddObject(m, "GUID_DRS_REPL_SYNCRONIZE", PyString_FromString("1131f6ab-9c07-11d1-f79f-00c04fc2dcd2"));
2123 Py_INCREF((PyObject *)(void *)&dom_sid_Type);
2124 PyModule_AddObject(m, "dom_sid", (PyObject *)(void *)&dom_sid_Type);
2125 Py_INCREF((PyObject *)(void *)&security_ace_object_Type);
2126 PyModule_AddObject(m, "ace_object", (PyObject *)(void *)&security_ace_object_Type);
2127 Py_INCREF((PyObject *)(void *)&security_ace_Type);
2128 PyModule_AddObject(m, "ace", (PyObject *)(void *)&security_ace_Type);
2129 Py_INCREF((PyObject *)(void *)&security_acl_Type);
2130 PyModule_AddObject(m, "acl", (PyObject *)(void *)&security_acl_Type);
2131 Py_INCREF((PyObject *)(void *)&security_descriptor_Type);
2132 PyModule_AddObject(m, "descriptor", (PyObject *)(void *)&security_descriptor_Type);
2133 Py_INCREF((PyObject *)(void *)&sec_desc_buf_Type);
2134 PyModule_AddObject(m, "sec_desc_buf", (PyObject *)(void *)&sec_desc_buf_Type);
2135 Py_INCREF((PyObject *)(void *)&security_token_Type);
2136 PyModule_AddObject(m, "token", (PyObject *)(void *)&security_token_Type);
2137 Py_INCREF((PyObject *)(void *)&security_unix_token_Type);
2138 PyModule_AddObject(m, "unix_token", (PyObject *)(void *)&security_unix_token_Type);
2139 Py_INCREF((PyObject *)(void *)&generic_mapping_Type);
2140 PyModule_AddObject(m, "generic_mapping", (PyObject *)(void *)&generic_mapping_Type);
2141 Py_INCREF((PyObject *)(void *)&standard_mapping_Type);
2142 PyModule_AddObject(m, "standard_mapping", (PyObject *)(void *)&standard_mapping_Type);
2143#ifdef PY_MOD_SECURITY_PATCH
2144 PY_MOD_SECURITY_PATCH(m);
2145#endif
2146
2147}
Note: See TracBrowser for help on using the repository browser.