[SCM] Samba Shared Repository - branch v3-4-test updated - release-4-0-0alpha7-1005-g7d791d8

Michael Adam obnox at samba.org
Sun May 17 20:26:09 GMT 2009


The branch, v3-4-test has been updated
       via  7d791d813e9ca9cb1733d312dc040737b67f4bf4 (commit)
      from  85719213666c1a863f95a9762c1b9c5feea3c440 (commit)

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


- Log -----------------------------------------------------------------
commit 7d791d813e9ca9cb1733d312dc040737b67f4bf4
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
    (cherry picked from commit 2722dd357cedcd3fad1e3739a4a64f924d53eccb)

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

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


Changeset truncated at 500 lines:

diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c
index 881c0a6..1dd8c1f 100644
--- a/source3/utils/net_conf.c
+++ b/source3/utils/net_conf.c
@@ -781,12 +781,19 @@ static int net_conf_setparm(struct net_context *c, 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",
+			 win_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, win_errstr(werr));
-			goto done;
+			goto cancel;
 		}
 	}
 
@@ -795,10 +802,25 @@ static int net_conf_setparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
 	if (!W_ERROR_IS_OK(werr)) {
 		d_fprintf(stderr, "Error setting value '%s': %s\n",
 			  param, win_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",
+			 win_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",
+			 win_errstr(werr));
+	}
 
 done:
 	TALLOC_FREE(mem_ctx);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list