libsmbconf: add handling of NULL strings to smbconf_find_in_array().
authorMichael Adam <obnox@samba.org>
Tue, 15 Apr 2008 11:50:27 +0000 (13:50 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 15 Apr 2008 15:40:27 +0000 (17:40 +0200)
Michael
(This used to be commit a5923bafe9b543d50dca06d251186948baeac8cc)

source3/lib/smbconf/smbconf_util.c

index 20bd51a62bdcfabb909d15b515f1e95fb553b6f4..b2e253dd26c3bb6fc6bc611d9e2fd751f1c15bb5 100644 (file)
@@ -111,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;
                        }