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

Michael Adam obnox at samba.org
Tue Jul 8 15:22:59 GMT 2008


The branch, v3-3-test has been updated
       via  f329aaf0452cc9bbad9fb6f67dac00bf8d1ef128 (commit)
      from  22735ee14a244dbda768c26dbe83a1b2aa3c03ec (commit)

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


- Log -----------------------------------------------------------------
commit f329aaf0452cc9bbad9fb6f67dac00bf8d1ef128
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jul 8 17:10:01 2008 +0200

    registry: fetch regdb_fetch_keys() when a key exists but not its subkey-record.
    
    According to the new policy a key (that is not a base key) exists,
    iff it exists in the subkey list of its parent key.
    
    Usually this subkeylist is present, but in a transaction-less
    dbwrap backend (ctdb), a failing write can leave an "incomplete"
    key without its own subkeylist-record. (Otherwise such an
    incomplete key can be generated with e.g. tdbtool.)
    For such a key net registry enumerate (e.g.) would fail.
    This commit fixes this behaviour of regdb_fetch_keys().
    
    Michael

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

Summary of changes:
 source/registry/reg_backend_db.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/registry/reg_backend_db.c b/source/registry/reg_backend_db.c
index 0d976be..b1e3e2b 100644
--- a/source/registry/reg_backend_db.c
+++ b/source/registry/reg_backend_db.c
@@ -929,21 +929,22 @@ int regdb_fetch_keys(const char *key, REGSUBKEY_CTR *ctr)
 	DEBUG(11,("regdb_fetch_keys: Enter key => [%s]\n", key ? key : "NULL"));
 
 	if (!regdb_key_exists(key)) {
-		goto fail;
+		goto done;
 	}
 
 	ctr->seqnum = regdb_get_seqnum();
 
 	value = regdb_fetch_key_internal(frame, key);
 
-	buf = value.dptr;
-	buflen = value.dsize;
-
-	if ( !buf ) {
-		DEBUG(5,("regdb_fetch_keys: tdb lookup failed to locate key [%s]\n", key));
-		goto fail;
+	if (value.dptr == NULL) {
+		DEBUG(10, ("regdb_fetch_keys: no subkeys found for key [%s]\n",
+			   key));
+		ret = 0;
+		goto done;
 	}
 
+	buf = value.dptr;
+	buflen = value.dsize;
 	len = tdb_unpack( buf, buflen, "d", &num_items);
 
 	for (i=0; i<num_items; i++) {
@@ -952,14 +953,14 @@ int regdb_fetch_keys(const char *key, REGSUBKEY_CTR *ctr)
 		if (!W_ERROR_IS_OK(werr)) {
 			DEBUG(5, ("regdb_fetch_keys: regsubkey_ctr_addkey "
 				  "failed: %s\n", dos_errstr(werr)));
-			goto fail;
+			goto done;
 		}
 	}
 
 	DEBUG(11,("regdb_fetch_keys: Exit [%d] items\n", num_items));
 
 	ret = num_items;
- fail:
+done:
 	TALLOC_FREE(frame);
 	return ret;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list