[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Thu Aug 25 17:24:02 MDT 2011


The branch, master has been updated
       via  a3538b9 werror: remove duplicate definition of WERR_INVALID_OWNER
       via  9d3fa10 s3:dbwrap_tdb: correctly catch the error from the return code of tdb_parse in db_tdb_fetch()
       via  316834c s3:smbd: remove an unused variable in dptr_create()
       via  1e09f12 s3:registry: fix the v2_to_v3 upgrade code so that it does not create value list security records for the INFO/version key ...
       via  9b46798 s3:registry: fix the v1_to_v2 upgrade code so that it does not normalize the INFO/version key ...
       via  b4cb969 s3:registry: define a constant REGDB_VERSION_KEYNAME for the key INFO/version (and use it)
       via  b1a94b6 s3:registry: hand db context in to v2_to_v3 upgrade code via private_data
       via  48f0801 s3:registry: fix broken use of dbwrap store record in v1_to_v2 upgrade code
      from  faa769e s3: Fix the build of vfs_aixacl2.c

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit a3538b92d3ecc9d819d170d2e64cdbb0f4fff941
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 24 12:50:33 2011 +0200

    werror: remove duplicate definition of WERR_INVALID_OWNER
    
    Autobuild-User: Michael Adam <obnox at samba.org>
    Autobuild-Date: Fri Aug 26 01:23:52 CEST 2011 on sn-devel-104

commit 9d3fa10c352ae29091ffa0ef33f43a8c24a7161f
Author: Michael Adam <obnox at samba.org>
Date:   Thu Aug 25 13:45:40 2011 +0200

    s3:dbwrap_tdb: correctly catch the error from the return code of tdb_parse in db_tdb_fetch()

commit 316834cf42c352aa8a99f463f35e812fa4f6e397
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 17 10:19:58 2011 +0200

    s3:smbd: remove an unused variable in dptr_create()

commit 1e09f12d1f755ab4eeb76c51c7b52a44c78ed477
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 24 01:14:22 2011 +0200

    s3:registry: fix the v2_to_v3 upgrade code so that it does not create value list security records for the INFO/version key ...

commit 9b46798b1191ec88a3776b52aea7eb2e962f6ac7
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 24 01:13:47 2011 +0200

    s3:registry: fix the v1_to_v2 upgrade code so that it does not normalize the INFO/version key ...

commit b4cb969e4099ee35f184cfaa82d6048b28228be8
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 24 01:12:28 2011 +0200

    s3:registry: define a constant REGDB_VERSION_KEYNAME for the key INFO/version (and use it)

commit b1a94b66cc25153be3a8db1d640b4b760219a04b
Author: Michael Adam <obnox at samba.org>
Date:   Thu Aug 25 17:18:12 2011 +0200

    s3:registry: hand db context in to v2_to_v3 upgrade code via private_data
    
    This also fixes the earlier faulty handing in of a useless stackframe
    memory context via private_data.

commit 48f08011e56664bf91570499d38e5e4d39e8ed38
Author: Michael Adam <obnox at samba.org>
Date:   Thu Aug 25 17:12:33 2011 +0200

    s3:registry: fix broken use of dbwrap store record in v1_to_v2 upgrade code
    
    This also fixes broken private_data parameter for the traverse function
    (making use of it): Originally a memory context was handed in but was not used.

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

Summary of changes:
 libcli/util/werror.h              |    1 -
 source3/lib/dbwrap/dbwrap_tdb.c   |    7 ++++-
 source3/registry/reg_backend_db.c |   56 ++++++++++++++++++++++++------------
 source3/smbd/dir.c                |    1 -
 4 files changed, 43 insertions(+), 22 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/util/werror.h b/libcli/util/werror.h
index efcc19c..d59f4d6 100644
--- a/libcli/util/werror.h
+++ b/libcli/util/werror.h
@@ -131,7 +131,6 @@ typedef uint32_t WERROR;
 #define WERR_NOT_AUTHENTICATED W_ERROR(0x000004DC)
 #define WERR_MACHINE_LOCKED W_ERROR(0x000004F7)
 #define WERR_UNKNOWN_REVISION W_ERROR(0x00000519)
-#define WERR_INVALID_OWNER W_ERROR(0x0000051B)
 #define WERR_REVISION_MISMATCH W_ERROR(0x0000051A)
 #define WERR_INVALID_OWNER W_ERROR(0x0000051B)
 #define WERR_INVALID_PRIMARY_GROUP W_ERROR(0x0000051C)
diff --git a/source3/lib/dbwrap/dbwrap_tdb.c b/source3/lib/dbwrap/dbwrap_tdb.c
index aca57b6..f3528a9 100644
--- a/source3/lib/dbwrap/dbwrap_tdb.c
+++ b/source3/lib/dbwrap/dbwrap_tdb.c
@@ -160,12 +160,17 @@ static int db_tdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
 		db->private_data, struct db_tdb_ctx);
 
 	struct tdb_fetch_state state;
+	int ret;
 
 	state.mem_ctx = mem_ctx;
 	state.result = 0;
 	state.data = tdb_null;
 
-	tdb_parse_record(ctx->wtdb->tdb, key, db_tdb_fetch_parse, &state);
+	ret = tdb_parse_record(ctx->wtdb->tdb, key, db_tdb_fetch_parse, &state);
+
+	if (ret < 0) {
+		return -1;
+	}
 
 	if (state.result == -1) {
 		return -1;
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index 4e10bf6..58e7b33 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -37,6 +37,8 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_REGISTRY
 
+#define REGDB_VERSION_KEYNAME "INFO/version"
+
 static struct db_context *regdb = NULL;
 static int regdb_refcount;
 
@@ -368,15 +370,26 @@ static int regdb_normalize_keynames_fn(struct db_record *rec,
 	TALLOC_CTX *mem_ctx = talloc_tos();
 	const char *keyname;
 	NTSTATUS status;
+	struct db_context *db = (struct db_context *)private_data;
 
 	if (rec->key.dptr == NULL || rec->key.dsize == 0) {
 		return 0;
 	}
 
+	if (db == NULL) {
+		DEBUG(0, ("regdb_normalize_keynames_fn: ERROR: "
+			  "NULL db context handed in via private_data\n"));
+		return 1;
+	}
+
+	if (strncmp((const char *)rec->key.dptr, REGDB_VERSION_KEYNAME,
+	    strlen(REGDB_VERSION_KEYNAME)) == 0)
+	{
+		return 0;
+	}
+
 	keyname = strchr((const char *) rec->key.dptr, '/');
 	if (keyname) {
-		struct db_record new_rec;
-
 		keyname = talloc_string_sub(mem_ctx,
 					    (const char *) rec->key.dptr,
 					    "/",
@@ -386,10 +399,6 @@ static int regdb_normalize_keynames_fn(struct db_record *rec,
 			  (const char *) rec->key.dptr,
 			  keyname));
 
-		new_rec.value = rec->value;
-		new_rec.key = string_term_tdb_data(keyname);
-		new_rec.private_data = rec->private_data;
-
 		/* Delete the original record and store the normalized key */
 		status = rec->delete_rec(rec);
 		if (!NT_STATUS_IS_OK(status)) {
@@ -399,7 +408,8 @@ static int regdb_normalize_keynames_fn(struct db_record *rec,
 			return 1;
 		}
 
-		status = rec->store(&new_rec, new_rec.value, TDB_REPLACE);
+		status = dbwrap_store_bystring(db, keyname, rec->value,
+					       TDB_REPLACE);
 		if (!NT_STATUS_IS_OK(status)) {
 			DEBUG(0,("regdb_normalize_keynames_fn: "
 				 "failed to store new record for [%s]!\n",
@@ -414,20 +424,18 @@ static int regdb_normalize_keynames_fn(struct db_record *rec,
 static WERROR regdb_store_regdb_version(struct db_context *db, uint32_t version)
 {
 	NTSTATUS status;
-	const char *version_keyname = "INFO/version";
-
 	if (db == NULL) {
 		return WERR_CAN_NOT_COMPLETE;
 	}
 
-	status = dbwrap_trans_store_int32(db, version_keyname, version);
+	status = dbwrap_trans_store_int32(db, REGDB_VERSION_KEYNAME, version);
 	if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(1, ("regdb_store_regdb_version: error storing %s = %d: %s\n",
-			  version_keyname, version, nt_errstr(status)));
+			  REGDB_VERSION_KEYNAME, version, nt_errstr(status)));
 		return ntstatus_to_werror(status);
 	} else {
 		DEBUG(10, ("regdb_store_regdb_version: stored %s = %d\n",
-			  version_keyname, version));
+			  REGDB_VERSION_KEYNAME, version));
 		return WERR_OK;
 	}
 }
@@ -440,7 +448,7 @@ static WERROR regdb_upgrade_v1_to_v2(struct db_context *db)
 
 	mem_ctx = talloc_stackframe();
 
-	rc = regdb->traverse(db, regdb_normalize_keynames_fn, mem_ctx);
+	rc = db->traverse(db, regdb_normalize_keynames_fn, db);
 
 	talloc_free(mem_ctx);
 
@@ -462,13 +470,26 @@ static int regdb_upgrade_v2_to_v3_fn(struct db_record *rec, void *private_data)
 	uint32_t buflen, len;
 	uint32_t num_items;
 	uint32_t i;
+	struct db_context *db = (struct db_context *)private_data;
 
 	if (rec->key.dptr == NULL || rec->key.dsize == 0) {
 		return 0;
 	}
 
+	if (db == NULL) {
+		DEBUG(0, ("regdb_normalize_keynames_fn: ERROR: "
+			  "NULL db context handed in via private_data\n"));
+		return 1;
+	}
+
 	keyname = (const char *)rec->key.dptr;
 
+	if (strncmp(keyname, REGDB_VERSION_KEYNAME,
+		    strlen(REGDB_VERSION_KEYNAME)) == 0)
+	{
+		return 0;
+	}
+
 	if (strncmp(keyname, REG_SORTED_SUBKEYS_PREFIX,
 		    strlen(REG_SORTED_SUBKEYS_PREFIX)) == 0)
 	{
@@ -520,7 +541,7 @@ static int regdb_upgrade_v2_to_v3_fn(struct db_record *rec, void *private_data)
 		DEBUG(10, ("regdb_upgrade_v2_to_v3: "
 			   "writing subkey list for [%s\\%s]\n",
 			   keyname, subkeyname));
-		werr = regdb_store_subkey_list(regdb, keyname, subkeyname);
+		werr = regdb_store_subkey_list(db, keyname, subkeyname);
 		if (!W_ERROR_IS_OK(werr)) {
 			return 1;
 		}
@@ -533,9 +554,8 @@ static WERROR regdb_upgrade_v2_to_v3(struct db_context *db)
 {
 	int rc;
 	WERROR werr;
-	TALLOC_CTX *frame = talloc_stackframe();
 
-	rc = regdb->traverse(db, regdb_upgrade_v2_to_v3_fn, frame);
+	rc = regdb->traverse(db, regdb_upgrade_v2_to_v3_fn, db);
 	if (rc < 0) {
 		werr = WERR_REG_IO_FAILURE;
 		goto done;
@@ -544,7 +564,6 @@ static WERROR regdb_upgrade_v2_to_v3(struct db_context *db)
 	werr = regdb_store_regdb_version(db, REGVER_V3);
 
 done:
-	talloc_free(frame);
 	return werr;
 }
 
@@ -554,7 +573,6 @@ done:
 
 WERROR regdb_init(void)
 {
-	const char *vstring = "INFO/version";
 	uint32 vers_id, expected_version;
 	WERROR werr;
 
@@ -586,7 +604,7 @@ WERROR regdb_init(void)
 
 	expected_version = REGVER_V3;
 
-	vers_id = dbwrap_fetch_int32(regdb, vstring);
+	vers_id = dbwrap_fetch_int32(regdb, REGDB_VERSION_KEYNAME);
 	if (vers_id == -1) {
 		DEBUG(10, ("regdb_init: registry version uninitialized "
 			   "(got %d), initializing to version %d\n",
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index e7c17de..cc74886 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -427,7 +427,6 @@ NTSTATUS dptr_create(connection_struct *conn, files_struct *fsp,
 	struct smbd_server_connection *sconn = conn->sconn;
 	struct dptr_struct *dptr = NULL;
 	struct smb_Dir *dir_hnd;
-	NTSTATUS status;
 
 	if (fsp && fsp->is_directory && fsp->fh->fd != -1) {
 		path = fsp->fsp_name->base_name;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list