[SCM] SAMBA-CTDB repository - branch v3-2-ctdb updated - build_3.2.11_ctdb.60-2-g7cefc53

Michael Adam obnox at samba.org
Mon May 18 08:58:25 GMT 2009


The branch, v3-2-ctdb has been updated
       via  7cefc534a5028123fb3c9f75b20fb34a2e0ab588 (commit)
      from  b31b37ca68f29cccd4cf93176e6097a40f36e3fc (commit)

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


- Log -----------------------------------------------------------------
commit 7cefc534a5028123fb3c9f75b20fb34a2e0ab588
Author: Michael Adam <obnox at samba.org>
Date:   Sun May 17 22:15:02 2009 +0200

    s3:fix bug #6371, unsuccessful net conf setparm leaves empty share
    
    Wrap creation of share and setting of parameter into a transaction.
    
    Michael

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

Summary of changes:
 source/utils/net_conf.c |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/utils/net_conf.c b/source/utils/net_conf.c
index 57b9d51..2962af9 100644
--- a/source/utils/net_conf.c
+++ b/source/utils/net_conf.c
@@ -753,12 +753,19 @@ static int net_conf_setparm(struct smbconf_ctx *conf_ctx,
 	}
 	value_str = argv[2];
 
+	werr = smbconf_transaction_start(conf_ctx);
+	if (!W_ERROR_IS_OK(werr)) {
+		d_printf("error starting transaction: %s\n",
+			 dos_errstr(werr));
+		goto done;
+	}
+
 	if (!smbconf_share_exists(conf_ctx, service)) {
 		werr = smbconf_create_share(conf_ctx, service);
 		if (!W_ERROR_IS_OK(werr)) {
 			d_fprintf(stderr, "Error creating share '%s': %s\n",
 				  service, dos_errstr(werr));
-			goto done;
+			goto cancel;
 		}
 	}
 
@@ -767,10 +774,25 @@ static int net_conf_setparm(struct smbconf_ctx *conf_ctx,
 	if (!W_ERROR_IS_OK(werr)) {
 		d_fprintf(stderr, "Error setting value '%s': %s\n",
 			  param, dos_errstr(werr));
-		goto done;
+		goto cancel;
 	}
 
-	ret = 0;
+	werr = smbconf_transaction_commit(conf_ctx);
+	if (!W_ERROR_IS_OK(werr)) {
+		d_printf("error committing transaction: %s\n",
+			 dos_errstr(werr));
+	} else {
+		ret = 0;
+	}
+
+	goto done;
+
+cancel:
+	werr = smbconf_transaction_cancel(conf_ctx);
+	if (!W_ERROR_IS_OK(werr)) {
+		d_printf("error cancelling transaction: %s\n",
+			 dos_errstr(werr));
+	}
 
 done:
 	TALLOC_FREE(mem_ctx);


-- 
SAMBA-CTDB repository


More information about the samba-cvs mailing list