Cleanup references to module objects returned from PyImport_ImportModule
[gd/samba-autobuild/.git] / source4 / librpc / rpc / pyrpc.c
1 /* 
2    Unix SMB/CIFS implementation.
3    Samba utility functions
4    Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include <Python.h>
21 #include "python/py3compat.h"
22 #include "includes.h"
23 #include <structmember.h>
24 #include "librpc/rpc/pyrpc.h"
25 #include "lib/events/events.h"
26 #include "param/pyparam.h"
27 #include "librpc/rpc/dcerpc.h"
28 #include "librpc/rpc/pyrpc_util.h"
29 #include "auth/credentials/pycredentials.h"
30 #include "auth/gensec/gensec.h"
31
32 void initbase(void);
33
34 static PyTypeObject dcerpc_InterfaceType;
35
36 static PyTypeObject *BaseObject_Type;
37
38 static PyTypeObject *ndr_syntax_id_Type;
39
40 static bool PyString_AsGUID(PyObject *object, struct GUID *uuid)
41 {
42         NTSTATUS status;
43         status = GUID_from_string(PyStr_AsString(object), uuid);
44         if (NT_STATUS_IS_ERR(status)) {
45                 PyErr_SetNTSTATUS(status);
46                 return false;
47         }
48         return true;
49 }
50
51 static bool ndr_syntax_from_py_object(PyObject *object, struct ndr_syntax_id *syntax_id)
52 {
53         ZERO_STRUCTP(syntax_id);
54
55         if (PyStr_Check(object) || PyUnicode_Check(object)) {
56                 return PyString_AsGUID(object, &syntax_id->uuid);
57         } else if (PyTuple_Check(object)) {
58                 PyObject *item = NULL;
59                 if (PyTuple_Size(object) < 1 || PyTuple_Size(object) > 2) {
60                         PyErr_SetString(PyExc_ValueError, "Syntax ID tuple has invalid size");
61                         return false;
62                 }
63
64                 item = PyTuple_GetItem(object, 0);
65                 if (!(PyStr_Check(item) || PyUnicode_Check(item))) {
66                         PyErr_SetString(PyExc_ValueError, "Expected GUID as first element in tuple");
67                         return false;
68                 }
69
70                 if (!PyString_AsGUID(item, &syntax_id->uuid)) {
71                         return false;
72                 }
73
74                 item = PyTuple_GetItem(object, 1);
75                 if (!PyInt_Check(item)) {
76                         PyErr_SetString(PyExc_ValueError, "Expected version as second element in tuple");
77                         return false;
78                 }
79
80                 syntax_id->if_version = PyInt_AsLong(item);
81                 return true;
82         }
83
84         PyErr_SetString(PyExc_TypeError, "Expected UUID or syntax id tuple");
85         return false;
86 }
87
88 static PyObject *py_iface_server_name(PyObject *obj, void *closure)
89 {
90         const char *server_name;
91         dcerpc_InterfaceObject *iface = (dcerpc_InterfaceObject *)obj;
92
93         server_name = dcerpc_server_name(iface->pipe);
94         if (server_name == NULL)
95                 Py_RETURN_NONE;
96
97         return PyStr_FromString(server_name);
98 }
99
100 static PyObject *py_ndr_syntax_id(struct ndr_syntax_id *syntax_id)
101 {
102         PyObject *ret;
103         char *uuid_str;
104
105         uuid_str = GUID_string(NULL, &syntax_id->uuid);
106         if (uuid_str == NULL)
107                 return NULL;
108
109         ret = Py_BuildValue("(s,i)", uuid_str, syntax_id->if_version);
110
111         talloc_free(uuid_str);
112
113         return ret;
114 }
115
116 static PyObject *py_iface_abstract_syntax(PyObject *obj, void *closure)
117 {
118         dcerpc_InterfaceObject *iface = (dcerpc_InterfaceObject *)obj;
119
120         return py_ndr_syntax_id(&iface->pipe->syntax);
121 }
122
123 static PyObject *py_iface_transfer_syntax(PyObject *obj, void *closure)
124 {
125         dcerpc_InterfaceObject *iface = (dcerpc_InterfaceObject *)obj;
126
127         return py_ndr_syntax_id(&iface->pipe->transfer_syntax);
128 }
129
130 static PyObject *py_iface_session_key(PyObject *obj, void *closure)
131 {
132         dcerpc_InterfaceObject *iface = (dcerpc_InterfaceObject *)obj;
133         DATA_BLOB session_key;
134
135         NTSTATUS status = dcerpc_fetch_session_key(iface->pipe, &session_key);
136         PyErr_NTSTATUS_IS_ERR_RAISE(status);
137
138         return PyBytes_FromStringAndSize((const char *)session_key.data, session_key.length);
139 }
140
141 static PyObject *py_iface_user_session_key(PyObject *obj, void *closure)
142 {
143         dcerpc_InterfaceObject *iface = (dcerpc_InterfaceObject *)obj;
144         TALLOC_CTX *mem_ctx;
145         NTSTATUS status;
146         struct gensec_security *security = NULL;
147         DATA_BLOB session_key = data_blob_null;
148         static PyObject *session_key_obj = NULL;
149
150         if (iface->pipe == NULL) {
151                 PyErr_SetNTSTATUS(NT_STATUS_NO_USER_SESSION_KEY);
152                 return NULL;
153         }
154
155         if (iface->pipe->conn == NULL) {
156                 PyErr_SetNTSTATUS(NT_STATUS_NO_USER_SESSION_KEY);
157                 return NULL;
158         }
159
160         if (iface->pipe->conn->security_state.generic_state == NULL) {
161                 PyErr_SetNTSTATUS(NT_STATUS_NO_USER_SESSION_KEY);
162                 return NULL;
163         }
164
165         security = iface->pipe->conn->security_state.generic_state;
166
167         mem_ctx = talloc_new(NULL);
168
169         status = gensec_session_key(security, mem_ctx, &session_key);
170         if (!NT_STATUS_IS_OK(status)) {
171                 talloc_free(mem_ctx);
172                 PyErr_SetNTSTATUS(status);
173                 return NULL;
174         }
175
176         session_key_obj = PyBytes_FromStringAndSize((const char *)session_key.data,
177                                                      session_key.length);
178         talloc_free(mem_ctx);
179         return session_key_obj;
180 }
181
182 static PyObject *py_iface_get_timeout(PyObject *obj, void *closure)
183 {
184         dcerpc_InterfaceObject *iface = (dcerpc_InterfaceObject *)obj;
185         uint32_t timeout;
186
187         timeout = dcerpc_binding_handle_set_timeout(iface->binding_handle, 0);
188         dcerpc_binding_handle_set_timeout(iface->binding_handle, timeout);
189
190         return PyLong_FromUnsignedLong(timeout);
191 }
192
193 static int py_iface_set_timeout(PyObject *obj, PyObject *value, void *closure)
194 {
195         dcerpc_InterfaceObject *iface = (dcerpc_InterfaceObject *)obj;
196         uint32_t timeout;
197
198         timeout = PyLong_AsUnsignedLong(value);
199         if (PyErr_Occurred() != NULL) {
200                 return -1;
201         }
202
203         dcerpc_binding_handle_set_timeout(iface->binding_handle, timeout);
204         return 0;
205 }
206
207 static PyGetSetDef dcerpc_interface_getsetters[] = {
208         {
209                 .name = discard_const_p(char, "server_name"),
210                 .get  = py_iface_server_name,
211                 .doc  = discard_const_p(char, "name of the server, if connected over SMB"),
212         },
213         {
214                 .name = discard_const_p(char, "abstract_syntax"),
215                 .get  = py_iface_abstract_syntax,
216                 .doc  = discard_const_p(char, "syntax id of the abstract syntax"),
217         },
218         {
219                 .name = discard_const_p(char, "transfer_syntax"),
220                 .get  = py_iface_transfer_syntax,
221                 .doc  = discard_const_p(char, "syntax id of the transfer syntax"),
222         },
223         {
224                 .name = discard_const_p(char, "session_key"),
225                 .get  = py_iface_session_key,
226                 .doc  = discard_const_p(char, "session key (as used for blob encryption on LSA and SAMR)"),
227         },
228         {
229                 .name = discard_const_p(char, "user_session_key"),
230                 .get  = py_iface_user_session_key,
231                 .doc  = discard_const_p(char, "user_session key (as used for blob encryption on DRSUAPI)"),
232         },
233         {
234                 .name = discard_const_p(char, "request_timeout"),
235                 .get  = py_iface_get_timeout,
236                 .set  = py_iface_set_timeout,
237                 .doc  = discard_const_p(char, "request timeout, in seconds"),
238         },
239         { .name = NULL }
240 };
241
242 static PyObject *py_iface_request(PyObject *self, PyObject *args, PyObject *kwargs)
243 {
244         dcerpc_InterfaceObject *iface = (dcerpc_InterfaceObject *)self;
245         int opnum;
246         DATA_BLOB data_in, data_out;
247         NTSTATUS status;
248         char *in_data;
249         Py_ssize_t in_length;
250         PyObject *ret;
251         PyObject *object = NULL;
252         struct GUID object_guid;
253         TALLOC_CTX *mem_ctx = talloc_new(NULL);
254         uint32_t out_flags = 0;
255         const char *kwnames[] = { "opnum", "data", "object", NULL };
256
257         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "is#|O:request", 
258                 discard_const_p(char *, kwnames), &opnum, &in_data, &in_length, &object)) {
259                 talloc_free(mem_ctx);
260                 return NULL;
261         }
262
263         data_in.data = (uint8_t *)talloc_memdup(mem_ctx, in_data, in_length);
264         data_in.length = in_length;
265
266         ZERO_STRUCT(data_out);
267
268         if (object != NULL && !PyString_AsGUID(object, &object_guid)) {
269                 talloc_free(mem_ctx);
270                 return NULL;
271         }
272
273         status = dcerpc_binding_handle_raw_call(iface->binding_handle,
274                                                 object?&object_guid:NULL,
275                                                 opnum,
276                                                 0, /* in_flags */
277                                                 data_in.data,
278                                                 data_in.length,
279                                                 mem_ctx,
280                                                 &data_out.data,
281                                                 &data_out.length,
282                                                 &out_flags);
283         if (!NT_STATUS_IS_OK(status)) {
284                 PyErr_SetDCERPCStatus(iface->pipe, status);
285                 talloc_free(mem_ctx);
286                 return NULL;
287         }
288
289         ret = PyBytes_FromStringAndSize((char *)data_out.data, data_out.length);
290
291         talloc_free(mem_ctx);
292         return ret;
293 }
294
295 static PyMethodDef dcerpc_interface_methods[] = {
296         { "request", (PyCFunction)py_iface_request, METH_VARARGS|METH_KEYWORDS, "S.request(opnum, data, object=None) -> data\nMake a raw request" },
297         { NULL, NULL, 0, NULL },
298 };
299
300 static void dcerpc_interface_dealloc(PyObject* self)
301 {
302         dcerpc_InterfaceObject *interface = (dcerpc_InterfaceObject *)self;
303         interface->binding_handle = NULL;
304         interface->pipe = NULL;
305         TALLOC_FREE(interface->mem_ctx);
306         self->ob_type->tp_free(self);
307 }
308
309 static PyObject *dcerpc_interface_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
310 {
311         PyObject *ret;
312         const char *binding_string = NULL;
313         PyObject *py_lp_ctx = Py_None;
314         PyObject *py_credentials = Py_None;
315         PyObject *syntax = Py_None;
316         PyObject *py_basis = Py_None;
317         const char *kwnames[] = {
318                 "binding", "syntax", "lp_ctx", "credentials", "basis_connection", NULL
319         };
320         static struct ndr_interface_table dummy_table;
321         static struct ndr_interface_string_array dummy_endpoints;
322         PyObject *args2 = Py_None;
323         PyObject *kwargs2 = Py_None;
324
325         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sO|OOO:connect", discard_const_p(char *, kwnames), &binding_string, &syntax, &py_lp_ctx, &py_credentials, &py_basis)) {
326                 return NULL;
327         }
328
329         if (strncmp(binding_string, "irpc:", 5) == 0) {
330                 PyErr_SetString(PyExc_ValueError, "irpc: transport not supported");
331                 return NULL;
332         }
333
334         /*
335          * Fill a dummy interface table struct. TODO: In the future, we should
336          * rather just allow connecting without requiring an interface table.
337          *
338          * We just fill the syntax during the connect, but keep the memory valid
339          * the whole time.
340          */
341         if (!ndr_syntax_from_py_object(syntax, &dummy_table.syntax_id)) {
342                 return NULL;
343         }
344
345         /*
346          * Initialise the endpoints list in dummy_table if required
347          */
348         if (dummy_table.endpoints == NULL) {
349                 dummy_table.endpoints = &dummy_endpoints;
350         }
351
352         args2 = Py_BuildValue("(s)", binding_string);
353         if (args2 == NULL) {
354                 return NULL;
355         }
356
357         kwargs2 = Py_BuildValue("{s:O,s:O,s:O}",
358                                 "lp_ctx", py_lp_ctx,
359                                 "credentials", py_credentials,
360                                 "basis_connection", py_basis);
361         if (kwargs2 == NULL) {
362                 Py_DECREF(args2);
363                 return NULL;
364         }
365
366         ret = py_dcerpc_interface_init_helper(type, args2, kwargs2, &dummy_table);
367         ZERO_STRUCT(dummy_table.syntax_id);
368         Py_DECREF(args2);
369         Py_DECREF(kwargs2);
370         return ret;
371 }
372
373 static PyTypeObject dcerpc_InterfaceType = {
374         PyVarObject_HEAD_INIT(NULL, 0)
375         .tp_name = "dcerpc.ClientConnection",
376         .tp_basicsize = sizeof(dcerpc_InterfaceObject),
377         .tp_dealloc = dcerpc_interface_dealloc,
378         .tp_getset = dcerpc_interface_getsetters,
379         .tp_methods = dcerpc_interface_methods,
380         .tp_doc = "ClientConnection(binding, syntax, lp_ctx=None, credentials=None) -> connection\n"
381 "\n"
382 "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
383 "syntax should be a tuple with a GUID and version number of an interface\n"
384 "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
385 "credentials should be a credentials.Credentials object.\n\n",
386         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
387         .tp_new = dcerpc_interface_new,
388 };
389
390 static PyObject *py_transfer_syntax_ndr_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
391 {
392         return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_transfer_syntax_ndr);
393 }
394
395 static PyTypeObject py_transfer_syntax_ndr_SyntaxType = {
396         PyVarObject_HEAD_INIT(NULL, 0)
397         .tp_name = "base.transfer_syntax_ndr",
398         .tp_doc = "transfer_syntax_ndr()\n",
399         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
400         .tp_new = py_transfer_syntax_ndr_new,
401 };
402
403 static PyObject *py_transfer_syntax_ndr64_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
404 {
405         return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_transfer_syntax_ndr64);
406 }
407
408 static PyTypeObject py_transfer_syntax_ndr64_SyntaxType = {
409         PyVarObject_HEAD_INIT(NULL, 0)
410         .tp_name = "base.transfer_syntax_ndr64",
411         .tp_doc = "transfer_syntax_ndr64()\n",
412         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
413         .tp_new = py_transfer_syntax_ndr64_new,
414 };
415
416 static PyObject *py_bind_time_features_syntax_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
417 {
418         const char *kwnames[] = {
419                 "features", NULL
420         };
421         unsigned long long features = 0;
422         struct ndr_syntax_id syntax;
423         PyObject *args2 = Py_None;
424         PyObject *kwargs2 = Py_None;
425
426         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "K:features", discard_const_p(char *, kwnames), &features)) {
427                 return NULL;
428         }
429
430         args2 = Py_BuildValue("()");
431         if (args2 == NULL) {
432                 return NULL;
433         }
434
435         kwargs2 = Py_BuildValue("{}");
436         if (kwargs2 == NULL) {
437                 Py_DECREF(args2);
438                 return NULL;
439         }
440
441         syntax = dcerpc_construct_bind_time_features(features);
442
443         return py_dcerpc_syntax_init_helper(type, args2, kwargs2, &syntax);
444 }
445
446 static PyTypeObject py_bind_time_features_syntax_SyntaxType = {
447         PyVarObject_HEAD_INIT(NULL, 0)
448         .tp_name = "base.bind_time_features_syntax",
449         .tp_doc = "bind_time_features_syntax(features)\n",
450         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
451         .tp_new = py_bind_time_features_syntax_new,
452 };
453
454 struct py_dcerpc_ndr_pointer {
455         PyObject *value;
456 };
457
458 static void py_dcerpc_ndr_pointer_dealloc(PyObject* self)
459 {
460         struct py_dcerpc_ndr_pointer *obj =
461                 pytalloc_get_type(self, struct py_dcerpc_ndr_pointer);
462
463         Py_DECREF(obj->value);
464         obj->value = NULL;
465
466         self->ob_type->tp_free(self);
467 }
468
469 static PyObject *py_dcerpc_ndr_pointer_get_value(PyObject *self, void *closure)
470 {
471         struct py_dcerpc_ndr_pointer *obj =
472                 pytalloc_get_type(self, struct py_dcerpc_ndr_pointer);
473
474         Py_INCREF(obj->value);
475         return obj->value;
476 }
477
478 static int py_dcerpc_ndr_pointer_set_value(PyObject *self, PyObject *value, void *closure)
479 {
480         struct py_dcerpc_ndr_pointer *obj =
481                 pytalloc_get_type(self, struct py_dcerpc_ndr_pointer);
482
483         Py_DECREF(obj->value);
484         obj->value = value;
485         Py_INCREF(obj->value);
486         return 0;
487 }
488
489 static PyGetSetDef py_dcerpc_ndr_pointer_getsetters[] = {
490         {
491                 .name = discard_const_p(char, "value"),
492                 .get  = py_dcerpc_ndr_pointer_get_value,
493                 .set  = py_dcerpc_ndr_pointer_set_value,
494                 .doc  = discard_const_p(char, "the value store by the pointer"),
495         },
496         {
497                 .name = NULL,
498         },
499 };
500
501 static PyObject *py_dcerpc_ndr_pointer_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
502 {
503         PyObject *ret = NULL;
504         struct py_dcerpc_ndr_pointer *obj = NULL;
505         const char *kwnames[] = { "value", NULL };
506         PyObject *value = NULL;
507         bool ok;
508
509         ok = PyArg_ParseTupleAndKeywords(args, kwargs, "O:value",
510                                          discard_const_p(char *, kwnames),
511                                          &value);
512         if (!ok) {
513                 return NULL;
514         }
515
516         ret = pytalloc_new(struct py_dcerpc_ndr_pointer, type);
517         if (ret == NULL) {
518                 return NULL;
519         }
520
521         obj = pytalloc_get_type(ret, struct py_dcerpc_ndr_pointer);
522         *obj = (struct py_dcerpc_ndr_pointer) {
523                 .value = value,
524         };
525
526         Py_INCREF(obj->value);
527         return ret;
528 }
529
530 static PyTypeObject py_dcerpc_ndr_pointer_type = {
531         PyVarObject_HEAD_INIT(NULL, 0)
532         .tp_name = "base.ndr_pointer",
533         .tp_dealloc = py_dcerpc_ndr_pointer_dealloc,
534         .tp_getset = py_dcerpc_ndr_pointer_getsetters,
535         .tp_doc = "ndr_pointer(value)\n",
536         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
537         .tp_new = py_dcerpc_ndr_pointer_new,
538 };
539
540 static struct PyModuleDef moduledef = {
541     PyModuleDef_HEAD_INIT,
542     .m_name = "base",
543     .m_doc = "DCE/RPC protocol implementation",
544     .m_size = -1,
545 };
546
547 MODULE_INIT_FUNC(base)
548 {
549         PyObject *m;
550         PyObject *dep_talloc;
551         PyObject *dep_samba_dcerpc_misc;
552
553         dep_talloc = PyImport_ImportModule("talloc");
554         if (dep_talloc == NULL)
555                 return NULL;
556
557         BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
558         if (BaseObject_Type == NULL) {
559                 Py_CLEAR(dep_talloc);
560                 return NULL;
561         }
562
563         Py_CLEAR(dep_talloc);
564         dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
565         if (dep_samba_dcerpc_misc == NULL) {
566                 return NULL;
567         }
568
569         ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id");
570         Py_CLEAR(dep_samba_dcerpc_misc);
571         if (ndr_syntax_id_Type == NULL) {
572                 return NULL;
573         }
574
575         py_transfer_syntax_ndr_SyntaxType.tp_base = ndr_syntax_id_Type;
576         py_transfer_syntax_ndr_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
577         py_transfer_syntax_ndr64_SyntaxType.tp_base = ndr_syntax_id_Type;
578         py_transfer_syntax_ndr64_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
579         py_bind_time_features_syntax_SyntaxType.tp_base = ndr_syntax_id_Type;
580         py_bind_time_features_syntax_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
581
582         py_dcerpc_ndr_pointer_type.tp_base = BaseObject_Type;
583         py_dcerpc_ndr_pointer_type.tp_basicsize = pytalloc_BaseObject_size();
584
585         if (PyType_Ready(&dcerpc_InterfaceType) < 0) {
586                 return NULL;
587         }
588
589         if (PyType_Ready(&py_transfer_syntax_ndr_SyntaxType) < 0) {
590                 return NULL;
591         }
592         if (PyType_Ready(&py_transfer_syntax_ndr64_SyntaxType) < 0) {
593                 return NULL;
594         }
595         if (PyType_Ready(&py_bind_time_features_syntax_SyntaxType) < 0) {
596                 return NULL;
597         }
598
599         if (PyType_Ready(&py_dcerpc_ndr_pointer_type) < 0) {
600                 return NULL;
601         }
602
603         m = PyModule_Create(&moduledef);
604         if (m == NULL) {
605                 return NULL;
606         }
607
608         Py_INCREF((PyObject *)&dcerpc_InterfaceType);
609         PyModule_AddObject(m, "ClientConnection", (PyObject *)&dcerpc_InterfaceType);
610
611         Py_INCREF((PyObject *)(void *)&py_transfer_syntax_ndr_SyntaxType);
612         PyModule_AddObject(m, "transfer_syntax_ndr", (PyObject *)(void *)&py_transfer_syntax_ndr_SyntaxType);
613         Py_INCREF((PyObject *)(void *)&py_transfer_syntax_ndr64_SyntaxType);
614         PyModule_AddObject(m, "transfer_syntax_ndr64", (PyObject *)(void *)&py_transfer_syntax_ndr64_SyntaxType);
615         Py_INCREF((PyObject *)(void *)&py_bind_time_features_syntax_SyntaxType);
616         PyModule_AddObject(m, "bind_time_features_syntax", (PyObject *)(void *)&py_bind_time_features_syntax_SyntaxType);
617         Py_INCREF((PyObject *)(void *)&py_dcerpc_ndr_pointer_type);
618         PyModule_AddObject(m, "ndr_pointer", (PyObject *)(void *)&py_dcerpc_ndr_pointer_type);
619         return m;
620 }