Mercurial > dropbear
view list.c @ 1851:7f549ee3df48
Use HOME before /etc/passwd to find id_dropbear (#137)
Currently dbclient uses the value of HOME by default when looking for
~/.ssh/known_hosts, falling back to /etc/passwd if HOME is not set (so
that people can work around broken values in /etc/passwd).
However, when locating the default authentication key (defaults to
~/.ssh/id_dropbear), paths not starting with / are always prefixed with
the value from /etc/passwd.
Make the behaviour consistent by adjusting expand_homedir_path to use
the value of HOME, falling back to /etc/passwd if HOME is not set.
author | Matt Robinson <git@nerdoftheherd.com> |
---|---|
date | Tue, 19 Oct 2021 06:02:47 +0100 |
parents | d68d61e7056a |
children |
line wrap: on
line source
#include "includes.h" #include "dbutil.h" #include "list.h" void list_append(m_list *list, void *item) { m_list_elem *elem; elem = m_malloc(sizeof(*elem)); elem->item = item; elem->list = list; elem->next = NULL; if (!list->first) { list->first = elem; elem->prev = NULL; } else { elem->prev = list->last; list->last->next = elem; } list->last = elem; } m_list * list_new() { m_list *ret = m_malloc(sizeof(m_list)); ret->first = ret->last = NULL; return ret; } void * list_remove(m_list_elem *elem) { void *item = elem->item; m_list *list = elem->list; if (list->first == elem) { list->first = elem->next; } if (list->last == elem) { list->last = elem->prev; } if (elem->prev) { elem->prev->next = elem->next; } if (elem->next) { elem->next->prev = elem->prev; } m_free(elem); return item; }