]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
net conf: implement "net conf delincludes".
authorMichael Adam <obnox@samba.org>
Wed, 9 Apr 2008 21:24:52 +0000 (23:24 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 9 Apr 2008 23:29:03 +0000 (01:29 +0200)
usage: "net conf delincludes <servicename>"

This is equivalent to "net conf setincludes <servicename>"
(without further arguments).

Michael

source/utils/net_conf.c

index e6957d0f3ef826d34f204bcafcd59847e9633d66..e83a2be524ecd2ac2d964ceab3e41ffe33d137cc 100644 (file)
@@ -121,6 +121,12 @@ static int net_conf_setincludes_usage(int argc, const char **argv)
        return -1;
 }
 
+static int net_conf_delincludes_usage(int argc, const char **argv)
+{
+       d_printf("USAGE: net conf delincludes <section>\n");
+       return -1;
+}
+
 
 /**********************************************************************
  *
@@ -868,6 +874,38 @@ done:
        return ret;
 }
 
+static int net_conf_delincludes(struct smbconf_ctx *conf_ctx,
+                               int argc, const char **argv)
+{
+       WERROR werr;
+       char *service;
+       int ret = -1;
+       TALLOC_CTX *mem_ctx = talloc_stackframe();
+
+       if (argc != 1) {
+               net_conf_delincludes_usage(argc, argv);
+               goto done;
+       }
+
+       service = talloc_strdup_lower(mem_ctx, argv[0]);
+       if (service == NULL) {
+               d_printf("error: out of memory!\n");
+               goto done;
+       }
+
+       werr = smbconf_delete_includes(conf_ctx, service);
+       if (!W_ERROR_IS_OK(werr)) {
+               d_printf("error deleting includes: %s\n", dos_errstr(werr));
+               goto done;
+       }
+
+       ret = 0;
+
+done:
+       TALLOC_FREE(mem_ctx);
+       return ret;
+}
+
 
 /**********************************************************************
  *
@@ -972,6 +1010,8 @@ int net_conf(int argc, const char **argv)
                 "Show the includes of a share definition."},
                {"setincludes", net_conf_setincludes,
                 "Set includes for a share."},
+               {"delincludes", net_conf_delincludes,
+                "Delete includes from a share definition."},
                {NULL, NULL, NULL}
        };