summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2007-12-23 03:52:00 +0100
committerMichael Adam <obnox@samba.org>2007-12-23 04:10:32 +0100
commita48f3c8a964fe6b320a052a6251354351f8d98e0 (patch)
tree037d4bad2efd3a5b2d781b682a39013d9a3cf2cd
parentb6527f3d29dccc4b86252e7d6722371e61870e80 (diff)
downloadsamba-a48f3c8a964fe6b320a052a6251354351f8d98e0.tar.gz
samba-a48f3c8a964fe6b320a052a6251354351f8d98e0.tar.bz2
samba-a48f3c8a964fe6b320a052a6251354351f8d98e0.zip
Make libnet_smbconf_set_global_param() call libnet_smbconf_setparm().
This not only removes duplicate logic, but also the use of libnet_smbconf_reg_setvalue_internal() instead of do_modify_val_config() which is removed, does add important tests and canonicalizations. Michael (This used to be commit fa844866493ee270f31faa3eca77cdff16b26301)
-rw-r--r--source3/libnet/libnet_conf.c61
1 files changed, 15 insertions, 46 deletions
diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c
index f364e4fb64..9d06f8287b 100644
--- a/source3/libnet/libnet_conf.c
+++ b/source3/libnet/libnet_conf.c
@@ -243,21 +243,6 @@ done:
return werr;
}
-static WERROR do_modify_val_config(struct registry_key *key,
- const char *val_name,
- const char *val_data)
-{
- struct registry_value val;
-
- ZERO_STRUCT(val);
-
- val.type = REG_SZ;
- val.v.sz.str = CONST_DISCARD(char *, val_data);
- val.v.sz.len = strlen(val_data) + 1;
-
- return reg_setvalue(key, val_name, &val);
-}
-
/**********************************************************************
*
* The actual net conf api functions, that are exported.
@@ -285,37 +270,6 @@ WERROR libnet_smbconf_setparm(TALLOC_CTX *mem_ctx,
return werr;
}
-WERROR libnet_smbconf_set_global_param(TALLOC_CTX *mem_ctx,
- const char *param,
- const char *val)
-{
- WERROR werr;
- struct registry_key *key = NULL;
-
- if (!lp_include_registry_globals()) {
- return WERR_NOT_SUPPORTED;
- }
-
- if (!registry_init_regdb()) {
- return WERR_REG_IO_FAILURE;
- }
-
- if (!libnet_smbconf_key_exists(mem_ctx, GLOBAL_NAME)) {
- werr = libnet_reg_createkey_internal(mem_ctx,
- GLOBAL_NAME, &key);
- } else {
- werr = libnet_smbconf_open_path(mem_ctx,
- GLOBAL_NAME,
- REG_KEY_WRITE, &key);
- }
-
- if (!W_ERROR_IS_OK(werr)) {
- return werr;
- }
-
- return do_modify_val_config(key, param, val);
-}
-
WERROR libnet_smbconf_delparm(TALLOC_CTX *mem_ctx,
const char *service,
const char *param)
@@ -339,3 +293,18 @@ WERROR libnet_smbconf_delparm(TALLOC_CTX *mem_ctx,
return WERR_OK;
}
+
+
+/**********************************************************************
+ *
+ * Convenience functions, that are also exportet.
+ *
+ **********************************************************************/
+
+WERROR libnet_smbconf_set_global_param(TALLOC_CTX *mem_ctx,
+ const char *param,
+ const char *val)
+{
+ return libnet_smbconf_setparm(mem_ctx, GLOBAL_NAME, param, val);
+}
+