mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
r4166: More small API fixes, keep registry structs as small as possible.
Implement DelValue in the RPC server (This used to be commit f6b9ec89af934e837069fb26c0e3491fc78ebc12)
This commit is contained in:
parent
fe01af9fb2
commit
47fa1d33e4
@ -75,10 +75,8 @@ struct registry_key {
|
||||
const char *path; /* Full path to the key */
|
||||
char *class_name; /* Name of key class */
|
||||
NTTIME last_mod; /* Time last modified */
|
||||
SEC_DESC *security;
|
||||
struct registry_hive *hive;
|
||||
void *backend_data;
|
||||
int ref;
|
||||
};
|
||||
|
||||
struct registry_value {
|
||||
@ -86,10 +84,6 @@ struct registry_value {
|
||||
unsigned int data_type;
|
||||
int data_len;
|
||||
void *data_blk; /* Might want a separate block */
|
||||
struct registry_hive *hive;
|
||||
struct registry_key *parent;
|
||||
void *backend_data;
|
||||
int ref;
|
||||
};
|
||||
|
||||
/* FIXME */
|
||||
@ -142,7 +136,7 @@ struct hive_operations {
|
||||
|
||||
/* Value management */
|
||||
WERROR (*set_value)(struct registry_key *, const char *name, int type, void *data, int len);
|
||||
WERROR (*del_value)(struct registry_value *);
|
||||
WERROR (*del_value)(struct registry_key *, const char *valname);
|
||||
};
|
||||
|
||||
struct registry_hive {
|
||||
|
@ -281,8 +281,6 @@ WERROR reg_key_get_value_by_index(TALLOC_CTX *mem_ctx, struct registry_key *key,
|
||||
return WERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
(*val)->parent = key;
|
||||
(*val)->hive = key->hive;
|
||||
return WERR_OK;
|
||||
}
|
||||
|
||||
@ -408,9 +406,6 @@ WERROR reg_key_get_value_by_name(TALLOC_CTX *mem_ctx, struct registry_key *key,
|
||||
if(!W_ERROR_IS_OK(error) && !W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS))
|
||||
return error;
|
||||
|
||||
(*val)->parent = key;
|
||||
(*val)->hive = key->hive;
|
||||
|
||||
return WERR_OK;
|
||||
}
|
||||
|
||||
@ -447,7 +442,7 @@ WERROR reg_key_del_recursive(struct registry_key *key)
|
||||
}
|
||||
|
||||
if(W_ERROR_IS_OK(error)) {
|
||||
error = reg_del_value(val);
|
||||
error = reg_del_value(key, val->name);
|
||||
if(!W_ERROR_IS_OK(error)) {
|
||||
talloc_destroy(mem_ctx);
|
||||
return error;
|
||||
@ -564,13 +559,13 @@ WERROR reg_val_set(struct registry_key *key, const char *value, int type, void *
|
||||
|
||||
|
||||
|
||||
WERROR reg_del_value(struct registry_value *val)
|
||||
WERROR reg_del_value(struct registry_key *key, const char *valname)
|
||||
{
|
||||
WERROR ret = WERR_OK;
|
||||
if(!val->hive->functions->del_value)
|
||||
if(!key->hive->functions->del_value)
|
||||
return WERR_NOT_SUPPORTED;
|
||||
|
||||
ret = val->hive->functions->del_value(val);
|
||||
ret = key->hive->functions->del_value(key, valname);
|
||||
|
||||
if(!W_ERROR_IS_OK(ret)) return ret;
|
||||
|
||||
|
@ -120,27 +120,13 @@ static WERROR reg_dir_open(struct registry_hive *h, struct registry_key **key)
|
||||
return WERR_OK;
|
||||
}
|
||||
|
||||
static WERROR reg_dir_set_value(struct registry_key *p, const char *name, int type, void *data, int len)
|
||||
{
|
||||
/* FIXME */
|
||||
return WERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
static WERROR reg_dir_del_value(struct registry_value *v)
|
||||
{
|
||||
/* FIXME*/
|
||||
return WERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
static struct hive_operations reg_backend_dir = {
|
||||
.name = "dir",
|
||||
.open_hive = reg_dir_open,
|
||||
.open_key = reg_dir_open_key,
|
||||
.add_key = reg_dir_add_key,
|
||||
.del_key = reg_dir_del_key,
|
||||
.get_subkey_by_index = reg_dir_key_by_index,
|
||||
.set_value = reg_dir_set_value,
|
||||
.del_value = reg_dir_del_value,
|
||||
.get_subkey_by_index = reg_dir_key_by_index
|
||||
};
|
||||
|
||||
NTSTATUS registry_dir_init(void)
|
||||
|
@ -144,7 +144,7 @@ static WERROR ldb_get_value_by_id(TALLOC_CTX *mem_ctx, struct registry_key *k, i
|
||||
|
||||
*value = talloc_p(mem_ctx, struct registry_value);
|
||||
(*value)->name = talloc_strdup(mem_ctx, el->values[0].data);
|
||||
(*value)->backend_data = talloc_strdup(mem_ctx, kd->values[idx]->dn);
|
||||
/* FIXME */
|
||||
|
||||
return WERR_OK;
|
||||
}
|
||||
|
@ -218,7 +218,6 @@ static WERROR rpc_get_value_by_index(TALLOC_CTX *mem_ctx, struct registry_key *p
|
||||
if(NT_STATUS_IS_OK(status) &&
|
||||
W_ERROR_IS_OK(r.out.result) && r.out.length) {
|
||||
*value = talloc_p(mem_ctx, struct registry_value);
|
||||
(*value)->parent = parent;
|
||||
(*value)->name = talloc_strdup(mem_ctx, r.out.name_out.name);
|
||||
(*value)->data_type = type;
|
||||
(*value)->data_len = *r.out.length;
|
||||
|
@ -332,7 +332,6 @@ static WERROR w95_get_value_by_id(TALLOC_CTX *mem_ctx, struct registry_key *k, i
|
||||
}
|
||||
|
||||
*value = talloc_p(mem_ctx, struct registry_value);
|
||||
(*value)->backend_data = curval;
|
||||
(*value)->name = talloc_strndup(mem_ctx, (char *)curval+sizeof(RGDB_VALUE), curval->name_len);
|
||||
|
||||
(*value)->data_len = curval->data_len;
|
||||
|
@ -701,13 +701,9 @@ static int nt_apply_reg_command_file(struct registry_context *r, const char *cmd
|
||||
|
||||
while (cmd->val_count) {
|
||||
VAL_SPEC_LIST *val = cmd->val_spec_list;
|
||||
struct registry_value *reg_val = NULL;
|
||||
|
||||
if (val->type == REG_DELETE) {
|
||||
error = reg_key_get_value_by_name( mem_ctx, tmp, val->name, ®_val);
|
||||
if(W_ERROR_IS_OK(error)) {
|
||||
error = reg_del_value(reg_val);
|
||||
}
|
||||
error = reg_del_value(tmp, val->name);
|
||||
if(!W_ERROR_IS_OK(error)) {
|
||||
DEBUG(0, ("Error removing value '%s'\n", val->name));
|
||||
}
|
||||
|
@ -142,18 +142,12 @@ static struct registry_key *cmd_rmkey(TALLOC_CTX *mem_ctx, struct registry_key *
|
||||
|
||||
static struct registry_key *cmd_rmval(TALLOC_CTX *mem_ctx, struct registry_key *cur, int argc, char **argv)
|
||||
{
|
||||
struct registry_value *val;
|
||||
if(argc < 2) {
|
||||
fprintf(stderr, "Usage: rmval <valuename>\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!W_ERROR_IS_OK(reg_key_get_value_by_name(mem_ctx, cur, argv[1], &val))) {
|
||||
fprintf(stderr, "No such value '%s'\n", argv[1]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!W_ERROR_IS_OK(reg_del_value(val))) {
|
||||
if(!W_ERROR_IS_OK(reg_del_value(cur, argv[1]))) {
|
||||
fprintf(stderr, "Error deleting value '%s'\n", argv[1]);
|
||||
} else {
|
||||
fprintf(stderr, "Successfully deleted value '%s'\n", argv[1]);
|
||||
|
@ -149,16 +149,14 @@ static WERROR winreg_DeleteValue(struct dcesrv_call_state *dce_call, TALLOC_CTX
|
||||
struct winreg_DeleteValue *r)
|
||||
{
|
||||
struct dcesrv_handle *h;
|
||||
struct registry_value *value;
|
||||
struct registry_key *key;
|
||||
|
||||
h = dcesrv_handle_fetch(dce_call->conn, r->in.handle, HTYPE_REGVAL);
|
||||
h = dcesrv_handle_fetch(dce_call->conn, r->in.handle, HTYPE_REGKEY);
|
||||
DCESRV_CHECK_HANDLE(h);
|
||||
|
||||
value = h->data;
|
||||
key = h->data;
|
||||
|
||||
/* FIXME */
|
||||
|
||||
return WERR_NOT_SUPPORTED;
|
||||
return reg_del_value(key, r->in.value.name);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user