[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-872-gc2d9baa

Michael Adam obnox at samba.org
Sun Apr 13 13:54:54 GMT 2008


The branch, v3-2-test has been updated
       via  c2d9baa29edb2356f32ca19aea828184e9ac7b93 (commit)
       via  7dd7471da7eca2671b4aa62e8790973e3ff14177 (commit)
       via  d4e74036d3b8c5de4ce130eab7fc775e3cb746d5 (commit)
       via  14d82708d4499b48830d3dd25a0133f00a39d030 (commit)
       via  0b196095dbbc29c796cb0742fe6e57a421e9596b (commit)
       via  7c343c60574cda091f59861fbcb2893aefb564e9 (commit)
       via  5da52b95ac69e4abfbc44335df2447bec8f16e13 (commit)
       via  6a31e659cb371395dff0906786f3c6ef0cc2b3de (commit)
       via  e65a999989c97c4c7b0af5093e0e89583691e9a8 (commit)
       via  78bb005ee45e7a0be24b5222c3f878058b5cd8ea (commit)
       via  da45fb92f69221758f36db4cbb7d871e3ce60718 (commit)
       via  e97d558c5660e6d235b62528f5527a62ac1252d7 (commit)
       via  2f4ca62dce50225d67ba8643afba4199e1845c5f (commit)
       via  4bfc0be55f2a436a9c687ab6ad86e704fcb753d6 (commit)
       via  e0718f04a7392695eed6cd1bf888d3af1d5d6177 (commit)
       via  4fd9b45ffc08e7deeae58be3129832148748af13 (commit)
       via  c312852abce72bc167abee8b29fc699c4a643ca7 (commit)
       via  8fe1a2f567afbecbe487f08825cb43b038065e99 (commit)
      from  81f34489f7923db1141175b8b6bcc8594c6b2ee0 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit c2d9baa29edb2356f32ca19aea828184e9ac7b93
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 15:45:33 2008 +0200

    registry: honour the WERROR that regsubkey_ctr_addkey gives us in reg_load_tree.
    
    Michael

commit 7dd7471da7eca2671b4aa62e8790973e3ff14177
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 15:41:07 2008 +0200

    registry: honour the WERROR that regsubkey_ctr_addkey gives in regdb_fetch_keys.
    
    Michael

commit d4e74036d3b8c5de4ce130eab7fc775e3cb746d5
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 15:36:05 2008 +0200

    net registry: remove superfluous regdb_close().
    
    Michael

commit 14d82708d4499b48830d3dd25a0133f00a39d030
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 15:33:12 2008 +0200

    registry: rename init_registry() to registry_init_full() for consistency.
    
    Michael

commit 0b196095dbbc29c796cb0742fe6e57a421e9596b
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 15:31:02 2008 +0200

    registry: change init_registry() to return WERROR instead of bool.
    
    Michael

commit 7c343c60574cda091f59861fbcb2893aefb564e9
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 15:25:47 2008 +0200

    registry: change registry_init_smbconf() to return WERROR instead of bool
    
    Michael

commit 5da52b95ac69e4abfbc44335df2447bec8f16e13
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 15:21:31 2008 +0200

    registry: refactor common part of registry initialization out.
    
    into a new function registry_init_common().
    
    Michael

commit 6a31e659cb371395dff0906786f3c6ef0cc2b3de
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 15:12:04 2008 +0200

    registry: change registry_init_basic() to return WERROR instead of bool
    
    Michael

commit e65a999989c97c4c7b0af5093e0e89583691e9a8
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 14:55:49 2008 +0200

    registry: change reghook_cache_add() to return WERROR instead of bool
    
    Michael

commit 78bb005ee45e7a0be24b5222c3f878058b5cd8ea
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 14:49:32 2008 +0200

    registry cachehook: change helper function keyname_to_path() to return WERROR.
    
    Michael

commit da45fb92f69221758f36db4cbb7d871e3ce60718
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 14:41:44 2008 +0200

    adt_tree: change pathtree_add to return WERR instead of bool.
    
    Michael

commit e97d558c5660e6d235b62528f5527a62ac1252d7
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 14:40:51 2008 +0200

    registry cachehook: revert logic to make fast path more obvious and reduce indent.
    
    Michael

commit 2f4ca62dce50225d67ba8643afba4199e1845c5f
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 14:18:06 2008 +0200

    registry: change reghook_cache_init() to return WERROR and use it in the callers.
    
    Michael

commit 4bfc0be55f2a436a9c687ab6ad86e704fcb753d6
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 13:41:39 2008 +0200

    registry cachehook: compare cache_tree against NULL, not 0.
    
    Michael

commit e0718f04a7392695eed6cd1bf888d3af1d5d6177
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 13:38:44 2008 +0200

    registry: change init_registry_key() and init_registry_data() to return WERR
    
    Michael

commit 4fd9b45ffc08e7deeae58be3129832148748af13
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 12:46:21 2008 +0200

    registry: unify debug output in the registry init functions.
    
    Michael

commit c312852abce72bc167abee8b29fc699c4a643ca7
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 12:41:34 2008 +0200

    registry: change regdb_init() to return WERROR instead of bool.
    
    Michael

commit 8fe1a2f567afbecbe487f08825cb43b038065e99
Author: Michael Adam <obnox at samba.org>
Date:   Sun Apr 13 12:10:07 2008 +0200

    registry: make registry_init_smbconf() hook the registry ops onto given key.
    
    This still defaults to HKLM\Software\Samba\smbconf, but is interchangeable now.
    This allows us to open the libsmbconf registry backend on different registry keys.
    
    Michael

-----------------------------------------------------------------------

Summary of changes:
 source/include/adt_tree.h          |    2 +-
 source/lib/adt_tree.c              |   12 +++---
 source/lib/smbconf/smbconf_reg.c   |    4 +-
 source/libgpo/gpo_reg.c            |    5 +-
 source/registry/reg_api.c          |    6 ++-
 source/registry/reg_backend_db.c   |   72 ++++++++++++++++++++++-----------
 source/registry/reg_cachehook.c    |   78 +++++++++++++++++++++--------------
 source/registry/reg_init_basic.c   |   38 +++++++++++------
 source/registry/reg_init_full.c    |   25 +++++------
 source/registry/reg_init_smbconf.c |   40 ++++++++++---------
 source/smbd/server.c               |    2 +-
 source/utils/net_registry.c        |    4 +-
 12 files changed, 171 insertions(+), 117 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/adt_tree.h b/source/include/adt_tree.h
index 3e2f100..3acda8e 100644
--- a/source/include/adt_tree.h
+++ b/source/include/adt_tree.h
@@ -47,7 +47,7 @@ SORTED_TREE*  pathtree_init( void *data_p, int (cmp_fn)(void*, void*) );
 
 /* add a new path component */
 
-bool          pathtree_add( SORTED_TREE *tree, const char *path, void *data_p );
+WERROR        pathtree_add( SORTED_TREE *tree, const char *path, void *data_p );
 
 /* search path */
 
diff --git a/source/lib/adt_tree.c b/source/lib/adt_tree.c
index ef72ba3..6ac498d 100644
--- a/source/lib/adt_tree.c
+++ b/source/lib/adt_tree.c
@@ -191,23 +191,23 @@ static TREE_NODE* pathtree_find_child( TREE_NODE *node, char* key )
  Add a new node into the tree given a key path and a blob of data
  *************************************************************************/
 
- bool pathtree_add( SORTED_TREE *tree, const char *path, void *data_p )
+ WERROR pathtree_add( SORTED_TREE *tree, const char *path, void *data_p )
 {
 	char *str, *base, *path2;
 	TREE_NODE *current, *next;
-	bool ret = True;
+	WERROR ret = WERR_OK;
 	
 	DEBUG(8,("pathtree_add: Enter\n"));
 		
 	if ( !path || *path != '/' ) {
 		DEBUG(0,("pathtree_add: Attempt to add a node with a bad path [%s]\n",
 			path ? path : "NULL" ));
-		return False;
+		return WERR_INVALID_PARAM;
 	}
 	
 	if ( !tree ) {
 		DEBUG(0,("pathtree_add: Attempt to add a node to an uninitialized tree!\n"));
-		return False;
+		return WERR_INVALID_PARAM;
 	}
 	
 	/* move past the first '/' */
@@ -216,7 +216,7 @@ static TREE_NODE* pathtree_find_child( TREE_NODE *node, char* key )
 	path2 = SMB_STRDUP( path );
 	if ( !path2 ) {
 		DEBUG(0,("pathtree_add: strdup() failed on string [%s]!?!?!\n", path));
-		return False;
+		return WERR_NOMEM;
 	}
 	
 
@@ -244,7 +244,7 @@ static TREE_NODE* pathtree_find_child( TREE_NODE *node, char* key )
 			next = pathtree_birth_child( current, base );
 			if ( !next ) {
 				DEBUG(0,("pathtree_add: Failed to create new child!\n"));
-				ret =  False;
+				ret = WERR_NOMEM;
 				goto done;
 			}
 		}
diff --git a/source/lib/smbconf/smbconf_reg.c b/source/lib/smbconf/smbconf_reg.c
index 0ac49a7..ce38a20 100644
--- a/source/lib/smbconf/smbconf_reg.c
+++ b/source/lib/smbconf/smbconf_reg.c
@@ -576,8 +576,8 @@ static WERROR smbconf_reg_init(struct smbconf_ctx *ctx, const char *path)
 	}
 	rpd(ctx)->open = false;
 
-	if (!registry_init_smbconf()) {
-		werr = WERR_REG_IO_FAILURE;
+	werr = registry_init_smbconf(path);
+	if (!W_ERROR_IS_OK(werr)) {
 		goto done;
 	}
 
diff --git a/source/libgpo/gpo_reg.c b/source/libgpo/gpo_reg.c
index 80639b8..de4a793 100644
--- a/source/libgpo/gpo_reg.c
+++ b/source/libgpo/gpo_reg.c
@@ -60,8 +60,9 @@ WERROR gp_init_reg_ctx(TALLOC_CTX *mem_ctx,
 		return WERR_INVALID_PARAM;
 	}
 
-	if (!registry_init_basic()) {
-		return WERR_CAN_NOT_COMPLETE;
+	werr = registry_init_basic();
+	if (!W_ERROR_IS_OK(werr)) {
+		return werr;
 	}
 
 	tmp_ctx = TALLOC_ZERO_P(mem_ctx, struct gp_registry_context);
diff --git a/source/registry/reg_api.c b/source/registry/reg_api.c
index cbbc7dd..e9a7145 100644
--- a/source/registry/reg_api.c
+++ b/source/registry/reg_api.c
@@ -771,7 +771,11 @@ static WERROR reg_load_tree(REGF_FILE *regfile, const char *topkeypath,
 
 	key->subkey_index = 0;
 	while ((subkey = regfio_fetch_subkey( regfile, key ))) {
-		regsubkey_ctr_addkey(subkeys, subkey->keyname);
+		result = regsubkey_ctr_addkey(subkeys, subkey->keyname);
+		if (!W_ERROR_IS_OK(result)) {
+			TALLOC_FREE(subkeys);
+			return result;
+		}
 	}
 
 	/* write this key and values out */
diff --git a/source/registry/reg_backend_db.c b/source/registry/reg_backend_db.c
index fd442d6..bd28eb3 100644
--- a/source/registry/reg_backend_db.c
+++ b/source/registry/reg_backend_db.c
@@ -91,9 +91,9 @@ static struct builtin_regkey_value builtin_registry_values[] = {
  * Initialize a key in the registry:
  * create each component key of the specified path.
  */
-static bool init_registry_key_internal(const char *add_path)
+static WERROR init_registry_key_internal(const char *add_path)
 {
-	bool ret = false;
+	WERROR werr;
 	TALLOC_CTX *frame = talloc_stackframe();
 	char *path = NULL;
 	char *base = NULL;
@@ -108,6 +108,7 @@ static bool init_registry_key_internal(const char *add_path)
 	path = talloc_strdup(frame, add_path);
 	base = talloc_strdup(frame, "");
 	if (!path || !base) {
+		werr = WERR_NOMEM;
 		goto fail;
 	}
 	p = path;
@@ -119,11 +120,13 @@ static bool init_registry_key_internal(const char *add_path)
 		if (*base) {
 			base = talloc_asprintf(frame, "%s\\", base);
 			if (!base) {
+				werr = WERR_NOMEM;
 				goto fail;
 			}
 		}
 		base = talloc_asprintf_append(base, "%s", keyname);
 		if (!base) {
+			werr = WERR_NOMEM;
 			goto fail;
 		}
 
@@ -131,11 +134,13 @@ static bool init_registry_key_internal(const char *add_path)
 
 		subkeyname = talloc_strdup(frame, "");
 		if (!subkeyname) {
+			werr = WERR_NOMEM;
 			goto fail;
 		}
 		if (*p) {
 			remaining = talloc_strdup(frame, p);
 			if (!remaining) {
+				werr = WERR_NOMEM;
 				goto fail;
 			}
 			p2 = remaining;
@@ -145,6 +150,7 @@ static bool init_registry_key_internal(const char *add_path)
 			{
 				subkeyname = talloc_strdup(frame,p2);
 				if (!subkeyname) {
+					werr = WERR_NOMEM;
 					goto fail;
 				}
 			}
@@ -160,22 +166,28 @@ static bool init_registry_key_internal(const char *add_path)
 
 		if (!(subkeys = TALLOC_ZERO_P(frame, REGSUBKEY_CTR))) {
 			DEBUG(0,("talloc() failure!\n"));
+			werr = WERR_NOMEM;
 			goto fail;
 		}
 
 		regdb_fetch_keys(base, subkeys);
 		if (*subkeyname) {
-			regsubkey_ctr_addkey( subkeys, subkeyname);
+			werr = regsubkey_ctr_addkey(subkeys, subkeyname);
+			if (!W_ERROR_IS_OK(werr)) {
+				goto fail;
+			}
 		}
 		if (!regdb_store_keys( base, subkeys)) {
+			werr = WERR_CAN_NOT_COMPLETE;
 			goto fail;
 		}
 	}
 
-	ret = true;
+	werr = WERR_OK;
+
 fail:
 	TALLOC_FREE(frame);
-	return ret;
+	return werr;
 }
 
 /**
@@ -183,38 +195,42 @@ fail:
  * create each component key of the specified path,
  * wrapped in one db transaction.
  */
-bool init_registry_key(const char *add_path)
+WERROR init_registry_key(const char *add_path)
 {
+	WERROR werr;
+
 	if (regdb->transaction_start(regdb) != 0) {
 		DEBUG(0, ("init_registry_key: transaction_start failed\n"));
-		return false;
+		return WERR_REG_IO_FAILURE;
 	}
 
-	if (!init_registry_key_internal(add_path)) {
+	werr = init_registry_key_internal(add_path);
+	if (!W_ERROR_IS_OK(werr)) {
 		goto fail;
 	}
 
 	if (regdb->transaction_commit(regdb) != 0) {
 		DEBUG(0, ("init_registry_key: Could not commit transaction\n"));
-		return false;
+		return WERR_REG_IO_FAILURE;
 	}
 
-	return true;
+	return WERR_OK;
 
 fail:
 	if (regdb->transaction_cancel(regdb) != 0) {
 		smb_panic("init_registry_key: transaction_cancel failed\n");
 	}
 
-	return false;
+	return werr;
 }
 
 /***********************************************************************
  Open the registry data in the tdb
  ***********************************************************************/
 
-bool init_registry_data(void)
+WERROR init_registry_data(void)
 {
+	WERROR werr;
 	TALLOC_CTX *frame = NULL;
 	REGVAL_CTR *values;
 	int i;
@@ -231,13 +247,14 @@ bool init_registry_data(void)
 	if (regdb->transaction_start(regdb) != 0) {
 		DEBUG(0, ("init_registry_data: tdb_transaction_start "
 			  "failed\n"));
-		return false;
+		return WERR_REG_IO_FAILURE;
 	}
 
 	/* loop over all of the predefined paths and add each component */
 
 	for (i=0; builtin_registry_paths[i] != NULL; i++) {
-		if (!init_registry_key_internal(builtin_registry_paths[i])) {
+		werr = init_registry_key_internal(builtin_registry_paths[i]);
+		if (!W_ERROR_IS_OK(werr)) {
 			goto fail;
 		}
 	}
@@ -250,6 +267,7 @@ bool init_registry_data(void)
 
 		values = TALLOC_ZERO_P(frame, REGVAL_CTR);
 		if (values == NULL) {
+			werr = WERR_NOMEM;
 			goto fail;
 		}
 
@@ -297,10 +315,10 @@ bool init_registry_data(void)
 	if (regdb->transaction_commit(regdb) != 0) {
 		DEBUG(0, ("init_registry_data: Could not commit "
 			  "transaction\n"));
-		return false;
+		return WERR_REG_IO_FAILURE;
 	}
 
-	return true;
+	return WERR_OK;
 
  fail:
 
@@ -311,23 +329,24 @@ bool init_registry_data(void)
 			  "failed\n");
 	}
 
-	return false;
+	return werr;
 }
 
 /***********************************************************************
  Open the registry database
  ***********************************************************************/
  
-bool regdb_init(void)
+WERROR regdb_init(void)
 {
 	const char *vstring = "INFO/version";
 	uint32 vers_id;
+	WERROR werr;
 
 	if (regdb) {
 		DEBUG(10, ("regdb_init: incrementing refcount (%d)\n",
 			  regdb_refcount));
 		regdb_refcount++;
-		return true;
+		return WERR_OK;
 	}
 
 	regdb = db_open_trans(NULL, state_path("registry.tdb"), 0,
@@ -336,9 +355,10 @@ bool regdb_init(void)
 		regdb = db_open_trans(NULL, state_path("registry.tdb"), 0,
 				      REG_TDB_FLAGS, O_RDWR|O_CREAT, 0600);
 		if (!regdb) {
+			werr = ntstatus_to_werror(map_nt_error_from_unix(errno));
 			DEBUG(0,("regdb_init: Failed to open registry %s (%s)\n",
 				state_path("registry.tdb"), strerror(errno) ));
-			return false;
+			return werr;
 		}
 		
 		DEBUG(10,("regdb_init: Successfully created registry tdb\n"));
@@ -357,14 +377,14 @@ bool regdb_init(void)
 		if (!NT_STATUS_IS_OK(status)) {
 			DEBUG(0, ("regdb_init: error storing %s = %d: %s\n",
 				  vstring, REGVER_V1, nt_errstr(status)));
-			return false;
+			return ntstatus_to_werror(status);
 		} else {
 			DEBUG(10, ("regdb_init: stored %s = %d\n",
 				  vstring, REGVER_V1));
 		}
 	}
 
-	return true;
+	return WERR_OK;
 }
 
 /***********************************************************************
@@ -700,6 +720,7 @@ fail:
 
 int regdb_fetch_keys(const char *key, REGSUBKEY_CTR *ctr)
 {
+	WERROR werr;
 	char *path = NULL;
 	uint32 num_items;
 	uint8 *buf;
@@ -744,7 +765,12 @@ int regdb_fetch_keys(const char *key, REGSUBKEY_CTR *ctr)
 
 	for (i=0; i<num_items; i++) {
 		len += tdb_unpack(buf+len, buflen-len, "f", subkeyname);
-		regsubkey_ctr_addkey(ctr, subkeyname);
+		werr = regsubkey_ctr_addkey(ctr, subkeyname);
+		if (!W_ERROR_IS_OK(werr)) {
+			DEBUG(5, ("regdb_fetch_keys: regsubkey_ctr_addkey "
+				  "failed: %s\n", dos_errstr(werr)));
+			goto fail;
+		}
 	}
 
 	DEBUG(11,("regdb_fetch_keys: Exit [%d] items\n", num_items));
diff --git a/source/registry/reg_cachehook.c b/source/registry/reg_cachehook.c
index eb2884f..6697a69 100644
--- a/source/registry/reg_cachehook.c
+++ b/source/registry/reg_cachehook.c
@@ -28,44 +28,50 @@
 static SORTED_TREE *cache_tree = NULL;
 extern REGISTRY_OPS regdb_ops;		/* these are the default */
 
-static char *keyname_to_path(TALLOC_CTX *mem_ctx, const char *keyname)
+static WERROR keyname_to_path(TALLOC_CTX *mem_ctx, const char *keyname,
+			      char **path)
 {
-	char *path = NULL;
+	char *tmp_path = NULL;
 
-	if ((keyname == NULL)) {
-		return NULL;
+	if ((keyname == NULL) || (path == NULL)) {
+		return WERR_INVALID_PARAM;
 	}
 
-	path = talloc_asprintf(mem_ctx, "\\%s", keyname);
-	if (path == NULL) {
+	tmp_path = talloc_asprintf(mem_ctx, "\\%s", keyname);
+	if (tmp_path == NULL) {
 		DEBUG(0, ("talloc_asprintf failed!\n"));
-		return NULL;
+		return WERR_NOMEM;
 	}
 
-	path = talloc_string_sub(mem_ctx, path, "\\", "/");
-	if (path == NULL) {
+	tmp_path = talloc_string_sub(mem_ctx, tmp_path, "\\", "/");
+	if (tmp_path == NULL) {
 		DEBUG(0, ("talloc_string_sub_failed!\n"));
+		return WERR_NOMEM;
 	}
 
-	return path;
+	*path = tmp_path;
+
+	return WERR_OK;
 }
 
 /**********************************************************************
  Initialize the cache tree if it has not been initialized yet.
  *********************************************************************/
 
-bool reghook_cache_init( void )
+WERROR reghook_cache_init(void)
 {
-	if (cache_tree == NULL) {
-		cache_tree = pathtree_init(&regdb_ops, NULL);
-		if (cache_tree !=0) {
-			DEBUG(10, ("reghook_cache_init: new tree with default "
-				   "ops %p for key [%s]\n", (void *)&regdb_ops,
-				   KEY_TREE_ROOT));
-		}
+	if (cache_tree != NULL) {
+		return WERR_OK;
 	}
 
-	return (cache_tree != NULL);
+	cache_tree = pathtree_init(&regdb_ops, NULL);
+	if (cache_tree == NULL) {
+		return WERR_NOMEM;
+	}
+	DEBUG(10, ("reghook_cache_init: new tree with default "
+		   "ops %p for key [%s]\n", (void *)&regdb_ops,
+		   KEY_TREE_ROOT));
+	return WERR_OK;
 }
 
 /**********************************************************************
@@ -73,23 +79,28 @@ bool reghook_cache_init( void )
  is not in the exact format that a SORTED_TREE expects.
  *********************************************************************/
 
-bool reghook_cache_add(const char *keyname, REGISTRY_OPS *ops)
+WERROR reghook_cache_add(const char *keyname, REGISTRY_OPS *ops)
 {
-	bool ret;
+	WERROR werr;
 	char *key = NULL;
 
-	key = keyname_to_path(talloc_tos(), keyname);
+	if ((keyname == NULL) || (ops == NULL)) {
+		return WERR_INVALID_PARAM;
+	}
 
-	if ((key == NULL) || (ops == NULL)) {
-		return false;
+	werr = keyname_to_path(talloc_tos(), keyname, &key);
+	if (!W_ERROR_IS_OK(werr)) {
+		goto done;
 	}
 
 	DEBUG(10, ("reghook_cache_add: Adding ops %p for key [%s]\n",
 		   (void *)ops, key));
 
-	ret = pathtree_add(cache_tree, key, ops);
+	werr = pathtree_add(cache_tree, key, ops);
+
+done:
 	TALLOC_FREE(key);
-	return ret;
+	return werr;
 }
 
 /**********************************************************************
@@ -98,15 +109,19 @@ bool reghook_cache_add(const char *keyname, REGISTRY_OPS *ops)
 
 REGISTRY_OPS *reghook_cache_find(const char *keyname)
 {
-	char *key;
-	REGISTRY_OPS *ops;
-
-	key = keyname_to_path(talloc_tos(), keyname);
+	WERROR werr;
+	char *key = NULL;
+	REGISTRY_OPS *ops = NULL;
 
-	if (key == NULL) {
+	if (keyname == NULL) {
 		return NULL;
 	}
 
+	werr = keyname_to_path(talloc_tos(), keyname, &key);
+	if (!W_ERROR_IS_OK(werr)) {
+		goto done;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list