summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-04-09 00:05:45 +0200
committerMichael Adam <obnox@samba.org>2008-04-10 01:29:00 +0200
commitbb39d5c14b86dc704c1d2845a3a22580a3915dbd (patch)
tree57497e6714cca37421e39d85c9f537c9e27c806a /source3
parent1da629537cdd81eb499666c59b9c6260ff8a89b7 (diff)
downloadsamba-bb39d5c14b86dc704c1d2845a3a22580a3915dbd.tar.gz
samba-bb39d5c14b86dc704c1d2845a3a22580a3915dbd.tar.bz2
samba-bb39d5c14b86dc704c1d2845a3a22580a3915dbd.zip
libsmbconf: add function smbconf_reg_valname_valid() and use it in get_values()
so "includes" doesn't get listed as a parameter Michael (This used to be commit 01c4bd07305b4ce800b99a098652623f118a74aa)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/smbconf/smbconf_reg.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c
index 23aad44892..65f07a0893 100644
--- a/source3/lib/smbconf/smbconf_reg.c
+++ b/source3/lib/smbconf/smbconf_reg.c
@@ -63,6 +63,12 @@ static bool smbconf_reg_valname_forbidden(const char *valname)
return false;
}
+static bool smbconf_reg_valname_valid(const char *valname)
+{
+ return (lp_parameter_is_valid(valname) &&
+ !smbconf_reg_valname_forbidden(valname));
+}
+
/**
* Open a registry key specified by "path"
*/
@@ -448,6 +454,7 @@ static WERROR smbconf_reg_get_values(TALLOC_CTX *mem_ctx,
uint32_t count;
struct registry_value *valvalue = NULL;
char *valname = NULL;
+ uint32_t tmp_num_values = 0;
char **tmp_valnames = NULL;
char **tmp_valstrings = NULL;
@@ -471,19 +478,24 @@ static WERROR smbconf_reg_get_values(TALLOC_CTX *mem_ctx,
{
char *valstring;
+ if (!smbconf_reg_valname_valid(valname)) {
+ continue;
+ }
+
werr = smbconf_add_string_to_array(tmp_ctx,
&tmp_valnames,
- count, valname);
+ tmp_num_values, valname);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
valstring = smbconf_format_registry_value(tmp_ctx, valvalue);
werr = smbconf_add_string_to_array(tmp_ctx, &tmp_valstrings,
- count, valstring);
+ tmp_num_values, valstring);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
+ tmp_num_values++;
}
if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
goto done;
@@ -491,8 +503,8 @@ static WERROR smbconf_reg_get_values(TALLOC_CTX *mem_ctx,
werr = WERR_OK;
- *num_values = count;
- if (count > 0) {
+ *num_values = tmp_num_values;
+ if (tmp_num_values > 0) {
*value_names = talloc_move(mem_ctx, &tmp_valnames);
*value_strings = talloc_move(mem_ctx, &tmp_valstrings);
} else {