s4:pyregistry: fix crash bugs introduced by e5a6eadd8214b56da34f733318a0fecaebbe5ef5
authorStefan Metzmacher <metze@samba.org>
Fri, 6 Feb 2009 11:10:23 +0000 (12:10 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 6 Feb 2009 11:13:26 +0000 (12:13 +0100)
The registry api uses wild casts in the returned types, so we can't check
the talloc name against the type used in the public api...

metze

source4/lib/registry/pyregistry.c

index 9ebd136081e36d0cb745aa6d7cf212a6be7777e7..30becbb1bbc09b9bdf9b3828e8487346b9a4a21a 100644 (file)
@@ -36,8 +36,9 @@ PyAPI_DATA(PyTypeObject) PyRegistry;
 PyAPI_DATA(PyTypeObject) PyHiveKey;
 
 /*#define PyRegistryKey_AsRegistryKey(obj) py_talloc_get_type(obj, struct registry_key)*/
 PyAPI_DATA(PyTypeObject) PyHiveKey;
 
 /*#define PyRegistryKey_AsRegistryKey(obj) py_talloc_get_type(obj, struct registry_key)*/
-#define PyRegistry_AsRegistryContext(obj) py_talloc_get_type(obj, struct registry_context)
-#define PyHiveKey_AsHiveKey(obj) py_talloc_get_type(obj, struct hive_key)
+#define PyRegistry_AsRegistryContext(obj) ((struct registry_context *)py_talloc_get_ptr(obj))
+#define PyHiveKey_AsHiveKey(obj) ((struct hive_key*)py_talloc_get_ptr(obj))
+
 
 static PyObject *py_get_predefined_key_by_name(PyObject *self, PyObject *args)
 {
 
 static PyObject *py_get_predefined_key_by_name(PyObject *self, PyObject *args)
 {