diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2004-12-13 00:45:29 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:07:21 -0500 |
commit | 47fa1d33e4a6b9aeaf06ad2c12d9744bdf967bb9 (patch) | |
tree | c49e1c6140d856fdf5c497791a1976def204fd5d /source4 | |
parent | fe01af9fb278a320820b41b7970a1f04b3b696a5 (diff) | |
download | samba-47fa1d33e4a6b9aeaf06ad2c12d9744bdf967bb9.tar.gz samba-47fa1d33e4a6b9aeaf06ad2c12d9744bdf967bb9.tar.bz2 samba-47fa1d33e4a6b9aeaf06ad2c12d9744bdf967bb9.zip |
r4166: More small API fixes, keep registry structs as small as possible.
Implement DelValue in the RPC server
(This used to be commit f6b9ec89af934e837069fb26c0e3491fc78ebc12)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/include/registry.h | 8 | ||||
-rw-r--r-- | source4/lib/registry/common/reg_interface.c | 13 | ||||
-rw-r--r-- | source4/lib/registry/reg_backend_dir.c | 16 | ||||
-rw-r--r-- | source4/lib/registry/reg_backend_ldb.c | 2 | ||||
-rw-r--r-- | source4/lib/registry/reg_backend_rpc.c | 1 | ||||
-rw-r--r-- | source4/lib/registry/reg_backend_w95.c | 1 | ||||
-rw-r--r-- | source4/lib/registry/tools/regpatch.c | 6 | ||||
-rw-r--r-- | source4/lib/registry/tools/regshell.c | 8 | ||||
-rw-r--r-- | source4/rpc_server/winreg/rpc_winreg.c | 10 |
9 files changed, 13 insertions, 52 deletions
diff --git a/source4/include/registry.h b/source4/include/registry.h index 345d6fac43..5865636836 100644 --- a/source4/include/registry.h +++ b/source4/include/registry.h @@ -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 { diff --git a/source4/lib/registry/common/reg_interface.c b/source4/lib/registry/common/reg_interface.c index ee140e150f..79bb0b765c 100644 --- a/source4/lib/registry/common/reg_interface.c +++ b/source4/lib/registry/common/reg_interface.c @@ -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; diff --git a/source4/lib/registry/reg_backend_dir.c b/source4/lib/registry/reg_backend_dir.c index c004be5a06..89f9280585 100644 --- a/source4/lib/registry/reg_backend_dir.c +++ b/source4/lib/registry/reg_backend_dir.c @@ -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) diff --git a/source4/lib/registry/reg_backend_ldb.c b/source4/lib/registry/reg_backend_ldb.c index e848507634..ec8a6d9de3 100644 --- a/source4/lib/registry/reg_backend_ldb.c +++ b/source4/lib/registry/reg_backend_ldb.c @@ -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; } diff --git a/source4/lib/registry/reg_backend_rpc.c b/source4/lib/registry/reg_backend_rpc.c index 78c45f6365..16516d25b7 100644 --- a/source4/lib/registry/reg_backend_rpc.c +++ b/source4/lib/registry/reg_backend_rpc.c @@ -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; diff --git a/source4/lib/registry/reg_backend_w95.c b/source4/lib/registry/reg_backend_w95.c index a94ad86c2c..957039dea3 100644 --- a/source4/lib/registry/reg_backend_w95.c +++ b/source4/lib/registry/reg_backend_w95.c @@ -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; diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c index a4a4649c96..18589a9285 100644 --- a/source4/lib/registry/tools/regpatch.c +++ b/source4/lib/registry/tools/regpatch.c @@ -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)); } diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index 47d84c1f62..0a09708869 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -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]); diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c index 478c6c1d86..41147c089d 100644 --- a/source4/rpc_server/winreg/rpc_winreg.c +++ b/source4/rpc_server/winreg/rpc_winreg.c @@ -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); } |