Add auto-adding of [global] to libnet_conf_set_global_parameter().
authorMichael Adam <obnox@samba.org>
Sun, 13 Jan 2008 21:56:11 +0000 (22:56 +0100)
committerMichael Adam <obnox@samba.org>
Sun, 13 Jan 2008 22:16:41 +0000 (23:16 +0100)
Michael
(This used to be commit ad2497cfac90b2e91be6995931629453fd6ed5fa)

source3/libnet/libnet_conf.c

index 11dc1639ad7752bdb5125d90518c94c5e79c560f..3934f2c476c2706a9772712584b4366b1b524136 100644 (file)
@@ -887,6 +887,17 @@ done:
 WERROR libnet_conf_set_global_parameter(struct libnet_conf_ctx *ctx,
                                        const char *param, const char *val)
 {
-       return libnet_conf_set_parameter(ctx, GLOBAL_NAME, param, val);
+       WERROR werr;
+
+       if (!libnet_conf_share_exists(ctx, GLOBAL_NAME)) {
+               werr = libnet_conf_create_share(ctx, GLOBAL_NAME);
+               if (!W_ERROR_IS_OK(werr)) {
+                       goto done;
+               }
+       }
+       werr = libnet_conf_set_parameter(ctx, GLOBAL_NAME, param, val);
+
+done:
+       return werr;
 }