summaryrefslogtreecommitdiff
path: root/source3/lib/smbconf/smbconf_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/smbconf/smbconf_util.c')
-rw-r--r--source3/lib/smbconf/smbconf_util.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/source3/lib/smbconf/smbconf_util.c b/source3/lib/smbconf/smbconf_util.c
index 1a3a0ded44..b2e253dd26 100644
--- a/source3/lib/smbconf/smbconf_util.c
+++ b/source3/lib/smbconf/smbconf_util.c
@@ -82,7 +82,7 @@ WERROR smbconf_add_string_to_array(TALLOC_CTX *mem_ctx,
{
char **new_array = NULL;
- if ((array == NULL) || (string == NULL)) {
+ if (array == NULL) {
return WERR_INVALID_PARAM;
}
@@ -91,10 +91,14 @@ WERROR smbconf_add_string_to_array(TALLOC_CTX *mem_ctx,
return WERR_NOMEM;
}
- new_array[count] = talloc_strdup(new_array, string);
- if (new_array[count] == NULL) {
- TALLOC_FREE(new_array);
- return WERR_NOMEM;
+ if (string == NULL) {
+ new_array[count] = NULL;
+ } else {
+ new_array[count] = talloc_strdup(new_array, string);
+ if (new_array[count] == NULL) {
+ TALLOC_FREE(new_array);
+ return WERR_NOMEM;
+ }
}
*array = new_array;
@@ -107,12 +111,14 @@ bool smbconf_find_in_array(const char *string, char **list,
{
uint32_t i;
- if ((string == NULL) || (list == NULL)) {
+ if (list == NULL) {
return false;
}
for (i = 0; i < num_entries; i++) {
- if (strequal(string, list[i])) {
+ if (((string == NULL) && (list[i] == NULL)) ||
+ strequal(string, list[i]))
+ {
if (entry != NULL) {
*entry = i;
}