struct nwrap_cache *cache;
struct nwrap_vector entries;
+ struct nwrap_vector lists;
int num;
int idx;
ENTRY e;
ENTRY *p;
struct nwrap_entlist *el;
+ bool ok;
if (h_name == NULL) {
NWRAP_LOG(NWRAP_LOG_ERROR, "h_name NULL - can't add");
return false;
}
+ ok = nwrap_vector_add_item(&(nwrap_he_global.lists), (void *)el);
+ if (!ok) {
+ NWRAP_LOG(NWRAP_LOG_ERROR,
+ "Failed to add list entry to vector.");
+ return false;
+ }
+
return true;
}
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);
struct nwrap_he *nwrap_he =
(struct nwrap_he *)nwrap->private_data;
struct nwrap_entdata *ed;
+ struct nwrap_entlist *el;
size_t i;
nwrap_vector_foreach (ed, nwrap_he->entries, i)
SAFE_FREE(nwrap_he->entries.items);
nwrap_he->entries.count = nwrap_he->entries.capacity = 0;
+ nwrap_vector_foreach(el, nwrap_he->lists, i)
+ {
+ while (el != NULL) {
+ struct nwrap_entlist *el_next;
+
+ el_next = el->next;
+ SAFE_FREE(el);
+ el = el_next;
+ }
+ }
+ SAFE_FREE(nwrap_he->lists.items);
+ nwrap_he->lists.count = nwrap_he->lists.capacity = 0;
+
nwrap_he->num = 0;
nwrap_he->idx = 0;
}
nwrap_pw_global.num = 0;
}
+#if defined(HAVE_SHADOW_H) && defined(HAVE_GETSPNAM)
+ if (nwrap_sp_global.cache != NULL) {
+ struct nwrap_cache *c = nwrap_sp_global.cache;
+
+ nwrap_files_cache_unload(c);
+ if (c->fd >= 0) {
+ fclose(c->fp);
+ c->fd = -1;
+ }
+
+ nwrap_sp_global.num = 0;
+ }
+#endif /* defined(HAVE_SHADOW_H) && defined(HAVE_GETSPNAM) */
+
if (nwrap_he_global.cache != NULL) {
struct nwrap_cache *c = nwrap_he_global.cache;
nwrap_he_global.num = 0;
}
+ free(user_addrlist.items);
+#ifdef HAVE_GETHOSTBYNAME2
+ free(user_addrlist2.items);
+#endif
+
hdestroy();
NWRAP_UNLOCK_ALL;
}