]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:net conf: support dangling parameters by specifying "" as the section name.
authorMichael Adam <obnox@samba.org>
Fri, 24 Oct 2008 11:49:16 +0000 (13:49 +0200)
committerMichael Adam <obnox@samba.org>
Mon, 27 Apr 2009 09:21:02 +0000 (11:21 +0200)
for {get,set,del}parm

Michael

source3/utils/net_conf.c

index 663c5925c78fd5e33933ed4f47f1537667ffca35..864ca9cc1818f26a87ae276dc8a6c3251d1e04eb 100644 (file)
@@ -769,10 +769,16 @@ static int net_conf_setparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
                net_conf_setparm_usage(c, argc, argv);
                goto done;
        }
-       service = talloc_strdup(mem_ctx, argv[0]);
-       if (service == NULL) {
-               d_printf("error: out of memory!\n");
-               goto done;
+       /*
+        * NULL service name means "dangling parameters" to libsmbconf.
+        * We use the empty string from the command line for this purpose.
+        */
+       if (strlen(argv[0]) != 0) {
+               service = talloc_strdup(mem_ctx, argv[0]);
+               if (service == NULL) {
+                       d_printf("error: out of memory!\n");
+                       goto done;
+               }
        }
        param = strlower_talloc(mem_ctx, argv[1]);
        if (param == NULL) {
@@ -821,10 +827,16 @@ static int net_conf_getparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
                net_conf_getparm_usage(c, argc, argv);
                goto done;
        }
-       service = talloc_strdup(mem_ctx, argv[0]);
-       if (service == NULL) {
-               d_printf("error: out of memory!\n");
-               goto done;
+       /*
+        * NULL service name means "dangling parameters" to libsmbconf.
+        * We use the empty string from the command line for this purpose.
+        */
+       if (strlen(argv[0]) != 0) {
+               service = talloc_strdup(mem_ctx, argv[0]);
+               if (service == NULL) {
+                       d_printf("error: out of memory!\n");
+                       goto done;
+               }
        }
        param = strlower_talloc(mem_ctx, argv[1]);
        if (param == NULL) {
@@ -871,10 +883,16 @@ static int net_conf_delparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
                net_conf_delparm_usage(c, argc, argv);
                goto done;
        }
-       service = talloc_strdup(mem_ctx, argv[0]);
-       if (service == NULL) {
-               d_printf("error: out of memory!\n");
-               goto done;
+       /*
+        * NULL service name means "dangling parameters" to libsmbconf.
+        * We use the empty string from the command line for this purpose.
+        */
+       if (strlen(argv[0]) != 0) {
+               service = talloc_strdup(mem_ctx, argv[0]);
+               if (service == NULL) {
+                       d_printf("error: out of memory!\n");
+                       goto done;
+               }
        }
        param = strlower_talloc(mem_ctx, argv[1]);
        if (param == NULL) {