nwrap: Don't fail if we want to add an existing entry
[samba.git] / lib / nss_wrapper / nss_wrapper.c
index be977dfad96c138fb3b7500e22ae9a076234a7c2..f48b9cc7e8d65d1f992a014d8dad80fc2ed833a8 100644 (file)
@@ -2622,12 +2622,14 @@ static bool nwrap_ed_inventarize_add_to_existing(struct nwrap_entdata *const ed,
        for (cursor = el; cursor->next != NULL; cursor = cursor->next)
        {
                if (cursor->ed == ed) {
-                       return false;
+                       /* The entry already exists in this list. */
+                       return true;
                }
        }
 
        if (cursor->ed == ed) {
-               return false;
+               /* The entry already exists in this list. */
+               return true;
        }
 
        el_new = nwrap_entlist_init(ed);
@@ -5578,7 +5580,9 @@ void nwrap_destructor(void)
        }
 
        free(user_addrlist.items);
+#ifdef HAVE_GETHOSTBYNAME2
        free(user_addrlist2.items);
+#endif
 
        hdestroy();
        NWRAP_UNLOCK_ALL;