[SCM] SAMBA-CTDB repository - branch v3-2-ctdb updated - build_3.2.7_ctdb.54-140-g568921e

Michael Adam obnox at samba.org
Thu Feb 26 10:09:40 GMT 2009


The branch, v3-2-ctdb has been updated
       via  568921e84308237c49c673dccd2a19866e5ced0d (commit)
       via  903148d45777411fb048fed877fe2a72503742d5 (commit)
       via  93df7bda9220b3efa569b9f13eeb06fa34e0c205 (commit)
       via  9bb38a1d6cc147dfcc44d86cca7cf13e4adad185 (commit)
       via  6ff485d80e7c074b5b55be7123395f5b4b979791 (commit)
       via  cab026186a717fcf63f044bf360836c59e8b8416 (commit)
       via  f60f533c8e3c5109f63dc5feb8558efe311db209 (commit)
       via  8909f5233bf927422208e3d963f7b57af51d74c2 (commit)
       via  29abe710dd114355a9795e74f899b2a0cb0ba009 (commit)
       via  0fb4868adbbd216a8efbc75900c1338f1f2c77ba (commit)
       via  8e4b9e02c9590d7e7fe2d469b515a41fa3c2d11d (commit)
       via  915da20591b580ae707295780c7b6497197deb87 (commit)
       via  45a2bf29d331f240c9446370a1668a70d9a379e8 (commit)
      from  06c3e883f0730501181244c360fecd67002c97dd (commit)

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


- Log -----------------------------------------------------------------
commit 568921e84308237c49c673dccd2a19866e5ced0d
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 22 10:11:29 2009 +0100

    Wrap creating the sorted subkey cache in a transaction

commit 903148d45777411fb048fed877fe2a72503742d5
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 22 01:11:51 2009 +0100

    Add a comment describing the sorted subkeys

commit 93df7bda9220b3efa569b9f13eeb06fa34e0c205
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Feb 20 06:01:16 2009 +0100

    Add sorted subkey cache
    
    On my box this gets net conf list for 1000 records down to .1 seconds

commit 9bb38a1d6cc147dfcc44d86cca7cf13e4adad185
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 22 00:47:54 2009 +0100

    Add db_tdb_parse

commit 6ff485d80e7c074b5b55be7123395f5b4b979791
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Feb 22 00:18:05 2009 +0100

    Add dbwrap->parse_record

commit cab026186a717fcf63f044bf360836c59e8b8416
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Feb 21 18:00:42 2009 +0100

    Speed up "net conf list"
    
    For 1000 shares this speeds up net conf list from .6 to .25 seconds on my box

commit f60f533c8e3c5109f63dc5feb8558efe311db209
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Feb 21 17:01:58 2009 +0100

    Speed up "net conf list"
    
    With 1000 shares in the registry, this changed the time of "net conf list" from
    1.1 seconds to .6 seconds.

commit 8909f5233bf927422208e3d963f7b57af51d74c2
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 17 08:35:35 2008 +0100

    s3:dbwrap: add get_flags() hook to db_context
    
    metze

commit 29abe710dd114355a9795e74f899b2a0cb0ba009
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 21 17:16:37 2009 +0100

    s3:libsmbconf: use talloc_free instead of TALLOC_FREE in reg backend
    
    Michael

commit 0fb4868adbbd216a8efbc75900c1338f1f2c77ba
Author: Michael Adam <obnox at samba.org>
Date:   Thu Oct 23 11:16:50 2008 +0200

    libsmbconf: add method is_writeable() and wrapper smbconf_is_writeable()
    
    This allows for per-config-source checking of write support.
    
    Michael

commit 8e4b9e02c9590d7e7fe2d469b515a41fa3c2d11d
Author: Michael Adam <obnox at samba.org>
Date:   Mon Oct 20 23:52:02 2008 +0200

    libsmbconf: add backend_requires_messaging() method to libsmbconf.
    
    In a clustered environment, the registry backend needs messaging
    to be set up since ctdb requires this.
    
    Michael

commit 915da20591b580ae707295780c7b6497197deb87
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jun 23 11:11:08 2008 +0200

    libsmbconf: add "includes" to the forbidden_valnames[].
    
    This removes the warning messages 'Unknown parameter encountered: "includes"'.
    
    Michael
    (cherry picked from commit b20019ceaaf4a8964792f6ba37f50f91b6847e7f)

commit 45a2bf29d331f240c9446370a1668a70d9a379e8
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jun 23 11:09:38 2008 +0200

    libsmbconf: fastpaths first in smbconf_reg_valname_valid().
    
    Before dropping into lp_parameter_is_valid().
    
    Michael
    (cherry picked from commit 59beb7acd777a4c224dce90fbbff7a137d2b89c1)

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

Summary of changes:
 source/include/dbwrap.h              |    5 +
 source/include/reg_db.h              |    1 +
 source/lib/dbwrap.c                  |   26 ++++
 source/lib/dbwrap_ctdb.c             |    8 +
 source/lib/dbwrap_tdb.c              |   21 +++
 source/lib/smbconf/smbconf.c         |   21 +++-
 source/lib/smbconf/smbconf.h         |    2 +
 source/lib/smbconf/smbconf_private.h |    2 +
 source/lib/smbconf/smbconf_reg.c     |  223 ++++++++++++-------------------
 source/lib/smbconf/smbconf_txt.c     |   13 ++
 source/registry/reg_backend_db.c     |  244 +++++++++++++++++++++++++++++++---
 11 files changed, 408 insertions(+), 158 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/dbwrap.h b/source/include/dbwrap.h
index 46833fa..cf71450 100644
--- a/source/include/dbwrap.h
+++ b/source/include/dbwrap.h
@@ -42,9 +42,14 @@ struct db_context {
 				      void *private_data),
 			     void *private_data);
 	int (*get_seqnum)(struct db_context *db);
+	int (*get_flags)(struct db_context *db);
 	int (*transaction_start)(struct db_context *db);
 	int (*transaction_commit)(struct db_context *db);
 	int (*transaction_cancel)(struct db_context *db);
+	int (*parse_record)(struct db_context *db, TDB_DATA key,
+			    int (*parser)(TDB_DATA key, TDB_DATA data,
+					  void *private_data),
+			    void *private_data);
 	void *private_data;
 	bool persistent;
 };
diff --git a/source/include/reg_db.h b/source/include/reg_db.h
index 92448ae..5cafa0a 100644
--- a/source/include/reg_db.h
+++ b/source/include/reg_db.h
@@ -26,5 +26,6 @@
 
 #define REG_VALUE_PREFIX    "SAMBA_REGVAL"
 #define REG_SECDESC_PREFIX  "SAMBA_SECDESC"
+#define REG_SORTED_SUBKEYS_PREFIX  "SAMBA_SORTED_SUBKEYS"
 
 #endif /* _REG_DB_H */
diff --git a/source/lib/dbwrap.c b/source/lib/dbwrap.c
index 73c2761..055f554 100644
--- a/source/lib/dbwrap.c
+++ b/source/lib/dbwrap.c
@@ -42,6 +42,29 @@ static int dbwrap_fallback_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
 	return 0;
 }
 
+/*
+ * Fall back using fetch if no genuine parse operation is provided
+ */
+
+static int dbwrap_fallback_parse_record(struct db_context *db, TDB_DATA key,
+					int (*parser)(TDB_DATA key,
+						      TDB_DATA data,
+						      void *private_data),
+					void *private_data)
+{
+	TDB_DATA data;
+	int res;
+
+	res = db->fetch(db, talloc_tos(), key, &data);
+	if (res != 0) {
+		return res;
+	}
+
+	res = parser(key, data, private_data);
+	TALLOC_FREE(data.dptr);
+	return res;
+}
+
 /**
  * open a database
  */
@@ -101,6 +124,9 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
 	if ((result != NULL) && (result->fetch == NULL)) {
 		result->fetch = dbwrap_fallback_fetch;
 	}
+	if ((result != NULL) && (result->parse_record == NULL)) {
+		result->parse_record = dbwrap_fallback_parse_record;
+	}
 
 	return result;
 }
diff --git a/source/lib/dbwrap_ctdb.c b/source/lib/dbwrap_ctdb.c
index 2818634..816b522 100644
--- a/source/lib/dbwrap_ctdb.c
+++ b/source/lib/dbwrap_ctdb.c
@@ -1158,6 +1158,13 @@ static int db_ctdb_get_seqnum(struct db_context *db)
 	return tdb_get_seqnum(ctx->wtdb->tdb);
 }
 
+static int db_ctdb_get_flags(struct db_context *db)
+{
+        struct db_ctdb_ctx *ctx = talloc_get_type_abort(db->private_data,
+                                                        struct db_ctdb_ctx);
+	return tdb_get_flags(ctx->wtdb->tdb);
+}
+
 struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
 				const char *name,
 				int hash_size, int tdb_flags,
@@ -1219,6 +1226,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
 	result->traverse = db_ctdb_traverse;
 	result->traverse_read = db_ctdb_traverse_read;
 	result->get_seqnum = db_ctdb_get_seqnum;
+	result->get_flags = db_ctdb_get_flags;
 	result->transaction_start = db_ctdb_transaction_start;
 	result->transaction_commit = db_ctdb_transaction_commit;
 	result->transaction_cancel = db_ctdb_transaction_cancel;
diff --git a/source/lib/dbwrap_tdb.c b/source/lib/dbwrap_tdb.c
index 7bdadd3..ffd7712 100644
--- a/source/lib/dbwrap_tdb.c
+++ b/source/lib/dbwrap_tdb.c
@@ -176,6 +176,17 @@ static int db_tdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
 	return 0;
 }
 
+static int db_tdb_parse(struct db_context *db, TDB_DATA key,
+			int (*parser)(TDB_DATA key, TDB_DATA data,
+				      void *private_data),
+			void *private_data)
+{
+	struct db_tdb_ctx *ctx = talloc_get_type_abort(
+		db->private_data, struct db_tdb_ctx);
+
+	return tdb_parse_record(ctx->wtdb->tdb, key, parser, private_data);
+}
+
 static NTSTATUS db_tdb_store(struct db_record *rec, TDB_DATA data, int flag)
 {
 	struct db_tdb_ctx *ctx = talloc_get_type_abort(rec->private_data,
@@ -291,6 +302,14 @@ static int db_tdb_get_seqnum(struct db_context *db)
 	return tdb_get_seqnum(db_ctx->wtdb->tdb);
 }
 
+static int db_tdb_get_flags(struct db_context *db)
+
+{
+	struct db_tdb_ctx *db_ctx =
+		talloc_get_type_abort(db->private_data, struct db_tdb_ctx);
+	return tdb_get_flags(db_ctx->wtdb->tdb);
+}
+
 static int db_tdb_transaction_start(struct db_context *db)
 {
 	struct db_tdb_ctx *db_ctx =
@@ -343,7 +362,9 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
 	result->fetch = db_tdb_fetch;
 	result->traverse = db_tdb_traverse;
 	result->traverse_read = db_tdb_traverse_read;
+	result->parse_record = db_tdb_parse;
 	result->get_seqnum = db_tdb_get_seqnum;
+	result->get_flags = db_tdb_get_flags;
 	result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0);
 	result->transaction_start = db_tdb_transaction_start;
 	result->transaction_commit = db_tdb_transaction_commit;
diff --git a/source/lib/smbconf/smbconf.c b/source/lib/smbconf/smbconf.c
index 1a9b4e0..5d5049c 100644
--- a/source/lib/smbconf/smbconf.c
+++ b/source/lib/smbconf/smbconf.c
@@ -43,6 +43,23 @@ static WERROR smbconf_global_check(struct smbconf_ctx *ctx)
  **********************************************************************/
 
 /**
+ * Tell whether the backend requires messaging to be set up
+ * for the backend to work correctly.
+ */
+bool smbconf_backend_requires_messaging(struct smbconf_ctx *ctx)
+{
+	return ctx->ops->requires_messaging(ctx);
+}
+
+/**
+ * Tell whether the source is writeable.
+ */
+bool smbconf_is_writeable(struct smbconf_ctx *ctx)
+{
+	return ctx->ops->is_writeable(ctx);
+}
+
+/**
  * Close the configuration.
  */
 void smbconf_shutdown(struct smbconf_ctx *ctx)
@@ -186,10 +203,6 @@ WERROR smbconf_get_share(struct smbconf_ctx *ctx,
 			 const char *servicename,
 			 struct smbconf_service **service)
 {
-	if (!smbconf_share_exists(ctx, servicename)) {
-		return WERR_NO_SUCH_SERVICE;
-	}
-
 	return ctx->ops->get_share(ctx, mem_ctx, servicename, service);
 }
 
diff --git a/source/lib/smbconf/smbconf.h b/source/lib/smbconf/smbconf.h
index e337476..9ff9a83 100644
--- a/source/lib/smbconf/smbconf.h
+++ b/source/lib/smbconf/smbconf.h
@@ -56,6 +56,8 @@ WERROR smbconf_init_txt(TALLOC_CTX *mem_ctx,
 /*
  * the smbconf API functions
  */
+bool smbconf_backend_requires_messaging(struct smbconf_ctx *ctx);
+bool smbconf_is_writeable(struct smbconf_ctx *ctx);
 void smbconf_shutdown(struct smbconf_ctx *ctx);
 bool smbconf_changed(struct smbconf_ctx *ctx, struct smbconf_csn *csn,
 		     const char *service, const char *param);
diff --git a/source/lib/smbconf/smbconf_private.h b/source/lib/smbconf/smbconf_private.h
index 8e7d6a9..b0333e9 100644
--- a/source/lib/smbconf/smbconf_private.h
+++ b/source/lib/smbconf/smbconf_private.h
@@ -23,6 +23,8 @@
 struct smbconf_ops {
 	WERROR (*init)(struct smbconf_ctx *ctx, const char *path);
 	int (*shutdown)(struct smbconf_ctx *ctx);
+	bool (*requires_messaging)(struct smbconf_ctx *ctx);
+	bool (*is_writeable)(struct smbconf_ctx *ctx);
 	WERROR (*open_conf)(struct smbconf_ctx *ctx);
 	int (*close_conf)(struct smbconf_ctx *ctx);
 	void (*get_csn)(struct smbconf_ctx *ctx, struct smbconf_csn *csn,
diff --git a/source/lib/smbconf/smbconf_reg.c b/source/lib/smbconf/smbconf_reg.c
index dfce750..ad3ddf8 100644
--- a/source/lib/smbconf/smbconf_reg.c
+++ b/source/lib/smbconf/smbconf_reg.c
@@ -23,7 +23,7 @@
 #define INCLUDES_VALNAME "includes"
 
 struct reg_private_data {
-	NT_USER_TOKEN *token;
+	struct registry_key *base_key;
 	bool open;		/* did _we_ open the registry? */
 };
 
@@ -52,6 +52,7 @@ static bool smbconf_reg_valname_forbidden(const char *valname)
 		"lock dir",
 		"config backend",
 		"include",
+		"includes", /* this has a special meaning internally */
 		NULL
 	};
 	const char **forbidden = NULL;
@@ -66,56 +67,8 @@ static bool smbconf_reg_valname_forbidden(const char *valname)
 
 static bool smbconf_reg_valname_valid(const char *valname)
 {
-	return (lp_parameter_is_valid(valname) &&
-		!smbconf_reg_valname_forbidden(valname));
-}
-
-/**
- * Open a registry key specified by "path"
- */
-static WERROR smbconf_reg_open_path(TALLOC_CTX *mem_ctx,
-				    struct smbconf_ctx *ctx,
-				    const char *path,
-				    uint32 desired_access,
-				    struct registry_key **key)
-{
-	WERROR werr = WERR_OK;
-
-	if (ctx == NULL) {
-		DEBUG(1, ("Error: configuration is not open!\n"));
-		werr = WERR_INVALID_PARAM;
-		goto done;
-	}
-
-	if (rpd(ctx)->token == NULL) {
-		DEBUG(1, ("Error: token missing from smbconf_ctx. "
-			  "was smbconf_init() called?\n"));
-		werr = WERR_INVALID_PARAM;
-		goto done;
-	}
-
-	werr = ctx->ops->open_conf(ctx);
-	if (!W_ERROR_IS_OK(werr)) {
-		DEBUG(1, ("Error opening the registry.\n"));
-		goto done;
-	}
-
-	if (path == NULL) {
-		DEBUG(1, ("Error: NULL path string given\n"));
-		werr = WERR_INVALID_PARAM;
-		goto done;
-	}
-
-	werr = reg_open_path(mem_ctx, path, desired_access, rpd(ctx)->token,
-			     key);
-
-	if (!W_ERROR_IS_OK(werr)) {
-		DEBUG(5, ("Error opening registry path '%s': %s\n",
-			  path, dos_errstr(werr)));
-	}
-
-done:
-	return werr;
+	return (!smbconf_reg_valname_forbidden(valname) &&
+		lp_parameter_is_valid(valname));
 }
 
 /**
@@ -127,37 +80,12 @@ static WERROR smbconf_reg_open_service_key(TALLOC_CTX *mem_ctx,
 					   uint32 desired_access,
 					   struct registry_key **key)
 {
-	WERROR werr = WERR_OK;
-	char *path = NULL;
-
 	if (servicename == NULL) {
-		path = talloc_strdup(mem_ctx, ctx->path);
-	} else {
-		path = talloc_asprintf(mem_ctx, "%s\\%s", ctx->path,
-				       servicename);
-	}
-	if (path == NULL) {
-		werr = WERR_NOMEM;
-		goto done;
+		*key = rpd(ctx)->base_key;
+		return WERR_OK;
 	}
-
-	werr = smbconf_reg_open_path(mem_ctx, ctx, path, desired_access, key);
-
-done:
-	TALLOC_FREE(path);
-	return werr;
-}
-
-/**
- * open the base key
- */
-static WERROR smbconf_reg_open_base_key(TALLOC_CTX *mem_ctx,
-					struct smbconf_ctx *ctx,
-					uint32 desired_access,
-					struct registry_key **key)
-{
-	return smbconf_reg_open_path(mem_ctx, ctx, ctx->path, desired_access,
-				     key);
+	return reg_openkey(mem_ctx, rpd(ctx)->base_key, servicename,
+			   desired_access, key);
 }
 
 /**
@@ -175,7 +103,7 @@ static bool smbconf_value_exists(struct registry_key *key, const char *param)
 		ret = true;
 	}
 
-	TALLOC_FREE(ctx);
+	talloc_free(ctx);
 	return ret;
 }
 
@@ -188,7 +116,6 @@ static WERROR smbconf_reg_create_service_key(TALLOC_CTX *mem_ctx,
 					     struct registry_key **newkey)
 {
 	WERROR werr = WERR_OK;
-	struct registry_key *create_parent = NULL;
 	TALLOC_CTX *create_ctx;
 	enum winreg_CreateAction action = REG_ACTION_NONE;
 
@@ -197,13 +124,7 @@ static WERROR smbconf_reg_create_service_key(TALLOC_CTX *mem_ctx,
 	 * and will be destroyed when leaving this function... */
 	create_ctx = talloc_stackframe();
 
-	werr = smbconf_reg_open_base_key(create_ctx, ctx, REG_KEY_WRITE,
-					 &create_parent);
-	if (!W_ERROR_IS_OK(werr)) {
-		goto done;
-	}
-
-	werr = reg_createkey(mem_ctx, create_parent, subkeyname,
+	werr = reg_createkey(mem_ctx, rpd(ctx)->base_key, subkeyname,
 			     REG_KEY_WRITE, newkey, &action);
 	if (W_ERROR_IS_OK(werr) && (action != REG_CREATED_NEW_KEY)) {
 		DEBUG(10, ("Key '%s' already exists.\n", subkeyname));
@@ -214,8 +135,7 @@ static WERROR smbconf_reg_create_service_key(TALLOC_CTX *mem_ctx,
 			 subkeyname, dos_errstr(werr)));
 	}
 
-done:
-	TALLOC_FREE(create_ctx);
+	talloc_free(create_ctx);
 	return werr;
 }
 
@@ -330,7 +250,7 @@ static WERROR smbconf_reg_set_multi_sz_value(struct registry_key *key,
 	}
 
 done:
-	TALLOC_FREE(tmp_ctx);
+	talloc_free(tmp_ctx);
 	return werr;
 }
 
@@ -435,7 +355,7 @@ static WERROR smbconf_reg_get_includes_internal(TALLOC_CTX *mem_ctx,
 	}
 
 done:
-	TALLOC_FREE(tmp_ctx);
+	talloc_free(tmp_ctx);
 	return werr;
 }
 
@@ -532,7 +452,7 @@ static WERROR smbconf_reg_get_values(TALLOC_CTX *mem_ctx,
 	}
 
 done:
-	TALLOC_FREE(tmp_ctx);
+	talloc_free(tmp_ctx);
 	return werr;
 }
 
@@ -591,7 +511,7 @@ static WERROR smbconf_reg_delete_values(struct registry_key *key)
 	werr = WERR_OK;
 
 done:
-	TALLOC_FREE(mem_ctx);
+	talloc_free(mem_ctx);
 	return werr;
 }
 
@@ -607,6 +527,7 @@ done:
 static WERROR smbconf_reg_init(struct smbconf_ctx *ctx, const char *path)
 {
 	WERROR werr = WERR_OK;
+	struct nt_user_token *token;
 
 	if (path == NULL) {
 		path = KEY_SMBCONF;
@@ -619,8 +540,7 @@ static WERROR smbconf_reg_init(struct smbconf_ctx *ctx, const char *path)
 
 	ctx->data = TALLOC_ZERO_P(ctx, struct reg_private_data);
 
-	werr = ntstatus_to_werror(registry_create_admin_token(ctx,
-							&(rpd(ctx)->token)));
+	werr = ntstatus_to_werror(registry_create_admin_token(ctx, &token));
 	if (!W_ERROR_IS_OK(werr)) {
 		DEBUG(1, ("Error creating admin token\n"));
 		goto done;
@@ -632,6 +552,19 @@ static WERROR smbconf_reg_init(struct smbconf_ctx *ctx, const char *path)
 		goto done;
 	}
 
+	werr = ctx->ops->open_conf(ctx);
+	if (!W_ERROR_IS_OK(werr)) {
+		DEBUG(1, ("Error opening the registry.\n"));
+		goto done;
+	}
+
+	werr = reg_open_path(ctx, ctx->path,
+			     SEC_RIGHTS_ENUM_SUBKEYS | REG_KEY_WRITE,
+			     token, &rpd(ctx)->base_key);
+	if (!W_ERROR_IS_OK(werr)) {
+		goto done;
+	}
+
 done:
 	return werr;
 }
@@ -641,6 +574,27 @@ static int smbconf_reg_shutdown(struct smbconf_ctx *ctx)
 	return ctx->ops->close_conf(ctx);
 }
 
+static bool smbconf_reg_requires_messaging(struct smbconf_ctx *ctx)
+{
+#ifdef CLUSTER_SUPPORT
+	if (lp_clustering() && lp_parm_bool(-1, "ctdb", "registry.tdb", true)) {
+		return true;
+	}
+#endif
+	return false;
+}
+
+static bool smbconf_reg_is_writeable(struct smbconf_ctx *ctx)
+{
+	/*
+	 * The backend has write support.
+	 *
+	 *  TODO: add access checks whether the concrete
+	 *  config source is really writeable by the calling user.
+	 */
+	return true;
+}
+
 static WERROR smbconf_reg_open(struct smbconf_ctx *ctx)
 {
 	WERROR werr;
@@ -701,6 +655,13 @@ static WERROR smbconf_reg_drop(struct smbconf_ctx *ctx)
 	struct registry_key *new_key = NULL;
 	TALLOC_CTX* mem_ctx = talloc_stackframe();
 	enum winreg_CreateAction action;
+	struct nt_user_token *token;
+
+	werr = ntstatus_to_werror(registry_create_admin_token(ctx, &token));
+	if (!W_ERROR_IS_OK(werr)) {
+		DEBUG(1, ("Error creating admin token\n"));
+		goto done;
+	}
 
 	path = talloc_strdup(mem_ctx, ctx->path);
 	if (path == NULL) {
@@ -709,8 +670,8 @@ static WERROR smbconf_reg_drop(struct smbconf_ctx *ctx)
 	}
 	p = strrchr(path, '\\');
 	*p = '\0';
-	werr = smbconf_reg_open_path(mem_ctx, ctx, path, REG_KEY_WRITE,
-				     &parent_key);
+	werr = reg_open_path(mem_ctx, path, REG_KEY_WRITE, token,
+			     &parent_key);


-- 
SAMBA-CTDB repository


More information about the samba-cvs mailing list