summaryrefslogtreecommitdiff
path: root/source4/lib/registry
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/registry')
-rw-r--r--source4/lib/registry/hive.c2
-rw-r--r--source4/lib/registry/patchfile.c11
-rw-r--r--source4/lib/registry/patchfile_dotreg.c9
-rw-r--r--source4/lib/registry/patchfile_preg.c2
-rw-r--r--source4/lib/registry/pyregistry.c3
-rw-r--r--source4/lib/registry/regf.c58
-rw-r--r--source4/lib/registry/registry.h30
-rw-r--r--source4/lib/registry/tests/diff.c19
-rw-r--r--source4/lib/registry/tests/generic.c24
-rw-r--r--source4/lib/registry/tests/hive.c3
-rw-r--r--source4/lib/registry/tools/regdiff.c3
-rw-r--r--source4/lib/registry/tools/regpatch.c2
-rw-r--r--source4/lib/registry/tools/regshell.c8
-rw-r--r--source4/lib/registry/tools/regtree.c3
-rw-r--r--source4/lib/registry/util.c30
15 files changed, 76 insertions, 131 deletions
diff --git a/source4/lib/registry/hive.c b/source4/lib/registry/hive.c
index c9cb247071..5763dff0d2 100644
--- a/source4/lib/registry/hive.c
+++ b/source4/lib/registry/hive.c
@@ -54,7 +54,7 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
if (!strncmp(peek, "regf", 4)) {
close(fd);
- return reg_open_regf_file(parent_ctx, location, lp_iconv_convenience(lp_ctx), root);
+ return reg_open_regf_file(parent_ctx, location, root);
} else if (!strncmp(peek, "TDB file", 8)) {
close(fd);
return reg_open_ldb_file(parent_ctx, location, session_info,
diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c
index a01c3554c4..061d0fe52d 100644
--- a/source4/lib/registry/patchfile.c
+++ b/source4/lib/registry/patchfile.c
@@ -26,12 +26,10 @@
_PUBLIC_ WERROR reg_preg_diff_load(int fd,
- struct smb_iconv_convenience *iconv_convenience,
const struct reg_diff_callbacks *callbacks,
void *callback_data);
_PUBLIC_ WERROR reg_dotreg_diff_load(int fd,
- struct smb_iconv_convenience *iconv_convenience,
const struct reg_diff_callbacks *callbacks,
void *callback_data);
@@ -338,7 +336,6 @@ _PUBLIC_ WERROR reg_generate_diff(struct registry_context *ctx1,
* Load diff file
*/
_PUBLIC_ WERROR reg_diff_load(const char *filename,
- struct smb_iconv_convenience *iconv_convenience,
const struct reg_diff_callbacks *callbacks,
void *callback_data)
{
@@ -372,10 +369,10 @@ _PUBLIC_ WERROR reg_diff_load(const char *filename,
#endif
if (strncmp(hdr, "PReg", 4) == 0) {
/* Must be a GPO Registry.pol file */
- return reg_preg_diff_load(fd, iconv_convenience, callbacks, callback_data);
+ return reg_preg_diff_load(fd, callbacks, callback_data);
} else {
/* Must be a normal .REG file */
- return reg_dotreg_diff_load(fd, iconv_convenience, callbacks, callback_data);
+ return reg_dotreg_diff_load(fd, callbacks, callback_data);
}
}
@@ -531,7 +528,6 @@ static WERROR reg_diff_apply_del_all_values(void *_ctx, const char *key_name)
* Apply diff to a registry context
*/
_PUBLIC_ WERROR reg_diff_apply(struct registry_context *ctx,
- struct smb_iconv_convenience *iconv_convenience,
const char *filename)
{
struct reg_diff_callbacks callbacks;
@@ -543,6 +539,5 @@ _PUBLIC_ WERROR reg_diff_apply(struct registry_context *ctx,
callbacks.del_all_values = reg_diff_apply_del_all_values;
callbacks.done = NULL;
- return reg_diff_load(filename, iconv_convenience,
- &callbacks, ctx);
+ return reg_diff_load(filename, &callbacks, ctx);
}
diff --git a/source4/lib/registry/patchfile_dotreg.c b/source4/lib/registry/patchfile_dotreg.c
index 5bb955ebc3..70437a1087 100644
--- a/source4/lib/registry/patchfile_dotreg.c
+++ b/source4/lib/registry/patchfile_dotreg.c
@@ -35,7 +35,6 @@
struct dotreg_data {
int fd;
- struct smb_iconv_convenience *iconv_convenience;
};
static WERROR reg_dotreg_diff_add_key(void *_data, const char *key_name)
@@ -61,7 +60,7 @@ static WERROR reg_dotreg_diff_set_value(void *_data, const char *path,
uint32_t value_type, DATA_BLOB value)
{
struct dotreg_data *data = (struct dotreg_data *)_data;
- char *data_string = reg_val_data_string(NULL, data->iconv_convenience,
+ char *data_string = reg_val_data_string(NULL,
value_type, value);
W_ERROR_HAVE_NO_MEMORY(data_string);
fdprintf(data->fd, "\"%s\"=%s:%s\n",
@@ -101,7 +100,6 @@ static WERROR reg_dotreg_diff_del_all_values(void *callback_data,
* Save registry diff
*/
_PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
- struct smb_iconv_convenience *iconv_convenience,
struct reg_diff_callbacks **callbacks,
void **callback_data)
{
@@ -110,8 +108,6 @@ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
data = talloc_zero(ctx, struct dotreg_data);
*callback_data = data;
- data->iconv_convenience = iconv_convenience;
-
if (filename) {
data->fd = open(filename, O_CREAT|O_WRONLY, 0755);
if (data->fd < 0) {
@@ -140,7 +136,6 @@ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
* Load diff file
*/
_PUBLIC_ WERROR reg_dotreg_diff_load(int fd,
- struct smb_iconv_convenience *iconv_convenience,
const struct reg_diff_callbacks *callbacks,
void *callback_data)
{
@@ -248,7 +243,7 @@ _PUBLIC_ WERROR reg_dotreg_diff_load(int fd,
q++;
}
- reg_string_to_val(line, iconv_convenience,
+ reg_string_to_val(line,
q?p:"REG_SZ", q?q:p,
&value_type, &value);
diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c
index 625904bd52..28b56dd7e9 100644
--- a/source4/lib/registry/patchfile_preg.c
+++ b/source4/lib/registry/patchfile_preg.c
@@ -164,7 +164,6 @@ static WERROR reg_preg_diff_done(void *_data)
* Save registry diff
*/
_PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename,
- struct smb_iconv_convenience *ic,
struct reg_diff_callbacks **callbacks,
void **callback_data)
{
@@ -209,7 +208,6 @@ _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename,
* Load diff file
*/
_PUBLIC_ WERROR reg_preg_diff_load(int fd,
- struct smb_iconv_convenience *iconv_convenience,
const struct reg_diff_callbacks *callbacks,
void *callback_data)
{
diff --git a/source4/lib/registry/pyregistry.c b/source4/lib/registry/pyregistry.c
index d4cdd895af..58894feb3a 100644
--- a/source4/lib/registry/pyregistry.c
+++ b/source4/lib/registry/pyregistry.c
@@ -22,7 +22,6 @@
#include <tevent.h>
#include "libcli/util/pyerrors.h"
#include "lib/registry/registry.h"
-#include "scripting/python/modules.h" /* for py_iconv_convenience() */
#include "lib/talloc/pytalloc.h"
#include "auth/credentials/pycredentials.h"
#include "param/pyparam.h"
@@ -91,7 +90,7 @@ static PyObject *py_diff_apply(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s", &filename))
return NULL;
- result = reg_diff_apply(ctx, py_iconv_convenience(NULL), filename);
+ result = reg_diff_apply(ctx, filename);
PyErr_WERROR_IS_ERR_RAISE(result);
Py_RETURN_NONE;
diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c
index 3888b8e3ab..176b256c87 100644
--- a/source4/lib/registry/regf.c
+++ b/source4/lib/registry/regf.c
@@ -49,7 +49,6 @@ struct regf_data {
int fd;
struct hbin_block **hbins;
struct regf_hdr *header;
- struct smb_iconv_convenience *iconv_convenience;
};
static WERROR regf_save_hbin(struct regf_data *data);
@@ -134,7 +133,7 @@ static DATA_BLOB hbin_get(const struct regf_data *data, uint32_t offset)
static bool hbin_get_tdr(struct regf_data *regf, uint32_t offset,
TALLOC_CTX *ctx, tdr_pull_fn_t pull_fn, void *p)
{
- struct tdr_pull *pull = tdr_pull_init(regf, regf->iconv_convenience);
+ struct tdr_pull *pull = tdr_pull_init(regf);
pull->data = hbin_get(regf, offset);
if (!pull->data.data) {
@@ -272,7 +271,7 @@ static uint32_t hbin_store (struct regf_data *data, DATA_BLOB blob)
static uint32_t hbin_store_tdr(struct regf_data *data,
tdr_push_fn_t push_fn, void *p)
{
- struct tdr_push *push = tdr_push_init(data, data->iconv_convenience);
+ struct tdr_push *push = tdr_push_init(data);
uint32_t ret;
if (NT_STATUS_IS_ERR(push_fn(push, p))) {
@@ -399,7 +398,7 @@ static uint32_t hbin_store_tdr_resize(struct regf_data *regf,
tdr_push_fn_t push_fn,
uint32_t orig_offset, void *p)
{
- struct tdr_push *push = tdr_push_init(regf, regf->iconv_convenience);
+ struct tdr_push *push = tdr_push_init(regf);
uint32_t ret;
if (NT_STATUS_IS_ERR(push_fn(push, p))) {
@@ -615,7 +614,7 @@ static WERROR regf_get_subkey_by_index(TALLOC_CTX *ctx,
if (!strncmp((char *)data.data, "li", 2)) {
struct li_block li;
- struct tdr_pull *pull = tdr_pull_init(private_data->hive, private_data->hive->iconv_convenience);
+ struct tdr_pull *pull = tdr_pull_init(private_data->hive);
DEBUG(10, ("Subkeys in LI list\n"));
pull->data = data;
@@ -636,7 +635,7 @@ static WERROR regf_get_subkey_by_index(TALLOC_CTX *ctx,
} else if (!strncmp((char *)data.data, "lf", 2)) {
struct lf_block lf;
- struct tdr_pull *pull = tdr_pull_init(private_data->hive, private_data->hive->iconv_convenience);
+ struct tdr_pull *pull = tdr_pull_init(private_data->hive);
DEBUG(10, ("Subkeys in LF list\n"));
pull->data = data;
@@ -657,7 +656,7 @@ static WERROR regf_get_subkey_by_index(TALLOC_CTX *ctx,
key_off = lf.hr[idx].nk_offset;
} else if (!strncmp((char *)data.data, "lh", 2)) {
struct lh_block lh;
- struct tdr_pull *pull = tdr_pull_init(private_data->hive, private_data->hive->iconv_convenience);
+ struct tdr_pull *pull = tdr_pull_init(private_data->hive);
DEBUG(10, ("Subkeys in LH list\n"));
pull->data = data;
@@ -677,7 +676,7 @@ static WERROR regf_get_subkey_by_index(TALLOC_CTX *ctx,
key_off = lh.hr[idx].nk_offset;
} else if (!strncmp((char *)data.data, "ri", 2)) {
struct ri_block ri;
- struct tdr_pull *pull = tdr_pull_init(ctx, private_data->hive->iconv_convenience);
+ struct tdr_pull *pull = tdr_pull_init(ctx);
uint16_t i;
uint16_t sublist_count = 0;
@@ -811,7 +810,7 @@ static WERROR regf_match_subkey_by_name(TALLOC_CTX *ctx,
return WERR_GENERAL_FAILURE;
}
- pull = tdr_pull_init(ctx, private_data->hive->iconv_convenience);
+ pull = tdr_pull_init(ctx);
pull->data = subkey_data;
@@ -854,7 +853,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx,
if (!strncmp((char *)data.data, "li", 2)) {
struct li_block li;
- struct tdr_pull *pull = tdr_pull_init(ctx, private_data->hive->iconv_convenience);
+ struct tdr_pull *pull = tdr_pull_init(ctx);
uint16_t i;
DEBUG(10, ("Subkeys in LI list\n"));
@@ -885,7 +884,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx,
return WERR_BADFILE;
} else if (!strncmp((char *)data.data, "lf", 2)) {
struct lf_block lf;
- struct tdr_pull *pull = tdr_pull_init(ctx, private_data->hive->iconv_convenience);
+ struct tdr_pull *pull = tdr_pull_init(ctx);
uint16_t i;
DEBUG(10, ("Subkeys in LF list\n"));
@@ -920,7 +919,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx,
return WERR_BADFILE;
} else if (!strncmp((char *)data.data, "lh", 2)) {
struct lh_block lh;
- struct tdr_pull *pull = tdr_pull_init(ctx, private_data->hive->iconv_convenience);
+ struct tdr_pull *pull = tdr_pull_init(ctx);
uint16_t i;
uint32_t hash;
@@ -957,7 +956,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx,
return WERR_BADFILE;
} else if (!strncmp((char *)data.data, "ri", 2)) {
struct ri_block ri;
- struct tdr_pull *pull = tdr_pull_init(ctx, private_data->hive->iconv_convenience);
+ struct tdr_pull *pull = tdr_pull_init(ctx);
uint16_t i, j;
DEBUG(10, ("Subkeys in RI list\n"));
@@ -1062,7 +1061,7 @@ static WERROR regf_set_sec_desc(struct hive_key *key,
(tdr_pull_fn_t) tdr_pull_nk_block, &root);
/* Push the security descriptor to a blob */
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_struct_blob(&data, regf, NULL,
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_struct_blob(&data, regf,
sec_desc, (ndr_push_flags_fn_t)ndr_push_security_descriptor))) {
DEBUG(0, ("Unable to push security descriptor\n"));
return WERR_GENERAL_FAILURE;
@@ -1215,7 +1214,7 @@ static WERROR regf_get_sec_desc(TALLOC_CTX *ctx, const struct hive_key *key,
data.data = sk.sec_desc;
data.length = sk.rec_size;
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_struct_blob(&data, ctx, NULL, *sd,
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_struct_blob(&data, ctx, *sd,
(ndr_pull_flags_fn_t)ndr_pull_security_descriptor))) {
DEBUG(0, ("Error parsing security descriptor\n"));
return WERR_GENERAL_FAILURE;
@@ -1299,7 +1298,7 @@ static WERROR regf_sl_add_entry(struct regf_data *regf, uint32_t list_offset,
}
if (!strncmp((char *)data.data, "li", 2)) {
- struct tdr_pull *pull = tdr_pull_init(regf, regf->iconv_convenience);
+ struct tdr_pull *pull = tdr_pull_init(regf);
struct li_block li;
pull->data = data;
@@ -1328,7 +1327,7 @@ static WERROR regf_sl_add_entry(struct regf_data *regf, uint32_t list_offset,
talloc_free(li.nk_offset);
} else if (!strncmp((char *)data.data, "lf", 2)) {
- struct tdr_pull *pull = tdr_pull_init(regf, regf->iconv_convenience);
+ struct tdr_pull *pull = tdr_pull_init(regf);
struct lf_block lf;
pull->data = data;
@@ -1354,7 +1353,7 @@ static WERROR regf_sl_add_entry(struct regf_data *regf, uint32_t list_offset,
talloc_free(lf.hr);
} else if (!strncmp((char *)data.data, "lh", 2)) {
- struct tdr_pull *pull = tdr_pull_init(regf, regf->iconv_convenience);
+ struct tdr_pull *pull = tdr_pull_init(regf);
struct lh_block lh;
pull->data = data;
@@ -1403,7 +1402,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset,
if (strncmp((char *)data.data, "li", 2) == 0) {
struct li_block li;
- struct tdr_pull *pull = tdr_pull_init(regf, regf->iconv_convenience);
+ struct tdr_pull *pull = tdr_pull_init(regf);
uint16_t i;
bool found_offset = false;
@@ -1447,7 +1446,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset,
list_offset, &li);
} else if (strncmp((char *)data.data, "lf", 2) == 0) {
struct lf_block lf;
- struct tdr_pull *pull = tdr_pull_init(regf, regf->iconv_convenience);
+ struct tdr_pull *pull = tdr_pull_init(regf);
uint16_t i;
bool found_offset = false;
@@ -1493,7 +1492,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset,
list_offset, &lf);
} else if (strncmp((char *)data.data, "lh", 2) == 0) {
struct lh_block lh;
- struct tdr_pull *pull = tdr_pull_init(regf, regf->iconv_convenience);
+ struct tdr_pull *pull = tdr_pull_init(regf);
uint16_t i;
bool found_offset = false;
@@ -1889,7 +1888,7 @@ static WERROR regf_set_value(struct hive_key *key, const char *name,
static WERROR regf_save_hbin(struct regf_data *regf)
{
- struct tdr_push *push = tdr_push_init(regf, regf->iconv_convenience);
+ struct tdr_push *push = tdr_push_init(regf);
unsigned int i;
W_ERROR_HAVE_NO_MEMORY(push);
@@ -1907,7 +1906,7 @@ static WERROR regf_save_hbin(struct regf_data *regf)
regf->header->chksum = regf_hdr_checksum(push->data.data);
talloc_free(push);
- if (NT_STATUS_IS_ERR(tdr_push_to_fd(regf->fd, regf->iconv_convenience,
+ if (NT_STATUS_IS_ERR(tdr_push_to_fd(regf->fd,
(tdr_push_fn_t)tdr_push_regf_hdr,
regf->header))) {
DEBUG(0, ("Error writing registry file header\n"));
@@ -1920,7 +1919,7 @@ static WERROR regf_save_hbin(struct regf_data *regf)
}
for (i = 0; regf->hbins[i]; i++) {
- if (NT_STATUS_IS_ERR(tdr_push_to_fd(regf->fd, regf->iconv_convenience,
+ if (NT_STATUS_IS_ERR(tdr_push_to_fd(regf->fd,
(tdr_push_fn_t)tdr_push_hbin_block,
regf->hbins[i]))) {
DEBUG(0, ("Error writing HBIN block\n"));
@@ -1932,7 +1931,6 @@ static WERROR regf_save_hbin(struct regf_data *regf)
}
WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx,
- struct smb_iconv_convenience *iconv_convenience,
const char *location,
int minor_version, struct hive_key **key)
{
@@ -1947,8 +1945,6 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx,
regf = (struct regf_data *)talloc_zero(NULL, struct regf_data);
- regf->iconv_convenience = iconv_convenience;
-
W_ERROR_HAVE_NO_MEMORY(regf);
DEBUG(5, ("Attempting to create registry file\n"));
@@ -2017,7 +2013,7 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx,
NULL);
/* Push the security descriptor to a blob */
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_struct_blob(&data, regf, NULL,
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_struct_blob(&data, regf,
sd, (ndr_push_flags_fn_t)ndr_push_security_descriptor))) {
DEBUG(0, ("Unable to push security descriptor\n"));
return WERR_GENERAL_FAILURE;
@@ -2060,7 +2056,7 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx,
}
WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, const char *location,
- struct smb_iconv_convenience *iconv_convenience, struct hive_key **key)
+ struct hive_key **key)
{
struct regf_data *regf;
struct regf_hdr *regf_hdr;
@@ -2069,8 +2065,6 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, const char *location,
regf = (struct regf_data *)talloc_zero(parent_ctx, struct regf_data);
- regf->iconv_convenience = iconv_convenience;
-
W_ERROR_HAVE_NO_MEMORY(regf);
DEBUG(5, ("Attempting to load registry file\n"));
@@ -2085,7 +2079,7 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, const char *location,
return WERR_GENERAL_FAILURE;
}
- pull = tdr_pull_init(regf, regf->iconv_convenience);
+ pull = tdr_pull_init(regf);
pull->data.data = (uint8_t*)fd_load(regf->fd, &pull->data.length, 0, regf);
diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h
index e43b0b054c..76247528b2 100644
--- a/source4/lib/registry/registry.h
+++ b/source4/lib/registry/registry.h
@@ -23,7 +23,6 @@
struct registry_context;
struct loadparm_context;
-struct smb_iconv_convenience;
#include <talloc.h>
#include "libcli/util/werror.h"
@@ -206,8 +205,7 @@ WERROR hive_key_flush(struct hive_key *key);
WERROR reg_open_directory(TALLOC_CTX *parent_ctx,
const char *location, struct hive_key **key);
WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx,
- const char *location, struct smb_iconv_convenience *iconv_convenience,
- struct hive_key **key);
+ const char *location, struct hive_key **key);
WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
struct auth_session_info *session_info,
struct cli_credentials *credentials,
@@ -219,7 +217,6 @@ WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
WERROR reg_create_directory(TALLOC_CTX *parent_ctx,
const char *location, struct hive_key **key);
WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx,
- struct smb_iconv_convenience *iconv_convenience,
const char *location,
int major_version,
struct hive_key **key);
@@ -453,19 +450,15 @@ WERROR reg_create_key(TALLOC_CTX *mem_ctx,
/* Utility functions */
const char *str_regtype(int type);
-bool push_reg_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
- DATA_BLOB *blob, const char *s);
-bool push_reg_multi_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
- DATA_BLOB *blob, const char **a);
-bool pull_reg_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
- const DATA_BLOB *blob, const char **s);
-bool pull_reg_multi_sz(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *ic,
- const DATA_BLOB *blob, const char ***a);
+bool push_reg_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *s);
+bool push_reg_multi_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char **a);
+bool pull_reg_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char **s);
+bool pull_reg_multi_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char ***a);
int regtype_by_string(const char *str);
-char *reg_val_data_string(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t type, const DATA_BLOB data);
-char *reg_val_description(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, const char *name,
+char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type, const DATA_BLOB data);
+char *reg_val_description(TALLOC_CTX *mem_ctx, const char *name,
uint32_t type, const DATA_BLOB data);
-bool reg_string_to_val(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, const char *type_str,
+bool reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str,
const char *data_str, uint32_t *type, DATA_BLOB *data);
WERROR reg_open_key_abs(TALLOC_CTX *mem_ctx, struct registry_context *handle,
const char *name, struct registry_key **result);
@@ -502,18 +495,16 @@ struct reg_diff_callbacks {
};
WERROR reg_diff_apply(struct registry_context *ctx,
- struct smb_iconv_convenience *ic, const char *filename);
+ const char *filename);
WERROR reg_generate_diff(struct registry_context *ctx1,
struct registry_context *ctx2,
const struct reg_diff_callbacks *callbacks,
void *callback_data);
WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
- struct smb_iconv_convenience *iconv_convenience,
struct reg_diff_callbacks **callbacks,
void **callback_data);
WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename,
- struct smb_iconv_convenience *ic,
struct reg_diff_callbacks **callbacks,
void **callback_data);
WERROR reg_generate_diff_key(struct registry_key *oldkey,
@@ -522,17 +513,14 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey,
const struct reg_diff_callbacks *callbacks,
void *callback_data);
WERROR reg_diff_load(const char *filename,
- struct smb_iconv_convenience *iconv_convenience,
const struct reg_diff_callbacks *callbacks,
void *callback_data);
WERROR reg_dotreg_diff_load(int fd,
- struct smb_iconv_convenience *iconv_convenience,
const struct reg_diff_callbacks *callbacks,
void *callback_data);
WERROR reg_preg_diff_load(int fd,
- struct smb_iconv_convenience *iconv_convenience,
const struct reg_diff_callbacks *callbacks,
void *callback_data);
diff --git a/source4/lib/registry/tests/diff.c b/source4/lib/registry/tests/diff.c
index 4241ab5ee2..d6a5bd53f2 100644
--- a/source4/lib/registry/tests/diff.c
+++ b/source4/lib/registry/tests/diff.c
@@ -52,14 +52,11 @@ static bool test_generate_diff(struct torture_context *tctx, void *tcase_data)
static bool test_diff_load(struct torture_context *tctx, void *tcase_data)
{
struct diff_tcase_data *td = tcase_data;
- struct smb_iconv_convenience *ic;
struct reg_diff_callbacks *callbacks;
void *data;
WERROR error;
- ic = lp_iconv_convenience(tctx->lp_ctx);
-
- error = reg_diff_load(td->filename, iconv_convenience, callbacks, data);
+ error = reg_diff_load(td->filename, callbacks, data);
torture_assert_werr_ok(tctx, error, "reg_diff_load");
return true;
@@ -71,7 +68,7 @@ static bool test_diff_apply(struct torture_context *tctx, void *tcase_data)
struct registry_key *key;
WERROR error;
- error = reg_diff_apply(td->r1_ctx, lp_iconv_convenience(tctx->lp_ctx), td->filename);
+ error = reg_diff_apply(td->r1_ctx, td->filename);
torture_assert_werr_ok(tctx, error, "reg_diff_apply");
error = td->r1_ctx->ops->get_predefined_key(td->r1_ctx, HKEY_LOCAL_MACHINE, &key);
@@ -247,16 +244,14 @@ static bool diff_setup_tcase(struct torture_context *tctx, void **data)
static bool diff_setup_preg_tcase (struct torture_context *tctx, void **data)
{
struct diff_tcase_data *td;
- struct smb_iconv_convenience *ic;
WERROR error;
diff_setup_tcase(tctx, data);
td = *data;
- ic = lp_iconv_convenience(tctx->lp_ctx);
-
td->filename = talloc_asprintf(tctx, "%s/test.pol", td->tempdir);
- error = reg_preg_diff_save(tctx, td->filename, ic, &td->callbacks, &td->callback_data);
+ error = reg_preg_diff_save(tctx, td->filename, &td->callbacks,
+ &td->callback_data);
torture_assert_werr_ok(tctx, error, "reg_preg_diff_save");
return true;
@@ -265,16 +260,14 @@ static bool diff_setup_preg_tcase (struct torture_context *tctx, void **data)
static bool diff_setup_dotreg_tcase (struct torture_context *tctx, void **data)
{
struct diff_tcase_data *td;
- struct smb_iconv_convenience *ic;
WERROR error;
diff_setup_tcase(tctx, data);
td = *data;
- ic = lp_iconv_convenience(tctx->lp_ctx);
-
td->filename = talloc_asprintf(tctx, "%s/test.reg", td->tempdir);
- error = reg_dotreg_diff_save(tctx, td->filename, ic, &td->callbacks, &td->callback_data);
+ error = reg_dotreg_diff_save(tctx, td->filename, &td->callbacks,
+ &td->callback_data);
torture_assert_werr_ok(tctx, error, "reg_dotreg_diff_save");
return true;
diff --git a/source4/lib/registry/tests/generic.c b/source4/lib/registry/tests/generic.c
index 75b6c7ff26..a69a6148d5 100644
--- a/source4/lib/registry/tests/generic.c
+++ b/source4/lib/registry/tests/generic.c
@@ -65,7 +65,7 @@ static bool test_reg_val_data_string_dword(struct torture_context *ctx)
uint8_t d[] = { 0x20, 0x00, 0x00, 0x00 };
DATA_BLOB db = { d, 4 };
torture_assert_str_equal(ctx, "0x00000020",
- reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_DWORD, db),
+ reg_val_data_string(ctx, REG_DWORD, db),
"dword failed");
return true;
}
@@ -75,7 +75,7 @@ static bool test_reg_val_data_string_dword_big_endian(struct torture_context *ct
uint8_t d[] = { 0x20, 0x00, 0x00, 0x00 };
DATA_BLOB db = { d, 4 };
torture_assert_str_equal(ctx, "0x00000020",
- reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_DWORD_BIG_ENDIAN, db),
+ reg_val_data_string(ctx, REG_DWORD_BIG_ENDIAN, db),
"dword failed");
return true;
}
@@ -85,7 +85,7 @@ static bool test_reg_val_data_string_qword(struct torture_context *ctx)
uint8_t d[] = { 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
DATA_BLOB db = { d, 8 };
torture_assert_str_equal(ctx, "0x0000000000000020",
- reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_QWORD, db),
+ reg_val_data_string(ctx, REG_QWORD, db),
"qword failed");
return true;
}
@@ -93,14 +93,14 @@ static bool test_reg_val_data_string_qword(struct torture_context *ctx)
static bool test_reg_val_data_string_sz(struct torture_context *ctx)
{
DATA_BLOB db;
- convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16,
+ convert_string_talloc(ctx, CH_UTF8, CH_UTF16,
"bla", 3, (void **)&db.data, &db.length, false);
torture_assert_str_equal(ctx, "bla",
- reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_SZ, db),
+ reg_val_data_string(ctx, REG_SZ, db),
"sz failed");
db.length = 4;
torture_assert_str_equal(ctx, "bl",
- reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_SZ, db),
+ reg_val_data_string(ctx, REG_SZ, db),
"sz failed");
return true;
}
@@ -110,7 +110,7 @@ static bool test_reg_val_data_string_binary(struct torture_context *ctx)
uint8_t x[] = { 0x1, 0x2, 0x3, 0x4 };
DATA_BLOB db = { x, 4 };
torture_assert_str_equal(ctx, "01020304",
- reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_BINARY, db),
+ reg_val_data_string(ctx, REG_BINARY, db),
"binary failed");
return true;
}
@@ -120,7 +120,7 @@ static bool test_reg_val_data_string_empty(struct torture_context *ctx)
{
DATA_BLOB db = { NULL, 0 };
torture_assert_str_equal(ctx, "",
- reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_BINARY, db),
+ reg_val_data_string(ctx, REG_BINARY, db),
"empty failed");
return true;
}
@@ -128,12 +128,12 @@ static bool test_reg_val_data_string_empty(struct torture_context *ctx)
static bool test_reg_val_description(struct torture_context *ctx)
{
DATA_BLOB data;
- convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16,
+ convert_string_talloc(ctx, CH_UTF8, CH_UTF16,
"stationary traveller",
strlen("stationary traveller"),
(void **)&data.data, &data.length, false);
torture_assert_str_equal(ctx, "camel = REG_SZ : stationary traveller",
- reg_val_description(ctx, lp_iconv_convenience(ctx->lp_ctx), "camel", REG_SZ, data),
+ reg_val_description(ctx, "camel", REG_SZ, data),
"reg_val_description failed");
return true;
}
@@ -142,12 +142,12 @@ static bool test_reg_val_description(struct torture_context *ctx)
static bool test_reg_val_description_nullname(struct torture_context *ctx)
{
DATA_BLOB data;
- convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16,
+ convert_string_talloc(ctx, CH_UTF8, CH_UTF16,
"west berlin",
strlen("west berlin"),
(void **)&data.data, &data.length, false);
torture_assert_str_equal(ctx, "<No Name> = REG_SZ : west berlin",
- reg_val_description(ctx, lp_iconv_convenience(ctx->lp_ctx), NULL, REG_SZ, data),
+ reg_val_description(ctx, NULL, REG_SZ, data),
"description with null name failed");
return true;
}
diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c
index 905b9a97ef..4ae9a5bcbf 100644
--- a/source4/lib/registry/tests/hive.c
+++ b/source4/lib/registry/tests/hive.c
@@ -435,8 +435,7 @@ static bool hive_setup_regf(struct torture_context *tctx, void **data)
rmdir(dirname);
- error = reg_create_regf_file(tctx, lp_iconv_convenience(tctx->lp_ctx),
- dirname, 5, &key);
+ error = reg_create_regf_file(tctx, dirname, 5, &key);
if (!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Unable to create new regf file\n");
return false;
diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c
index 945b472903..bd58f7748f 100644
--- a/source4/lib/registry/tools/regdiff.c
+++ b/source4/lib/registry/tools/regdiff.c
@@ -130,8 +130,7 @@ int main(int argc, const char **argv)
poptFreeContext(pc);
- error = reg_dotreg_diff_save(ctx, outputfile, lp_iconv_convenience(cmdline_lp_ctx), &callbacks,
- &callback_data);
+ error = reg_dotreg_diff_save(ctx, outputfile, &callbacks, &callback_data);
if (!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Problem saving registry diff to '%s': %s\n",
outputfile, win_errstr(error));
diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c
index 3f550e517e..a8c1843116 100644
--- a/source4/lib/registry/tools/regpatch.c
+++ b/source4/lib/registry/tools/regpatch.c
@@ -68,7 +68,7 @@ int main(int argc, char **argv)
poptFreeContext(pc);
- reg_diff_apply(h, lp_iconv_convenience(cmdline_lp_ctx), patch);
+ reg_diff_apply(h, patch);
return 0;
}
diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c
index b72b07574e..3a8c62d1ce 100644
--- a/source4/lib/registry/tools/regshell.c
+++ b/source4/lib/registry/tools/regshell.c
@@ -195,9 +195,7 @@ static WERROR cmd_set(struct regshell_context *ctx, int argc, char **argv)
return WERR_INVALID_PARAM;
}
- if (!reg_string_to_val(ctx, lp_iconv_convenience(cmdline_lp_ctx),
- argv[2], argv[3], &val.data_type,
- &val.data)) {
+ if (!reg_string_to_val(ctx, argv[2], argv[3], &val.data_type, &val.data)) {
fprintf(stderr, "Unable to interpret data\n");
return WERR_INVALID_PARAM;
}
@@ -259,7 +257,7 @@ static WERROR cmd_print(struct regshell_context *ctx, int argc, char **argv)
}
printf("%s\n%s\n", str_regtype(value_type),
- reg_val_data_string(ctx, lp_iconv_convenience(cmdline_lp_ctx), value_type, value_data));
+ reg_val_data_string(ctx, value_type, value_data));
return WERR_OK;
}
@@ -290,7 +288,7 @@ static WERROR cmd_ls(struct regshell_context *ctx, int argc, char **argv)
for (i = 0; W_ERROR_IS_OK(error = reg_key_get_value_by_index(ctx,
ctx->current, i, &name, &valuetype, &valuedata)); i++)
printf("V \"%s\" %s %s\n", name, str_regtype(valuetype),
- reg_val_data_string(ctx, lp_iconv_convenience(cmdline_lp_ctx), valuetype, valuedata));
+ reg_val_data_string(ctx, valuetype, valuedata));
return WERR_OK;
}
diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c
index 3a7026b4a4..6857940672 100644
--- a/source4/lib/registry/tools/regtree.c
+++ b/source4/lib/registry/tools/regtree.c
@@ -81,8 +81,7 @@ static void print_tree(unsigned int level, struct registry_key *p,
unsigned int j;
for(j = 0; j < level+1; j++) putchar(' ');
printf("%s\n", reg_val_description(mem_ctx,
- lp_iconv_convenience(cmdline_lp_ctx), valuename,
- valuetype, valuedata));
+ valuename, valuetype, valuedata));
}
talloc_free(mem_ctx);
diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c
index 62a94dfcc7..fce420e625 100644
--- a/source4/lib/registry/util.c
+++ b/source4/lib/registry/util.c
@@ -21,9 +21,7 @@
#include "lib/registry/registry.h"
#include "librpc/gen_ndr/winreg.h"
-_PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
- struct smb_iconv_convenience *iconv_convenience,
- uint32_t type,
+_PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type,
const DATA_BLOB data)
{
char *ret = NULL;
@@ -34,13 +32,9 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
switch (type) {
case REG_EXPAND_SZ:
case REG_SZ:
- convert_string_talloc_convenience(mem_ctx,
- iconv_convenience,
- CH_UTF16, CH_UNIX,
- data.data,
- data.length,
- (void **)&ret,
- NULL, false);
+ convert_string_talloc(mem_ctx,
+ CH_UTF16, CH_UNIX, data.data, data.length,
+ (void **)&ret, NULL, false);
break;
case REG_DWORD:
case REG_DWORD_BIG_ENDIAN:
@@ -73,21 +67,17 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
/** Generate a string that describes a registry value */
_PUBLIC_ char *reg_val_description(TALLOC_CTX *mem_ctx,
- struct smb_iconv_convenience *iconv_convenience,
const char *name,
uint32_t data_type,
const DATA_BLOB data)
{
return talloc_asprintf(mem_ctx, "%s = %s : %s", name?name:"<No Name>",
str_regtype(data_type),
- reg_val_data_string(mem_ctx, iconv_convenience, data_type, data));
+ reg_val_data_string(mem_ctx, data_type, data));
}
-_PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx,
- struct smb_iconv_convenience *iconv_convenience,
- const char *type_str,
- const char *data_str, uint32_t *type,
- DATA_BLOB *data)
+_PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str,
+ const char *data_str, uint32_t *type, DATA_BLOB *data)
{
*type = regtype_by_string(type_str);
@@ -99,10 +89,8 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx,
switch (*type) {
case REG_SZ:
case REG_EXPAND_SZ:
- return convert_string_talloc_convenience(mem_ctx,
- iconv_convenience,
- CH_UNIX, CH_UTF16,
- data_str,
+ return convert_string_talloc(mem_ctx,
+ CH_UNIX, CH_UTF16, data_str,
strlen(data_str)+1,
(void **)&data->data,
&data->length, false);