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

Michael Adam obnox at samba.org
Mon Mar 17 07:39:54 GMT 2008


The branch, v3-2-test has been updated
       via  3ea0a0beb47bf91b71d949de5abb797177721dcc (commit)
       via  df848d8eeeb102288a3acb9a0f8a7015e0c6ca6b (commit)
       via  76dad05e4ce4b4cb26557bc151359ed9d58d6317 (commit)
       via  d553b5d72569c1496bfa3de703c9bf15a9a6cb60 (commit)
       via  e4f2c856ec716697af4815491b5ae8ddb263cd51 (commit)
       via  860316cbe70836882bff16b39f0deb5c12cbd1f3 (commit)
       via  7454e426f2ea9aa42620ed5bcb34c85797b9e21b (commit)
       via  3a1d79116b693bc25af1106c9a43ffd275ac3d1e (commit)
       via  93ea27a3e23e489a2af3c778684f8a8a4594b567 (commit)
       via  331d7fd2ea6d8aeb029478a6ab8d4051fa2c03fd (commit)
       via  a99b51159a7db5f249ff136cf9ba758d14380a35 (commit)
       via  e1d4a2fa5b5b0f21d1ea4a9dffc326878c9f54b7 (commit)
       via  9315de404812d89dddcec6ac4ae17c34f5012746 (commit)
       via  95525772f2791f0fb999fe9f271da5b0fbdc62d8 (commit)
       via  966b2414cb6efdfe5acb412ed9bdfd7589ee694c (commit)
       via  76e4cdc25fc9a7e47fd9a356dc54533b62c5db08 (commit)
       via  f357b1ddd3ea552163151f27b4ec70fe0488a0ba (commit)
       via  8b0dd1e7582eef71275eea2da2b444588412c517 (commit)
       via  7fd0ae3edce8a6ae913344cc0974181c19179b23 (commit)
       via  d39957e2c9216ef01b2ef53863c0ef5d3a9b5fee (commit)
       via  79f37d47655ec26176a8da5f47e1c7400888a2ef (commit)
       via  3c42d8ee16a4b143c6658fe26030569658eaef66 (commit)
      from  2fd25423700cb60f20a8b8d6613279cb06fb518d (commit)

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


- Log -----------------------------------------------------------------
commit 3ea0a0beb47bf91b71d949de5abb797177721dcc
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 01:44:26 2008 +0100

    registry: convert regdb REGISTRY_OPS to named struct initializers.
    
    Michael

commit df848d8eeeb102288a3acb9a0f8a7015e0c6ca6b
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 01:39:16 2008 +0100

    registry: use talloc instead of malloc and provide common exit point
    
    in regdb_get_secdesc().
    
    Michael

commit 76dad05e4ce4b4cb26557bc151359ed9d58d6317
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 01:32:47 2008 +0100

    registry: remove an unused variable from regdb_set_secdesc().
    
    Michael

commit d553b5d72569c1496bfa3de703c9bf15a9a6cb60
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 01:31:47 2008 +0100

    registry: untangle assignments and if statements in regdb_set_secdesc().
    
    Michael

commit e4f2c856ec716697af4815491b5ae8ddb263cd51
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 01:27:27 2008 +0100

    registry: use talloc_stackframe instead of hand crafted temporary context.
    
    Michael

commit 860316cbe70836882bff16b39f0deb5c12cbd1f3
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 01:26:35 2008 +0100

    registry: use talloc instead of malloc for tdb data in regdb_store_values().
    
    Michael

commit 7454e426f2ea9aa42620ed5bcb34c85797b9e21b
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 01:20:18 2008 +0100

    registry: don't use talloc_stackframe() instead of talloc_tos() als temp ctx
    
    in regdb_store_values(). Also provide common exit path for
    freeing memory.
    
    Michael

commit 3a1d79116b693bc25af1106c9a43ffd275ac3d1e
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 01:17:15 2008 +0100

    registry: don't leak to talloc stack in regdb_fetch_keys().
    
    Michael

commit 93ea27a3e23e489a2af3c778684f8a8a4594b567
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 01:09:31 2008 +0100

    registry: explicitly use talloc context instead of talloc_tos()
    
    in regdb_fetch_keys().
    
    Michael

commit 331d7fd2ea6d8aeb029478a6ab8d4051fa2c03fd
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 01:05:48 2008 +0100

    registry: don't leak on success path in regdb_store_keys().
    
    Michael

commit a99b51159a7db5f249ff136cf9ba758d14380a35
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 01:02:47 2008 +0100

    registry: allocate tempory data in talloc stack in regdb_store_keys().
    
    Michael

commit e1d4a2fa5b5b0f21d1ea4a9dffc326878c9f54b7
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 01:00:40 2008 +0100

    registry: separate cancel and failur exit paths in regdb_store_keys().
    
    Michael

commit 9315de404812d89dddcec6ac4ae17c34f5012746
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 00:43:56 2008 +0100

    registry: don't leak memory on transaction fail in regdb_store_keys().
    
    Michael

commit 95525772f2791f0fb999fe9f271da5b0fbdc62d8
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 00:41:59 2008 +0100

    registry: don't leak (to talloc_tos()) in regdb_store_keys().
    
    use talloc_stackframe() and free on error path.
    
    Michael

commit 966b2414cb6efdfe5acb412ed9bdfd7589ee694c
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 00:22:12 2008 +0100

    registry: reformat regdb_store_keys_internal(), killing long lines.
    
    Michael

commit 76e4cdc25fc9a7e47fd9a356dc54533b62c5db08
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 00:09:07 2008 +0100

    registry: don't leak (to talloc_tos()) in regdb_store_keys_internal().
    
    Michael

commit f357b1ddd3ea552163151f27b4ec70fe0488a0ba
Author: Michael Adam <obnox at samba.org>
Date:   Mon Mar 17 00:02:52 2008 +0100

    registry: reformat init_registry_data() some, killing long lines.
    
    Michael

commit 8b0dd1e7582eef71275eea2da2b444588412c517
Author: Michael Adam <obnox at samba.org>
Date:   Sun Mar 16 23:52:40 2008 +0100

    registry: explicitly use talloc context instead of talloc_tos()
    
    in init_registry_data().
    
    Michael

commit 7fd0ae3edce8a6ae913344cc0974181c19179b23
Author: Michael Adam <obnox at samba.org>
Date:   Sun Mar 16 23:49:59 2008 +0100

    registry: don't leak (to talloc_tos()) in init_registry_data().
    
    Michael

commit d39957e2c9216ef01b2ef53863c0ef5d3a9b5fee
Author: Michael Adam <obnox at samba.org>
Date:   Sun Mar 16 23:08:33 2008 +0100

    registry: rename tdb_refcount to regdb_refcount after change to dbwrap.
    
    Michael

commit 79f37d47655ec26176a8da5f47e1c7400888a2ef
Author: Michael Adam <obnox at samba.org>
Date:   Sun Mar 16 23:07:15 2008 +0100

    registry: rename tdb_reg to regdb after change to dbwrap.
    
    Michael

commit 3c42d8ee16a4b143c6658fe26030569658eaef66
Author: Michael Adam <obnox at samba.org>
Date:   Sun Mar 16 23:03:34 2008 +0100

    registry: migrate tdb registry backend to dbwrap.
    
    Michael

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

Summary of changes:
 source/registry/reg_backend_db.c |  391 +++++++++++++++++++------------------
 1 files changed, 201 insertions(+), 190 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/registry/reg_backend_db.c b/source/registry/reg_backend_db.c
index 518078a..1378d00 100644
--- a/source/registry/reg_backend_db.c
+++ b/source/registry/reg_backend_db.c
@@ -24,8 +24,8 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_REGISTRY
 
-static struct tdb_wrap *tdb_reg = NULL;
-static int tdb_refcount;
+static struct db_context *regdb = NULL;
+static int regdb_refcount;
 
 /* List the deepest path into the registry.  All part components will be created.*/
 
@@ -83,7 +83,7 @@ static struct builtin_regkey_value builtin_registry_values[] = {
  Open the registry data in the tdb
  ***********************************************************************/
 
-static bool init_registry_data( void )
+static bool init_registry_data(void)
 {
 	char *path = NULL;
 	char *base = NULL;
@@ -105,7 +105,7 @@ static bool init_registry_data( void )
 	 * transaction behaviour.
 	 */
 
-	if ( tdb_transaction_start( tdb_reg->tdb ) == -1 ) {
+	if (regdb->transaction_start(regdb) == -1) {
 		DEBUG(0, ("init_registry_data: tdb_transaction_start "
 			  "failed\n"));
 		return false;
@@ -113,25 +113,26 @@ static bool init_registry_data( void )
 
 	/* loop over all of the predefined paths and add each component */
 
-	for ( i=0; builtin_registry_paths[i] != NULL; i++ ) {
+	for (i=0; builtin_registry_paths[i] != NULL; i++) {
 
 		frame = talloc_stackframe();
 
-		DEBUG(6,("init_registry_data: Adding [%s]\n", builtin_registry_paths[i]));
+		DEBUG(6, ("init_registry_data: Adding [%s]\n",
+			  builtin_registry_paths[i]));
 
-		path = talloc_strdup(talloc_tos(), builtin_registry_paths[i]);
-		base = talloc_strdup(talloc_tos(), "");
+		path = talloc_strdup(frame, builtin_registry_paths[i]);
+		base = talloc_strdup(frame, "");
 		if (!path || !base) {
 			goto fail;
 		}
 		p = path;
 
-		while (next_token_talloc(talloc_tos(), &p, &keyname, "\\")) {
+		while (next_token_talloc(frame, &p, &keyname, "\\")) {
 
 			/* build up the registry path from the components */
 
 			if (*base) {
-				base = talloc_asprintf(talloc_tos(), "%s\\", base);
+				base = talloc_asprintf(frame, "%s\\", base);
 				if (!base) {
 					goto fail;
 				}
@@ -143,34 +144,36 @@ static bool init_registry_data( void )
 
 			/* get the immediate subkeyname (if we have one ) */
 
-			subkeyname = talloc_strdup(talloc_tos(), "");
+			subkeyname = talloc_strdup(frame, "");
 			if (!subkeyname) {
 				goto fail;
 			}
 			if (*p) {
-				remaining = talloc_strdup(talloc_tos(), p);
+				remaining = talloc_strdup(frame, p);
 				if (!remaining) {
 					goto fail;
 				}
 				p2 = remaining;
 
-				if (!next_token_talloc(talloc_tos(), &p2,
-							&subkeyname, "\\")) {
-					subkeyname = talloc_strdup(talloc_tos(),p2);
+				if (!next_token_talloc(frame, &p2,
+							&subkeyname, "\\"))
+				{
+					subkeyname = talloc_strdup(frame,p2);
 					if (!subkeyname) {
 						goto fail;
 					}
 				}
 			}
 
-			DEBUG(10,("init_registry_data: Storing key [%s] with subkey [%s]\n",
-				base, *subkeyname ? subkeyname : "NULL"));
+			DEBUG(10,("init_registry_data: Storing key [%s] with "
+				  "subkey [%s]\n", base,
+				  *subkeyname ? subkeyname : "NULL"));
 
-			/* we don't really care if the lookup succeeds or not since
-			   we are about to update the record.  We just want any
-			   subkeys already present */
+			/* we don't really care if the lookup succeeds or not
+			 * since we are about to update the record.
+			 * We just want any subkeys already present */
 
-			if ( !(subkeys = TALLOC_ZERO_P(talloc_tos(), REGSUBKEY_CTR )) ) {
+			if (!(subkeys = TALLOC_ZERO_P(frame, REGSUBKEY_CTR))) {
 				DEBUG(0,("talloc() failure!\n"));
 				goto fail;
 			}
@@ -189,47 +192,56 @@ static bool init_registry_data( void )
 
 	/* loop over all of the predefined values and add each component */
 
+	frame = talloc_stackframe();
+
 	for (i=0; builtin_registry_values[i].path != NULL; i++) {
 
-		if (!(values = TALLOC_ZERO_P(talloc_tos(), REGVAL_CTR))) {
+		if (!(values = TALLOC_ZERO_P(frame, REGVAL_CTR))) {
 			goto fail;
 		}
 
-		regdb_fetch_values( builtin_registry_values[i].path, values);
+		regdb_fetch_values(builtin_registry_values[i].path, values);
 
-		/* preserve existing values across restarts.  Only add new ones */
+		/* preserve existing values across restarts. Only add new ones */
 
-		if (!regval_ctr_key_exists(values, builtin_registry_values[i].valuename)) {
+		if (!regval_ctr_key_exists(values,
+					builtin_registry_values[i].valuename))
+		{
 			switch(builtin_registry_values[i].type) {
 			case REG_DWORD:
-				regval_ctr_addvalue( values,
-				                     builtin_registry_values[i].valuename,
-						     REG_DWORD,
-						     (char*)&builtin_registry_values[i].data.dw_value,
-						     sizeof(uint32) );
+				regval_ctr_addvalue(values,
+					builtin_registry_values[i].valuename,
+					REG_DWORD,
+					(char*)&builtin_registry_values[i].data.dw_value,
+					sizeof(uint32));
 				break;
 
 			case REG_SZ:
-				init_unistr2( &data, builtin_registry_values[i].data.string, UNI_STR_TERMINATE);
-				regval_ctr_addvalue( values,
-				                     builtin_registry_values[i].valuename,
-						     REG_SZ,
-						     (char*)data.buffer,
-						     data.uni_str_len*sizeof(uint16) );
+				init_unistr2(&data,
+					builtin_registry_values[i].data.string,
+					UNI_STR_TERMINATE);
+				regval_ctr_addvalue(values,
+					builtin_registry_values[i].valuename,
+					REG_SZ,
+					(char*)data.buffer,
+					data.uni_str_len*sizeof(uint16));
 				break;
 
 			default:
-				DEBUG(0,("init_registry_data: invalid value type in builtin_registry_values [%d]\n",
-					builtin_registry_values[i].type));
+				DEBUG(0, ("init_registry_data: invalid value "
+					  "type in builtin_registry_values "
+					  "[%d]\n",
+					  builtin_registry_values[i].type));
 			}
-			regdb_store_values( builtin_registry_values[i].path, values );
+			regdb_store_values(builtin_registry_values[i].path,
+					   values);
 		}
-		TALLOC_FREE( values );
+		TALLOC_FREE(values);
 	}
 
 	TALLOC_FREE(frame);
 
-	if (tdb_transaction_commit( tdb_reg->tdb ) == -1) {
+	if (regdb->transaction_commit(regdb) == -1) {
 		DEBUG(0, ("init_registry_data: Could not commit "
 			  "transaction\n"));
 		return false;
@@ -241,7 +253,7 @@ static bool init_registry_data( void )
 
 	TALLOC_FREE(frame);
 
-	if (tdb_transaction_cancel( tdb_reg->tdb ) == -1) {
+	if (regdb->transaction_cancel(regdb) == -1) {
 		smb_panic("init_registry_data: tdb_transaction_cancel "
 			  "failed\n");
 	}
@@ -258,16 +270,16 @@ bool regdb_init( void )
 	const char *vstring = "INFO/version";
 	uint32 vers_id;
 
-	if ( tdb_reg ) {
-		DEBUG(10,("regdb_init: incrementing refcount (%d)\n", tdb_refcount));
-		tdb_refcount++;
+	if ( regdb ) {
+		DEBUG(10,("regdb_init: incrementing refcount (%d)\n", regdb_refcount));
+		regdb_refcount++;
 		return true;
 	}
 
-	if ( !(tdb_reg = tdb_wrap_open(NULL, state_path("registry.tdb"), 0, REG_TDB_FLAGS, O_RDWR, 0600)) )
+	if ( !(regdb = db_open(NULL, state_path("registry.tdb"), 0, REG_TDB_FLAGS, O_RDWR, 0600)) )
 	{
-		tdb_reg = tdb_wrap_open(NULL, state_path("registry.tdb"), 0, REG_TDB_FLAGS, O_RDWR|O_CREAT, 0600);
-		if ( !tdb_reg ) {
+		regdb = db_open(NULL, state_path("registry.tdb"), 0, REG_TDB_FLAGS, O_RDWR|O_CREAT, 0600);
+		if ( !regdb ) {
 			DEBUG(0,("regdb_init: Failed to open registry %s (%s)\n",
 				state_path("registry.tdb"), strerror(errno) ));
 			return false;
@@ -276,9 +288,9 @@ bool regdb_init( void )
 		DEBUG(10,("regdb_init: Successfully created registry tdb\n"));
 	}
 
-	tdb_refcount = 1;
+	regdb_refcount = 1;
 
-	vers_id = tdb_fetch_int32(tdb_reg->tdb, vstring);
+	vers_id = dbwrap_fetch_int32(regdb, vstring);
 
 	if ( vers_id != REGVER_V1 ) {
 		/* any upgrade code here if needed */
@@ -304,16 +316,16 @@ WERROR regdb_open( void )
 {
 	WERROR result = WERR_OK;
 
-	if ( tdb_reg ) {
-		DEBUG(10,("regdb_open: incrementing refcount (%d)\n", tdb_refcount));
-		tdb_refcount++;
+	if ( regdb ) {
+		DEBUG(10,("regdb_open: incrementing refcount (%d)\n", regdb_refcount));
+		regdb_refcount++;
 		return WERR_OK;
 	}
 	
 	become_root();
 
-	tdb_reg = tdb_wrap_open(NULL, state_path("registry.tdb"), 0, REG_TDB_FLAGS, O_RDWR, 0600);
-	if ( !tdb_reg ) {
+	regdb = db_open(NULL, state_path("registry.tdb"), 0, REG_TDB_FLAGS, O_RDWR, 0600);
+	if ( !regdb ) {
 		result = ntstatus_to_werror( map_nt_error_from_unix( errno ) );
 		DEBUG(0,("regdb_open: Failed to open %s! (%s)\n", 
 			state_path("registry.tdb"), strerror(errno) ));
@@ -321,8 +333,8 @@ WERROR regdb_open( void )
 
 	unbecome_root();
 
-	tdb_refcount = 1;
-	DEBUG(10,("regdb_open: refcount reset (%d)\n", tdb_refcount));
+	regdb_refcount = 1;
+	DEBUG(10,("regdb_open: refcount reset (%d)\n", regdb_refcount));
 
 	return result;
 }
@@ -332,20 +344,20 @@ WERROR regdb_open( void )
 
 int regdb_close( void )
 {
-	if (tdb_refcount == 0) {
+	if (regdb_refcount == 0) {
 		return 0;
 	}
 
-	tdb_refcount--;
+	regdb_refcount--;
 
-	DEBUG(10,("regdb_close: decrementing refcount (%d)\n", tdb_refcount));
+	DEBUG(10,("regdb_close: decrementing refcount (%d)\n", regdb_refcount));
 
-	if ( tdb_refcount > 0 )
+	if ( regdb_refcount > 0 )
 		return 0;
 
-	SMB_ASSERT( tdb_refcount >= 0 );
+	SMB_ASSERT( regdb_refcount >= 0 );
 
-	TALLOC_FREE(tdb_reg);
+	TALLOC_FREE(regdb);
 	return 0;
 }
 
@@ -356,7 +368,7 @@ int regdb_close( void )
  ***********************************************************************/
 int regdb_get_seqnum(void)
 {
-	return tdb_get_seqnum(tdb_reg->tdb);
+	return regdb->get_seqnum(regdb);
 }
 
 /***********************************************************************
@@ -374,7 +386,8 @@ static bool regdb_store_keys_internal(const char *key, REGSUBKEY_CTR *ctr)
 	bool ret = true;
 	uint32 num_subkeys = regsubkey_ctr_numkeys(ctr);
 	char *keyname = NULL;
-	TALLOC_CTX *ctx = talloc_tos();
+	TALLOC_CTX *ctx = talloc_stackframe();
+	NTSTATUS status;
 
 	if (!key) {
 		return false;
@@ -388,7 +401,8 @@ static bool regdb_store_keys_internal(const char *key, REGSUBKEY_CTR *ctr)
 
 	/* allocate some initial memory */
 
-	if (!(buffer = (uint8 *)SMB_MALLOC(1024))) {
+	buffer = (uint8 *)SMB_MALLOC(1024);
+	if (buffer == NULL) {
 		return false;
 	}
 	buflen = 1024;
@@ -396,22 +410,25 @@ static bool regdb_store_keys_internal(const char *key, REGSUBKEY_CTR *ctr)
 
 	/* store the number of subkeys */
 
-	len += tdb_pack(buffer+len, buflen-len, "d", num_subkeys );
+	len += tdb_pack(buffer+len, buflen-len, "d", num_subkeys);
 
 	/* pack all the strings */
 
 	for (i=0; i<num_subkeys; i++) {
-		len += tdb_pack( buffer+len, buflen-len, "f", regsubkey_ctr_specific_key(ctr, i) );
-		if ( len > buflen ) {
+		len += tdb_pack(buffer+len, buflen-len, "f",
+				regsubkey_ctr_specific_key(ctr, i));
+		if (len > buflen) {
 			/* allocate some extra space */
-			if ((buffer = (uint8 *)SMB_REALLOC( buffer, len*2 )) == NULL) {
-				DEBUG(0,("regdb_store_keys: Failed to realloc memory of size [%d]\n", len*2));
+			buffer = (uint8 *)SMB_REALLOC(buffer, len*2);
+			if(buffer == NULL) {
+				DEBUG(0, ("regdb_store_keys: Failed to realloc "
+					  "memory of size [%d]\n", len*2));
 				ret = false;
 				goto done;
 			}
 			buflen = len*2;
-
-			len = tdb_pack( buffer+len, buflen-len, "f", regsubkey_ctr_specific_key(ctr, i) );
+			len = tdb_pack(buffer+len, buflen-len, "f",
+				       regsubkey_ctr_specific_key(ctr, i));
 		}
 	}
 
@@ -419,13 +436,15 @@ static bool regdb_store_keys_internal(const char *key, REGSUBKEY_CTR *ctr)
 
 	dbuf.dptr = buffer;
 	dbuf.dsize = len;
-	if ( tdb_store_bystring( tdb_reg->tdb, keyname, dbuf, TDB_REPLACE ) == -1) {
+	status = dbwrap_store_bystring(regdb, keyname, dbuf, TDB_REPLACE);
+	if (!NT_STATUS_IS_OK(status)) {
 		ret = false;
 		goto done;
 	}
 
 done:
-	SAFE_FREE( buffer );
+	TALLOC_FREE(ctx);
+	SAFE_FREE(buffer);
 	return ret;
 }
 
@@ -440,14 +459,15 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
 	char *path = NULL;
 	REGSUBKEY_CTR *subkeys = NULL, *old_subkeys = NULL;
 	char *oldkeyname = NULL;
-	TALLOC_CTX *ctx = talloc_tos();
+	TALLOC_CTX *ctx = talloc_stackframe();
+	NTSTATUS status;
 
 	/*
 	 * fetch a list of the old subkeys so we can determine if anything has
 	 * changed
 	 */
 
-	if (!(old_subkeys = TALLOC_ZERO_P(ctr, REGSUBKEY_CTR))) {
+	if (!(old_subkeys = TALLOC_ZERO_P(ctx, REGSUBKEY_CTR))) {
 		DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
 		return false;
 	}
@@ -473,20 +493,20 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
 		}
 	}
 
-	if (tdb_transaction_start( tdb_reg->tdb ) == -1) {
-		DEBUG(0, ("regdb_store_keys: tdb_transaction_start failed\n"));
-		return false;
+	TALLOC_FREE(old_subkeys);
+
+	if (regdb->transaction_start(regdb) == -1) {
+		DEBUG(0, ("regdb_store_keys: transaction_start failed\n"));
+		goto fail;
 	}
 
 	/*
 	 * Re-fetch the old keys inside the transaction
 	 */
 
-	TALLOC_FREE(old_subkeys);
-
-	if (!(old_subkeys = TALLOC_ZERO_P(ctr, REGSUBKEY_CTR))) {
+	if (!(old_subkeys = TALLOC_ZERO_P(ctx, REGSUBKEY_CTR))) {
 		DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
-		goto fail;
+		goto cancel;
 	}
 
 	regdb_fetch_keys(key, old_subkeys);
@@ -496,7 +516,7 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
 	if (!regdb_store_keys_internal(key, ctr) ) {
 		DEBUG(0,("regdb_store_keys: Failed to store new subkey list "
 			 "for parent [%s]\n", key));
-		goto fail;
+		goto cancel;
 	}
 
 	/* now delete removed keys */
@@ -515,15 +535,16 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
 
 		path = talloc_asprintf(ctx, "%s/%s", key, oldkeyname);
 		if (!path) {
-			goto fail;
+			goto cancel;
 		}
 		path = normalize_reg_path(ctx, path);
 		if (!path) {
-			goto fail;
+			goto cancel;
 		}
-		if (tdb_delete_bystring(tdb_reg->tdb, path) == -1) {
+		status = dbwrap_delete_bystring(regdb, path);
+		if (!NT_STATUS_IS_OK(status)) {
 			DEBUG(1, ("Deleting %s failed\n", path));
-			goto fail;
+			goto cancel;
 		}
 
 		TALLOC_FREE(path);
@@ -532,17 +553,17 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
 				key,
 				oldkeyname );
 		if (!path) {
-			goto fail;
+			goto cancel;
 		}
 		path = normalize_reg_path(ctx, path);
 		if (!path) {
-			goto fail;
+			goto cancel;
 		}
 
 		/*
 		 * Ignore errors here, we might have no values around
 		 */
-		tdb_delete_bystring( tdb_reg->tdb, path );
+		dbwrap_delete_bystring(regdb, path);
 		TALLOC_FREE(path);
 	}
 
@@ -553,15 +574,15 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
 	num_subkeys = regsubkey_ctr_numkeys(ctr);
 
 	if (num_subkeys == 0) {
-		if (!(subkeys = TALLOC_ZERO_P(ctr, REGSUBKEY_CTR)) ) {
+		if (!(subkeys = TALLOC_ZERO_P(ctx, REGSUBKEY_CTR)) ) {
 			DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
-			goto fail;
+			goto cancel;
 		}
 
 		if (!regdb_store_keys_internal(key, subkeys)) {
 			DEBUG(0,("regdb_store_keys: Failed to store "
 				 "new record for key [%s]\n", key));
-			goto fail;
+			goto cancel;
 		}
 		TALLOC_FREE(subkeys);
 
@@ -572,11 +593,11 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
 					key,
 					regsubkey_ctr_specific_key(ctr, i));
 		if (!path) {
-			goto fail;
+			goto cancel;
 		}
-		if (!(subkeys = TALLOC_ZERO_P(ctr, REGSUBKEY_CTR)) ) {
+		if (!(subkeys = TALLOC_ZERO_P(ctx, REGSUBKEY_CTR)) ) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list