summaryrefslogtreecommitdiff
path: root/source4/lib/registry/reg_backend_dir
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-04-08 22:39:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:51:09 -0500
commitaebfb3b9f415d3c1f6b2a39aee27b072d48893cb (patch)
tree4eebbcafdd559216ef8ad952f11ebe05f947b5f0 /source4/lib/registry/reg_backend_dir
parentd907dcf383fcdf82add4fd7c397885eab5bb57af (diff)
downloadsamba-aebfb3b9f415d3c1f6b2a39aee27b072d48893cb.tar.gz
samba-aebfb3b9f415d3c1f6b2a39aee27b072d48893cb.tar.bz2
samba-aebfb3b9f415d3c1f6b2a39aee27b072d48893cb.zip
r128: Another registry update. Changes:
- Start with the LDB backend - The API is now more windows-like, which should make it easier to use in rpc_server - Added a GTK+ front-end - Added some more IDL More updates will follow, especially in the RPC field.. (This used to be commit 3adffa021779b26047a20f16a3c0b53d74751560)
Diffstat (limited to 'source4/lib/registry/reg_backend_dir')
-rw-r--r--source4/lib/registry/reg_backend_dir/reg_backend_dir.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/source4/lib/registry/reg_backend_dir/reg_backend_dir.c b/source4/lib/registry/reg_backend_dir/reg_backend_dir.c
index 9cb15cd285..4daaf3d628 100644
--- a/source4/lib/registry/reg_backend_dir/reg_backend_dir.c
+++ b/source4/lib/registry/reg_backend_dir/reg_backend_dir.c
@@ -21,7 +21,7 @@
#include "includes.h"
#include "lib/registry/common/registry.h"
-static BOOL reg_dir_add_key(REG_KEY *parent, const char *name)
+static WERROR reg_dir_add_key(REG_KEY *parent, const char *name, uint32 access_mask, SEC_DESC *desc)
{
char *path;
int ret;
@@ -29,15 +29,16 @@ static BOOL reg_dir_add_key(REG_KEY *parent, const char *name)
path = reg_path_win2unix(path);
ret = mkdir(path, 0700);
SAFE_FREE(path);
- return (ret == 0);
+ if(ret == 0)return WERR_OK;
+ return WERR_INVALID_PARAM;
}
-static BOOL reg_dir_del_key(REG_KEY *k)
+static WERROR reg_dir_del_key(REG_KEY *k)
{
- return (rmdir((char *)k->backend_data) == 0);
+ return (rmdir((char *)k->backend_data) == 0)?WERR_OK:WERR_GENERAL_FAILURE;
}
-static REG_KEY *reg_dir_open_key(REG_HANDLE *h, const char *name)
+static WERROR reg_dir_open_key(REG_HANDLE *h, const char *name, REG_KEY **subkey)
{
DIR *d;
char *fullpath;
@@ -45,7 +46,7 @@ static REG_KEY *reg_dir_open_key(REG_HANDLE *h, const char *name)
TALLOC_CTX *mem_ctx = talloc_init("tmp");
if(!name) {
DEBUG(0, ("NULL pointer passed as directory name!"));
- return NULL;
+ return WERR_INVALID_PARAM;
}
fullpath = talloc_asprintf(mem_ctx, "%s%s", h->location, name);
fullpath = reg_path_win2unix(fullpath);
@@ -54,16 +55,17 @@ static REG_KEY *reg_dir_open_key(REG_HANDLE *h, const char *name)
if(!d) {
DEBUG(3,("Unable to open '%s': %s\n", fullpath, strerror(errno)));
talloc_destroy(mem_ctx);
- return NULL;
+ return WERR_BADFILE;
}
closedir(d);
ret = reg_key_new_abs(name, h, fullpath);
talloc_steal(mem_ctx, ret->mem_ctx, fullpath);
talloc_destroy(mem_ctx);
- return ret;
+ *subkey = ret;
+ return WERR_OK;
}
-static BOOL reg_dir_fetch_subkeys(REG_KEY *k, int *count, REG_KEY ***r)
+static WERROR reg_dir_fetch_subkeys(REG_KEY *k, int *count, REG_KEY ***r)
{
struct dirent *e;
int max = 200;
@@ -75,7 +77,7 @@ static BOOL reg_dir_fetch_subkeys(REG_KEY *k, int *count, REG_KEY ***r)
d = opendir(fullpath);
- if(!d) return False;
+ if(!d) return WERR_INVALID_PARAM;
while((e = readdir(d))) {
if(e->d_type == DT_DIR &&
@@ -96,35 +98,35 @@ static BOOL reg_dir_fetch_subkeys(REG_KEY *k, int *count, REG_KEY ***r)
closedir(d);
*r = ar;
- return True;
+ return WERR_OK;
}
-static BOOL reg_dir_open(REG_HANDLE *h, const char *loc, BOOL try) {
- if(!loc) return False;
- return True;
+static WERROR reg_dir_open(REG_HANDLE *h, const char *loc, const char *credentials) {
+ if(!loc) return WERR_INVALID_PARAM;
+ return WERR_OK;
}
-static REG_VAL *reg_dir_add_value(REG_KEY *p, const char *name, int type, void *data, int len)
+static WERROR reg_dir_add_value(REG_KEY *p, const char *name, int type, void *data, int len, REG_VAL **value)
{
- REG_VAL *ret = reg_val_new(p, NULL);
char *fullpath;
FILE *fd;
- ret->name = name?talloc_strdup(ret->mem_ctx, name):NULL;
- fullpath = reg_path_win2unix(strdup(reg_val_get_path(ret)));
+ *value = reg_val_new(p, NULL);
+ (*value)->name = name?talloc_strdup((*value)->mem_ctx, name):NULL;
+ fullpath = reg_path_win2unix(strdup(reg_val_get_path(*value)));
fd = fopen(fullpath, "w+");
/* FIXME */
- return NULL;
+ return WERR_NOT_SUPPORTED;
}
-static BOOL reg_dir_del_value(REG_VAL *v)
+static WERROR reg_dir_del_value(REG_VAL *v)
{
/* FIXME*/
- return False;
+ return WERR_NOT_SUPPORTED;
}
-static REG_OPS reg_backend_dir = {
+static struct registry_ops reg_backend_dir = {
.name = "dir",
.open_registry = reg_dir_open,
.open_key = reg_dir_open_key,