[SCM] SAMBA-CTDB repository - branch v3-6-ctdb updated - ab46204d4d813bab82845ffe97c1019ee6b7e553

Michael Adam obnox at samba.org
Fri Sep 30 09:37:03 MDT 2011


The branch, v3-6-ctdb has been updated
  discards  5c0302b77389625fd356c79e5de5820d6c2f8c5b (commit)
  discards  a8fdadb821b6527813c67e76f838fffe2cb63e79 (commit)
  discards  57650ad5c794be9b2e508553f9282a8910362a32 (commit)
  discards  f07d23c35231b30446276274eb0b37f0a0db2341 (commit)
  discards  b0fc3a62845d008b6cb8b89b56967037819b22b9 (commit)
  discards  88d6507f92e7660eb5b1668d45c9c863a60c46b4 (commit)
  discards  33d71bed1f113ecad9aa07f38dc3b1f57aecedd3 (commit)
  discards  ec70526bdfb80952f8fddc74c3d58568567cc96f (commit)
  discards  836876483013ed1f20eee382898b1e425288231e (commit)
  discards  d4ec8c637e7f8f22d51ff5ddfc5b43a33ecfa25b (commit)
  discards  c03547c884e54875d45fe26d83bee0c06254c130 (commit)
  discards  d49cb959ec273202fb4d886130db68d5cca002a2 (commit)
  discards  17462f8c1b216b2f09dbc3ba06ff7636fabec8c9 (commit)
  discards  922082ec40a12b5c6bffba9fd664144ffbe4c3bd (commit)
  discards  784a19616a299f37624c8c271a742af4d893b752 (commit)
  discards  618d66265f248e5f852620800e842aff9c96a87a (commit)
  discards  8b51ddbf7d33acb706377ee92d3dba459a0348b7 (commit)
  discards  1913d9edb20c603bf4e295806d85fe2041a81ae6 (commit)
  discards  814aa0ced5d30efb88510c2ae49e2ad9fa8d6f33 (commit)
  discards  81074c7010c28d213b0718e595732ff8d7d917c8 (commit)
  discards  dd4a255a9070b0089e6cbe42747d4c1bed76ebc3 (commit)
  discards  15bf0783ce6b41321c95eb3d4142822c6eab2e15 (commit)
  discards  565bba84628eb304ef5c39b358bb5691c907add2 (commit)
  discards  5378c4df9c3c79c36b3b189c18bc16d78c544a57 (commit)
  discards  f8ab29a30cfa99c290a3ae6eb85c7a014e16cb3c (commit)
  discards  5fc34a3a7df87d7841616c88dae4915b9060e1a9 (commit)
  discards  8bbe4163af9d1b3bf9270ac06203d2f2d36db39e (commit)
  discards  5f64f18cebd500fcceb956f32e0b3af28b4e7ba5 (commit)
  discards  9f5418b421d95ff6ad8965c896816c2188761cd2 (commit)
  discards  d18b41192fc2fb8c05cb7b545348364a9785cc42 (commit)
       via  ab46204d4d813bab82845ffe97c1019ee6b7e553 (commit)
       via  159c1f1f07e89cff5ea8445f79e7d20a2aadc389 (commit)
       via  8ffa5e144bc71e5f19d476c6abc4fccfe64e03ff (commit)
       via  aa744bd81103a7bf03bff324f064f4c9ce4315ff (commit)
       via  2ec70a0ff13c77feec814336fba7fd93a6524050 (commit)
       via  7f7e0da680198387e098cafd059fff5f26407a26 (commit)
       via  5da3fef57595b3e3495e29e2fbe4cf5af833a2e1 (commit)
       via  3090715d198bed996139b4d8f3e5640bcb3da35c (commit)
       via  32b4d961bb8443170975e32808faa6f454f98c6c (commit)
       via  d244413f8c27ff9202dcbb0c79396d4ef715b919 (commit)
       via  8f12c95422a87ce1b7b3312d746bad0432713315 (commit)
       via  ed4c8aa148b7146c704cd8ab746391bc959cb50d (commit)
       via  246c6607111dbd4c523d32660091a45d52ebbf2b (commit)
       via  25b339d02a2b108880d69dd84770336b6a7673be (commit)
       via  399776b9b5af32bcf549ad84a190bbc436a62f7a (commit)
       via  c4e53380fe0768f948b0fe95730ff8096cc6ff1e (commit)
       via  4fda84fca2ceb8cf6e64a8003ba4ce0713fc3ddb (commit)
       via  938f9acc1ee308868c9479bcd61bee1c3b410120 (commit)
       via  79df244b59a15b5bf63f5cdb3d3555d68b6c9e62 (commit)
       via  83ccf49719c9c37c11b904ec72b873a7cad2c0a4 (commit)
       via  245810e5198fa63bb3527cf46c732ac827521821 (commit)
       via  3af61581eff9fe18b7764412da6148c78eb4e319 (commit)
       via  8c93e80ec71c45a2d014111b856d59e20d714df7 (commit)
       via  6054cf1cf2eab472847b5511ecad48b7dda640ce (commit)
       via  840a7801fb3faa3ff732d8e050ff65c2cc597085 (commit)
       via  40b58a31253bd20be3dfc7a147e13639c458c9fa (commit)
       via  aac87bca299a9b83e1a77577daea7d1d5f6cda18 (commit)
       via  c6198dc8657c3a2eac9a23e81f8af59c775472ee (commit)
       via  e8f9765655bdf68afc5ba6fabacf4569c9284d1d (commit)
       via  d26450a510a5cfa05e7d592cc2ff88479b969f9d (commit)
       via  33ed4735e2c547811167528946b606c803a37644 (commit)
       via  00755860273f4bd98089b7608815c47d8c7dbb4d (commit)
       via  88417f6d80378e88cc83fc3c6ee86f0583de3547 (commit)
       via  df7bcfa936af77d5ba0689907740234108784545 (commit)
       via  29d8d23bcfcf7d8fe314dda78388fd6432079d3f (commit)
       via  a7396ad4b94df2bdda853571440839ed9fcc7783 (commit)
       via  8377f2459788853259915cd27897cc632641a53c (commit)
       via  da7cff1bfc62658d7ad7bf591ef81dc1cf66142c (commit)
       via  588989272099cabf8192274100bbe187c3611ba7 (commit)
       via  70023eaebc33d7130bcddf0075beee7d19df276a (commit)
       via  80da07e03cedff97bf2a360ca69ee83361ff79e5 (commit)
       via  4fcc91d1c7db034a53454bcf17d1e93414dc5205 (commit)
       via  89c265415e168c27bd8dbd9f2e05f28833cdaafd (commit)
       via  2e4914ef35839644882c626613d703c845e81554 (commit)
       via  9240fa911f088216a7e12f6bdc9354d12a312b1e (commit)
       via  1456a70298d5be5c9615dfc455b60a7017728ffd (commit)
       via  5ab53f695afad1bbf0e58e860089aa040ae7efa3 (commit)
      from  5c0302b77389625fd356c79e5de5820d6c2f8c5b (commit)

http://gitweb.samba.org/?p=obnox/samba-ctdb.git;a=shortlog;h=v3-6-ctdb


- Log -----------------------------------------------------------------
commit ab46204d4d813bab82845ffe97c1019ee6b7e553
Author: Michael Adam <obnox at samba.org>
Date:   Fri Sep 30 16:05:13 2011 +0200

    v3-6-ctdb: VERSION: Bump ctdb vendor patch level to 26

commit 159c1f1f07e89cff5ea8445f79e7d20a2aadc389
Author: Michael Adam <obnox at samba.org>
Date:   Tue Sep 27 16:11:06 2011 +0200

    v3-6-ctdb: Bump ctdb vendor patch level to 25

commit 8ffa5e144bc71e5f19d476c6abc4fccfe64e03ff
Author: Michael Adam <obnox at samba.org>
Date:   Mon Sep 5 17:09:37 2011 +0200

    v3-6-ctdb: bump ctdb vendor patch level to 24

commit aa744bd81103a7bf03bff324f064f4c9ce4315ff
Author: Christian Ambach <ambi at samba.org>
Date:   Wed Aug 31 17:10:40 2011 +0200

    v3-6-ctdb: bump version number to 23

commit 2ec70a0ff13c77feec814336fba7fd93a6524050
Author: Christian Ambach <ambi at samba.org>
Date:   Thu Aug 25 13:52:04 2011 +0200

    v3-6-ctdb: bump vendor level to 22

commit 7f7e0da680198387e098cafd059fff5f26407a26
Author: Michael Adam <obnox at samba.org>
Date:   Tue Aug 23 14:36:52 2011 +0200

    v3-6-ctdb: VERSION: Bump the ctdb vendor patch level to 21

commit 5da3fef57595b3e3495e29e2fbe4cf5af833a2e1
Author: Michael Adam <obnox at samba.org>
Date:   Mon Aug 15 17:40:21 2011 +0200

    v3-6-ctdb: VERSION: Bump the ctdb vendor patch level to 20

commit 3090715d198bed996139b4d8f3e5640bcb3da35c
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Aug 9 16:54:46 2011 +0200

    v3-6-ctdb: VERSION bump vendor patch level to 19

commit 32b4d961bb8443170975e32808faa6f454f98c6c
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Aug 9 10:46:42 2011 +0200

    v3-6-ctdb: VERSION bump vendor patch level to 18

commit d244413f8c27ff9202dcbb0c79396d4ef715b919
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Aug 3 11:26:26 2011 +0200

    v3-6-ctdb: bump vendor patch level to 17

commit 8f12c95422a87ce1b7b3312d746bad0432713315
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jul 27 13:07:56 2011 +0200

    v3-6-ctdb: VERSION: Bump vendor patch level to 16

commit ed4c8aa148b7146c704cd8ab746391bc959cb50d
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jun 21 17:45:49 2011 +0200

    v3-6-ctdb: bump vendor patch level to 15

commit 246c6607111dbd4c523d32660091a45d52ebbf2b
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jun 21 17:45:49 2011 +0200

    v3-6-ctdb: bump vendor patch level to 14

commit 25b339d02a2b108880d69dd84770336b6a7673be
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jun 9 17:16:53 2011 +0200

    v3-6-ctdb: VERSION bump vendor patch level to 13

commit 399776b9b5af32bcf549ad84a190bbc436a62f7a
Author: Michael Adam <obnox at samba.org>
Date:   Wed Mar 30 16:40:48 2011 +0200

    v3-6-ctdb: VERSION bump vendor patch level to 12

commit c4e53380fe0768f948b0fe95730ff8096cc6ff1e
Author: Volker Lendecke <vl at samba.org>
Date:   Mon May 16 11:40:46 2011 +0200

    v3-6-ctdb: VERSION bump vendor patch level to 11

commit 4fda84fca2ceb8cf6e64a8003ba4ce0713fc3ddb
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Apr 27 14:23:51 2011 +0200

    v3-6-ctdb: VERSION bump vendor patch level to 10

commit 938f9acc1ee308868c9479bcd61bee1c3b410120
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Apr 18 11:44:13 2011 +0200

    v3-6-ctdb: VERSION bump vendor patch level to 9

commit 79df244b59a15b5bf63f5cdb3d3555d68b6c9e62
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Mar 5 16:10:49 2010 +0100

    v3-6-ctdb: packaging(RHEL-CTDB): package the gpfs_prefetch vfs module

commit 83ccf49719c9c37c11b904ec72b873a7cad2c0a4
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jan 21 14:07:15 2011 +0100

    v3-6-ctdb: s3:vfs: Add a gpfs_prefetch module.
    
    This can not go upstream yet because it uses the gpfs_fcntl call
    from the non-GPL libgpfs.

commit 245810e5198fa63bb3527cf46c732ac827521821
Author: Michael Adam <obnox at samba.org>
Date:   Wed Mar 30 16:40:48 2011 +0200

    v3-6-ctdb: VERSION bump vendor patch level to 8

commit 3af61581eff9fe18b7764412da6148c78eb4e319
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Mar 30 16:40:48 2011 +0200

    v3-6-ctdb: VERSION bump vendor patch level to 7

commit 8c93e80ec71c45a2d014111b856d59e20d714df7
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Mar 29 12:49:40 2011 +0200

    v3-6-ctdb: VERSION bump vendor patch level to 6

commit 6054cf1cf2eab472847b5511ecad48b7dda640ce
Author: Michael Adam <obnox at samba.org>
Date:   Thu Feb 10 00:37:30 2011 +0100

    v3-6-ctdb: VERSION bump vendor patch level to 5

commit 840a7801fb3faa3ff732d8e050ff65c2cc597085
Author: Michael Adam <obnox at samba.org>
Date:   Thu Feb 10 00:37:30 2011 +0100

    v3-6-ctdb: VERSION bump vendor patch level to 4

commit 40b58a31253bd20be3dfc7a147e13639c458c9fa
Author: Michael Adam <obnox at samba.org>
Date:   Thu Feb 10 00:37:30 2011 +0100

    v3-6-ctdb: VERSION bump vendor patch level to 3

commit aac87bca299a9b83e1a77577daea7d1d5f6cda18
Author: Michael Adam <obnox at samba.org>
Date:   Thu Feb 10 00:37:30 2011 +0100

    v3-6-ctdb: VERSION bump vendor patch level to 2

commit c6198dc8657c3a2eac9a23e81f8af59c775472ee
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 15 00:16:56 2008 +0100

    v3-6-ctdb: s3: Add the "net groupfilter" command
    
    This is the start of a bad hack for even worse systems: Many Unix systems still
    have the NGROUPS problem: A user can not be member of more than a very limited
    number of groups. Solaris for example limits this to 16 by default. Many
    Windows environments have a *LOT* more groups per user, some even go to
    hundreds. Whether that is efficient is debatable, but it's there.
    
    This patch implements the
    
    "net groupfilter"
    
    command with the "addsid", "delsid" and "list" subcommands. If any SIDs are
    present according to "net groupfilter list" (they are stored in secrets.tdb),
    then only the SIDs in that list are converted to GIDs for a user at login time.
    
    This gives the Administrator the possibility to define a set of groups that are
    used on the Unix box, making sure that no user is in more than NGROUPS of those
    at a time.
    
    This patch is incomplete in the sense that winbind is not aware of this, only
    smbd. So it is kind of an emergency hack for smbd-only machines.
    
    Volker
    
    Signed-off-by: Michael Adam <obnox at samba.org>

commit e8f9765655bdf68afc5ba6fabacf4569c9284d1d
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Apr 21 18:41:32 2008 +0200

    v3-6-ctdb: apply patch from v3-0-ctdb to special case root in libnss_winbind
    
    This is needed to ensure the administrator can login to a node even
    when ctdbd and winbindd are stuck

commit d26450a510a5cfa05e7d592cc2ff88479b969f9d
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jan 18 13:19:55 2011 +0100

    v3-6-ctdb: add README.v3-6-ctdb

commit 33ed4735e2c547811167528946b606c803a37644
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jun 23 16:41:38 2009 +0200

    v3-6-ctdb: VERSION: add vendor-suffix "ctdb" and vendor-patch level "1"
    
    Michael
    
    following the versioning scheme of the v3-2-ctdb branch
    
    Michael

commit 00755860273f4bd98089b7608815c47d8c7dbb4d
Author: Michael Adam <obnox at samba.org>
Date:   Fri Sep 30 15:54:05 2011 +0200

    s3:net registry check: use REGDB_CODE_VERSION

commit 88417f6d80378e88cc83fc3c6ee86f0583de3547
Author: Gregor Beck <gbeck at sernet.de>
Date:   Thu Sep 29 10:12:18 2011 +0200

    s3:net: registry check: cleanup handling of registry format version
    
    A version specified with option --version takes precedence. If a registry tdb
    is explicitly given the version is taken from the INFO/version key, otherwise
    the version of the binary is used.
    
    If this version differs from the one found in the INFO/version key the --force
    option is required to proceed.

commit df7bcfa936af77d5ba0689907740234108784545
Author: Gregor Beck <gbeck at sernet.de>
Date:   Thu Sep 29 09:53:56 2011 +0200

    s3:net: registry check: do not block --force option
    
    Signed-off-by: Michael Adam <obnox at samba.org>

commit 29d8d23bcfcf7d8fe314dda78388fd6432079d3f
Author: Gregor Beck <gbeck at sernet.de>
Date:   Mon Sep 26 13:42:15 2011 +0200

    s3:net: registry: avoid unnecessary initialization of the registry.
    
    This allows for using help without having access to the registry and
    prevents update code to run if only a readonly check is to be performed.

commit a7396ad4b94df2bdda853571440839ed9fcc7783
Author: Gregor Beck <gbeck at sernet.de>
Date:   Mon Sep 26 13:41:42 2011 +0200

    s3:net: registry check: use current registry format version as default if
    working on the active registry.
    
    Signed-off-by: Michael Adam <obnox at samba.org>

commit 8377f2459788853259915cd27897cc632641a53c
Author: Michael Adam <obnox at samba.org>
Date:   Fri Sep 30 15:42:31 2011 +0200

    s3:registry: improve regdb_create_subkey_internal() to always complete incomlete keys
    
    Originally, this function did not create the key's subkey list record if only
    the record was listed in the subkeylist of its parent key. Now this is fixed.
    
    Pair-Programmed-With: Gregor Beck <gbeck at sernet.de>

commit da7cff1bfc62658d7ad7bf591ef81dc1cf66142c
Author: Michael Adam <obnox at samba.org>
Date:   Thu Sep 29 18:06:56 2011 +0200

    s3:registry: fix the test for a REG_SZ blob possibly being a zero terminated ucs2 string
    
    1. catch data blobs with odd number of bytes (not an ucs2 string at all)
    2. test the right ucs2 character to be 0
       (prevent out-of bounds access/potential segfault)

commit 588989272099cabf8192274100bbe187c3611ba7
Author: Michael Adam <obnox at samba.org>
Date:   Fri Sep 2 00:36:21 2011 +0200

    s3:registry: fix a debug message typo
    
    Autobuild-User: Michael Adam <obnox at samba.org>
    Autobuild-Date: Fri Sep  2 11:47:11 CEST 2011 on sn-devel-104

commit 70023eaebc33d7130bcddf0075beee7d19df276a
Author: Michael Adam <obnox at samba.org>
Date:   Fri Sep 2 00:34:12 2011 +0200

    s3:registry: introduce a define REGDB_CODE_VERSION and use it in regdb code.
    
    This is to not use the precise code version REGDB_VERSION_V3 explicitly
    in the code.

commit 80da07e03cedff97bf2a360ca69ee83361ff79e5
Author: Michael Adam <obnox at samba.org>
Date:   Fri Sep 2 00:07:58 2011 +0200

    s3:registry: rename REGVE_Vx toREGDB_VERSION_Vx for consistency

commit 4fcc91d1c7db034a53454bcf17d1e93414dc5205
Author: Michael Adam <obnox at samba.org>
Date:   Tue Aug 30 16:30:01 2011 +0200

    s3:registry: implement regdb_set_secdesc() with regdb_trans_do()
    
    Autobuild-User: Michael Adam <obnox at samba.org>
    Autobuild-Date: Fri Sep  2 00:51:40 CEST 2011 on sn-devel-104

commit 89c265415e168c27bd8dbd9f2e05f28833cdaafd
Author: Michael Adam <obnox at samba.org>
Date:   Tue Aug 30 14:06:22 2011 +0200

    s3:registry: implement regdb_store_values() with regdb_trans_do()
    
    This adds the runtime check for changed regdb format version to store_values

commit 2e4914ef35839644882c626613d703c845e81554
Author: Michael Adam <obnox at samba.org>
Date:   Tue Aug 30 16:11:01 2011 +0200

    s3:registry: change regdb_store_values_internal() from bool to NTSTATUS return code

commit 9240fa911f088216a7e12f6bdc9354d12a312b1e
Author: Michael Adam <obnox at samba.org>
Date:   Tue Aug 30 16:00:21 2011 +0200

    s3:registry: use the regdb_trans_do wrapper instead of using dbwrap_trans_do directly in the registry db code.
    
    This verifies the regdb format version number before the corresponding write operations.

commit 1456a70298d5be5c9615dfc455b60a7017728ffd
Author: Michael Adam <obnox at samba.org>
Date:   Mon Aug 29 17:06:27 2011 +0200

    s3:registry: add regdb_trans_do(): a transaction wrapper that will check the regdb version
    
    If the version has changed since initialization, the write will
    fail with ACCESS_DENIED.

commit 5ab53f695afad1bbf0e58e860089aa040ae7efa3
Author: Michael Adam <obnox at samba.org>
Date:   Tue Aug 30 15:59:30 2011 +0200

    s3:registry: drop log level of unknown regdb version message in regdb_init() to 0

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

Summary of changes:
 source3/VERSION                    |    2 +-
 source3/registry/reg_backend_db.c  |  240 +++++++++++++++++++++++++-----------
 source3/registry/reg_db.h          |   10 +-
 source3/registry/reg_format.c      |   11 ++-
 source3/utils/net.c                |    2 +-
 source3/utils/net.h                |    2 +-
 source3/utils/net_registry.c       |   14 ++-
 source3/utils/net_registry_check.c |   57 +++++----
 source3/utils/net_registry_check.h |    1 +
 9 files changed, 234 insertions(+), 105 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/VERSION b/source3/VERSION
index 257c67d..1617d6c 100644
--- a/source3/VERSION
+++ b/source3/VERSION
@@ -85,7 +85,7 @@ SAMBA_VERSION_IS_GIT_SNAPSHOT=no
 #                                                      #
 ########################################################
 SAMBA_VERSION_VENDOR_SUFFIX="ctdb"
-SAMBA_VERSION_VENDOR_PATCH=25
+SAMBA_VERSION_VENDOR_PATCH=26
 
 ########################################################
 # This can be set by vendors if they want..            #
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index ddccaad..32051ad 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -47,8 +47,8 @@ static bool regdb_store_keys_internal(struct db_context *db, const char *key,
 				      struct regsubkey_ctr *ctr);
 static int regdb_fetch_values_internal(struct db_context *db, const char* key,
 				       struct regval_ctr *values);
-static bool regdb_store_values_internal(struct db_context *db, const char *key,
-					struct regval_ctr *values);
+static NTSTATUS regdb_store_values_internal(struct db_context *db, const char *key,
+					    struct regval_ctr *values);
 static WERROR regdb_store_subkey_list(struct db_context *db, const char *parent,
 				      const char *key);
 
@@ -57,6 +57,48 @@ static WERROR regdb_create_subkey_internal(struct db_context *db,
 					   const char *key,
 					   const char *subkey);
 
+
+struct regdb_trans_ctx {
+	NTSTATUS (*action)(struct db_context *, void *);
+	void *private_data;
+};
+
+static NTSTATUS regdb_trans_do_action(struct db_context *db, void *private_data)
+{
+	NTSTATUS status;
+	int32_t version_id;
+	struct regdb_trans_ctx *ctx = (struct regdb_trans_ctx *)private_data;
+
+	version_id = dbwrap_fetch_int32(db, REGDB_VERSION_KEYNAME);
+
+	if (version_id != REGDB_CODE_VERSION) {
+		DEBUG(0, ("ERROR: changed registry version %d found while "
+			  "trying to write to the registry. Version %d "
+			  "expected.  Denying access.\n",
+			  version_id, REGDB_CODE_VERSION));
+		return NT_STATUS_ACCESS_DENIED;
+	}
+
+	status = ctx->action(db,  ctx->private_data);
+	return status;
+}
+
+static WERROR regdb_trans_do(struct db_context *db,
+			     NTSTATUS (*action)(struct db_context *, void *),
+			     void *private_data)
+{
+	NTSTATUS status;
+	struct regdb_trans_ctx ctx;
+
+
+	ctx.action = action;
+	ctx.private_data = private_data;
+
+	status = dbwrap_trans_do(db, regdb_trans_do_action, &ctx);
+
+	return ntstatus_to_werror(status);
+}
+
 /* List the deepest path into the registry.  All part components will be created.*/
 
 /* If you want to have a part of the path controlled by the tdb and part by
@@ -218,9 +260,9 @@ WERROR init_registry_key(const char *add_path)
 
 	init_ctx.add_path = add_path;
 
-	return ntstatus_to_werror(dbwrap_trans_do(regdb,
-						  init_registry_key_action,
-						  &init_ctx));
+	return regdb_trans_do(regdb,
+			      init_registry_key_action,
+			      &init_ctx);
 }
 
 /***********************************************************************
@@ -291,9 +333,12 @@ static NTSTATUS init_registry_data_action(struct db_context *db,
 		{
 			regdb_ctr_add_value(values,
 					    &builtin_registry_values[i]);
-			regdb_store_values_internal(db,
+			status = regdb_store_values_internal(db,
 					builtin_registry_values[i].path,
 					values);
+			if (!NT_STATUS_IS_OK(status)) {
+				goto done;
+			}
 		}
 		TALLOC_FREE(values);
 	}
@@ -353,9 +398,9 @@ do_init:
 	 * transaction behaviour.
 	 */
 
-	werr = ntstatus_to_werror(dbwrap_trans_do(regdb,
-						  init_registry_data_action,
-						  NULL));
+	werr = regdb_trans_do(regdb,
+			      init_registry_data_action,
+			      NULL);
 
 done:
 	TALLOC_FREE(frame);
@@ -454,7 +499,7 @@ static WERROR regdb_upgrade_v1_to_v2(struct db_context *db)
 		return WERR_REG_IO_FAILURE;
 	}
 
-	werr = regdb_store_regdb_version(db, REGVER_V2);
+	werr = regdb_store_regdb_version(db, REGDB_VERSION_V2);
 	return werr;
 }
 
@@ -559,7 +604,7 @@ static WERROR regdb_upgrade_v2_to_v3(struct db_context *db)
 		goto done;
 	}
 
-	werr = regdb_store_regdb_version(db, REGVER_V3);
+	werr = regdb_store_regdb_version(db, REGDB_VERSION_V3);
 
 done:
 	return werr;
@@ -571,7 +616,7 @@ done:
 
 WERROR regdb_init(void)
 {
-	uint32 vers_id, expected_version;
+	uint32 vers_id;
 	WERROR werr;
 
 	if (regdb) {
@@ -600,22 +645,20 @@ WERROR regdb_init(void)
 	DEBUG(10, ("regdb_init: registry db openend. refcount reset (%d)\n",
 		   regdb_refcount));
 
-	expected_version = REGVER_V3;
-
 	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",
-			   vers_id, expected_version));
+			   vers_id, REGDB_CODE_VERSION));
 
-		werr = regdb_store_regdb_version(regdb, expected_version);
+		werr = regdb_store_regdb_version(regdb, REGDB_CODE_VERSION);
 		return werr;
 	}
 
-	if (vers_id > expected_version || vers_id == 0) {
-		DEBUG(1, ("regdb_init: unknown registry version %d "
+	if (vers_id > REGDB_CODE_VERSION || vers_id == 0) {
+		DEBUG(0, ("regdb_init: unknown registry version %d "
 			  "(code version = %d), refusing initialization\n",
-			  vers_id, expected_version));
+			  vers_id, REGDB_CODE_VERSION));
 		return WERR_CAN_NOT_COMPLETE;
 	}
 
@@ -623,9 +666,9 @@ WERROR regdb_init(void)
 		return WERR_REG_IO_FAILURE;
 	}
 
-	if (vers_id == REGVER_V1) {
-		DEBUG(10, ("regdb_init: upgrading registry fromversion %d "
-			   "to %d\n", REGVER_V1, REGVER_V2));
+	if (vers_id == REGDB_VERSION_V1) {
+		DEBUG(10, ("regdb_init: upgrading registry from version %d "
+			   "to %d\n", REGDB_VERSION_V1, REGDB_VERSION_V2));
 
 		werr = regdb_upgrade_v1_to_v2(regdb);
 		if (!W_ERROR_IS_OK(werr)) {
@@ -633,12 +676,12 @@ WERROR regdb_init(void)
 			return werr;
 		}
 
-		vers_id = REGVER_V2;
+		vers_id = REGDB_VERSION_V2;
 	}
 
-	if (vers_id == REGVER_V2) {
+	if (vers_id == REGDB_VERSION_V2) {
 		DEBUG(10, ("regdb_init: upgrading registry from version %d "
-			   "to %d\n", REGVER_V2, REGVER_V3));
+			   "to %d\n", REGDB_VERSION_V2, REGDB_VERSION_V3));
 
 		werr = regdb_upgrade_v2_to_v3(regdb);
 		if (!W_ERROR_IS_OK(werr)) {
@@ -646,7 +689,7 @@ WERROR regdb_init(void)
 			return werr;
 		}
 
-		vers_id = REGVER_V3;
+		vers_id = REGDB_VERSION_V3;
 	}
 
 	/* future upgrade code should go here */
@@ -1157,9 +1200,9 @@ static bool regdb_store_keys_internal(struct db_context *db, const char *key,
 	store_ctx.key = key;
 	store_ctx.ctr = ctr;
 
-	werr = ntstatus_to_werror(dbwrap_trans_do(db,
-						  regdb_store_keys_action,
-						  &store_ctx));
+	werr = regdb_trans_do(db,
+			      regdb_store_keys_action,
+			      &store_ctx);
 
 	ret = W_ERROR_IS_OK(werr);
 
@@ -1237,8 +1280,18 @@ static WERROR regdb_create_subkey_internal(struct db_context *db,
 	W_ERROR_NOT_OK_GOTO_DONE(werr);
 
 	if (regsubkey_ctr_key_exists(subkeys, subkey)) {
-		werr = WERR_OK;
-		goto done;
+		char *newkey;
+
+		newkey = talloc_asprintf(mem_ctx, "%s\\%s", key, subkey);
+		if (newkey == NULL) {
+			werr = WERR_NOMEM;
+			goto done;
+		}
+
+		if (regdb_key_exists(db, newkey)) {
+			werr = WERR_OK;
+			goto done;
+		}
 	}
 
 	talloc_free(subkeys);
@@ -1246,9 +1299,9 @@ static WERROR regdb_create_subkey_internal(struct db_context *db,
 	create_ctx.key = key;
 	create_ctx.subkey = subkey;
 
-	werr = ntstatus_to_werror(dbwrap_trans_do(db,
-						  regdb_create_subkey_action,
-						  &create_ctx));
+	werr = regdb_trans_do(db,
+			      regdb_create_subkey_action,
+			      &create_ctx);
 
 done:
 	talloc_free(mem_ctx);
@@ -1288,9 +1341,9 @@ static WERROR regdb_create_basekey(struct db_context *db, const char *key)
 
 	create_ctx.key = key;
 
-	werr = ntstatus_to_werror(dbwrap_trans_do(db,
-						  regdb_create_basekey_action,
-						  &create_ctx));
+	werr = regdb_trans_do(db,
+			      regdb_create_basekey_action,
+			      &create_ctx);
 
 	return werr;
 }
@@ -1372,9 +1425,9 @@ static WERROR regdb_delete_subkey(const char *key, const char *subkey, bool lazy
 	delete_ctx.path = path;
 	delete_ctx.lazy = lazy;
 
-	werr = ntstatus_to_werror(dbwrap_trans_do(regdb,
-						  regdb_delete_subkey_action,
-						  &delete_ctx));
+	werr = regdb_trans_do(regdb,
+			      regdb_delete_subkey_action,
+			      &delete_ctx);
 
 done:
 	talloc_free(mem_ctx);
@@ -1707,19 +1760,20 @@ int regdb_fetch_values(const char* key, struct regval_ctr *values)
 	return regdb_fetch_values_internal(regdb, key, values);
 }
 
-static bool regdb_store_values_internal(struct db_context *db, const char *key,
-					struct regval_ctr *values)
+static NTSTATUS regdb_store_values_internal(struct db_context *db,
+					    const char *key,
+					    struct regval_ctr *values)
 {
 	TDB_DATA old_data, data;
 	char *keystr = NULL;
 	TALLOC_CTX *ctx = talloc_stackframe();
 	int len;
 	NTSTATUS status;
-	bool result = false;
 
 	DEBUG(10,("regdb_store_values: Looking for value of key [%s] \n", key));
 
 	if (!regdb_key_exists(db, key)) {
+		status = NT_STATUS_NOT_FOUND;
 		goto done;
 	}
 
@@ -1728,6 +1782,7 @@ static bool regdb_store_values_internal(struct db_context *db, const char *key,
 	len = regdb_pack_values(values, data.dptr, data.dsize);
 	if (len <= 0) {
 		DEBUG(0,("regdb_store_values: unable to pack values. len <= 0\n"));
+		status = NT_STATUS_UNSUCCESSFUL;
 		goto done;
 	}
 
@@ -1740,6 +1795,7 @@ static bool regdb_store_values_internal(struct db_context *db, const char *key,
 
 	keystr = talloc_asprintf(ctx, "%s\\%s", REG_VALUE_PREFIX, key );
 	if (!keystr) {
+		status = NT_STATUS_NO_MEMORY;
 		goto done;
 	}
 	keystr = normalize_reg_path(ctx, keystr);
@@ -1753,22 +1809,45 @@ static bool regdb_store_values_internal(struct db_context *db, const char *key,
 	    && (old_data.dsize == data.dsize)
 	    && (memcmp(old_data.dptr, data.dptr, data.dsize) == 0))
 	{
-		result = true;
+		status = NT_STATUS_OK;
 		goto done;
 	}
 
 	status = dbwrap_trans_store_bystring(db, keystr, data, TDB_REPLACE);
 
-	result = NT_STATUS_IS_OK(status);
-
 done:
 	TALLOC_FREE(ctx);
-	return result;
+	return status;
+}
+
+struct regdb_store_values_ctx {
+	const char *key;
+	struct regval_ctr *values;
+};
+
+static NTSTATUS regdb_store_values_action(struct db_context *db,
+					  void *private_data)
+{
+	NTSTATUS status;
+	struct regdb_store_values_ctx *ctx =
+		(struct regdb_store_values_ctx *)private_data;
+
+	status = regdb_store_values_internal(db, ctx->key, ctx->values);
+
+	return status;
 }
 
 bool regdb_store_values(const char *key, struct regval_ctr *values)
 {
-	return regdb_store_values_internal(regdb, key, values);
+	WERROR werr;
+	struct regdb_store_values_ctx ctx;
+
+	ctx.key = key;
+	ctx.values = values;
+
+	werr = regdb_trans_do(regdb, regdb_store_values_action, &ctx);
+
+	return W_ERROR_IS_OK(werr);
 }
 
 static WERROR regdb_get_secdesc(TALLOC_CTX *mem_ctx, const char *key,
@@ -1819,47 +1898,68 @@ done:
 	return err;
 }
 
-static WERROR regdb_set_secdesc(const char *key,
-				struct security_descriptor *secdesc)
+struct regdb_set_secdesc_ctx {
+	const char *key;
+	struct security_descriptor *secdesc;
+};
+
+static NTSTATUS regdb_set_secdesc_action(struct db_context *db,
+					 void *private_data)
 {
-	TALLOC_CTX *mem_ctx = talloc_stackframe();
 	char *tdbkey;
-	WERROR err = WERR_NOMEM;
+	NTSTATUS status;
 	TDB_DATA tdbdata;
+	struct regdb_set_secdesc_ctx *ctx =
+		(struct regdb_set_secdesc_ctx *)private_data;
+	TALLOC_CTX *frame = talloc_stackframe();
 
-	if (!regdb_key_exists(regdb, key)) {
-		err = WERR_BADFILE;
+	tdbkey = talloc_asprintf(frame, "%s\\%s", REG_SECDESC_PREFIX, ctx->key);
+	if (tdbkey == NULL) {
 		goto done;
 	}
 
-	tdbkey = talloc_asprintf(mem_ctx, "%s\\%s", REG_SECDESC_PREFIX, key);
+	tdbkey = normalize_reg_path(frame, tdbkey);
 	if (tdbkey == NULL) {
+		status = NT_STATUS_NO_MEMORY;
 		goto done;
 	}
 
-	tdbkey = normalize_reg_path(mem_ctx, tdbkey);
-	if (tdbkey == NULL) {
-		err = WERR_NOMEM;
+	if (ctx->secdesc == NULL) {
+		/* assuming a delete */
+		status = dbwrap_delete_bystring(db, tdbkey);
 		goto done;
 	}
 
-	if (secdesc == NULL) {
-		/* assuming a delete */
-		err = ntstatus_to_werror(dbwrap_trans_delete_bystring(regdb,
-								      tdbkey));
+	status = marshall_sec_desc(frame, ctx->secdesc, &tdbdata.dptr,
+				   &tdbdata.dsize);
+	if (!NT_STATUS_IS_OK(status)) {
 		goto done;
 	}
 
-	err = ntstatus_to_werror(marshall_sec_desc(mem_ctx, secdesc,
-						   &tdbdata.dptr,
-						   &tdbdata.dsize));
-	W_ERROR_NOT_OK_GOTO_DONE(err);
+	status = dbwrap_store_bystring(db, tdbkey, tdbdata, 0);
 
-	err = ntstatus_to_werror(dbwrap_trans_store_bystring(regdb, tdbkey,
-							     tdbdata, 0));
+done:
+	TALLOC_FREE(frame);
+	return status;
+}
 
- done:
-	TALLOC_FREE(mem_ctx);
+static WERROR regdb_set_secdesc(const char *key,
+				struct security_descriptor *secdesc)
+{
+	WERROR err;
+	struct regdb_set_secdesc_ctx ctx;
+
+	if (!regdb_key_exists(regdb, key)) {
+		err = WERR_BADFILE;
+		goto done;
+	}
+
+	ctx.key = key;
+	ctx.secdesc = secdesc;
+
+	err = regdb_trans_do(regdb, regdb_set_secdesc_action, &ctx);
+
+done:
 	return err;
 }
 
diff --git a/source3/registry/reg_db.h b/source3/registry/reg_db.h
index b77e45a..d0d9fd3 100644
--- a/source3/registry/reg_db.h
+++ b/source3/registry/reg_db.h
@@ -22,10 +22,12 @@
 
 #define REG_TDB_FLAGS   TDB_SEQNUM
 
-#define REGVER_V1       1       /* first db version with write support */
-#define REGVER_V2       2       /* version 2 with normalized keys */
-#define REGVER_V3	3	/* different definition of key existence, */
-				/* sorted subkeys cache removed. */
+#define REGDB_VERSION_V1    1  /* first db version with write support */
+#define REGDB_VERSION_V2    2  /* version 2 with normalized keys */
+#define REGDB_VERSION_V3    3  /* different definition of key existence, */
+                               /* sorted subkeys cache removed. */
+
+#define REGDB_CODE_VERSION REGDB_VERSION_V3
 
 #define REG_VALUE_PREFIX    "SAMBA_REGVAL"
 #define REG_SECDESC_PREFIX  "SAMBA_SECDESC"
diff --git a/source3/registry/reg_format.c b/source3/registry/reg_format.c
index ab7fe9d..6495288 100644
--- a/source3/registry/reg_format.c
+++ b/source3/registry/reg_format.c
@@ -328,7 +328,16 @@ done:
 static bool is_zero_terminated_ucs2(const uint8_t* data, size_t len) {
 	const size_t idx = len/sizeof(smb_ucs2_t);
 	const smb_ucs2_t *str = (const smb_ucs2_t*)data;
-	return (idx > 0) && (str[idx] == 0);
+
+	if ((len % sizeof(smb_ucs2_t)) != 0) {
+		return false;
+	}
+


-- 
SAMBA-CTDB repository


More information about the samba-cvs mailing list