summaryrefslogtreecommitdiff
path: root/source4/lib/registry
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-02-09 16:51:46 +0100
committerJelmer Vernooij <jelmer@samba.org>2009-02-09 16:51:46 +0100
commit9b366d703210b493aa1389bbdd288a2b00958766 (patch)
tree12acaf89af2c6bd2610018d267e2d8030d9b4bd6 /source4/lib/registry
parent6d139ca4680abcbda5110f2f0886aa038ff62088 (diff)
parent1dadf17be847e3f93b72988bcc7e8620a8d5908c (diff)
downloadsamba-9b366d703210b493aa1389bbdd288a2b00958766.tar.gz
samba-9b366d703210b493aa1389bbdd288a2b00958766.tar.bz2
samba-9b366d703210b493aa1389bbdd288a2b00958766.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'source4/lib/registry')
-rw-r--r--source4/lib/registry/patchfile_preg.c14
-rw-r--r--source4/lib/registry/pyregistry.c30
-rw-r--r--source4/lib/registry/regf.c2
3 files changed, 25 insertions, 21 deletions
diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c
index 26b57e4f45..e9801bb425 100644
--- a/source4/lib/registry/patchfile_preg.c
+++ b/source4/lib/registry/patchfile_preg.c
@@ -64,7 +64,7 @@ static WERROR reg_preg_diff_set_value(void *_data, const char *key_name,
const char *value_name,
uint32_t value_type, DATA_BLOB value_data)
{
- struct preg_data *data = _data;
+ struct preg_data *data = (struct preg_data *)_data;
uint32_t buf;
preg_write_utf16(data->ic, data->fd, "[");
@@ -86,12 +86,12 @@ static WERROR reg_preg_diff_set_value(void *_data, const char *key_name,
static WERROR reg_preg_diff_del_key(void *_data, const char *key_name)
{
- struct preg_data *data = _data;
+ struct preg_data *data = (struct preg_data *)_data;
char *parent_name;
DATA_BLOB blob;
parent_name = talloc_strndup(data->ctx, key_name, strrchr(key_name, '\\')-key_name);
- blob.data = (void *)talloc_strndup(data->ctx, key_name+(strrchr(key_name, '\\')-key_name)+1,
+ blob.data = (uint8_t *)talloc_strndup(data->ctx, key_name+(strrchr(key_name, '\\')-key_name)+1,
strlen(key_name)-(strrchr(key_name, '\\')-key_name));
blob.length = strlen((char *)blob.data)+1;
@@ -103,13 +103,13 @@ static WERROR reg_preg_diff_del_key(void *_data, const char *key_name)
static WERROR reg_preg_diff_del_value(void *_data, const char *key_name,
const char *value_name)
{
- struct preg_data *data = _data;
+ struct preg_data *data = (struct preg_data *)_data;
char *val;
DATA_BLOB blob;
val = talloc_asprintf(data->ctx, "**Del.%s", value_name);
- blob.data = (void *)talloc(data->ctx, uint32_t);
+ blob.data = (uint8_t *)talloc(data->ctx, uint32_t);
*(uint32_t *)blob.data = 0;
blob.length = 4;
return reg_preg_diff_set_value(data, key_name, val, REG_DWORD, blob);
@@ -117,10 +117,10 @@ static WERROR reg_preg_diff_del_value(void *_data, const char *key_name,
static WERROR reg_preg_diff_del_all_values(void *_data, const char *key_name)
{
- struct preg_data *data = _data;
+ struct preg_data *data = (struct preg_data *)_data;
DATA_BLOB blob;
- blob.data = (void *)talloc(data->ctx, uint32_t);
+ blob.data = (uint8_t *)talloc(data->ctx, uint32_t);
*(uint32_t *)blob.data = 0;
blob.length = 4;
diff --git a/source4/lib/registry/pyregistry.c b/source4/lib/registry/pyregistry.c
index 166543b6fd..30becbb1bb 100644
--- a/source4/lib/registry/pyregistry.c
+++ b/source4/lib/registry/pyregistry.c
@@ -18,29 +18,33 @@
*/
#include "includes.h"
+#include <tevent.h>
#include <Python.h>
#include "libcli/util/pyerrors.h"
#include "lib/registry/registry.h"
#include "scripting/python/modules.h" /* for py_iconv_convenience() */
#include <pytalloc.h>
-#include <tevent.h>
+#include "auth/credentials/pycredentials.h"
#include "param/pyparam.h"
#ifndef Py_RETURN_NONE
#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
#endif
-extern struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj);
-
PyAPI_DATA(PyTypeObject) PyRegistryKey;
PyAPI_DATA(PyTypeObject) PyRegistry;
PyAPI_DATA(PyTypeObject) PyHiveKey;
+/*#define PyRegistryKey_AsRegistryKey(obj) py_talloc_get_type(obj, struct registry_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)
{
char *name;
WERROR result;
- struct registry_context *ctx = py_talloc_get_ptr(self);
+ struct registry_context *ctx = PyRegistry_AsRegistryContext(self);
struct registry_key *key;
if (!PyArg_ParseTuple(args, "s", &name))
@@ -56,7 +60,7 @@ static PyObject *py_key_del_abs(PyObject *self, PyObject *args)
{
char *path;
WERROR result;
- struct registry_context *ctx = py_talloc_get_ptr(self);
+ struct registry_context *ctx = PyRegistry_AsRegistryContext(self);
if (!PyArg_ParseTuple(args, "s", &path))
return NULL;
@@ -70,7 +74,7 @@ static PyObject *py_key_del_abs(PyObject *self, PyObject *args)
static PyObject *py_get_predefined_key(PyObject *self, PyObject *args)
{
uint32_t hkey;
- struct registry_context *ctx = py_talloc_get_ptr(self);
+ struct registry_context *ctx = PyRegistry_AsRegistryContext(self);
WERROR result;
struct registry_key *key;
@@ -87,7 +91,7 @@ static PyObject *py_diff_apply(PyObject *self, PyObject *args)
{
char *filename;
WERROR result;
- struct registry_context *ctx = py_talloc_get_ptr(self);
+ struct registry_context *ctx = PyRegistry_AsRegistryContext(self);
if (!PyArg_ParseTuple(args, "s", &filename))
return NULL;
@@ -99,7 +103,7 @@ static PyObject *py_diff_apply(PyObject *self, PyObject *args)
static PyObject *py_mount_hive(PyObject *self, PyObject *args)
{
- struct registry_context *ctx = py_talloc_get_ptr(self);
+ struct registry_context *ctx = PyRegistry_AsRegistryContext(self);
uint32_t hkey;
PyObject *py_hivekey, *py_elements = Py_None;
const char **elements;
@@ -124,7 +128,7 @@ static PyObject *py_mount_hive(PyObject *self, PyObject *args)
SMB_ASSERT(ctx != NULL);
- result = reg_mount_hive(ctx, py_talloc_get_ptr(py_hivekey), hkey, elements);
+ result = reg_mount_hive(ctx, PyHiveKey_AsHiveKey(py_hivekey), hkey, elements);
PyErr_WERROR_IS_ERR_RAISE(result);
Py_RETURN_NONE;
@@ -166,7 +170,7 @@ PyTypeObject PyRegistry = {
static PyObject *py_hive_key_del(PyObject *self, PyObject *args)
{
char *name;
- struct hive_key *key = py_talloc_get_ptr(self);
+ struct hive_key *key = PyHiveKey_AsHiveKey(self);
WERROR result;
if (!PyArg_ParseTuple(args, "s", &name))
@@ -182,7 +186,7 @@ static PyObject *py_hive_key_del(PyObject *self, PyObject *args)
static PyObject *py_hive_key_flush(PyObject *self)
{
WERROR result;
- struct hive_key *key = py_talloc_get_ptr(self);
+ struct hive_key *key = PyHiveKey_AsHiveKey(self);
result = hive_key_flush(key);
PyErr_WERROR_IS_ERR_RAISE(result);
@@ -194,7 +198,7 @@ static PyObject *py_hive_key_del_value(PyObject *self, PyObject *args)
{
char *name;
WERROR result;
- struct hive_key *key = py_talloc_get_ptr(self);
+ struct hive_key *key = PyHiveKey_AsHiveKey(self);
if (!PyArg_ParseTuple(args, "s", &name))
return NULL;
@@ -212,7 +216,7 @@ static PyObject *py_hive_key_set_value(PyObject *self, PyObject *args)
uint32_t type;
DATA_BLOB value;
WERROR result;
- struct hive_key *key = py_talloc_get_ptr(self);
+ struct hive_key *key = PyHiveKey_AsHiveKey(self);
if (!PyArg_ParseTuple(args, "siz#", &name, &type, &value.data, &value.length))
return NULL;
diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c
index 4cbcb09a10..fbb9cd9de9 100644
--- a/source4/lib/registry/regf.c
+++ b/source4/lib/registry/regf.c
@@ -543,7 +543,7 @@ static WERROR regf_get_value(TALLOC_CTX *ctx, struct hive_key *key,
if (vk->data_length & 0x80000000) {
vk->data_length &=~0x80000000;
- data->data = talloc_memdup(ctx, (uint8_t *)&vk->data_offset, vk->data_length);
+ data->data = (uint8_t *)talloc_memdup(ctx, (uint8_t *)&vk->data_offset, vk->data_length);
data->length = vk->data_length;
} else {
*data = hbin_get(regf, vk->data_offset);