The branch, v3-2-test has been updated
       via  097af0309d7c3e9342058ba5266667293b23c80d (commit)
       via  5315ef41f403b96715dd68b512e9e74662e2910a (commit)
      from  c22204aa85d4bb33534b6974dcfed9aad0c28cc4 (commit)

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


- Log -----------------------------------------------------------------
commit 097af0309d7c3e9342058ba5266667293b23c80d
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Mon Mar 17 18:01:33 2008 +0100

    libsmbconf: rename all occurrences of libnet_conf_ to smbconf_ .
    
    Michael

commit 5315ef41f403b96715dd68b512e9e74662e2910a
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Mon Mar 17 17:29:44 2008 +0100

    Move libnet_conf to a library lib/smbconf/ of its own, fixing the api.
    
    The libnet_conf code to access the registry based configuration has
    become more of a library used in several places in samba (e.g. loadparm)
    than an abstraction of "net conf". So I move it to a location lib/smbconf/.
    
    In the same breath, the api is fixed (not generated by make proto anymore).
    
    Michael

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

Summary of changes:
 source/Makefile.in                                 |    9 +-
 source/include/includes.h                          |    2 +
 source/lib/netapi/serverinfo.c                     |   11 +-
 .../libnet_conf.c => lib/smbconf/smbconf.c}        |  295 ++++++++++----------
 source/lib/smbconf/smbconf.h                       |   73 +++++
 source/libnet/libnet.h                             |    1 -
 source/libnet/libnet_conf.h                        |   27 --
 source/libnet/libnet_join.c                        |   34 ++--
 source/param/loadparm.c                            |   16 +-
 source/utils/net_conf.c                            |   94 +++----
 10 files changed, 299 insertions(+), 263 deletions(-)
 rename source/{libnet/libnet_conf.c => lib/smbconf/smbconf.c} (70%)
 create mode 100644 source/lib/smbconf/smbconf.h
 delete mode 100644 source/libnet/libnet_conf.h


Changeset truncated at 500 lines:

diff --git a/source/Makefile.in b/source/Makefile.in
index 4fa44aa..5934db1 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -364,7 +364,7 @@ READLINE_OBJ = lib/readline.o
 POPT_LIB_OBJ = lib/popt_common.o
 
 PARAM_WITHOUT_REG_OBJ = dynconfig.o param/loadparm.o param/params.o 
param/util.o lib/sharesec.o lib/ldap_debug_handler.o
-PARAM_REG_ADD_OBJ = $(REG_SMBCONF_OBJ) $(LIBNET_CONF_OBJ) 
$(PRIVILEGES_BASIC_OBJ)
+PARAM_REG_ADD_OBJ = $(REG_SMBCONF_OBJ) $(LIBSMBCONF_OBJ) 
$(PRIVILEGES_BASIC_OBJ)
 PARAM_OBJ = $(PARAM_WITHOUT_REG_OBJ) $(PARAM_REG_ADD_OBJ)
 
 KRBCLIENT_OBJ = libads/kerberos.o libads/ads_status.o
@@ -670,6 +670,7 @@ SMBD_OBJ_BASE = $(PARAM_WITHOUT_REG_OBJ) $(SMBD_OBJ_SRV) 
$(LIBSMB_OBJ) \
                $(LIBADS_OBJ) $(KRBCLIENT_OBJ) $(LIBADS_SERVER_OBJ) \
                $(REG_FULL_OBJ) $(POPT_LIB_OBJ) $(BUILDOPT_OBJ) \
                $(SMBLDAP_OBJ) $(LDB_OBJ) $(LIBNET_OBJ) @LIBWBCLIENT_STATIC@ \
+               $(LIBSMBCONF_OBJ) \
                $(PRIVILEGES_BASIC_OBJ)
 
 PRINTING_OBJ = printing/pcap.o printing/print_svid.o printing/print_aix.o \
@@ -816,6 +817,7 @@ LIBNETAPI_OBJ1 = lib/netapi/netapi.o \
                 lib/netapi/getdc.o
 
 LIBNETAPI_OBJ  = $(LIBNETAPI_OBJ1) $(LIBNET_OBJ) \
+                $(LIBSMBCONF_OBJ) \
                 $(REG_SMBCONF_OBJ) \
                 $(PARAM_WITHOUT_REG_OBJ) $(LIB_NONSMBD_OBJ) \
                 $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
@@ -823,9 +825,9 @@ LIBNETAPI_OBJ  = $(LIBNETAPI_OBJ1) $(LIBNET_OBJ) \
                 $(SECRETS_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ 
$(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \
                 $(DCUTIL_OBJ) $(LIBADS_OBJ) $(PRIVILEGES_BASIC_OBJ)
 
-LIBNET_CONF_OBJ = libnet/libnet_conf.o
+LIBSMBCONF_OBJ = lib/smbconf/smbconf.o
 
-LIBNET_OBJ = $(LIBNET_CONF_OBJ) libnet/libnet_join.o \
+LIBNET_OBJ = libnet/libnet_join.o \
             librpc/gen_ndr/ndr_libnet_join.o
 
 NET_OBJ1 = utils/net.o utils/net_ads.o utils/net_help.o \
@@ -848,6 +850,7 @@ NET_OBJ = $(NET_OBJ1) $(PARAM_WITHOUT_REG_OBJ) 
$(SECRETS_OBJ) $(LIBSMB_OBJ) \
          $(AFS_OBJ) $(AFS_SETTOKEN_OBJ) $(READLINE_OBJ) \
          $(LDB_OBJ) $(LIBGPO_OBJ) @BUILD_INIPARSER@ $(DISPLAY_SEC_OBJ) \
          $(REG_SMBCONF_OBJ) @LIBNETAPI_STATIC@ $(LIBNET_OBJ) \
+         $(LIBSMBCONF_OBJ) \
          $(WBCOMMON_OBJ) @LIBWBCLIENT_STATIC@ \
          $(PRIVILEGES_BASIC_OBJ)
 
diff --git a/source/include/includes.h b/source/include/includes.h
index 36c71d7..c56c3cf 100644
--- a/source/include/includes.h
+++ b/source/include/includes.h
@@ -726,6 +726,8 @@ typedef char fstring[FSTRING_LEN];
 #include "async_req.h"
 #include "async_smb.h"
 
+#include "lib/smbconf/smbconf.h"
+
 /* used in net.c */
 struct functable {
        const char *funcname;
diff --git a/source/lib/netapi/serverinfo.c b/source/lib/netapi/serverinfo.c
index d30e7d9..a29a840 100644
--- a/source/lib/netapi/serverinfo.c
+++ b/source/lib/netapi/serverinfo.c
@@ -169,7 +169,7 @@ static WERROR NetServerSetInfoLocal_1005(struct 
libnetapi_ctx *ctx,
                                         uint32_t *parm_error)
 {
        WERROR werr;
-       struct libnet_conf_ctx *conf_ctx;
+       struct smbconf_ctx *conf_ctx;
        struct srvsvc_NetSrvInfo1005 *info1005;
 
        if (!buffer) {
@@ -191,17 +191,16 @@ static WERROR NetServerSetInfoLocal_1005(struct 
libnetapi_ctx *ctx,
                return WERR_NOT_SUPPORTED;
        }
 
-       werr = libnet_conf_open(ctx, &conf_ctx);
+       werr = smbconf_open(ctx, &conf_ctx);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
        }
 
-       werr = libnet_conf_set_global_parameter(conf_ctx,
-                                               "server string",
-                                               info1005->comment);
+       werr = smbconf_set_global_parameter(conf_ctx, "server string",
+                                           info1005->comment);
 
  done:
-       libnet_conf_close(conf_ctx);
+       smbconf_close(conf_ctx);
        return werr;
 }
 
diff --git a/source/libnet/libnet_conf.c b/source/lib/smbconf/smbconf.c
similarity index 70%
rename from source/libnet/libnet_conf.c
rename to source/lib/smbconf/smbconf.c
index 688097b..4ccba09 100644
--- a/source/libnet/libnet_conf.c
+++ b/source/lib/smbconf/smbconf.c
@@ -19,7 +19,6 @@
  */
 
 #include "includes.h"
-#include "libnet/libnet.h"
 
 /**********************************************************************
  *
@@ -31,10 +30,10 @@
 /**
  * add a string to a talloced array of strings.
  */
-static WERROR libnet_conf_add_string_to_array(TALLOC_CTX *mem_ctx,
-                                             char ***array,
-                                             uint32_t count,
-                                             const char *string)
+static WERROR smbconf_add_string_to_array(TALLOC_CTX *mem_ctx,
+                                         char ***array,
+                                         uint32_t count,
+                                         const char *string)
 {
        char **new_array = NULL;
 
@@ -58,7 +57,7 @@ static WERROR libnet_conf_add_string_to_array(TALLOC_CTX 
*mem_ctx,
        return WERR_OK;
 }
 
-static WERROR libnet_conf_reg_initialize(struct libnet_conf_ctx *ctx)
+static WERROR smbconf_reg_initialize(struct smbconf_ctx *ctx)
 {
        WERROR werr = WERR_OK;
 
@@ -81,11 +80,11 @@ done:
 /**
  * Open a registry key specified by "path"
  */
-static WERROR libnet_conf_reg_open_path(TALLOC_CTX *mem_ctx,
-                                       struct libnet_conf_ctx *ctx,
-                                       const char *path,
-                                       uint32 desired_access,
-                                       struct registry_key **key)
+static WERROR smbconf_reg_open_path(TALLOC_CTX *mem_ctx,
+                                   struct smbconf_ctx *ctx,
+                                   const char *path,
+                                   uint32 desired_access,
+                                   struct registry_key **key)
 {
        WERROR werr = WERR_OK;
 
@@ -96,8 +95,8 @@ static WERROR libnet_conf_reg_open_path(TALLOC_CTX *mem_ctx,
        }
 
        if (ctx->token == NULL) {
-               DEBUG(1, ("Error: token missing from libnet_conf_ctx. "
-                         "was libnet_conf_open() called?\n"));
+               DEBUG(1, ("Error: token missing from smbconf_ctx. "
+                         "was smbconf_open() called?\n"));
                werr = WERR_INVALID_PARAM;
                goto done;
        }
@@ -122,11 +121,11 @@ done:
 /**
  * Open a subkey of KEY_SMBCONF (i.e a service)
  */
-static WERROR libnet_conf_reg_open_service_key(TALLOC_CTX *mem_ctx,
-                                              struct libnet_conf_ctx *ctx,
-                                              const char *servicename,
-                                              uint32 desired_access,
-                                              struct registry_key **key)
+static WERROR smbconf_reg_open_service_key(TALLOC_CTX *mem_ctx,
+                                          struct smbconf_ctx *ctx,
+                                          const char *servicename,
+                                          uint32 desired_access,
+                                          struct registry_key **key)
 {
        WERROR werr = WERR_OK;
        char *path = NULL;
@@ -143,8 +142,7 @@ static WERROR libnet_conf_reg_open_service_key(TALLOC_CTX 
*mem_ctx,
                goto done;
        }
 
-       werr = libnet_conf_reg_open_path(mem_ctx, ctx, path, desired_access,
-                                        key);
+       werr = smbconf_reg_open_path(mem_ctx, ctx, path, desired_access, key);
 
 done:
        TALLOC_FREE(path);
@@ -154,20 +152,19 @@ done:
 /**
  * open the base key KEY_SMBCONF
  */
-static WERROR libnet_conf_reg_open_base_key(TALLOC_CTX *mem_ctx,
-                                           struct libnet_conf_ctx *ctx,
-                                           uint32 desired_access,
-                                           struct registry_key **key)
+static WERROR smbconf_reg_open_base_key(TALLOC_CTX *mem_ctx,
+                                       struct smbconf_ctx *ctx,
+                                       uint32 desired_access,
+                                       struct registry_key **key)
 {
-       return libnet_conf_reg_open_path(mem_ctx, ctx, KEY_SMBCONF,
-                                        desired_access, key);
+       return smbconf_reg_open_path(mem_ctx, ctx, KEY_SMBCONF, desired_access,
+                                    key);
 }
 
 /**
  * check if a value exists in a given registry key
  */
-static bool libnet_conf_value_exists(struct registry_key *key,
-                                    const char *param)
+static bool smbconf_value_exists(struct registry_key *key, const char *param)
 {
        bool ret = false;
        WERROR werr = WERR_OK;
@@ -186,10 +183,10 @@ static bool libnet_conf_value_exists(struct registry_key 
*key,
 /**
  * create a subkey of KEY_SMBCONF
  */
-static WERROR libnet_conf_reg_create_service_key(TALLOC_CTX *mem_ctx,
-                                                struct libnet_conf_ctx *ctx,
-                                                const char * subkeyname,
-                                                struct registry_key **newkey)
+static WERROR smbconf_reg_create_service_key(TALLOC_CTX *mem_ctx,
+                                            struct smbconf_ctx *ctx,
+                                            const char * subkeyname,
+                                            struct registry_key **newkey)
 {
        WERROR werr = WERR_OK;
        struct registry_key *create_parent = NULL;
@@ -204,8 +201,8 @@ static WERROR libnet_conf_reg_create_service_key(TALLOC_CTX 
*mem_ctx,
                goto done;
        }
 
-       werr = libnet_conf_reg_open_base_key(create_ctx, ctx, REG_KEY_WRITE,
-                                            &create_parent);
+       werr = smbconf_reg_open_base_key(create_ctx, ctx, REG_KEY_WRITE,
+                                        &create_parent);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
        }
@@ -229,9 +226,9 @@ done:
 /**
  * add a value to a key.
  */
-static WERROR libnet_conf_reg_set_value(struct registry_key *key,
-                                       const char *valname,
-                                       const char *valstr)
+static WERROR smbconf_reg_set_value(struct registry_key *key,
+                                   const char *valname,
+                                   const char *valstr)
 {
        struct registry_value val;
        WERROR werr = WERR_OK;
@@ -303,8 +300,8 @@ done:
  * which are ar stored as REG_SZ values, so the incomplete
  * handling should be ok.
  */
-static char *libnet_conf_format_registry_value(TALLOC_CTX *mem_ctx,
-                                              struct registry_value *value)
+static char *smbconf_format_registry_value(TALLOC_CTX *mem_ctx,
+                                          struct registry_value *value)
 {
        char *result = NULL;
 
@@ -348,11 +345,11 @@ static char *libnet_conf_format_registry_value(TALLOC_CTX 
*mem_ctx,
  * Get the values of a key as a list of value names
  * and a list of value strings (ordered)
  */
-static WERROR libnet_conf_reg_get_values(TALLOC_CTX *mem_ctx,
-                                        struct registry_key *key,
-                                        uint32_t *num_values,
-                                        char ***value_names,
-                                        char ***value_strings)
+static WERROR smbconf_reg_get_values(TALLOC_CTX *mem_ctx,
+                                    struct registry_key *key,
+                                    uint32_t *num_values,
+                                    char ***value_names,
+                                    char ***value_strings)
 {
        TALLOC_CTX *tmp_ctx = NULL;
        WERROR werr = WERR_OK;
@@ -382,19 +379,16 @@ static WERROR libnet_conf_reg_get_values(TALLOC_CTX 
*mem_ctx,
        {
                char *valstring;
 
-               werr = libnet_conf_add_string_to_array(tmp_ctx,
-                                                      &tmp_valnames,
-                                                      count, valname);
+               werr = smbconf_add_string_to_array(tmp_ctx,
+                                                  &tmp_valnames,
+                                                  count, valname);
                if (!W_ERROR_IS_OK(werr)) {
                        goto done;
                }
 
-               valstring = libnet_conf_format_registry_value(tmp_ctx,
-                                                             valvalue);
-               werr = libnet_conf_add_string_to_array(tmp_ctx,
-                                                      &tmp_valstrings,
-                                                      count,
-                                                      valstring);
+               valstring = smbconf_format_registry_value(tmp_ctx, valvalue);
+               werr = smbconf_add_string_to_array(tmp_ctx, &tmp_valstrings,
+                                                  count, valstring);
                if (!W_ERROR_IS_OK(werr)) {
                        goto done;
                }
@@ -419,7 +413,7 @@ done:
        return werr;
 }
 
-static int libnet_conf_destroy_ctx(struct libnet_conf_ctx *ctx)
+static int smbconf_destroy_ctx(struct smbconf_ctx *ctx)
 {
        return regdb_close();
 }
@@ -433,36 +427,36 @@ static int libnet_conf_destroy_ctx(struct libnet_conf_ctx 
*ctx)
 /**
  * Open the configuration.
  *
- * This should be the first function in a sequence of calls to libnet_conf
+ * This should be the first function in a sequence of calls to smbconf
  * functions:
  *
  * Upon success, this creates and returns the conf context
  * that should be passed around in subsequent calls to the other
- * libnet_conf functions.
+ * smbconf functions.
  *
- * After the work with the configuration is completed, libnet_conf_close()
+ * After the work with the configuration is completed, smbconf_close()
  * should be called.
  */
-WERROR libnet_conf_open(TALLOC_CTX *mem_ctx, struct libnet_conf_ctx **conf_ctx)
+WERROR smbconf_open(TALLOC_CTX *mem_ctx, struct smbconf_ctx **conf_ctx)
 {
        WERROR werr = WERR_OK;
-       struct libnet_conf_ctx *ctx;
+       struct smbconf_ctx *ctx;
 
        if (conf_ctx == NULL) {
                return WERR_INVALID_PARAM;
        }
 
-       ctx = TALLOC_ZERO_P(mem_ctx, struct libnet_conf_ctx);
+       ctx = TALLOC_ZERO_P(mem_ctx, struct smbconf_ctx);
        if (ctx == NULL) {
                return WERR_NOMEM;
        }
 
-       werr = libnet_conf_reg_initialize(ctx);
+       werr = smbconf_reg_initialize(ctx);
        if (!W_ERROR_IS_OK(werr)) {
                goto fail;
        }
 
-       talloc_set_destructor(ctx, libnet_conf_destroy_ctx);
+       talloc_set_destructor(ctx, smbconf_destroy_ctx);
 
        *conf_ctx = ctx;
        return werr;
@@ -475,7 +469,7 @@ fail:
 /**
  * Close the configuration.
  */
-void libnet_conf_close(struct libnet_conf_ctx *ctx)
+void smbconf_close(struct smbconf_ctx *ctx)
 {
        /* this also closes the registry (by destructor): */
        TALLOC_FREE(ctx);
@@ -488,8 +482,8 @@ void libnet_conf_close(struct libnet_conf_ctx *ctx)
  * of the service and parameter, it returns the registry-sequence
  * number.
  */
-uint64_t libnet_conf_get_seqnum(struct libnet_conf_ctx *ctx,
-                               const char *service, const char *param)
+uint64_t smbconf_get_seqnum(struct smbconf_ctx *ctx,
+                           const char *service, const char *param)
 {
        return (uint64_t)regdb_get_seqnum();
 }
@@ -497,7 +491,7 @@ uint64_t libnet_conf_get_seqnum(struct libnet_conf_ctx *ctx,
 /**
  * Drop the whole configuration (restarting empty).
  */
-WERROR libnet_conf_drop(struct libnet_conf_ctx *ctx)
+WERROR smbconf_drop(struct smbconf_ctx *ctx)
 {
        char *path, *p;
        WERROR werr = WERR_OK;
@@ -513,8 +507,8 @@ WERROR libnet_conf_drop(struct libnet_conf_ctx *ctx)
        }
        p = strrchr(path, '\\');
        *p = '\0';
-       werr = libnet_conf_reg_open_path(mem_ctx, ctx, path, REG_KEY_WRITE,
-                                        &parent_key);
+       werr = smbconf_reg_open_path(mem_ctx, ctx, path, REG_KEY_WRITE,
+                                    &parent_key);
 
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -543,8 +537,8 @@ done:
  *  param_names  : list of lists of parameter names for each share
  *  param_values : list of lists of parameter values for each share
  */
-WERROR libnet_conf_get_config(TALLOC_CTX *mem_ctx,
-                             struct libnet_conf_ctx *ctx, uint32_t *num_shares,
+WERROR smbconf_get_config(TALLOC_CTX *mem_ctx,
+                             struct smbconf_ctx *ctx, uint32_t *num_shares,
                              char ***share_names, uint32_t **num_params,
                              char ****param_names, char ****param_values)
 {
@@ -571,8 +565,8 @@ WERROR libnet_conf_get_config(TALLOC_CTX *mem_ctx,
                goto done;
        }
 
-       werr = libnet_conf_get_share_names(tmp_ctx, ctx, &tmp_num_shares,
-                                          &tmp_share_names);
+       werr = smbconf_get_share_names(tmp_ctx, ctx, &tmp_num_shares,
+                                      &tmp_share_names);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
        }
@@ -589,11 +583,11 @@ WERROR libnet_conf_get_config(TALLOC_CTX *mem_ctx,
        }
 
        for (count = 0; count < tmp_num_shares; count++) {
-               werr = libnet_conf_get_share(mem_ctx, ctx,
-                                            tmp_share_names[count],
-                                            &tmp_num_params[count],
-                                            &tmp_param_names[count],
-                                            &tmp_param_values[count]);
+               werr = smbconf_get_share(mem_ctx, ctx,
+                                        tmp_share_names[count],
+                                        &tmp_num_params[count],
+                                        &tmp_param_names[count],
+                                        &tmp_param_values[count]);
                if (!W_ERROR_IS_OK(werr)) {
                        goto done;
                }
@@ -622,10 +616,10 @@ done:
 /**
  * get the list of share names defined in the configuration.
  */
-WERROR libnet_conf_get_share_names(TALLOC_CTX *mem_ctx,
-                                  struct libnet_conf_ctx *ctx,
-                                  uint32_t *num_shares,
-                                  char ***share_names)
+WERROR smbconf_get_share_names(TALLOC_CTX *mem_ctx,
+                              struct smbconf_ctx *ctx,
+                              uint32_t *num_shares,
+                              char ***share_names)
 {
        uint32_t count;
        uint32_t added_count = 0;
@@ -647,18 +641,17 @@ WERROR libnet_conf_get_share_names(TALLOC_CTX *mem_ctx,
        }
 
        /* make sure "global" is always listed first */
-       if (libnet_conf_share_exists(ctx, GLOBAL_NAME)) {
-               werr = libnet_conf_add_string_to_array(tmp_ctx,
-                                                      &tmp_share_names,
-                                                      0, GLOBAL_NAME);
+       if (smbconf_share_exists(ctx, GLOBAL_NAME)) {
+               werr = smbconf_add_string_to_array(tmp_ctx, &tmp_share_names,
+                                                  0, GLOBAL_NAME);
                if (!W_ERROR_IS_OK(werr)) {
                        goto done;
                }
                added_count++;
        }
 
-       werr = libnet_conf_reg_open_base_key(tmp_ctx, ctx,
-                                            SEC_RIGHTS_ENUM_SUBKEYS, &key);
+       werr = smbconf_reg_open_base_key(tmp_ctx, ctx,
+                                        SEC_RIGHTS_ENUM_SUBKEYS, &key);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
        }
@@ -672,10 +665,10 @@ WERROR libnet_conf_get_share_names(TALLOC_CTX *mem_ctx,
                        continue;
                }
 
-               werr = libnet_conf_add_string_to_array(tmp_ctx,
-                                                      &tmp_share_names,
-                                                      added_count,
-                                                      subkey_name);
+               werr = smbconf_add_string_to_array(tmp_ctx,
+                                                  &tmp_share_names,
+                                                  added_count,
+                                                  subkey_name);
                if (!W_ERROR_IS_OK(werr)) {
                        goto done;
                }
@@ -701,16 +694,16 @@ done:


-- 
Samba Shared Repository

Reply via email to