summaryrefslogtreecommitdiff
path: root/source4/lib/registry
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2015-12-03 15:24:12 +0100
committerJeremy Allison <jra@samba.org>2016-09-28 00:04:17 +0200
commit70807a42676ef8ba7468c6721687597926fe6f70 (patch)
tree9a2514028d5d19aaf5dfb7a7e756a93b876f680e /source4/lib/registry
parentf7b172fd42ca34d41e52155a84eaee2735705866 (diff)
downloadsamba-70807a42676ef8ba7468c6721687597926fe6f70.tar.gz
werror: replace WERR_BADFILE with WERR_FILE_NOT_FOUND in source4/lib/registry/
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4/lib/registry')
-rw-r--r--source4/lib/registry/hive.c8
-rw-r--r--source4/lib/registry/interface.c2
-rw-r--r--source4/lib/registry/ldb.c12
-rw-r--r--source4/lib/registry/local.c4
-rw-r--r--source4/lib/registry/patchfile.c26
-rw-r--r--source4/lib/registry/patchfile_dotreg.c6
-rw-r--r--source4/lib/registry/patchfile_preg.c2
-rw-r--r--source4/lib/registry/regf.c62
-rw-r--r--source4/lib/registry/samba.c2
-rw-r--r--source4/lib/registry/tests/hive.c10
-rw-r--r--source4/lib/registry/tests/registry.c14
11 files changed, 74 insertions, 74 deletions
diff --git a/source4/lib/registry/hive.c b/source4/lib/registry/hive.c
index d79135fadba..1f0672d865a 100644
--- a/source4/lib/registry/hive.c
+++ b/source4/lib/registry/hive.c
@@ -38,14 +38,14 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
fd = open(location, O_RDWR);
if (fd == -1) {
if (errno == ENOENT)
- return WERR_BADFILE;
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
+ return WERR_FILE_NOT_FOUND;
}
num = read(fd, peek, 20);
close(fd);
if (num == -1) {
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
if (!strncmp(peek, "regf", 4)) {
@@ -55,7 +55,7 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
credentials, ev_ctx, lp_ctx, root);
}
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
_PUBLIC_ WERROR hive_key_get_info(TALLOC_CTX *mem_ctx,
diff --git a/source4/lib/registry/interface.c b/source4/lib/registry/interface.c
index 07e606d05b6..e4c3ca513e2 100644
--- a/source4/lib/registry/interface.c
+++ b/source4/lib/registry/interface.c
@@ -69,7 +69,7 @@ _PUBLIC_ WERROR reg_get_predefined_key_by_name(struct registry_context *ctx,
DEBUG(1, ("No predefined key with name '%s'\n", name));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
/** Get predefined key by id. */
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 1dfffdb7acc..8e56ac13c93 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -419,7 +419,7 @@ static WERROR ldb_get_default_value(TALLOC_CTX *mem_ctx,
if (res->count == 0 || res->msgs[0]->num_elements == 0) {
talloc_free(res);
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
if ((data_type != NULL) && (data != NULL)) {
@@ -488,7 +488,7 @@ static WERROR ldb_get_value(TALLOC_CTX *mem_ctx, struct hive_key *k,
}
}
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, const struct hive_key *h,
@@ -515,7 +515,7 @@ static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, const struct hive_key *h,
DEBUG(3, ("Key '%s' not found\n",
ldb_dn_get_linearized(ldb_path)));
talloc_free(res);
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
newkd = talloc_zero(mem_ctx, struct ldb_key_data);
@@ -661,7 +661,7 @@ static WERROR ldb_del_value(TALLOC_CTX *mem_ctx, struct hive_key *key,
talloc_free(msg);
if (ret == LDB_ERR_NO_SUCH_ATTRIBUTE) {
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
} else if (ret != LDB_SUCCESS) {
DEBUG(1, ("ldb_del_value: %s\n", ldb_errstring(kd->ldb)));
return WERR_FOOBAR;
@@ -681,7 +681,7 @@ static WERROR ldb_del_value(TALLOC_CTX *mem_ctx, struct hive_key *key,
talloc_free(childdn);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
} else if (ret != LDB_SUCCESS) {
DEBUG(1, ("ldb_del_value: %s\n", ldb_errstring(kd->ldb)));
return WERR_FOOBAR;
@@ -906,7 +906,7 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
* remain { NULL, 0 }. */
werr = ldb_get_default_value(mem_ctx, key, NULL, &default_value_type,
&default_value);
- if ((!W_ERROR_IS_OK(werr)) && (!W_ERROR_EQUAL(werr, WERR_BADFILE))) {
+ if ((!W_ERROR_IS_OK(werr)) && (!W_ERROR_EQUAL(werr, WERR_FILE_NOT_FOUND))) {
return werr;
}
diff --git a/source4/lib/registry/local.c b/source4/lib/registry/local.c
index 6079efd6543..82acd0bc1be 100644
--- a/source4/lib/registry/local.c
+++ b/source4/lib/registry/local.c
@@ -148,7 +148,7 @@ WERROR local_get_predefined_key(struct registry_context *ctx,
}
if (mp == NULL)
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
*key = reg_import_hive_key(ctx, mp->key,
mp->path.predefined_key,
@@ -218,7 +218,7 @@ static WERROR local_create_key(TALLOC_CTX *mem_ctx,
elements[el] = NULL;
error = hive_get_key_by_name(mem_ctx, curkey,
curbegin, &curkey);
- if (W_ERROR_EQUAL(error, WERR_BADFILE)) {
+ if (W_ERROR_EQUAL(error, WERR_FILE_NOT_FOUND)) {
error = hive_key_add_name(mem_ctx, curkey, curbegin,
key_class, security,
&curkey);
diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c
index 061d0fe52d4..8259bdb0804 100644
--- a/source4/lib/registry/patchfile.c
+++ b/source4/lib/registry/patchfile.c
@@ -79,18 +79,18 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey,
if (newkey != NULL) {
error2 = reg_open_key(mem_ctx, newkey, keyname1, &t2);
} else {
- error2 = WERR_BADFILE;
+ error2 = WERR_FILE_NOT_FOUND;
t2 = NULL;
}
- if (!W_ERROR_IS_OK(error2) && !W_ERROR_EQUAL(error2, WERR_BADFILE)) {
+ if (!W_ERROR_IS_OK(error2) && !W_ERROR_EQUAL(error2, WERR_FILE_NOT_FOUND)) {
DEBUG(0, ("Error occurred while getting subkey by name: %s\n",
win_errstr(error2)));
talloc_free(mem_ctx);
return error2;
}
- /* if "error2" is going to be "WERR_BADFILE", then newkey */
+ /* if "error2" is going to be "WERR_FILE_NOT_FOUND", then newkey */
/* didn't have such a subkey and therefore add a del diff */
tmppath = talloc_asprintf(mem_ctx, "%s\\%s", path, keyname1);
if (tmppath == NULL) {
@@ -146,11 +146,11 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey,
if (W_ERROR_IS_OK(error2))
continue;
} else {
- error2 = WERR_BADFILE;
+ error2 = WERR_FILE_NOT_FOUND;
t1 = NULL;
}
- if (!W_ERROR_EQUAL(error2, WERR_BADFILE)) {
+ if (!W_ERROR_EQUAL(error2, WERR_FILE_NOT_FOUND)) {
DEBUG(0, ("Error occurred while getting subkey by name: %s\n",
win_errstr(error2)));
talloc_free(mem_ctx);
@@ -199,10 +199,10 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey,
name, &type2,
&contents2);
} else
- error2 = WERR_BADFILE;
+ error2 = WERR_FILE_NOT_FOUND;
if (!W_ERROR_IS_OK(error2)
- && !W_ERROR_EQUAL(error2, WERR_BADFILE)) {
+ && !W_ERROR_EQUAL(error2, WERR_FILE_NOT_FOUND)) {
DEBUG(0, ("Error occurred while getting value by name: %s\n",
win_errstr(error2)));
talloc_free(mem_ctx);
@@ -245,7 +245,7 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey,
error2 = reg_key_get_value_by_name(mem_ctx, newkey,
name, &type, &contents);
else
- error2 = WERR_BADFILE;
+ error2 = WERR_FILE_NOT_FOUND;
if (W_ERROR_IS_OK(error2)) {
talloc_free(discard_const_p(char, name));
@@ -253,7 +253,7 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey,
continue;
}
- if (!W_ERROR_EQUAL(error2, WERR_BADFILE)) {
+ if (!W_ERROR_EQUAL(error2, WERR_FILE_NOT_FOUND)) {
DEBUG(0, ("Error occurred while getting value by name: %s\n",
win_errstr(error2)));
talloc_free(mem_ctx);
@@ -287,7 +287,7 @@ _PUBLIC_ WERROR reg_generate_diff(struct registry_context *ctx1,
error = reg_get_predefined_key(ctx1,
reg_predefined_keys[i].handle, &r1);
if (!W_ERROR_IS_OK(error) &&
- !W_ERROR_EQUAL(error, WERR_BADFILE)) {
+ !W_ERROR_EQUAL(error, WERR_FILE_NOT_FOUND)) {
DEBUG(0, ("Unable to open hive %s for backend 1\n",
reg_predefined_keys[i].name));
continue;
@@ -296,7 +296,7 @@ _PUBLIC_ WERROR reg_generate_diff(struct registry_context *ctx1,
error = reg_get_predefined_key(ctx2,
reg_predefined_keys[i].handle, &r2);
if (!W_ERROR_IS_OK(error) &&
- !W_ERROR_EQUAL(error, WERR_BADFILE)) {
+ !W_ERROR_EQUAL(error, WERR_FILE_NOT_FOUND)) {
DEBUG(0, ("Unable to open hive %s for backend 2\n",
reg_predefined_keys[i].name));
continue;
@@ -429,7 +429,7 @@ static WERROR reg_diff_apply_del_key(void *_ctx, const char *key_name)
/* We can't proof here for success, because a common superkey could */
/* have been deleted before the subkey's (diff order). This removed */
- /* therefore all children recursively and the "WERR_BADFILE" result is */
+ /* therefore all children recursively and the "WERR_FILE_NOT_FOUND" result is */
/* expected. */
reg_key_del_abs(ctx, key_name);
@@ -448,7 +448,7 @@ static WERROR reg_diff_apply_set_value(void *_ctx, const char *path,
/* Open key */
error = reg_open_key_abs(ctx, ctx, path, &tmp);
- if (W_ERROR_EQUAL(error, WERR_BADFILE)) {
+ if (W_ERROR_EQUAL(error, WERR_FILE_NOT_FOUND)) {
DEBUG(0, ("Error opening key '%s'\n", path));
return error;
}
diff --git a/source4/lib/registry/patchfile_dotreg.c b/source4/lib/registry/patchfile_dotreg.c
index 49f71f9a7a6..fd3c0373ecc 100644
--- a/source4/lib/registry/patchfile_dotreg.c
+++ b/source4/lib/registry/patchfile_dotreg.c
@@ -200,7 +200,7 @@ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
data->fd = open(filename, O_CREAT|O_WRONLY, 0755);
if (data->fd < 0) {
DEBUG(0, ("Unable to open %s\n", filename));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
} else {
data->fd = STDOUT_FILENO;
@@ -358,10 +358,10 @@ _PUBLIC_ WERROR reg_dotreg_diff_load(int fd,
error = callbacks->del_value(callback_data,
curkey, value);
- /* Ignore if key does not exist (WERR_BADFILE)
+ /* Ignore if key does not exist (WERR_FILE_NOT_FOUND)
* Consistent with Windows behaviour */
if (!W_ERROR_IS_OK(error) &&
- !W_ERROR_EQUAL(error, WERR_BADFILE)) {
+ !W_ERROR_EQUAL(error, WERR_FILE_NOT_FOUND)) {
DEBUG(0, ("Error deleting value %s in key %s\n",
value, curkey));
talloc_free(mem_ctx);
diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c
index 19ebb6ac579..861eff92e7f 100644
--- a/source4/lib/registry/patchfile_preg.c
+++ b/source4/lib/registry/patchfile_preg.c
@@ -182,7 +182,7 @@ _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename,
data->fd = open(filename, O_CREAT|O_WRONLY, 0755);
if (data->fd < 0) {
DEBUG(0, ("Unable to open %s\n", filename));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
} else {
data->fd = STDOUT_FILENO;
diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c
index 4b7145e8d05..39277deff0e 100644
--- a/source4/lib/registry/regf.c
+++ b/source4/lib/registry/regf.c
@@ -596,7 +596,7 @@ static WERROR regf_get_value_by_name(TALLOC_CTX *mem_ctx,
}
if (W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS))
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
return error;
}
@@ -864,7 +864,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx,
/* Make sure that we don't crash if the key is empty */
if (nk->subkeys_offset == -1) {
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
data = hbin_get(private_data->hive, nk->subkeys_offset);
@@ -903,7 +903,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx,
break;
}
if (key_off == 0)
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
} else if (!strncmp((char *)data.data, "lf", 2)) {
struct lf_block lf;
struct tdr_pull *pull = tdr_pull_init(ctx);
@@ -938,7 +938,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx,
break;
}
if (key_off == 0)
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
} else if (!strncmp((char *)data.data, "lh", 2)) {
struct lh_block lh;
struct tdr_pull *pull = tdr_pull_init(ctx);
@@ -975,7 +975,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx,
break;
}
if (key_off == 0)
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
} else if (!strncmp((char *)data.data, "ri", 2)) {
struct ri_block ri;
struct tdr_pull *pull = tdr_pull_init(ctx);
@@ -1055,7 +1055,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx,
}
talloc_free(pull);
if (!key_off)
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
} else {
DEBUG(0, ("Unknown subkey list type.\n"));
return WERR_GENERAL_FAILURE;
@@ -1093,7 +1093,7 @@ static WERROR regf_set_sec_desc(struct hive_key *key,
if (!hbin_get_tdr(regf, private_data->nk->sk_offset, regf,
(tdr_pull_fn_t) tdr_pull_sk_block, &cur_sk)) {
DEBUG(0, ("Unable to find security descriptor for current key\n"));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
/* If there's no change, change nothing. */
if (memcmp(data.data, cur_sk.sec_desc,
@@ -1107,7 +1107,7 @@ static WERROR regf_set_sec_desc(struct hive_key *key,
if (!hbin_get_tdr(regf, cur_sk.prev_offset, regf,
(tdr_pull_fn_t) tdr_pull_sk_block, &sk)) {
DEBUG(0, ("Unable to find prev security descriptor for current key\n"));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
/* Change and store the previous security descriptor */
sk.next_offset = cur_sk.next_offset;
@@ -1118,7 +1118,7 @@ static WERROR regf_set_sec_desc(struct hive_key *key,
if (!hbin_get_tdr(regf, cur_sk.next_offset, regf,
(tdr_pull_fn_t) tdr_pull_sk_block, &sk)) {
DEBUG(0, ("Unable to find next security descriptor for current key\n"));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
/* Change and store the next security descriptor */
sk.prev_offset = cur_sk.prev_offset;
@@ -1139,7 +1139,7 @@ static WERROR regf_set_sec_desc(struct hive_key *key,
if (!hbin_get_tdr(regf, sk_offset, regf,
(tdr_pull_fn_t) tdr_pull_sk_block, &sk)) {
DEBUG(0, ("Unable to find security descriptor\n"));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
if (memcmp(data.data, sk.sec_desc, MIN(data.length, sk.rec_size)) == 0) {
private_data->nk->sk_offset = sk_offset;
@@ -1183,7 +1183,7 @@ static WERROR regf_set_sec_desc(struct hive_key *key,
if (!hbin_get_tdr(regf, new_sk.prev_offset, regf,
(tdr_pull_fn_t) tdr_pull_sk_block, &sk)) {
DEBUG(0, ("Unable to find security descriptor for previous key\n"));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
/* Change and store the previous security descriptor */
sk.next_offset = sk_offset;
@@ -1195,7 +1195,7 @@ static WERROR regf_set_sec_desc(struct hive_key *key,
if (!hbin_get_tdr(regf, new_sk.next_offset, regf,
(tdr_pull_fn_t) tdr_pull_sk_block, &sk)) {
DEBUG(0, ("Unable to find security descriptor for current key\n"));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
/* Change and store the next security descriptor (always root, as we append) */
sk.prev_offset = sk_offset;
@@ -1316,7 +1316,7 @@ static WERROR regf_sl_add_entry(struct regf_data *regf, uint32_t list_offset,
data = hbin_get(regf, list_offset);
if (!data.data) {
DEBUG(0, ("Unable to find subkey list\n"));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
if (!strncmp((char *)data.data, "li", 2)) {
@@ -1330,14 +1330,14 @@ static WERROR regf_sl_add_entry(struct regf_data *regf, uint32_t list_offset,
if (NT_STATUS_IS_ERR(tdr_pull_li_block(pull, regf, &li))) {
DEBUG(0, ("Error parsing LI list\n"));
talloc_free(pull);
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
talloc_free(pull);
if (strncmp(li.header, "li", 2) != 0) {
abort();
DEBUG(0, ("LI header corrupt\n"));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
/*
@@ -1381,7 +1381,7 @@ static WERROR regf_sl_add_entry(struct regf_data *regf, uint32_t list_offset,
if (NT_STATUS_IS_ERR(tdr_pull_lf_block(pull, regf, &lf))) {
DEBUG(0, ("Error parsing LF list\n"));
talloc_free(pull);
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
talloc_free(pull);
SMB_ASSERT(!strncmp(lf.header, "lf", 2));
@@ -1429,7 +1429,7 @@ static WERROR regf_sl_add_entry(struct regf_data *regf, uint32_t list_offset,
if (NT_STATUS_IS_ERR(tdr_pull_lh_block(pull, regf, &lh))) {
DEBUG(0, ("Error parsing LH list\n"));
talloc_free(pull);
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
talloc_free(pull);
SMB_ASSERT(!strncmp(lh.header, "lh", 2));
@@ -1471,7 +1471,7 @@ static WERROR regf_sl_add_entry(struct regf_data *regf, uint32_t list_offset,
return WERR_NOT_SUPPORTED;
} else {
DEBUG(0, ("Cannot add to unknown subkey list\n"));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
return WERR_OK;
@@ -1485,7 +1485,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset,
data = hbin_get(regf, list_offset);
if (!data.data) {
DEBUG(0, ("Unable to find subkey list\n"));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
if (strncmp((char *)data.data, "li", 2) == 0) {
@@ -1501,7 +1501,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset,
if (NT_STATUS_IS_ERR(tdr_pull_li_block(pull, regf, &li))) {
DEBUG(0, ("Error parsing LI list\n"));
talloc_free(pull);
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
talloc_free(pull);
@@ -1518,7 +1518,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset,
}
if (!found_offset) {
DEBUG(2, ("Subkey not found\n"));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
li.key_count--;
@@ -1545,7 +1545,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset,
if (NT_STATUS_IS_ERR(tdr_pull_lf_block(pull, regf, &lf))) {
DEBUG(0, ("Error parsing LF list\n"));
talloc_free(pull);
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
talloc_free(pull);
@@ -1563,7 +1563,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset,
}
if (!found_offset) {
DEBUG(2, ("Subkey not found\n"));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
lf.key_count--;
@@ -1591,7 +1591,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset,
if (NT_STATUS_IS_ERR(tdr_pull_lh_block(pull, regf, &lh))) {
DEBUG(0, ("Error parsing LF list\n"));
talloc_free(pull);
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
talloc_free(pull);
@@ -1609,7 +1609,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset,
}
if (!found_offset) {
DEBUG(0, ("Subkey not found\n"));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
lh.key_count--;
@@ -1630,7 +1630,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset,
return WERR_NOT_SUPPORTED;
} else {
DEBUG (0, ("Unknown header found in subkey list.\n"));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
return WERR_OK;
}
@@ -1648,7 +1648,7 @@ static WERROR regf_del_value(TALLOC_CTX *mem_ctx, struct hive_key *key,
unsigned int i;
if (nk->values_offset == -1) {
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
values = hbin_get(regf, nk->values_offset);
@@ -1663,7 +1663,7 @@ static WERROR regf_del_value(TALLOC_CTX *mem_ctx, struct hive_key *key,
&vk)) {
DEBUG(0, ("Unable to get VK block at %d\n",
vk_offset));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
if (strcmp(vk.data_name, name) == 0) {
hbin_free(regf, vk_offset);
@@ -1672,7 +1672,7 @@ static WERROR regf_del_value(TALLOC_CTX *mem_ctx, struct hive_key *key,
}
}
if (!found_offset) {
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
} else {
nk->num_values--;
values.length = (nk->num_values)*4;
@@ -1709,14 +1709,14 @@ static WERROR regf_del_key(TALLOC_CTX *mem_ctx, const struct hive_key *parent,
if (parent_nk->subkeys_offset == -1) {
DEBUG(4, ("Subkey list is empty, this key cannot contain subkeys.\n"));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
/* Find the key */
if (!W_ERROR_IS_OK(regf_get_subkey_by_name(parent_nk, parent, name,
(struct hive_key **)&key))) {
DEBUG(2, ("Key '%s' not found\n", name));
- return WERR_BADFILE;
+ return WERR_FILE_NOT_FOUND;
}
if (key->nk->subkeys_offset != -1) {
diff --git a/source4/lib/registry/samba.c b/source4/lib/registry/samba.c
index f798496dbe7..ff52297af07 100644
--- a/source4/lib/registry/samba.c
+++ b/source4/lib/registry/samba.c
@@ -44,7 +44,7 @@ static WERROR mount_samba_hive(struct registry_context *ctx,
error = reg_open_hive(ctx, location, auth_info, creds, event_ctx, lp_ctx, &hive);
- if (W_ERROR_EQUAL(error, WERR_BADFILE))
+ if (W_ERROR_EQUAL(error, WERR_FILE_NOT_FOUND))
error = reg_open_ldb_file(ctx, location, auth_info,
creds, event_ctx, lp_ctx, &hive);
diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c
index 2bc2e57b687..aca5cff2a98 100644
--- a/source4/lib/registry/tests/hive.c
+++ b/source4/lib/registry/tests/hive.c
@@ -34,7 +34,7 @@ static bool test_del_nonexistent_key(struct torture_context *tctx,
{
const struct hive_key *root = (const struct hive_key *)test_data;
WERROR error = hive_key_del(tctx, root, "bla");
- torture_assert_werr_equal(tctx, error, WERR_BADFILE,
+ torture_assert_werr_equal(tctx, error, WERR_FILE_NOT_FOUND,
"invalid return code");
return true;
@@ -169,7 +169,7 @@ static bool test_del_key(struct torture_context *tctx, const void *test_data)
torture_assert_werr_ok(tctx, error, "reg_key_del");
error = hive_key_del(mem_ctx, root, "Nested Key");
- torture_assert_werr_equal(tctx, error, WERR_BADFILE, "reg_key_del");
+ torture_assert_werr_equal(tctx, error, WERR_FILE_NOT_FOUND, "reg_key_del");
return true;
}
@@ -209,7 +209,7 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data)
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
error = hive_get_value(mem_ctx, subkey, "Answer", &type, &data);
- torture_assert_werr_equal(tctx, error, WERR_BADFILE,
+ torture_assert_werr_equal(tctx, error, WERR_FILE_NOT_FOUND,
"getting missing value");
error = hive_key_set_value(subkey, "Answer", REG_DWORD, db);
@@ -247,10 +247,10 @@ static bool test_del_value(struct torture_context *tctx, const void *test_data)
torture_assert_werr_ok(tctx, error, "deleting value");
error = hive_get_value(mem_ctx, subkey, "Answer", &type, &db);
- torture_assert_werr_equal(tctx, error, WERR_BADFILE, "getting value");
+ torture_assert_werr_equal(tctx, error, WERR_FILE_NOT_FOUND, "getting value");
error = hive_key_del_value(mem_ctx, subkey, "Answer");
- torture_assert_werr_equal(tctx, error, WERR_BADFILE,
+ torture_assert_werr_equal(tctx, error, WERR_FILE_NOT_FOUND,
"deleting value");
return true;
diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c
index b4f4ae8c842..227e65b5f25 100644
--- a/source4/lib/registry/tests/registry.c
+++ b/source4/lib/registry/tests/registry.c
@@ -54,7 +54,7 @@ static bool test_get_predefined_unknown(struct torture_context *tctx,
WERROR error;
error = reg_get_predefined_key(rctx, 1337, &root);
- torture_assert_werr_equal(tctx, error, WERR_BADFILE,
+ torture_assert_werr_equal(tctx, error, WERR_FILE_NOT_FOUND,
"getting predefined key failed");
return true;
}
@@ -86,7 +86,7 @@ static bool test_predef_key_by_name_invalid(struct torture_context *tctx,
WERROR error;
error = reg_get_predefined_key_by_name(rctx, "BLA", &root);
- torture_assert_werr_equal(tctx, error, WERR_BADFILE,
+ torture_assert_werr_equal(tctx, error, WERR_FILE_NOT_FOUND,
"getting predefined key failed");
return true;
}
@@ -200,7 +200,7 @@ static bool test_del_key(struct torture_context *tctx, void *_data)
torture_assert_werr_ok(tctx, error, "Delete key");
error = reg_key_del(tctx, root, "Polen");
- torture_assert_werr_equal(tctx, error, WERR_BADFILE,
+ torture_assert_werr_equal(tctx, error, WERR_FILE_NOT_FOUND,
"Delete missing key");
return true;
@@ -432,7 +432,7 @@ static bool test_get_value(struct torture_context *tctx, void *_data)
error = reg_key_get_value_by_name(tctx, subkey, __FUNCTION__, &type,
&data);
- torture_assert_werr_equal(tctx, error, WERR_BADFILE,
+ torture_assert_werr_equal(tctx, error, WERR_FILE_NOT_FOUND,
"getting missing value");
error = reg_val_set(subkey, __FUNCTION__, REG_DWORD,
@@ -483,7 +483,7 @@ static bool test_del_value(struct torture_context *tctx, void *_data)
error = reg_key_get_value_by_name(tctx, subkey, __FUNCTION__, &type,
&data);
- torture_assert_werr_equal(tctx, error, WERR_BADFILE,
+ torture_assert_werr_equal(tctx, error, WERR_FILE_NOT_FOUND,
"getting missing value");
error = reg_val_set(subkey, __FUNCTION__, REG_DWORD,
@@ -495,11 +495,11 @@ static bool test_del_value(struct torture_context *tctx, void *_data)
error = reg_key_get_value_by_name(tctx, subkey, __FUNCTION__,
&type, &data);
- torture_assert_werr_equal(tctx, error, WERR_BADFILE,
+ torture_assert_werr_equal(tctx, error, WERR_FILE_NOT_FOUND,
"getting missing value");
error = reg_del_value(tctx, subkey, "");
- torture_assert_werr_equal(tctx, error, WERR_BADFILE,
+ torture_assert_werr_equal(tctx, error, WERR_FILE_NOT_FOUND,
"unsetting missing default value");
error = reg_val_set(subkey, "", REG_SZ,