mirror of
https://github.com/samba-team/samba.git
synced 2025-02-24 13:57:43 +03:00
r26565: Fix python registry bindings. 'PROVISION_PYTHON=yes make test' works now.
(This used to be commit 485d1fa3d17fe6cc7a0ecd80e8bac42d173bbb19)
This commit is contained in:
parent
09f820f0bd
commit
249cc734ce
@ -107,7 +107,7 @@ WERROR hive_enum_key(TALLOC_CTX *mem_ctx,
|
|||||||
last_mod_time);
|
last_mod_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
WERROR hive_set_value(struct hive_key *key, const char *name, uint32_t type,
|
WERROR hive_key_set_value(struct hive_key *key, const char *name, uint32_t type,
|
||||||
const DATA_BLOB data)
|
const DATA_BLOB data)
|
||||||
{
|
{
|
||||||
if (key->ops->set_value == NULL)
|
if (key->ops->set_value == NULL)
|
||||||
|
@ -164,7 +164,7 @@ WERROR hive_enum_key(TALLOC_CTX *mem_ctx,
|
|||||||
const char **classname,
|
const char **classname,
|
||||||
NTTIME *last_mod_time);
|
NTTIME *last_mod_time);
|
||||||
|
|
||||||
WERROR hive_set_value(struct hive_key *key, const char *name,
|
WERROR hive_key_set_value(struct hive_key *key, const char *name,
|
||||||
uint32_t type, const DATA_BLOB data);
|
uint32_t type, const DATA_BLOB data);
|
||||||
|
|
||||||
WERROR hive_get_value(TALLOC_CTX *mem_ctx,
|
WERROR hive_get_value(TALLOC_CTX *mem_ctx,
|
||||||
|
@ -216,7 +216,7 @@ static WERROR local_set_value(struct registry_key *key, const char *name,
|
|||||||
{
|
{
|
||||||
struct local_key *local = (struct local_key *)key;
|
struct local_key *local = (struct local_key *)key;
|
||||||
|
|
||||||
return hive_set_value(local->hive_key, name, type, data);
|
return hive_key_set_value(local->hive_key, name, type, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static WERROR local_get_value(TALLOC_CTX *mem_ctx,
|
static WERROR local_get_value(TALLOC_CTX *mem_ctx,
|
||||||
|
@ -247,9 +247,6 @@ WERROR reg_create_key(TALLOC_CTX *mem_ctx,
|
|||||||
struct security_descriptor *security,
|
struct security_descriptor *security,
|
||||||
struct registry_key **key);
|
struct registry_key **key);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Utility functions */
|
/* Utility functions */
|
||||||
const char *str_regtype(int type);
|
const char *str_regtype(int type);
|
||||||
char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type,
|
char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type,
|
||||||
|
@ -137,6 +137,21 @@ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
|
|||||||
struct loadparm_context *lp_ctx,
|
struct loadparm_context *lp_ctx,
|
||||||
struct hive_key **root);
|
struct hive_key **root);
|
||||||
|
|
||||||
|
%rename(open_ldb) reg_open_ldb_file;
|
||||||
|
WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
|
||||||
|
struct auth_session_info *session_info,
|
||||||
|
struct cli_credentials *credentials,
|
||||||
|
struct loadparm_context *lp_ctx,
|
||||||
|
struct hive_key **k);
|
||||||
|
|
||||||
|
%rename(create_dir) reg_create_directory;
|
||||||
|
WERROR reg_create_directory(TALLOC_CTX *parent_ctx,
|
||||||
|
const char *location, struct hive_key **key);
|
||||||
|
|
||||||
|
%rename(open_dir) reg_open_directory;
|
||||||
|
WERROR reg_open_directory(TALLOC_CTX *parent_ctx,
|
||||||
|
const char *location, struct hive_key **key);
|
||||||
|
|
||||||
%talloctype(hive_key);
|
%talloctype(hive_key);
|
||||||
|
|
||||||
typedef struct hive_key {
|
typedef struct hive_key {
|
||||||
@ -144,6 +159,7 @@ typedef struct hive_key {
|
|||||||
WERROR del(const char *name);
|
WERROR del(const char *name);
|
||||||
WERROR flush(void);
|
WERROR flush(void);
|
||||||
WERROR del_value(const char *name);
|
WERROR del_value(const char *name);
|
||||||
|
WERROR set_value(const char *name, uint32_t type, const DATA_BLOB data);
|
||||||
}
|
}
|
||||||
} hive_key;
|
} hive_key;
|
||||||
|
|
||||||
|
@ -79,6 +79,9 @@ reg_swigregister = _registry.reg_swigregister
|
|||||||
reg_swigregister(reg)
|
reg_swigregister(reg)
|
||||||
|
|
||||||
hive_key = _registry.hive_key
|
hive_key = _registry.hive_key
|
||||||
|
open_ldb = _registry.open_ldb
|
||||||
|
create_dir = _registry.create_dir
|
||||||
|
open_dir = _registry.open_dir
|
||||||
open_samba = _registry.open_samba
|
open_samba = _registry.open_samba
|
||||||
HKEY_CLASSES_ROOT = _registry.HKEY_CLASSES_ROOT
|
HKEY_CLASSES_ROOT = _registry.HKEY_CLASSES_ROOT
|
||||||
HKEY_CURRENT_USER = _registry.HKEY_CURRENT_USER
|
HKEY_CURRENT_USER = _registry.HKEY_CURRENT_USER
|
||||||
|
@ -3582,6 +3582,192 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject *resultobj = 0;
|
||||||
|
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
|
||||||
|
char *arg2 = (char *) 0 ;
|
||||||
|
struct auth_session_info *arg3 = (struct auth_session_info *) 0 ;
|
||||||
|
struct cli_credentials *arg4 = (struct cli_credentials *) 0 ;
|
||||||
|
struct loadparm_context *arg5 = (struct loadparm_context *) 0 ;
|
||||||
|
struct hive_key **arg6 = (struct hive_key **) 0 ;
|
||||||
|
WERROR result;
|
||||||
|
int res2 ;
|
||||||
|
char *buf2 = 0 ;
|
||||||
|
int alloc2 = 0 ;
|
||||||
|
void *argp3 = 0 ;
|
||||||
|
int res3 = 0 ;
|
||||||
|
void *argp4 = 0 ;
|
||||||
|
int res4 = 0 ;
|
||||||
|
void *argp5 = 0 ;
|
||||||
|
int res5 = 0 ;
|
||||||
|
struct hive_key *tmp6 ;
|
||||||
|
PyObject * obj0 = 0 ;
|
||||||
|
PyObject * obj1 = 0 ;
|
||||||
|
PyObject * obj2 = 0 ;
|
||||||
|
PyObject * obj3 = 0 ;
|
||||||
|
char * kwnames[] = {
|
||||||
|
(char *) "location",(char *) "session_info",(char *) "credentials",(char *) "lp_ctx", NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
{
|
||||||
|
arg3 = NULL;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
arg4 = NULL;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
arg5 = loadparm_init(NULL);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
arg1 = NULL;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
arg6 = &tmp6;
|
||||||
|
}
|
||||||
|
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOO:open_ldb",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
|
||||||
|
res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2);
|
||||||
|
if (!SWIG_IsOK(res2)) {
|
||||||
|
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "open_ldb" "', argument " "2"" of type '" "char const *""'");
|
||||||
|
}
|
||||||
|
arg2 = (char *)(buf2);
|
||||||
|
if (obj1) {
|
||||||
|
res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_auth_session_info, 0 | 0 );
|
||||||
|
if (!SWIG_IsOK(res3)) {
|
||||||
|
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "open_ldb" "', argument " "3"" of type '" "struct auth_session_info *""'");
|
||||||
|
}
|
||||||
|
arg3 = (struct auth_session_info *)(argp3);
|
||||||
|
}
|
||||||
|
if (obj2) {
|
||||||
|
res4 = SWIG_ConvertPtr(obj2, &argp4,SWIGTYPE_p_cli_credentials, 0 | 0 );
|
||||||
|
if (!SWIG_IsOK(res4)) {
|
||||||
|
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "open_ldb" "', argument " "4"" of type '" "struct cli_credentials *""'");
|
||||||
|
}
|
||||||
|
arg4 = (struct cli_credentials *)(argp4);
|
||||||
|
}
|
||||||
|
if (obj3) {
|
||||||
|
res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_loadparm_context, 0 | 0 );
|
||||||
|
if (!SWIG_IsOK(res5)) {
|
||||||
|
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_ldb" "', argument " "5"" of type '" "struct loadparm_context *""'");
|
||||||
|
}
|
||||||
|
arg5 = (struct loadparm_context *)(argp5);
|
||||||
|
}
|
||||||
|
result = reg_open_ldb_file(arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
|
||||||
|
{
|
||||||
|
if (!W_ERROR_IS_OK(result)) {
|
||||||
|
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
|
||||||
|
PyErr_SetObject(PyExc_RuntimeError, obj);
|
||||||
|
} else if (resultobj == NULL) {
|
||||||
|
resultobj = Py_None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Py_XDECREF(resultobj);
|
||||||
|
resultobj = SWIG_NewPointerObj(*arg6, SWIGTYPE_p_hive_key, 0);
|
||||||
|
}
|
||||||
|
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
|
||||||
|
return resultobj;
|
||||||
|
fail:
|
||||||
|
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SWIGINTERN PyObject *_wrap_create_dir(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject *resultobj = 0;
|
||||||
|
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
|
||||||
|
char *arg2 = (char *) 0 ;
|
||||||
|
struct hive_key **arg3 = (struct hive_key **) 0 ;
|
||||||
|
WERROR result;
|
||||||
|
int res2 ;
|
||||||
|
char *buf2 = 0 ;
|
||||||
|
int alloc2 = 0 ;
|
||||||
|
struct hive_key *tmp3 ;
|
||||||
|
PyObject * obj0 = 0 ;
|
||||||
|
char * kwnames[] = {
|
||||||
|
(char *) "location", NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
{
|
||||||
|
arg1 = NULL;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
arg3 = &tmp3;
|
||||||
|
}
|
||||||
|
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:create_dir",kwnames,&obj0)) SWIG_fail;
|
||||||
|
res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2);
|
||||||
|
if (!SWIG_IsOK(res2)) {
|
||||||
|
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "create_dir" "', argument " "2"" of type '" "char const *""'");
|
||||||
|
}
|
||||||
|
arg2 = (char *)(buf2);
|
||||||
|
result = reg_create_directory(arg1,(char const *)arg2,arg3);
|
||||||
|
{
|
||||||
|
if (!W_ERROR_IS_OK(result)) {
|
||||||
|
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
|
||||||
|
PyErr_SetObject(PyExc_RuntimeError, obj);
|
||||||
|
} else if (resultobj == NULL) {
|
||||||
|
resultobj = Py_None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Py_XDECREF(resultobj);
|
||||||
|
resultobj = SWIG_NewPointerObj(*arg3, SWIGTYPE_p_hive_key, 0);
|
||||||
|
}
|
||||||
|
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
|
||||||
|
return resultobj;
|
||||||
|
fail:
|
||||||
|
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SWIGINTERN PyObject *_wrap_open_dir(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject *resultobj = 0;
|
||||||
|
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
|
||||||
|
char *arg2 = (char *) 0 ;
|
||||||
|
struct hive_key **arg3 = (struct hive_key **) 0 ;
|
||||||
|
WERROR result;
|
||||||
|
int res2 ;
|
||||||
|
char *buf2 = 0 ;
|
||||||
|
int alloc2 = 0 ;
|
||||||
|
struct hive_key *tmp3 ;
|
||||||
|
PyObject * obj0 = 0 ;
|
||||||
|
char * kwnames[] = {
|
||||||
|
(char *) "location", NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
{
|
||||||
|
arg1 = NULL;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
arg3 = &tmp3;
|
||||||
|
}
|
||||||
|
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:open_dir",kwnames,&obj0)) SWIG_fail;
|
||||||
|
res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2);
|
||||||
|
if (!SWIG_IsOK(res2)) {
|
||||||
|
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "open_dir" "', argument " "2"" of type '" "char const *""'");
|
||||||
|
}
|
||||||
|
arg2 = (char *)(buf2);
|
||||||
|
result = reg_open_directory(arg1,(char const *)arg2,arg3);
|
||||||
|
{
|
||||||
|
if (!W_ERROR_IS_OK(result)) {
|
||||||
|
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
|
||||||
|
PyErr_SetObject(PyExc_RuntimeError, obj);
|
||||||
|
} else if (resultobj == NULL) {
|
||||||
|
resultobj = Py_None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Py_XDECREF(resultobj);
|
||||||
|
resultobj = SWIG_NewPointerObj(*arg3, SWIGTYPE_p_hive_key, 0);
|
||||||
|
}
|
||||||
|
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
|
||||||
|
return resultobj;
|
||||||
|
fail:
|
||||||
|
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
|
SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
|
||||||
PyObject *resultobj = 0;
|
PyObject *resultobj = 0;
|
||||||
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
|
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
|
||||||
@ -3675,6 +3861,9 @@ static PyMethodDef SwigMethods[] = {
|
|||||||
{ (char *)"reg_swigregister", reg_swigregister, METH_VARARGS, NULL},
|
{ (char *)"reg_swigregister", reg_swigregister, METH_VARARGS, NULL},
|
||||||
{ (char *)"reg_swiginit", reg_swiginit, METH_VARARGS, NULL},
|
{ (char *)"reg_swiginit", reg_swiginit, METH_VARARGS, NULL},
|
||||||
{ (char *)"hive_key", (PyCFunction) _wrap_hive_key, METH_VARARGS | METH_KEYWORDS, NULL},
|
{ (char *)"hive_key", (PyCFunction) _wrap_hive_key, METH_VARARGS | METH_KEYWORDS, NULL},
|
||||||
|
{ (char *)"open_ldb", (PyCFunction) _wrap_open_ldb, METH_VARARGS | METH_KEYWORDS, NULL},
|
||||||
|
{ (char *)"create_dir", (PyCFunction) _wrap_create_dir, METH_VARARGS | METH_KEYWORDS, NULL},
|
||||||
|
{ (char *)"open_dir", (PyCFunction) _wrap_open_dir, METH_VARARGS | METH_KEYWORDS, NULL},
|
||||||
{ (char *)"open_samba", (PyCFunction) _wrap_open_samba, METH_VARARGS | METH_KEYWORDS, NULL},
|
{ (char *)"open_samba", (PyCFunction) _wrap_open_samba, METH_VARARGS | METH_KEYWORDS, NULL},
|
||||||
{ NULL, NULL, 0, NULL }
|
{ NULL, NULL, 0, NULL }
|
||||||
};
|
};
|
||||||
|
@ -17,8 +17,10 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
import registry
|
import registry
|
||||||
|
import samba.tests
|
||||||
|
|
||||||
class HelperTests(unittest.TestCase):
|
class HelperTests(unittest.TestCase):
|
||||||
def test_predef_to_name(self):
|
def test_predef_to_name(self):
|
||||||
@ -29,6 +31,22 @@ class HelperTests(unittest.TestCase):
|
|||||||
self.assertEquals("REG_DWORD", registry.str_regtype(4))
|
self.assertEquals("REG_DWORD", registry.str_regtype(4))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class HiveTests(samba.tests.TestCaseInTempDir):
|
||||||
|
def setUp(self):
|
||||||
|
super(HiveTests, self).setUp()
|
||||||
|
self.hive = registry.open_ldb(os.path.join(self.tempdir, "ldb_new.ldb"))
|
||||||
|
|
||||||
|
def test_ldb_new(self):
|
||||||
|
self.assertTrue(self.hive is not None)
|
||||||
|
|
||||||
|
def test_flush(self):
|
||||||
|
self.hive.flush()
|
||||||
|
|
||||||
|
def test_del_value(self):
|
||||||
|
self.hive.del_value("FOO")
|
||||||
|
|
||||||
|
|
||||||
class RegistryTests(unittest.TestCase):
|
class RegistryTests(unittest.TestCase):
|
||||||
def test_new(self):
|
def test_new(self):
|
||||||
self.registry = registry.Registry()
|
self.registry = registry.Registry()
|
||||||
|
@ -74,9 +74,9 @@ static bool test_keyinfo_nums(struct torture_context *tctx,
|
|||||||
NULL, &subkey);
|
NULL, &subkey);
|
||||||
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
|
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
|
||||||
|
|
||||||
error = hive_set_value(root, "Answer", REG_DWORD,
|
error = hive_key_set_value(root, "Answer", REG_DWORD,
|
||||||
data_blob_talloc(tctx, &data, sizeof(data)));
|
data_blob_talloc(tctx, &data, sizeof(data)));
|
||||||
torture_assert_werr_ok(tctx, error, "hive_set_value");
|
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
|
||||||
|
|
||||||
/* This is a new backend. There should be no subkeys and no
|
/* This is a new backend. There should be no subkeys and no
|
||||||
* values */
|
* values */
|
||||||
@ -154,9 +154,9 @@ static bool test_set_value(struct torture_context *tctx,
|
|||||||
NULL, &subkey);
|
NULL, &subkey);
|
||||||
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
|
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
|
||||||
|
|
||||||
error = hive_set_value(subkey, "Answer", REG_DWORD,
|
error = hive_key_set_value(subkey, "Answer", REG_DWORD,
|
||||||
data_blob_talloc(mem_ctx, &data, sizeof(data)));
|
data_blob_talloc(mem_ctx, &data, sizeof(data)));
|
||||||
torture_assert_werr_ok(tctx, error, "hive_set_value");
|
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -179,9 +179,9 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data)
|
|||||||
torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND,
|
torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND,
|
||||||
"getting missing value");
|
"getting missing value");
|
||||||
|
|
||||||
error = hive_set_value(subkey, "Answer", REG_DWORD,
|
error = hive_key_set_value(subkey, "Answer", REG_DWORD,
|
||||||
data_blob_talloc(mem_ctx, &data, sizeof(data)));
|
data_blob_talloc(mem_ctx, &data, sizeof(data)));
|
||||||
torture_assert_werr_ok(tctx, error, "hive_set_value");
|
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
|
||||||
|
|
||||||
error = hive_get_value(mem_ctx, subkey, "Answer", &type, &value);
|
error = hive_get_value(mem_ctx, subkey, "Answer", &type, &value);
|
||||||
torture_assert_werr_ok(tctx, error, "getting value");
|
torture_assert_werr_ok(tctx, error, "getting value");
|
||||||
@ -207,9 +207,9 @@ static bool test_del_value(struct torture_context *tctx, const void *test_data)
|
|||||||
NULL, &subkey);
|
NULL, &subkey);
|
||||||
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
|
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
|
||||||
|
|
||||||
error = hive_set_value(subkey, "Answer", REG_DWORD,
|
error = hive_key_set_value(subkey, "Answer", REG_DWORD,
|
||||||
data_blob_talloc(mem_ctx, &data, sizeof(data)));
|
data_blob_talloc(mem_ctx, &data, sizeof(data)));
|
||||||
torture_assert_werr_ok(tctx, error, "hive_set_value");
|
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
|
||||||
|
|
||||||
error = hive_key_del_value(subkey, "Answer");
|
error = hive_key_del_value(subkey, "Answer");
|
||||||
torture_assert_werr_ok(tctx, error, "deleting value");
|
torture_assert_werr_ok(tctx, error, "deleting value");
|
||||||
@ -240,9 +240,9 @@ static bool test_list_values(struct torture_context *tctx,
|
|||||||
NULL, &subkey);
|
NULL, &subkey);
|
||||||
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
|
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
|
||||||
|
|
||||||
error = hive_set_value(subkey, "Answer", REG_DWORD,
|
error = hive_key_set_value(subkey, "Answer", REG_DWORD,
|
||||||
data_blob_talloc(mem_ctx, &data, sizeof(data)));
|
data_blob_talloc(mem_ctx, &data, sizeof(data)));
|
||||||
torture_assert_werr_ok(tctx, error, "hive_set_value");
|
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
|
||||||
|
|
||||||
error = hive_get_value_by_index(mem_ctx, subkey, 0, &name,
|
error = hive_get_value_by_index(mem_ctx, subkey, 0, &name,
|
||||||
&type, &value);
|
&type, &value);
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
if (!W_ERROR_IS_OK($1)) {
|
if (!W_ERROR_IS_OK($1)) {
|
||||||
PyObject *obj = Py_BuildValue("(i,s)", $1.v, win_errstr($1));
|
PyObject *obj = Py_BuildValue("(i,s)", $1.v, win_errstr($1));
|
||||||
PyErr_SetObject(PyExc_RuntimeError, obj);
|
PyErr_SetObject(PyExc_RuntimeError, obj);
|
||||||
|
SWIG_fail;
|
||||||
} else if ($result == NULL) {
|
} else if ($result == NULL) {
|
||||||
$result = Py_None;
|
$result = Py_None;
|
||||||
}
|
}
|
||||||
@ -31,6 +32,7 @@
|
|||||||
if (NT_STATUS_IS_ERR($1)) {
|
if (NT_STATUS_IS_ERR($1)) {
|
||||||
PyObject *obj = Py_BuildValue("(i,s)", $1.v, nt_errstr($1));
|
PyObject *obj = Py_BuildValue("(i,s)", $1.v, nt_errstr($1));
|
||||||
PyErr_SetObject(PyExc_RuntimeError, obj);
|
PyErr_SetObject(PyExc_RuntimeError, obj);
|
||||||
|
SWIG_fail;
|
||||||
} else if ($result == NULL) {
|
} else if ($result == NULL) {
|
||||||
$result = Py_None;
|
$result = Py_None;
|
||||||
}
|
}
|
||||||
|
@ -281,12 +281,12 @@ def setup_templatesdb(path, setup_path, session_info, credentials, lp):
|
|||||||
|
|
||||||
def setup_registry(path, setup_path, session_info, credentials, lp):
|
def setup_registry(path, setup_path, session_info, credentials, lp):
|
||||||
reg = registry.Registry()
|
reg = registry.Registry()
|
||||||
hive = registry.Hive(path, session_info=session_info,
|
hive = registry.open_ldb(path, session_info=session_info,
|
||||||
credentials=credentials, lp_ctx=lp)
|
credentials=credentials, lp_ctx=lp)
|
||||||
reg.mount_hive(hive, "HKEY_LOCAL_MACHINE")
|
reg.mount_hive(hive, "HKEY_LOCAL_MACHINE")
|
||||||
provision_reg = setup_path("provision.reg")
|
provision_reg = setup_path("provision.reg")
|
||||||
assert os.path.exists(provision_reg)
|
assert os.path.exists(provision_reg)
|
||||||
reg.apply_patchfile(provision_reg)
|
reg.diff_apply(provision_reg)
|
||||||
|
|
||||||
|
|
||||||
def setup_samdb_rootdse(samdb, setup_path, schemadn, domaindn, hostname,
|
def setup_samdb_rootdse(samdb, setup_path, schemadn, domaindn, hostname,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user