Line data Source code
1 :
2 : /* Python wrapper functions auto-generated by pidl */
3 : #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
4 : #include "lib/replace/system/python.h"
5 : #include "python/py3compat.h"
6 : #include "includes.h"
7 : #include "python/modules.h"
8 : #include <pytalloc.h>
9 : #include "librpc/rpc/pyrpc.h"
10 : #include "librpc/rpc/pyrpc_util.h"
11 : #include "bin/default/librpc/gen_ndr/ndr_gmsa.h"
12 :
13 :
14 : /*
15 : * Suppress compiler warnings if the generated code does not call these
16 : * functions
17 : */
18 : #ifndef _MAYBE_UNUSED_
19 : #ifdef __has_attribute
20 : #if __has_attribute(unused)
21 : #define _MAYBE_UNUSED_ __attribute__ ((unused))
22 : #else
23 : #define _MAYBE_UNUSED_
24 : #endif
25 : #endif
26 : #endif
27 : /*
28 : * These functions are here to ensure they can be optimized out by
29 : * the compiler based on the constant input values
30 : */
31 :
32 88 : static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
33 : {
34 88 : switch (var_size) {
35 88 : case 8:
36 88 : return UINT64_MAX;
37 0 : case 4:
38 0 : return UINT32_MAX;
39 0 : case 2:
40 0 : return UINT16_MAX;
41 0 : case 1:
42 0 : return UINT8_MAX;
43 : }
44 :
45 0 : return 0;
46 : }
47 :
48 : static inline _MAYBE_UNUSED_ long long ndr_sizeof2intmax(size_t var_size)
49 : {
50 : switch (var_size) {
51 : case 8:
52 : return INT64_MAX;
53 : case 4:
54 : return INT32_MAX;
55 : case 2:
56 : return INT16_MAX;
57 : case 1:
58 : return INT8_MAX;
59 : }
60 :
61 : return 0;
62 : }
63 :
64 : static PyTypeObject MANAGEDPASSWORD_BLOB_PASSWORDS_Type;
65 : static PyTypeObject MANAGEDPASSWORD_BLOB_Type;
66 : static PyTypeObject gmsa_InterfaceType;
67 :
68 : static PyTypeObject *BaseObject_Type;
69 : static PyTypeObject *ClientConnection_Type;
70 : static PyTypeObject *ndr_syntax_id_Type;
71 :
72 116 : static PyObject *py_MANAGEDPASSWORD_BLOB_PASSWORDS_get_current(PyObject *obj, void *closure)
73 : {
74 116 : struct MANAGEDPASSWORD_BLOB_PASSWORDS *object = pytalloc_get_ptr(obj);
75 1 : PyObject *py_current;
76 116 : if (object->current == NULL) {
77 0 : Py_RETURN_NONE;
78 : }
79 116 : if (object->current == NULL) {
80 0 : py_current = Py_None;
81 0 : Py_INCREF(py_current);
82 : } else {
83 116 : py_current = PyBytes_FromUtf16StringOrNULL(object->current);
84 : }
85 116 : return py_current;
86 : }
87 :
88 45 : static int py_MANAGEDPASSWORD_BLOB_PASSWORDS_set_current(PyObject *py_obj, PyObject *value, void *closure)
89 : {
90 45 : struct MANAGEDPASSWORD_BLOB_PASSWORDS *object = pytalloc_get_ptr(py_obj);
91 45 : if (value == NULL) {
92 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->current");
93 0 : return -1;
94 : }
95 45 : if (value == Py_None) {
96 0 : object->current = NULL;
97 : } else {
98 45 : object->current = NULL;
99 : {
100 45 : unsigned char *str = NULL;
101 :
102 45 : str = PyUtf16String_FromBytes(
103 : pytalloc_get_mem_ctx(py_obj), value);
104 45 : if (str == NULL) {
105 0 : return -1;
106 : }
107 :
108 45 : object->current = str;
109 : }
110 : }
111 44 : return 0;
112 : }
113 :
114 42 : static PyObject *py_MANAGEDPASSWORD_BLOB_PASSWORDS_get_previous(PyObject *obj, void *closure)
115 : {
116 42 : struct MANAGEDPASSWORD_BLOB_PASSWORDS *object = pytalloc_get_ptr(obj);
117 1 : PyObject *py_previous;
118 42 : if (object->previous == NULL) {
119 18 : Py_RETURN_NONE;
120 : }
121 24 : if (object->previous == NULL) {
122 0 : py_previous = Py_None;
123 0 : Py_INCREF(py_previous);
124 : } else {
125 24 : py_previous = PyBytes_FromUtf16StringOrNULL(object->previous);
126 : }
127 24 : return py_previous;
128 : }
129 :
130 44 : static int py_MANAGEDPASSWORD_BLOB_PASSWORDS_set_previous(PyObject *py_obj, PyObject *value, void *closure)
131 : {
132 44 : struct MANAGEDPASSWORD_BLOB_PASSWORDS *object = pytalloc_get_ptr(py_obj);
133 44 : if (value == NULL) {
134 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->previous");
135 0 : return -1;
136 : }
137 44 : if (value == Py_None) {
138 20 : object->previous = NULL;
139 : } else {
140 24 : object->previous = NULL;
141 : {
142 24 : unsigned char *str = NULL;
143 :
144 24 : str = PyUtf16String_FromBytes(
145 : pytalloc_get_mem_ctx(py_obj), value);
146 24 : if (str == NULL) {
147 0 : return -1;
148 : }
149 :
150 24 : object->previous = str;
151 : }
152 : }
153 44 : return 0;
154 : }
155 :
156 42 : static PyObject *py_MANAGEDPASSWORD_BLOB_PASSWORDS_get_query_interval(PyObject *obj, void *closure)
157 : {
158 42 : struct MANAGEDPASSWORD_BLOB_PASSWORDS *object = pytalloc_get_ptr(obj);
159 1 : PyObject *py_query_interval;
160 42 : if (object->query_interval == NULL) {
161 0 : Py_RETURN_NONE;
162 : }
163 42 : if (object->query_interval == NULL) {
164 0 : py_query_interval = Py_None;
165 0 : Py_INCREF(py_query_interval);
166 : } else {
167 42 : py_query_interval = PyLong_FromUnsignedLongLong(*object->query_interval);
168 : }
169 42 : return py_query_interval;
170 : }
171 :
172 45 : static int py_MANAGEDPASSWORD_BLOB_PASSWORDS_set_query_interval(PyObject *py_obj, PyObject *value, void *closure)
173 : {
174 45 : struct MANAGEDPASSWORD_BLOB_PASSWORDS *object = pytalloc_get_ptr(py_obj);
175 45 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->query_interval));
176 45 : if (value == NULL) {
177 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->query_interval");
178 0 : return -1;
179 : }
180 45 : if (value == Py_None) {
181 0 : object->query_interval = NULL;
182 : } else {
183 45 : object->query_interval = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->query_interval);
184 45 : if (object->query_interval == NULL) {
185 0 : PyErr_NoMemory();
186 0 : return -1;
187 : }
188 : {
189 45 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->query_interval));
190 45 : if (PyLong_Check(value)) {
191 1 : unsigned long long test_var;
192 45 : test_var = PyLong_AsUnsignedLongLong(value);
193 45 : if (PyErr_Occurred() != NULL) {
194 0 : return -1;
195 : }
196 45 : if (test_var > uint_max) {
197 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
198 : PyLong_Type.tp_name, uint_max, test_var);
199 0 : return -1;
200 : }
201 45 : *object->query_interval = test_var;
202 : } else {
203 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
204 : PyLong_Type.tp_name);
205 0 : return -1;
206 : }
207 : }
208 : }
209 44 : return 0;
210 : }
211 :
212 29 : static PyObject *py_MANAGEDPASSWORD_BLOB_PASSWORDS_get_unchanged_interval(PyObject *obj, void *closure)
213 : {
214 29 : struct MANAGEDPASSWORD_BLOB_PASSWORDS *object = pytalloc_get_ptr(obj);
215 1 : PyObject *py_unchanged_interval;
216 29 : if (object->unchanged_interval == NULL) {
217 0 : Py_RETURN_NONE;
218 : }
219 29 : if (object->unchanged_interval == NULL) {
220 0 : py_unchanged_interval = Py_None;
221 0 : Py_INCREF(py_unchanged_interval);
222 : } else {
223 29 : py_unchanged_interval = PyLong_FromUnsignedLongLong(*object->unchanged_interval);
224 : }
225 29 : return py_unchanged_interval;
226 : }
227 :
228 45 : static int py_MANAGEDPASSWORD_BLOB_PASSWORDS_set_unchanged_interval(PyObject *py_obj, PyObject *value, void *closure)
229 : {
230 45 : struct MANAGEDPASSWORD_BLOB_PASSWORDS *object = pytalloc_get_ptr(py_obj);
231 45 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->unchanged_interval));
232 45 : if (value == NULL) {
233 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->unchanged_interval");
234 0 : return -1;
235 : }
236 45 : if (value == Py_None) {
237 0 : object->unchanged_interval = NULL;
238 : } else {
239 45 : object->unchanged_interval = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->unchanged_interval);
240 45 : if (object->unchanged_interval == NULL) {
241 0 : PyErr_NoMemory();
242 0 : return -1;
243 : }
244 : {
245 45 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->unchanged_interval));
246 45 : if (PyLong_Check(value)) {
247 1 : unsigned long long test_var;
248 45 : test_var = PyLong_AsUnsignedLongLong(value);
249 45 : if (PyErr_Occurred() != NULL) {
250 0 : return -1;
251 : }
252 45 : if (test_var > uint_max) {
253 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
254 : PyLong_Type.tp_name, uint_max, test_var);
255 0 : return -1;
256 : }
257 45 : *object->unchanged_interval = test_var;
258 : } else {
259 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
260 : PyLong_Type.tp_name);
261 0 : return -1;
262 : }
263 : }
264 : }
265 44 : return 0;
266 : }
267 :
268 : static PyGetSetDef py_MANAGEDPASSWORD_BLOB_PASSWORDS_getsetters[] = {
269 : {
270 : .name = discard_const_p(char, "current"),
271 : .get = py_MANAGEDPASSWORD_BLOB_PASSWORDS_get_current,
272 : .set = py_MANAGEDPASSWORD_BLOB_PASSWORDS_set_current,
273 : .doc = discard_const_p(char, "PIDL-generated element of base type u16string")
274 : },
275 : {
276 : .name = discard_const_p(char, "previous"),
277 : .get = py_MANAGEDPASSWORD_BLOB_PASSWORDS_get_previous,
278 : .set = py_MANAGEDPASSWORD_BLOB_PASSWORDS_set_previous,
279 : .doc = discard_const_p(char, "PIDL-generated element of base type u16string")
280 : },
281 : {
282 : .name = discard_const_p(char, "query_interval"),
283 : .get = py_MANAGEDPASSWORD_BLOB_PASSWORDS_get_query_interval,
284 : .set = py_MANAGEDPASSWORD_BLOB_PASSWORDS_set_query_interval,
285 : .doc = discard_const_p(char, "PIDL-generated element of base type hyper")
286 : },
287 : {
288 : .name = discard_const_p(char, "unchanged_interval"),
289 : .get = py_MANAGEDPASSWORD_BLOB_PASSWORDS_get_unchanged_interval,
290 : .set = py_MANAGEDPASSWORD_BLOB_PASSWORDS_set_unchanged_interval,
291 : .doc = discard_const_p(char, "PIDL-generated element of base type hyper")
292 : },
293 : { .name = NULL }
294 : };
295 :
296 0 : static PyObject *py_MANAGEDPASSWORD_BLOB_PASSWORDS_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
297 : {
298 0 : return pytalloc_new(struct MANAGEDPASSWORD_BLOB_PASSWORDS, type);
299 : }
300 :
301 :
302 : static PyTypeObject MANAGEDPASSWORD_BLOB_PASSWORDS_Type = {
303 : PyVarObject_HEAD_INIT(NULL, 0)
304 : .tp_name = "gmsa.MANAGEDPASSWORD_BLOB_PASSWORDS",
305 : .tp_getset = py_MANAGEDPASSWORD_BLOB_PASSWORDS_getsetters,
306 : .tp_methods = NULL,
307 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
308 : .tp_new = py_MANAGEDPASSWORD_BLOB_PASSWORDS_new,
309 : };
310 :
311 :
312 15 : static PyObject *py_MANAGEDPASSWORD_BLOB_get_version(PyObject *obj, void *closure)
313 : {
314 15 : struct MANAGEDPASSWORD_BLOB *object = pytalloc_get_ptr(obj);
315 1 : PyObject *py_version;
316 15 : py_version = PyLong_FromLong((uint16_t)(object->version));
317 15 : return py_version;
318 : }
319 :
320 0 : static int py_MANAGEDPASSWORD_BLOB_set_version(PyObject *py_obj, PyObject *value, void *closure)
321 : {
322 0 : struct MANAGEDPASSWORD_BLOB *object = pytalloc_get_ptr(py_obj);
323 0 : if (value == NULL) {
324 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->version");
325 0 : return -1;
326 : }
327 : {
328 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
329 0 : if (PyLong_Check(value)) {
330 0 : unsigned long long test_var;
331 0 : test_var = PyLong_AsUnsignedLongLong(value);
332 0 : if (PyErr_Occurred() != NULL) {
333 0 : return -1;
334 : }
335 0 : if (test_var > uint_max) {
336 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
337 : PyLong_Type.tp_name, uint_max, test_var);
338 0 : return -1;
339 : }
340 0 : object->version = test_var;
341 : } else {
342 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
343 : PyLong_Type.tp_name);
344 0 : return -1;
345 : }
346 : }
347 0 : return 0;
348 : }
349 :
350 15 : static PyObject *py_MANAGEDPASSWORD_BLOB_get_reserved(PyObject *obj, void *closure)
351 : {
352 15 : struct MANAGEDPASSWORD_BLOB *object = pytalloc_get_ptr(obj);
353 1 : PyObject *py_reserved;
354 15 : py_reserved = PyLong_FromLong((uint16_t)(object->reserved));
355 15 : return py_reserved;
356 : }
357 :
358 0 : static int py_MANAGEDPASSWORD_BLOB_set_reserved(PyObject *py_obj, PyObject *value, void *closure)
359 : {
360 0 : struct MANAGEDPASSWORD_BLOB *object = pytalloc_get_ptr(py_obj);
361 0 : if (value == NULL) {
362 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->reserved");
363 0 : return -1;
364 : }
365 : {
366 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->reserved));
367 0 : if (PyLong_Check(value)) {
368 0 : unsigned long long test_var;
369 0 : test_var = PyLong_AsUnsignedLongLong(value);
370 0 : if (PyErr_Occurred() != NULL) {
371 0 : return -1;
372 : }
373 0 : if (test_var > uint_max) {
374 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
375 : PyLong_Type.tp_name, uint_max, test_var);
376 0 : return -1;
377 : }
378 0 : object->reserved = test_var;
379 : } else {
380 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
381 : PyLong_Type.tp_name);
382 0 : return -1;
383 : }
384 : }
385 0 : return 0;
386 : }
387 :
388 15 : static PyObject *py_MANAGEDPASSWORD_BLOB_get_length(PyObject *obj, void *closure)
389 : {
390 15 : struct MANAGEDPASSWORD_BLOB *object = pytalloc_get_ptr(obj);
391 1 : PyObject *py_length;
392 15 : py_length = PyLong_FromUnsignedLongLong((uint32_t)(object->length));
393 15 : return py_length;
394 : }
395 :
396 0 : static int py_MANAGEDPASSWORD_BLOB_set_length(PyObject *py_obj, PyObject *value, void *closure)
397 : {
398 0 : struct MANAGEDPASSWORD_BLOB *object = pytalloc_get_ptr(py_obj);
399 0 : if (value == NULL) {
400 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->length");
401 0 : return -1;
402 : }
403 : {
404 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->length));
405 0 : if (PyLong_Check(value)) {
406 0 : unsigned long long test_var;
407 0 : test_var = PyLong_AsUnsignedLongLong(value);
408 0 : if (PyErr_Occurred() != NULL) {
409 0 : return -1;
410 : }
411 0 : if (test_var > uint_max) {
412 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
413 : PyLong_Type.tp_name, uint_max, test_var);
414 0 : return -1;
415 : }
416 0 : object->length = test_var;
417 : } else {
418 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
419 : PyLong_Type.tp_name);
420 0 : return -1;
421 : }
422 : }
423 0 : return 0;
424 : }
425 :
426 380 : static PyObject *py_MANAGEDPASSWORD_BLOB_get_passwords(PyObject *obj, void *closure)
427 : {
428 380 : struct MANAGEDPASSWORD_BLOB *object = pytalloc_get_ptr(obj);
429 7 : PyObject *py_passwords;
430 380 : py_passwords = pytalloc_reference_ex(&MANAGEDPASSWORD_BLOB_PASSWORDS_Type, pytalloc_get_mem_ctx(obj), &object->passwords);
431 380 : return py_passwords;
432 : }
433 :
434 0 : static int py_MANAGEDPASSWORD_BLOB_set_passwords(PyObject *py_obj, PyObject *value, void *closure)
435 : {
436 0 : struct MANAGEDPASSWORD_BLOB *object = pytalloc_get_ptr(py_obj);
437 0 : if (value == NULL) {
438 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->passwords");
439 0 : return -1;
440 : }
441 0 : PY_CHECK_TYPE(&MANAGEDPASSWORD_BLOB_PASSWORDS_Type, value, return -1;);
442 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
443 0 : PyErr_NoMemory();
444 0 : return -1;
445 : }
446 0 : object->passwords = *(struct MANAGEDPASSWORD_BLOB_PASSWORDS *)pytalloc_get_ptr(value);
447 0 : return 0;
448 : }
449 :
450 : static PyGetSetDef py_MANAGEDPASSWORD_BLOB_getsetters[] = {
451 : {
452 : .name = discard_const_p(char, "version"),
453 : .get = py_MANAGEDPASSWORD_BLOB_get_version,
454 : .set = py_MANAGEDPASSWORD_BLOB_set_version,
455 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
456 : },
457 : {
458 : .name = discard_const_p(char, "reserved"),
459 : .get = py_MANAGEDPASSWORD_BLOB_get_reserved,
460 : .set = py_MANAGEDPASSWORD_BLOB_set_reserved,
461 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
462 : },
463 : {
464 : .name = discard_const_p(char, "length"),
465 : .get = py_MANAGEDPASSWORD_BLOB_get_length,
466 : .set = py_MANAGEDPASSWORD_BLOB_set_length,
467 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
468 : },
469 : {
470 : .name = discard_const_p(char, "passwords"),
471 : .get = py_MANAGEDPASSWORD_BLOB_get_passwords,
472 : .set = py_MANAGEDPASSWORD_BLOB_set_passwords,
473 : .doc = discard_const_p(char, "PIDL-generated element of base type MANAGEDPASSWORD_BLOB_PASSWORDS")
474 : },
475 : { .name = NULL }
476 : };
477 :
478 73 : static PyObject *py_MANAGEDPASSWORD_BLOB_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
479 : {
480 73 : return pytalloc_new(struct MANAGEDPASSWORD_BLOB, type);
481 : }
482 :
483 1 : static PyObject *py_MANAGEDPASSWORD_BLOB_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
484 : {
485 1 : struct MANAGEDPASSWORD_BLOB *object = pytalloc_get_ptr(py_obj);
486 1 : PyObject *ret = NULL;
487 1 : DATA_BLOB blob;
488 1 : enum ndr_err_code err;
489 1 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
490 1 : if (tmp_ctx == NULL) {
491 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
492 0 : return NULL;
493 : }
494 1 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_MANAGEDPASSWORD_BLOB);
495 1 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
496 0 : TALLOC_FREE(tmp_ctx);
497 0 : PyErr_SetNdrError(err);
498 0 : return NULL;
499 : }
500 :
501 1 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
502 1 : TALLOC_FREE(tmp_ctx);
503 1 : return ret;
504 : }
505 :
506 28 : static PyObject *py_MANAGEDPASSWORD_BLOB_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
507 : {
508 28 : struct MANAGEDPASSWORD_BLOB *object = pytalloc_get_ptr(py_obj);
509 28 : DATA_BLOB blob = {.data = NULL, .length = 0};
510 28 : Py_ssize_t blob_length = 0;
511 1 : enum ndr_err_code err;
512 28 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
513 28 : PyObject *allow_remaining_obj = NULL;
514 28 : bool allow_remaining = false;
515 :
516 28 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
517 : discard_const_p(char *, kwnames),
518 : &blob.data, &blob_length,
519 : &allow_remaining_obj)) {
520 0 : return NULL;
521 : }
522 28 : blob.length = blob_length;
523 :
524 28 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
525 0 : allow_remaining = true;
526 : }
527 :
528 27 : if (allow_remaining) {
529 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_MANAGEDPASSWORD_BLOB);
530 : } else {
531 28 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_MANAGEDPASSWORD_BLOB);
532 : }
533 28 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
534 0 : PyErr_SetNdrError(err);
535 0 : return NULL;
536 : }
537 :
538 28 : Py_RETURN_NONE;
539 : }
540 :
541 0 : static PyObject *py_MANAGEDPASSWORD_BLOB_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
542 : {
543 0 : struct MANAGEDPASSWORD_BLOB *object = pytalloc_get_ptr(py_obj);
544 0 : PyObject *ret;
545 0 : char *retstr;
546 :
547 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_MANAGEDPASSWORD_BLOB, "MANAGEDPASSWORD_BLOB", object);
548 0 : ret = PyUnicode_FromString(retstr);
549 0 : talloc_free(retstr);
550 :
551 0 : return ret;
552 : }
553 :
554 : static PyMethodDef py_MANAGEDPASSWORD_BLOB_methods[] = {
555 : { "__ndr_pack__", (PyCFunction)py_MANAGEDPASSWORD_BLOB_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
556 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_MANAGEDPASSWORD_BLOB_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
557 : { "__ndr_print__", (PyCFunction)py_MANAGEDPASSWORD_BLOB_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
558 : { NULL, NULL, 0, NULL }
559 : };
560 :
561 :
562 : static PyTypeObject MANAGEDPASSWORD_BLOB_Type = {
563 : PyVarObject_HEAD_INIT(NULL, 0)
564 : .tp_name = "gmsa.MANAGEDPASSWORD_BLOB",
565 : .tp_getset = py_MANAGEDPASSWORD_BLOB_getsetters,
566 : .tp_methods = py_MANAGEDPASSWORD_BLOB_methods,
567 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
568 : .tp_new = py_MANAGEDPASSWORD_BLOB_new,
569 : };
570 :
571 :
572 : const struct PyNdrRpcMethodDef py_ndr_gmsa_methods[] = {
573 : {0}
574 : };
575 :
576 0 : static PyObject *interface_gmsa_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
577 : {
578 0 : return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_gmsa);
579 : }
580 :
581 : #define PY_DOC_GMSA "Active Directory Group Managed Service Accounts"
582 : static PyTypeObject gmsa_InterfaceType = {
583 : PyVarObject_HEAD_INIT(NULL, 0)
584 : .tp_name = "gmsa.gmsa",
585 : .tp_basicsize = sizeof(dcerpc_InterfaceObject),
586 : .tp_doc = "gmsa(binding, lp_ctx=None, credentials=None) -> connection\n"
587 : "\n"
588 : "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
589 : "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
590 : "credentials should be a credentials.Credentials object.\n\n"PY_DOC_GMSA,
591 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
592 : .tp_new = interface_gmsa_new,
593 : };
594 :
595 0 : static PyObject *syntax_gmsa_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
596 : {
597 0 : return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_gmsa.syntax_id);
598 : }
599 :
600 : #define PY_DOC_GMSA_SYNTAX "Active Directory Group Managed Service Accounts"
601 : static PyTypeObject gmsa_SyntaxType = {
602 : PyVarObject_HEAD_INIT(NULL, 0)
603 : .tp_name = "gmsa.gmsa_abstract_syntax",
604 : .tp_doc = "gmsa_abstract_syntax()\n"PY_DOC_GMSA_SYNTAX,
605 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
606 : .tp_new = syntax_gmsa_new,
607 : };
608 :
609 : static PyMethodDef gmsa_methods[] = {
610 : { NULL, NULL, 0, NULL }
611 : };
612 :
613 : static struct PyModuleDef moduledef = {
614 : PyModuleDef_HEAD_INIT,
615 : .m_name = "gmsa",
616 : .m_doc = "gmsa DCE/RPC",
617 : .m_size = -1,
618 : .m_methods = gmsa_methods,
619 : };
620 1054 : MODULE_INIT_FUNC(gmsa)
621 : {
622 1054 : PyObject *m = NULL;
623 1054 : PyObject *dep_talloc = NULL;
624 1054 : PyObject *dep_samba_dcerpc_base = NULL;
625 1054 : PyObject *dep_samba_dcerpc_misc = NULL;
626 :
627 1054 : dep_talloc = PyImport_ImportModule("talloc");
628 1054 : if (dep_talloc == NULL)
629 0 : goto out;
630 :
631 1054 : dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
632 1054 : if (dep_samba_dcerpc_base == NULL)
633 0 : goto out;
634 :
635 1054 : dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
636 1054 : if (dep_samba_dcerpc_misc == NULL)
637 0 : goto out;
638 :
639 1054 : BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
640 1054 : if (BaseObject_Type == NULL)
641 0 : goto out;
642 :
643 1054 : ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
644 1054 : if (ClientConnection_Type == NULL)
645 0 : goto out;
646 :
647 1054 : ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id");
648 1054 : if (ndr_syntax_id_Type == NULL)
649 0 : goto out;
650 :
651 1054 : MANAGEDPASSWORD_BLOB_PASSWORDS_Type.tp_base = BaseObject_Type;
652 1054 : MANAGEDPASSWORD_BLOB_PASSWORDS_Type.tp_basicsize = pytalloc_BaseObject_size();
653 :
654 1054 : MANAGEDPASSWORD_BLOB_Type.tp_base = BaseObject_Type;
655 1054 : MANAGEDPASSWORD_BLOB_Type.tp_basicsize = pytalloc_BaseObject_size();
656 :
657 1054 : gmsa_InterfaceType.tp_base = ClientConnection_Type;
658 :
659 1054 : gmsa_SyntaxType.tp_base = ndr_syntax_id_Type;
660 1054 : gmsa_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
661 :
662 1054 : if (PyType_Ready(&MANAGEDPASSWORD_BLOB_PASSWORDS_Type) < 0)
663 0 : goto out;
664 1054 : if (PyType_Ready(&MANAGEDPASSWORD_BLOB_Type) < 0)
665 0 : goto out;
666 1054 : if (PyType_Ready(&gmsa_InterfaceType) < 0)
667 0 : goto out;
668 1054 : if (PyType_Ready(&gmsa_SyntaxType) < 0)
669 0 : goto out;
670 1054 : if (!PyInterface_AddNdrRpcMethods(&gmsa_InterfaceType, py_ndr_gmsa_methods))
671 0 : return NULL;
672 :
673 : #ifdef PY_MANAGEDPASSWORD_BLOB_PASSWORDS_PATCH
674 : PY_MANAGEDPASSWORD_BLOB_PASSWORDS_PATCH(&MANAGEDPASSWORD_BLOB_PASSWORDS_Type);
675 : #endif
676 : #ifdef PY_MANAGEDPASSWORD_BLOB_PATCH
677 : PY_MANAGEDPASSWORD_BLOB_PATCH(&MANAGEDPASSWORD_BLOB_Type);
678 : #endif
679 : #ifdef PY_GMSA_PATCH
680 : PY_GMSA_PATCH(&gmsa_InterfaceType);
681 : #endif
682 : #ifdef PY_GMSA_ABSTRACT_SYNTAX_PATCH
683 : PY_GMSA_ABSTRACT_SYNTAX_PATCH(&gmsa_SyntaxType);
684 : #endif
685 : #ifdef PY_ABSTRACT_SYNTAX_PATCH
686 : PY_ABSTRACT_SYNTAX_PATCH(&gmsa_SyntaxType);
687 : #endif
688 :
689 1054 : m = PyModule_Create(&moduledef);
690 1054 : if (m == NULL)
691 0 : goto out;
692 :
693 735 : Py_INCREF((PyObject *)(void *)&MANAGEDPASSWORD_BLOB_PASSWORDS_Type);
694 1054 : PyModule_AddObject(m, "MANAGEDPASSWORD_BLOB_PASSWORDS", (PyObject *)(void *)&MANAGEDPASSWORD_BLOB_PASSWORDS_Type);
695 735 : Py_INCREF((PyObject *)(void *)&MANAGEDPASSWORD_BLOB_Type);
696 1054 : PyModule_AddObject(m, "MANAGEDPASSWORD_BLOB", (PyObject *)(void *)&MANAGEDPASSWORD_BLOB_Type);
697 735 : Py_INCREF((PyObject *)(void *)&gmsa_InterfaceType);
698 1054 : PyModule_AddObject(m, "gmsa", (PyObject *)(void *)&gmsa_InterfaceType);
699 735 : Py_INCREF((PyObject *)(void *)&gmsa_SyntaxType);
700 1054 : PyModule_AddObject(m, "gmsa_abstract_syntax", (PyObject *)(void *)&gmsa_SyntaxType);
701 735 : Py_INCREF((PyObject *)(void *)&gmsa_SyntaxType);
702 1054 : PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&gmsa_SyntaxType);
703 : #ifdef PY_MOD_GMSA_PATCH
704 : PY_MOD_GMSA_PATCH(m);
705 : #endif
706 1054 : out:
707 1054 : Py_XDECREF(dep_talloc);
708 1054 : Py_XDECREF(dep_samba_dcerpc_base);
709 1054 : Py_XDECREF(dep_samba_dcerpc_misc);
710 1019 : return m;
711 :
712 : }
|