Rev 11164: Remove the registry gconf module. in file:///home/jelmer/bzr.samba/4.0-regwrite/

Jelmer Vernooij jelmer at samba.org
Thu Feb 8 16:22:20 GMT 2007


At file:///home/jelmer/bzr.samba/4.0-regwrite/

------------------------------------------------------------
revno: 11164
revision-id: jelmer at samba.org-20070208161920-v3bjwnhfqy4f6j6y
parent: jelmer at samba.org-20070208155904-yfb5n63xvx2w0kzz
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 4.0-regwrite
timestamp: Thu 2007-02-08 17:19:20 +0100
message:
  Remove the registry gconf module. 
  
  Abstraction is nice and support for more things is also nice, but the current form of the registry library has 
  a bit too much of it. The gconf module was a nice proof-of-concept, but it doesn't really have a use, 
  nor can it be used sanely (can only work one way, as gconf requires schemas and doesn't have a 
  "blob" data type). It also has bitrotted a bit since it has to be enabled manually.
removed:
  source/lib/registry/config.m4  svn-v2:20 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2fregistry%2fconfig.m4
  source/lib/registry/reg_backend_gconf.c svn-v2:4132 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2fregistry%2freg_backend_gconf.c
renamed:
  source/lib/registry/reg_backend_rpc.c => source/lib/registry/rpc.c svn-v2:4132 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2fregistry%2freg_backend_rpc.c
modified:
  source/configure.ac            svn-v2:15565 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fconfigure.ac
  source/lib/registry/config.mk  svn-v2:851 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2fregistry%2fconfig.mk
  source/lib/registry/registry.h svn-v2:10026 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2fregistry%2fregistry.h
  source/lib/registry/rpc.c      svn-v2:4132 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2fregistry%2freg_backend_rpc.c
=== removed file 'source/lib/registry/config.m4'
--- a/source/lib/registry/config.m4	2006-04-26 12:22:54 +0000
+++ b/source/lib/registry/config.m4	1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
-# Registry backends
-SMB_ENABLE(registry_gconf, NO)
-
-SMB_EXT_LIB_FROM_PKGCONFIG(gconf, gconf-2.0)
-
-AC_ARG_ENABLE(reg-gconf,
-[   --enable-reg-gconf     Enable support for GConf registry backend],
-[
-	if test t$enable = tyes; then
-		SMB_ENABLE(registry_gconf, $SMB_ENABLE_gconf)
-	fi
-])

=== removed file 'source/lib/registry/reg_backend_gconf.c'
--- a/source/lib/registry/reg_backend_gconf.c	2005-02-10 06:45:13 +0000
+++ b/source/lib/registry/reg_backend_gconf.c	1970-01-01 00:00:00 +0000
@@ -1,197 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   Registry interface
-   Copyright (C) Jelmer Vernooij					  2004.
-   
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-   
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "includes.h"
-#include "registry.h"
-#include <gconf/gconf-client.h>
-
-static WERROR gerror_to_werror(GError *error)
-{
-	if(error == NULL) return WERR_OK;
-	/* FIXME */
-	return WERR_FOOBAR;
-}
-
-static WERROR reg_open_gconf_hive(struct registry_hive *h, struct registry_key **k)
-{
-	g_type_init();
-	h->backend_data = (void *)gconf_client_get_default();
-	if(!h->backend_data) return WERR_FOOBAR;
-	
-	*k = talloc(h, struct registry_key);
-	(*k)->name = talloc_strdup(*k, "");
-	(*k)->path = talloc_strdup(*k, "");
-	(*k)->backend_data = talloc_strdup(*k, "/");
-	return WERR_OK;
-}
-
-static WERROR gconf_open_key (TALLOC_CTX *mem_ctx, struct registry_key *h, const char *name, struct registry_key **key) 
-{
-	struct registry_key *ret;
-	char *fullpath;
-	
-	fullpath = talloc_asprintf(mem_ctx, "%s%s%s", 
-							   (char *)h->backend_data, 
-							   strlen((char *)h->backend_data) == 1?"":"/",
-							   reg_path_win2unix(talloc_strdup(mem_ctx, name)));
-
-	/* Check if key exists */
-	if(!gconf_client_dir_exists((GConfClient *)h->hive->backend_data, fullpath, NULL)) {
-		return WERR_DEST_NOT_FOUND;
-	}
-
-	ret = talloc(mem_ctx, struct registry_key);
-	ret->backend_data = fullpath;
-
-	*key = ret;
-	return WERR_OK;
-}
-
-static WERROR gconf_get_value_by_id(TALLOC_CTX *mem_ctx, struct registry_key *p, int idx, struct registry_value **val)
-{
-	GSList *entries;
-	GSList *cur;
-	GConfEntry *entry;
-	GConfValue *value;
-	struct registry_value *newval;
-	char *fullpath = p->backend_data;
-	const char *tmp;
-	int i;
-	cur = entries = gconf_client_all_entries((GConfClient*)p->hive->backend_data, fullpath, NULL);
-
-	for(i = 0; i < idx && cur; i++) cur = cur->next;
-
-	if(!cur) return WERR_NO_MORE_ITEMS;
-
-	entry = cur->data;
-	value = gconf_entry_get_value(entry);
-		
-	newval = talloc(mem_ctx, struct registry_value);
-	newval->name = talloc_strdup(mem_ctx, strrchr(gconf_entry_get_key(entry), '/')+1);
-	if(value) {
-		switch(value->type) {
-		case GCONF_VALUE_INVALID: 
-			newval->data_type = REG_NONE;
-			break;
-
-		case GCONF_VALUE_STRING:
-			newval->data_type = REG_SZ;
-			tmp = gconf_value_get_string(value);
-			newval->data_len = convert_string_talloc(mem_ctx, CH_UTF8, CH_UTF16, tmp, strlen(tmp), &(newval->data_blk));
-			break;
-
-		case GCONF_VALUE_INT:
-			newval->data_type = REG_DWORD;
-			newval->data_blk = talloc(mem_ctx, long);
-			*((long *)newval->data_blk) = gconf_value_get_int(value);
-			newval->data_len = sizeof(long);
-			break;
-
-		case GCONF_VALUE_FLOAT:
-			newval->data_blk = talloc(mem_ctx, double);
-			newval->data_type = REG_BINARY;
-			*((double *)newval->data_blk) = gconf_value_get_float(value);
-			newval->data_len = sizeof(double);
-			break;
-
-		case GCONF_VALUE_BOOL:
-			newval->data_blk = talloc(mem_ctx, BOOL);
-			newval->data_type = REG_BINARY;
-			*((BOOL *)newval->data_blk) = gconf_value_get_bool(value);
-			newval->data_len = sizeof(BOOL);
-			break;
-
-		default:
-			newval->data_type = REG_NONE;
-			DEBUG(0, ("Not implemented..\n"));
-			break;
-		}
-	} else newval->data_type = REG_NONE; 
-
-	g_slist_free(entries);
-	*val = newval;
-	return WERR_OK;
-}
-
-static WERROR gconf_get_subkey_by_id(TALLOC_CTX *mem_ctx, struct registry_key *p, int idx, struct registry_key **sub) 
-{
-	GSList *dirs;
-	GSList *cur;
-	int i;
-	char *fullpath = p->backend_data;
-	cur = dirs = gconf_client_all_dirs((GConfClient*)p->hive->backend_data, fullpath,NULL);
-
-	for(i = 0; i < idx && cur; i++) cur = cur->next;
-	
-	if(!cur) return WERR_NO_MORE_ITEMS;
-	
-	*sub = talloc(mem_ctx, struct registry_key);	
-	(*sub)->name = talloc_strdup(mem_ctx, strrchr((char *)cur->data, '/')+1);
-	(*sub)->backend_data = talloc_strdup(mem_ctx, cur->data);
-
-	g_slist_free(dirs);
-	return WERR_OK;
-}
-
-static WERROR gconf_set_value(struct registry_key *key, const char *valname, uint32_t type, void *data, int len)
-{
-	GError *error = NULL;
-	char *valpath;
-	asprintf(&valpath, "%s/%s", key->path, valname);
-	
-	switch(type) {
-	case REG_SZ:
-	case REG_EXPAND_SZ:
-		gconf_client_set_string((GConfClient *)key->hive->backend_data, valpath, data, &error);
-		SAFE_FREE(valpath);
-		return gerror_to_werror(error);
-
-	case REG_DWORD:
-		gconf_client_set_int((GConfClient *)key->hive->backend_data, valpath, 
- *((int *)data), &error);
-		SAFE_FREE(valpath);
-		return gerror_to_werror(error);
-	default:
-		DEBUG(0, ("Unsupported type: %d\n", type));
-		SAFE_FREE(valpath);
-		return WERR_NOT_SUPPORTED;
-	}
-
-	return WERR_NOT_SUPPORTED;
-}
-
-static struct hive_operations reg_backend_gconf = {
-	.name = "gconf",
-	.open_hive = reg_open_gconf_hive,
-	.open_key = gconf_open_key,
-	.get_subkey_by_index = gconf_get_subkey_by_id,
-	.get_value_by_index = gconf_get_value_by_id,
-	.set_value = gconf_set_value,
-	
-	/* Note: 
-	 * since GConf uses schemas for what keys and values are allowed, there 
-	 * is no way of 'emulating' add_key and del_key here.
-	 */
-};
-
-NTSTATUS registry_gconf_init(void)
-{
-	return registry_register(&reg_backend_gconf);
-}

=== renamed file 'source/lib/registry/reg_backend_rpc.c' => 'source/lib/registry/rpc.c'
--- a/source/lib/registry/reg_backend_rpc.c	2006-09-15 18:34:03 +0000
+++ b/source/lib/registry/rpc.c	2007-02-08 16:19:20 +0000
@@ -1,7 +1,7 @@
 /*
    Samba Unix/Linux SMB implementation
    RPC backend for the registry library
-   Copyright (C) 2003-2004 Jelmer Vernooij, jelmer at samba.org
+   Copyright (C) 2003-2007 Jelmer Vernooij, jelmer at samba.org
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -357,8 +357,8 @@
 	.num_values = rpc_num_values,
 };
 
-_PUBLIC_ WERROR reg_open_remote(struct registry_context **ctx, struct auth_session_info *session_info, struct cli_credentials *credentials, 
-		       const char *location, struct event_context *ev)
+_PUBLIC_ WERROR reg_open_remote(struct registry_context **ctx, struct auth_session_info *session_info, 
+								struct cli_credentials *credentials, const char *location, struct event_context *ev)
 {
 	NTSTATUS status;
 	struct dcerpc_pipe *p;

=== modified file 'source/configure.ac'
--- a/source/configure.ac	2007-01-15 19:08:03 +0000
+++ b/source/configure.ac	2007-02-08 16:19:20 +0000
@@ -36,7 +36,6 @@
 
 m4_include(auth/gensec/config.m4)
 m4_include(smbd/process_model.m4)
-m4_include(lib/registry/config.m4)
 m4_include(scripting/swig/config.m4)
 m4_include(gtk/config.m4)
 m4_include(ntvfs/posix/config.m4)

=== modified file 'source/lib/registry/config.mk'
--- a/source/lib/registry/config.mk	2007-02-08 15:59:04 +0000
+++ b/source/lib/registry/config.mk	2007-02-08 16:19:20 +0000
@@ -1,15 +1,3 @@
-# Registry backends
-################################################
-# Start MODULE registry_regf
-[MODULE::registry_regf]
-INIT_FUNCTION = registry_regf_init
-SUBSYSTEM = registry
-OBJ_FILES = \
-		reg_backend_regf.o
-PUBLIC_DEPENDENCIES = TDR_REGF
-# End MODULE registry_regf
-################################################
-
 [SUBSYSTEM::TDR_REGF]
 PUBLIC_DEPENDENCIES = TDR 
 OBJ_FILES = tdr_regf.o
@@ -27,27 +15,6 @@
 	@-rm -f lib/registry/regf.h lib/registry/tdr_regf*
 
 ################################################
-# Start MODULE registry_w95
-[MODULE::registry_w95]
-INIT_FUNCTION = registry_w95_init
-SUBSYSTEM = registry
-OBJ_FILES = \
-		reg_backend_w95.o
-# End MODULE registry_w95
-################################################
-
-################################################
-# Start MODULE registry_dir
-[MODULE::registry_dir]
-INIT_FUNCTION = registry_dir_init
-SUBSYSTEM = registry
-OBJ_FILES = \
-		reg_backend_dir.o
-PUBLIC_DEPENDENCIES = LIBTALLOC
-# End MODULE registry_dir
-################################################
-
-################################################
 # Start MODULE registry_rpc
 [MODULE::registry_rpc]
 INIT_FUNCTION = registry_rpc_init
@@ -55,36 +22,11 @@
 OUTPUT_TYPE = INTEGRATED
 SUBSYSTEM = registry
 OBJ_FILES = \
-		reg_backend_rpc.o
+		rpc.o
 PUBLIC_DEPENDENCIES = RPC_NDR_WINREG
 # End MODULE registry_rpc
 ################################################
 
-
-
-################################################
-# Start MODULE registry_gconf
-[MODULE::registry_gconf]
-INIT_FUNCTION = registry_gconf_init
-SUBSYSTEM = registry
-OBJ_FILES = \
-		reg_backend_gconf.o
-PUBLIC_DEPENDENCIES = gconf
-# End MODULE registry_gconf
-################################################
-
-################################################
-# Start MODULE registry_ldb
-[MODULE::registry_ldb]
-INIT_FUNCTION = registry_ldb_init
-SUBSYSTEM = registry
-OBJ_FILES = \
-		reg_backend_ldb.o
-PUBLIC_DEPENDENCIES = \
-		ldb
-# End MODULE registry_ldb
-################################################
-
 ################################################
 # Start SUBSYSTEM registry
 [LIBRARY::registry]
@@ -97,9 +39,13 @@
 		reg_samba.o \
 		patchfile_dotreg.o \
 		patchfile_preg.o \
-		patchfile.o
+		patchfile.o \
+		reg_backend_regf.o \
+		reg_backend_w95.o \
+		reg_backend_ldb.o \
+		reg_backend_dir.o
 PUBLIC_DEPENDENCIES = \
-		LIBSAMBA-UTIL CHARSET
+		LIBSAMBA-UTIL CHARSET TDR_REGF ldb
 PRIVATE_PROTO_HEADER = registry_proto.h
 PUBLIC_HEADERS = registry.h
 # End MODULE registry_ldb

=== modified file 'source/lib/registry/registry.h'
--- a/source/lib/registry/registry.h	2007-02-08 15:59:04 +0000
+++ b/source/lib/registry/registry.h	2007-02-08 16:19:20 +0000
@@ -96,10 +96,9 @@
 struct hive_operations {
 	const char *name;
 
-	/* Implement this one */
 	WERROR (*open_hive) (struct registry_hive *, struct registry_key **);
 
-	/* Or this one */
+	/* Or this function or get_subkey_by_name() */
 	WERROR (*open_key) (TALLOC_CTX *, const struct registry_key *, const char *name, struct registry_key **);
 
 	WERROR (*num_subkeys) (const struct registry_key *, uint32_t *count);
@@ -194,4 +193,6 @@
 
 #include "lib/registry/registry_proto.h"
 
+WERROR reg_open_w95_file(const char *location, struct registry_key **root);
+
 #endif /* _REGISTRY_H */



More information about the samba-cvs mailing list