The branch, v3-2-test has been updated
       via  aed01fd28c8e896e993239cbe9b2681132ddf980 (commit)
       via  90fa2981c949e21f66a44d634ebe9d661819f0a3 (commit)
       via  627a29b690c30f1096a4746186089cd9a1c92407 (commit)
       via  fd99c1804ae04b7c2a2b0a605e83ba88fa362edb (commit)
       via  c050b148d00c79571ef0e85c6e7c86d551ca6efd (commit)
       via  ad2497cfac90b2e91be6995931629453fd6ed5fa (commit)
       via  e2b34e9c028d712c7c8b22aade2c11d347ae176d (commit)
      from  4aaf4e7e73a5c7fa97ef730fbff5c7cb12df2d6c (commit)

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


- Log -----------------------------------------------------------------
commit aed01fd28c8e896e993239cbe9b2681132ddf980
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Sun Jan 13 23:20:51 2008 +0100

    Make use of the new libnet_conf_delete_global_parameter() function.
    
    Michael

commit 90fa2981c949e21f66a44d634ebe9d661819f0a3
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Sun Jan 13 23:16:01 2008 +0100

    Add a function libnet_conf_delete_global_parameter() to libnet_conf.c
    
    Create the [global] section if it does not yet exist.
    
    Michael

commit 627a29b690c30f1096a4746186089cd9a1c92407
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Sun Jan 13 23:12:27 2008 +0100

    Add a function libnet_conf_get_global_parameter() to libnet_conf.c
    
    It creates the [global] section if it does not yet exist.
    
    Michael

commit fd99c1804ae04b7c2a2b0a605e83ba88fa362edb
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Sun Jan 13 23:00:16 2008 +0100

    Move libnet_conf_set_global_parameter() inside libnet_conf.c
    
    Also remove the "convenience function" section comment.
    The set_global_parameter function now has a right to exist
    in the api.
    
    Michael

commit c050b148d00c79571ef0e85c6e7c86d551ca6efd
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Sun Jan 13 22:56:56 2008 +0100

    Add a comment header to libnet_conf_set_global_parameter().
    
    Michael

commit ad2497cfac90b2e91be6995931629453fd6ed5fa
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Sun Jan 13 22:56:11 2008 +0100

    Add auto-adding of [global] to libnet_conf_set_global_parameter().
    
    Michael

commit e2b34e9c028d712c7c8b22aade2c11d347ae176d
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Sun Jan 13 22:49:42 2008 +0100

    Remove auto-generation of missing share from libnet_conf_set_parameter().
    
    Günther, I wanted to have this as atomic as possible.
    I will add this behaviour to libnet_conf_set_global_parameter() next
    with the justification that [global] should exist transparently.
    
    Michael

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

Summary of changes:
 source/libnet/libnet_conf.c |   82 +++++++++++++++++++++++++++++++++++-------
 source/libnet/libnet_join.c |    2 +-
 2 files changed, 69 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/libnet/libnet_conf.c b/source/libnet/libnet_conf.c
index 8e44e4f..d20e10b 100644
--- a/source/libnet/libnet_conf.c
+++ b/source/libnet/libnet_conf.c
@@ -776,10 +776,8 @@ WERROR libnet_conf_set_parameter(struct libnet_conf_ctx 
*ctx,
        TALLOC_CTX *mem_ctx = talloc_stackframe();
 
        if (!libnet_conf_share_exists(ctx, service)) {
-               werr = libnet_conf_create_share(ctx, service);
-               if (!W_ERROR_IS_OK(werr)) {
-                       goto done;
-               }
+               werr = WERR_NO_SUCH_SERVICE;
+               goto done;
        }
 
        werr = libnet_conf_reg_open_service_key(mem_ctx, ctx, service,
@@ -796,6 +794,29 @@ done:
 }
 
 /**
+ * Set a global parameter
+ * (i.e. a parameter in the [global] service).
+ *
+ * This also creates [global] when it does not exist.
+ */
+WERROR libnet_conf_set_global_parameter(struct libnet_conf_ctx *ctx,
+                                       const char *param, const char *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;
+}
+
+/**
  * get the value of a configuration parameter as a string
  */
 WERROR libnet_conf_get_parameter(TALLOC_CTX *mem_ctx,
@@ -847,6 +868,31 @@ done:
 }
 
 /**
+ * Get the value of a global parameter.
+ *
+ * Create [global] if it does not exist.
+ */
+WERROR libnet_conf_get_global_parameter(TALLOC_CTX *mem_ctx,
+                                       struct libnet_conf_ctx *ctx,
+                                       const char *param,
+                                       char **valstr)
+{
+       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_get_parameter(mem_ctx, ctx, GLOBAL_NAME, param,
+                                        valstr);
+
+done:
+       return werr;
+}
+
+/**
  * delete a parameter from configuration
  */
 WERROR libnet_conf_delete_parameter(struct libnet_conf_ctx *ctx,
@@ -879,16 +925,24 @@ done:
        return werr;
 }
 
-
-/**********************************************************************
- *
- * Convenience functions that are also exported.
+/**
+ * Delete a global parameter.
  *
- **********************************************************************/
-
-WERROR libnet_conf_set_global_parameter(struct libnet_conf_ctx *ctx,
-                                       const char *param, const char *val)
+ * Create [global] if it does not exist.
+ */
+WERROR libnet_conf_delete_global_parameter(struct libnet_conf_ctx *ctx,
+                                          const char *param)
 {
-       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_delete_parameter(ctx, GLOBAL_NAME, param);
 
+done:
+       return werr;
+}
diff --git a/source/libnet/libnet_join.c b/source/libnet/libnet_join.c
index 66b5461..eaf851c 100644
--- a/source/libnet/libnet_join.c
+++ b/source/libnet/libnet_join.c
@@ -951,7 +951,7 @@ static WERROR do_unjoin_modify_vals_config(struct 
libnet_UnjoinCtx *r)
                }
        }
 
-       libnet_conf_delete_parameter(ctx, GLOBAL_NAME, "realm");
+       libnet_conf_delete_global_parameter(ctx, "realm");
 
 done:
        libnet_conf_close(ctx);


-- 
Samba Shared Repository

Reply via email to