net_conf: fix non-testmode import function.
authorMichael Adam <obnox@samba.org>
Wed, 26 Mar 2008 23:32:00 +0000 (00:32 +0100)
committerMichael Adam <obnox@samba.org>
Wed, 26 Mar 2008 23:32:09 +0000 (00:32 +0100)
Michael

source/utils/net_conf.c

index 630d01d0a08393801a9ea6dcdd375f75a5d262ca..1e4ab9b3f29ac4540159543379db7917a9bbd879 100644 (file)
@@ -131,7 +131,13 @@ static WERROR import_process_service(struct smbconf_ctx *conf_ctx,
        if (opt_testmode) {
                d_printf("[%s]\n", servicename);
        } else {
-               werr = smbconf_delete_share(conf_ctx, servicename);
+               if (smbconf_share_exists(conf_ctx, servicename)) {
+                       werr = smbconf_delete_share(conf_ctx, servicename);
+                       if (!W_ERROR_IS_OK(werr)) {
+                               goto done;
+                       }
+               }
+               werr = smbconf_create_share(conf_ctx, servicename);
                if (!W_ERROR_IS_OK(werr)) {
                        goto done;
                }
@@ -280,6 +286,10 @@ static int net_conf_import(struct smbconf_ctx *conf_ctx,
                if (!W_ERROR_IS_OK(werr)) {
                        goto done;
                }
+               werr = smbconf_drop(conf_ctx);
+               if (!W_ERROR_IS_OK(werr)) {
+                       goto done;
+               }
                for (sidx = 0; sidx < num_shares; sidx++) {
                        werr = import_process_service(conf_ctx,
                                        share_names[sidx],