summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <Todd.Miller@courtesan.com>2013-10-22 09:00:37 -0600
committerTodd C. Miller <Todd.Miller@courtesan.com>2013-10-22 09:00:37 -0600
commit401ee775ea3215392fa16f46d133a9288edcc376 (patch)
tree5ba58fbe9e58c57107344a494a125e153b19e62d
parentf4eb23e8f95806097508520fc9f3df4c6aef3a41 (diff)
downloadsudo-401ee775ea3215392fa16f46d133a9288edcc376.tar.gz
Convert sudo to use BSD TAILQ macros instead of home ground tail
queue functions. This includes a private queue.h header derived from FreeBSD. It is simpler to just use our own header rather than try to deal with macros that may or may not be present in various queue.h incarnations.
-rw-r--r--MANIFEST1
-rw-r--r--common/Makefile.in16
-rw-r--r--common/event.c12
-rw-r--r--common/event_poll.c4
-rw-r--r--common/event_select.c5
-rw-r--r--common/list.c38
-rw-r--r--common/regress/sudo_conf/conf_test.c2
-rw-r--r--common/sudo_conf.c7
-rw-r--r--doc/LICENSE3
-rw-r--r--include/list.h2
-rw-r--r--include/missing.h8
-rw-r--r--include/queue.h715
-rw-r--r--include/sudo_conf.h7
-rw-r--r--include/sudo_event.h14
-rw-r--r--plugins/sudoers/Makefile.in138
-rw-r--r--plugins/sudoers/ldap.c3
-rw-r--r--plugins/sudoers/parse.c3
-rw-r--r--plugins/sudoers/parse.h2
-rw-r--r--plugins/sudoers/sssd.c3
-rw-r--r--plugins/sudoers/sudo_nss.c46
-rw-r--r--plugins/sudoers/sudo_nss.h5
-rw-r--r--plugins/sudoers/sudoers.c12
-rw-r--r--plugins/sudoers/sudoers.h2
-rw-r--r--plugins/sudoers/visudo.c33
-rw-r--r--src/Makefile.in92
-rw-r--r--src/exec.c41
-rw-r--r--src/exec_pty.c12
-rw-r--r--src/load_plugins.c16
-rw-r--r--src/sudo.c13
-rw-r--r--src/sudo.h1
-rw-r--r--src/sudo_plugin_int.h5
31 files changed, 962 insertions, 299 deletions
diff --git a/MANIFEST b/MANIFEST
index 742f86647..2248ad338 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -147,6 +147,7 @@ include/gettext.h
include/lbuf.h
include/list.h
include/missing.h
+include/queue.h
include/secure_path.h
include/sudo_conf.h
include/sudo_debug.h
diff --git a/common/Makefile.in b/common/Makefile.in
index 5d58dce45..f9e33b41c 100644
--- a/common/Makefile.in
+++ b/common/Makefile.in
@@ -170,22 +170,22 @@ atoid.lo: $(srcdir)/atoid.c $(top_builddir)/config.h \
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/atoid.c
conf_test.lo: $(srcdir)/regress/sudo_conf/conf_test.c $(top_builddir)/config.h \
$(top_srcdir)/compat/stdbool.h $(incdir)/missing.h \
- $(incdir)/sudo_conf.h $(incdir)/list.h
+ $(incdir)/sudo_conf.h $(incdir)/queue.h
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/sudo_conf/conf_test.c
event.lo: $(srcdir)/event.c $(top_builddir)/config.h \
$(top_srcdir)/compat/stdbool.h $(incdir)/missing.h $(incdir)/alloc.h \
- $(incdir)/fatal.h $(incdir)/list.h $(incdir)/sudo_debug.h \
- $(incdir)/sudo_event.h
+ $(incdir)/fatal.h $(incdir)/sudo_debug.h $(incdir)/sudo_event.h \
+ $(incdir)/queue.h
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/event.c
event_poll.lo: $(srcdir)/event_poll.c $(top_builddir)/config.h \
$(top_srcdir)/compat/stdbool.h $(incdir)/missing.h \
- $(incdir)/alloc.h $(incdir)/fatal.h $(incdir)/list.h \
- $(incdir)/sudo_debug.h $(incdir)/sudo_event.h
+ $(incdir)/alloc.h $(incdir)/fatal.h $(incdir)/sudo_debug.h \
+ $(incdir)/sudo_event.h $(incdir)/queue.h
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/event_poll.c
event_select.lo: $(srcdir)/event_select.c $(top_builddir)/config.h \
$(top_srcdir)/compat/stdbool.h $(incdir)/missing.h \
- $(incdir)/alloc.h $(incdir)/fatal.h $(incdir)/list.h \
- $(incdir)/sudo_debug.h $(incdir)/sudo_event.h
+ $(incdir)/alloc.h $(incdir)/fatal.h $(incdir)/sudo_debug.h \
+ $(incdir)/sudo_event.h $(incdir)/queue.h
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/event_select.c
fatal.lo: $(srcdir)/fatal.c $(top_builddir)/config.h \
$(top_srcdir)/compat/stdbool.h $(incdir)/missing.h $(incdir)/alloc.h \
@@ -224,7 +224,7 @@ sudo_conf.lo: $(srcdir)/sudo_conf.c $(top_builddir)/config.h \
$(top_srcdir)/compat/stdbool.h $(incdir)/missing.h \
$(incdir)/alloc.h $(incdir)/fatal.h $(incdir)/fileops.h \
$(top_builddir)/pathnames.h $(incdir)/sudo_plugin.h \
- $(incdir)/sudo_conf.h $(incdir)/list.h $(incdir)/sudo_debug.h \
+ $(incdir)/sudo_conf.h $(incdir)/queue.h $(incdir)/sudo_debug.h \
$(incdir)/secure_path.h $(incdir)/gettext.h
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo_conf.c
sudo_debug.lo: $(srcdir)/sudo_debug.c $(top_builddir)/config.h \
diff --git a/common/event.c b/common/event.c
index 5067bd41d..4c6ad02c1 100644
--- a/common/event.c
+++ b/common/event.c
@@ -45,7 +45,6 @@
#include "missing.h"
#include "alloc.h"
#include "fatal.h"
-#include "list.h"
#include "sudo_debug.h"
#include "sudo_event.h"
@@ -58,6 +57,7 @@ sudo_ev_base_alloc(void)
debug_decl(sudo_ev_base_alloc, SUDO_DEBUG_EVENT)
base = ecalloc(1, sizeof(*base));
+ TAILQ_INIT(&base->events);
if (sudo_ev_base_alloc_impl(base) != 0) {
efree(base);
base = NULL;
@@ -110,9 +110,9 @@ sudo_ev_add(struct sudo_event_base *base, struct sudo_event *ev, bool tohead)
debug_return_int(-1);
ev->base = base;
if (tohead) {
- tq_insert_head(base, ev);
+ TAILQ_INSERT_HEAD(&base->events, ev, entries);
} else {
- tq_insert_tail(base, ev);
+ TAILQ_INSERT_TAIL(&base->events, ev, entries);
}
}
/* Clear pending delete so adding from callback works properly. */
@@ -149,17 +149,15 @@ sudo_ev_del(struct sudo_event_base *base, struct sudo_event *ev)
debug_return_int(-1);
/* Unlink from list. */
- tq_remove(base, ev);
+ TAILQ_REMOVE(&base->events, ev, entries);
/* If we removed the pending event, replace it with the next one. */
if (base->pending == ev)
- base->pending = ev->next;
+ base->pending = TAILQ_NEXT(ev, entries);
/* Mark event unused. */
ev->pfd_idx = -1;
ev->base = NULL;
- ev->prev = NULL;
- ev->next = NULL;
debug_return_int(0);
}
diff --git a/common/event_poll.c b/common/event_poll.c
index 19993fef2..4f153b5a0 100644
--- a/common/event_poll.c
+++ b/common/event_poll.c
@@ -46,7 +46,6 @@
#include "missing.h"
#include "alloc.h"
#include "fatal.h"
-#include "list.h"
#include "sudo_debug.h"
#include "sudo_event.h"
@@ -154,8 +153,7 @@ rescan:
break;
default:
/* Service each event that fired. */
- for (ev = tq_first(base); ev != NULL; ev = base->pending) {
- base->pending = list_next(ev);
+ TAILQ_FOREACH_SAFE(ev, &base->events, entries, base->pending) {
if (ev->pfd_idx != -1 && base->pfds[ev->pfd_idx].revents) {
int what = 0;
if (base->pfds[ev->pfd_idx].revents & (POLLIN|POLLHUP|POLLNVAL|POLLERR))
diff --git a/common/event_select.c b/common/event_select.c
index 23e9e6a96..c7e7a3980 100644
--- a/common/event_select.c
+++ b/common/event_select.c
@@ -51,7 +51,6 @@
#include "missing.h"
#include "alloc.h"
#include "fatal.h"
-#include "list.h"
#include "sudo_debug.h"
#include "sudo_event.h"
@@ -133,7 +132,7 @@ rescan:
/* For select we need to redo readfds and writefds each time. */
memset(base->readfds, 0, howmany(base->maxfd + 1, NFDBITS) * sizeof(fd_mask));
memset(base->writefds, 0, howmany(base->maxfd + 1, NFDBITS) * sizeof(fd_mask));
- tq_foreach_fwd(base, ev) {
+ TAILQ_FOREACH(ev, &base->events, entries) {
if (ISSET(ev->events, SUDO_EV_READ)) {
sudo_debug_printf(SUDO_DEBUG_DEBUG, "%s: added fd %d to readfs",
__func__, ev->fd);
@@ -164,7 +163,7 @@ rescan:
break;
default:
/* Service each event that fired. */
- for (ev = tq_first(base); ev != NULL; ev = base->pending) {
+ TAILQ_FOREACH_SAFE(ev, &base->events, entries, base->pending) {
int what = 0;
base->pending = list_next(ev);
if (FD_ISSET(ev->fd, base->readfds))
diff --git a/common/list.c b/common/list.c
index 86aeffeb4..dce6489ab 100644
--- a/common/list.c
+++ b/common/list.c
@@ -130,42 +130,6 @@ tq_append(void *vh, void *vl)
}
/*
- * Insert a single item at the head of the queue.
- */
-void
-tq_insert_head(void *vh, void *vl)
-{
- struct list_head_proto *h = (struct list_head_proto *)vh;
- struct list_proto *l = (struct list_proto *)vl;
-
- l->prev = NULL;
- l->next = h->first;
- if (tq_empty(h))
- h->last = l;
- else
- h->first->prev = l;
- h->first = l;
-}
-
-/*
- * Insert a single item at the tail of the queue.
- */
-void
-tq_insert_tail(void *vh, void *vl)
-{
- struct list_head_proto *h = (struct list_head_proto *)vh;
- struct list_proto *l = (struct list_proto *)vl;
-
- l->prev = h->last;
- l->next = NULL;
- if (tq_empty(h))
- h->first = l;
- else
- h->last->next = l;
- h->last = l;
-}
-
-/*
* Remove element from the tail_queue
*/
void
@@ -182,7 +146,7 @@ tq_remove(void *vh, void *vl)
/* At least two elements in the list. */
if (h->first == l) {
h->first = l->next;
- h->first->prev = h->first; /* XXX - do we rely on this behavior? */
+ h->first->prev = h->first;
} else if (h->last == l) {
h->last = l->prev;
h->last->next = NULL;
diff --git a/common/regress/sudo_conf/conf_test.c b/common/regress/sudo_conf/conf_test.c
index 8f1fbf318..63852e84b 100644
--- a/common/regress/sudo_conf/conf_test.c
+++ b/common/regress/sudo_conf/conf_test.c
@@ -86,7 +86,7 @@ sudo_conf_dump(void)
if (sudo_conf_noexec_path() != NULL)
printf("Path noexec %s\n", sudo_conf_noexec_path());
#endif
- tq_foreach_fwd(plugins, info) {
+ TAILQ_FOREACH(info, plugins, entries) {
printf("Plugin %s %s", info->symbol_name, info->path);
if (info->options) {
char * const * op;
diff --git a/common/sudo_conf.c b/common/sudo_conf.c
index ce7131f5f..b415f0deb 100644
--- a/common/sudo_conf.c
+++ b/common/sudo_conf.c
@@ -110,13 +110,14 @@ static struct sudo_conf_data {
int group_source;
int max_groups;
const char *debug_flags;
- struct sudo_conf_paths paths[5];
struct plugin_info_list plugins;
+ struct sudo_conf_paths paths[5];
} sudo_conf_data = {
true,
GROUP_SOURCE_ADAPTIVE,
-1,
NULL,
+ TAILQ_HEAD_INITIALIZER(sudo_conf_data.plugins),
{
#define SUDO_CONF_ASKPASS_IDX 0
{ "askpass", sizeof("askpass") - 1, _PATH_SUDO_ASKPASS },
@@ -302,10 +303,8 @@ set_plugin(const char *entry, const char *conf_file)
info->symbol_name = estrndup(name, namelen);
info->path = estrndup(path, pathlen);
info->options = options;
- info->prev = info;
- /* info->next = NULL; */
info->lineno = conf_lineno;
- tq_append(&sudo_conf_data.plugins, info);
+ TAILQ_INSERT_TAIL(&sudo_conf_data.plugins, info, entries);
}
const char *
diff --git a/doc/LICENSE b/doc/LICENSE
index 6bb71c8f3..fe9df7920 100644
--- a/doc/LICENSE
+++ b/doc/LICENSE
@@ -41,7 +41,8 @@ The file redblack.c bears the following license:
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-The files getcwd.c, glob.c, glob.h and snprintf.c bear the following license:
+The files getcwd.c, glob.c, glob.h, snprintf.c and queue.h bear the
+following license:
Copyright (c) 1989, 1990, 1991, 1993
The Regents of the University of California. All rights reserved.
diff --git a/include/list.h b/include/list.h
index 30072501a..1055e227a 100644
--- a/include/list.h
+++ b/include/list.h
@@ -69,8 +69,6 @@ struct n##_list { \
*/
void *tq_pop(void *);
void tq_append(void *, void *);
-void tq_insert_head(void *, void *);
-void tq_insert_tail(void *, void *);
void tq_remove(void *, void *);
void list_append(void *, void *);
void list2tq(void *, void *);
diff --git a/include/missing.h b/include/missing.h
index b0bcc6b05..5421025b7 100644
--- a/include/missing.h
+++ b/include/missing.h
@@ -73,6 +73,14 @@
# endif
#endif
+/*
+ * Given the pointer x to the member m of the struct s, return
+ * a pointer to the containing structure.
+ */
+#ifndef __containerof
+# define __containerof(x, s, m) ((s *)((char *)(x) - offsetof(s, m)))
+#endif
+
#ifndef __dso_public
# ifdef HAVE_DSO_VISIBILITY
# if defined(__GNUC__)
diff --git a/include/queue.h b/include/queue.h
new file mode 100644
index 000000000..de4ef162a
--- /dev/null
+++ b/include/queue.h
@@ -0,0 +1,715 @@
+/*
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)queue.h 8.5 (Berkeley) 8/20/94
+ * $FreeBSD: head/sys/sys/queue.h 251887 2013-06-18 02:57:56Z lstewart $
+ */
+
+#ifndef _SUDO_QUEUE_H_
+#define _SUDO_QUEUE_H_
+
+/*
+ * This file defines four types of data structures: singly-linked lists,
+ * singly-linked tail queues, lists and tail queues.
+ *
+ * A singly-linked list is headed by a single forward pointer. The elements
+ * are singly linked for minimum space and pointer manipulation overhead at
+ * the expense of O(n) removal for arbitrary elements. New elements can be
+ * added to the list after an existing element or at the head of the list.
+ * Elements being removed from the head of the list should use the explicit
+ * macro for this purpose for optimum efficiency. A singly-linked list may
+ * only be traversed in the forward direction. Singly-linked lists are ideal
+ * for applications with large datasets and few or no removals or for
+ * implementing a LIFO queue.
+ *
+ * A singly-linked tail queue is headed by a pair of pointers, one to the
+ * head of the list and the other to the tail of the list. The elements are
+ * singly linked for minimum space and pointer manipulation overhead at the
+ * expense of O(n) removal for arbitrary elements. New elements can be added
+ * to the list after an existing element, at the head of the list, or at the
+ * end of the list. Elements being removed from the head of the tail queue
+ * should use the explicit macro for this purpose for optimum efficiency.
+ * A singly-linked tail queue may only be traversed in the forward direction.
+ * Singly-linked tail queues are ideal for applications with large datasets
+ * and few or no removals or for implementing a FIFO queue.
+ *
+ * A list is headed by a single forward pointer (or an array of forward
+ * pointers for a hash table header). The elements are doubly linked
+ * so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before
+ * or after an existing element or at the head of the list. A list
+ * may be traversed in either direction.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * For details on the use of these macros, see the queue(3) manual page.
+ *
+ *
+ * SLIST LIST STAILQ TAILQ
+ * _HEAD + + + +
+ * _HEAD_INITIALIZER + + + +
+ * _ENTRY + + + +
+ * _INIT + + + +
+ * _EMPTY + + + +
+ * _FIRST + + + +
+ * _NEXT + + + +
+ * _PREV - + - +
+ * _LAST - - + +
+ * _FOREACH + + + +
+ * _FOREACH_FROM + + + +
+ * _FOREACH_SAFE + + + +
+ * _FOREACH_FROM_SAFE + + + +
+ * _FOREACH_REVERSE - - - +
+ * _FOREACH_REVERSE_FROM - - - +
+ * _FOREACH_REVERSE_SAFE - - - +
+ * _FOREACH_REVERSE_FROM_SAFE - - - +
+ * _INSERT_HEAD + + + +
+ * _INSERT_BEFORE - + - +
+ * _INSERT_AFTER + + + +
+ * _INSERT_TAIL - - + +
+ * _CONCAT - - + +
+ * _REMOVE_AFTER + - + -
+ * _REMOVE_HEAD + - + -
+ * _REMOVE + + + +
+ * _SWAP + + + +
+ *
+ */
+#ifdef QUEUE_MACRO_DEBUG
+/* Store the last 2 places the queue element or head was altered */
+struct qm_trace {
+ unsigned long lastline;
+ unsigned long prevline;
+ const char *lastfile;
+ const char *prevfile;
+};
+
+#undef TRACEBUF
+#define TRACEBUF struct qm_trace trace;
+#undef TRACEBUF_INITIALIZER
+#define TRACEBUF_INITIALIZER { __FILE__, __LINE__, NULL, 0 } ,
+#undef TRASHIT
+#define TRASHIT(x) do {(x) = (void *)-1;} while (0)
+#undef QMD_SAVELINK
+#define QMD_SAVELINK(name, link) void **name = (void *)&(link)
+
+#undef QMD_TRACE_HEAD
+#define QMD_TRACE_HEAD(head) do { \
+ (head)->trace.prevline = (head)->trace.lastline; \
+ (head)->trace.prevfile = (head)->trace.lastfile; \
+ (head)->trace.lastline = __LINE__; \
+ (head)->trace.lastfile = __FILE__; \
+} while (0)
+
+#undef QMD_TRACE_ELEM
+#define QMD_TRACE_ELEM(elem) do { \
+ (elem)->trace.prevline = (elem)->trace.lastline; \
+ (elem)->trace.prevfile = (elem)->trace.lastfile; \
+ (elem)->trace.lastline = __LINE__; \
+ (elem)->trace.lastfile = __FILE__; \
+} while (0)
+
+#else
+#undef QMD_TRACE_ELEM
+#define QMD_TRACE_ELEM(elem)
+#undef QMD_TRACE_HEAD
+#define QMD_TRACE_HEAD(head)
+#undef QMD_SAVELINK
+#define QMD_SAVELINK(name, link)
+#undef TRACEBUF
+#define TRACEBUF
+#undef TRACEBUF_INITIALIZER
+#define TRACEBUF_INITIALIZER
+#undef TRASHIT
+#define TRASHIT(x)
+#endif /* QUEUE_MACRO_DEBUG */
+
+/*
+ * Singly-linked List declarations.
+ */
+#undef SLIST_HEAD
+#define SLIST_HEAD(name, type) \
+struct name { \
+ struct type *slh_first; /* first element */ \
+}
+
+#undef SLIST_HEAD_INITIALIZER
+#define SLIST_HEAD_INITIALIZER(head) \
+ { NULL }
+
+#undef SLIST_ENTRY
+#define SLIST_ENTRY(type) \
+struct { \
+ struct type *sle_next; /* next element */ \
+}
+
+/*
+ * Singly-linked List functions.
+ */
+#undef SLIST_EMPTY
+#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
+
+#undef SLIST_FIRST
+#define SLIST_FIRST(head) ((head)->slh_first)
+
+#undef SLIST_FOREACH
+#define SLIST_FOREACH(var, head, field) \
+ for ((var) = SLIST_FIRST((head)); \
+ (var); \
+ (var) = SLIST_NEXT((var), field))
+
+#undef SLIST_FOREACH_FROM
+#define SLIST_FOREACH_FROM(var, head, field) \
+ for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \
+ (var); \
+ (var) = SLIST_NEXT((var), field))
+
+#undef SLIST_FOREACH_SAFE
+#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = SLIST_FIRST((head)); \
+ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#undef SLIST_FOREACH_FROM_SAFE
+#define SLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \
+ for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \
+ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#undef SLIST_FOREACH_PREVPTR
+#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
+ for ((varp) = &SLIST_FIRST((head)); \
+ ((var) = *(varp)) != NULL; \
+ (varp) = &SLIST_NEXT((var), field))
+
+#undef SLIST_INIT
+#define SLIST_INIT(head) do { \
+ SLIST_FIRST((head)) = NULL; \
+} while (0)
+
+#undef SLIST_INSERT_AFTER
+#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
+ SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \
+ SLIST_NEXT((slistelm), field) = (elm); \
+} while (0)
+
+#undef SLIST_INSERT_HEAD
+#define SLIST_INSERT_HEAD(head, elm, field) do { \
+ SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \
+ SLIST_FIRST((head)) = (elm); \
+} while (0)
+
+#undef SLIST_NEXT
+#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
+
+#undef SLIST_REMOVE
+#define SLIST_REMOVE(head, elm, type, field) do { \
+ QMD_SAVELINK(oldnext, (elm)->field.sle_next); \
+ if (SLIST_FIRST((head)) == (elm)) { \
+ SLIST_REMOVE_HEAD((head), field); \
+ } \
+ else { \
+ struct type *curelm = SLIST_FIRST((head)); \
+ while (SLIST_NEXT(curelm, field) != (elm)) \
+ curelm = SLIST_NEXT(curelm, field); \
+ SLIST_REMOVE_AFTER(curelm, field); \
+ } \
+ TRASHIT(*oldnext); \
+} while (0)
+
+#undef SLIST_REMOVE_AFTER
+#define SLIST_REMOVE_AFTER(elm, field) do { \
+ SLIST_NEXT(elm, field) = \
+ SLIST_NEXT(SLIST_NEXT(elm, field), field); \
+} while (0)
+
+#undef SLIST_REMOVE_HEAD
+#define SLIST_REMOVE_HEAD(head, field) do { \
+ SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
+} while (0)
+
+#undef SLIST_SWAP
+#define SLIST_SWAP(head1, head2, type) do { \
+ struct type *swap_first = SLIST_FIRST(head1); \
+ SLIST_FIRST(head1) = SLIST_FIRST(head2); \
+ SLIST_FIRST(head2) = swap_first; \
+} while (0)
+
+/*
+ * Singly-linked Tail queue declarations.
+ */
+#undef STAILQ_HEAD
+#define STAILQ_HEAD(name, type) \
+struct name { \
+ struct type *stqh_first;/* first element */ \
+ struct type **stqh_last;/* addr of last next element */ \
+}
+
+#undef STAILQ_HEAD_INITIALIZER
+#define STAILQ_HEAD_INITIALIZER(head) \
+ { NULL, &(head).stqh_first }
+
+#undef STAILQ_ENTRY
+#define STAILQ_ENTRY(type) \
+struct { \
+ struct type *stqe_next; /* next element */ \
+}
+
+/*
+ * Singly-linked Tail queue functions.
+ */
+#undef STAILQ_CONCAT
+#define STAILQ_CONCAT(head1, head2) do { \
+ if (!STAILQ_EMPTY((head2))) { \
+ *(head1)->stqh_last = (head2)->stqh_first; \
+ (head1)->stqh_last = (head2)->stqh_last; \
+ STAILQ_INIT((head2)); \
+ } \
+} while (0)
+
+#undef STAILQ_EMPTY
+#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
+
+#undef STAILQ_FIRST
+#define STAILQ_FIRST(head) ((head)->stqh_first)
+
+#undef STAILQ_FOREACH
+#define STAILQ_FOREACH(var, head, field) \
+ for ((var) = STAILQ_FIRST((head)); \
+ (var); \
+ (var) = STAILQ_NEXT((var), field))
+
+#undef STAILQ_FOREACH_FROM
+#define STAILQ_FOREACH_FROM(var, head, field) \
+ for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \
+ (var); \
+ (var) = STAILQ_NEXT((var), field))
+
+#undef STAILQ_FOREACH_SAFE
+#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = STAILQ_FIRST((head)); \
+ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#undef STAILQ_FOREACH_FROM_SAFE
+#define STAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \
+ for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \
+ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#undef STAILQ_INIT
+#define STAILQ_INIT(head) do { \
+ STAILQ_FIRST((head)) = NULL; \
+ (head)->stqh_last = &STAILQ_FIRST((head)); \
+} while (0)
+
+#undef STAILQ_INSERT_AFTER
+#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \
+ if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
+ (head)->stqh_last = &STAILQ_NEXT((elm), field); \
+ STAILQ_NEXT((tqelm), field) = (elm); \
+} while (0)
+
+#undef STAILQ_INSERT_HEAD
+#define STAILQ_INSERT_HEAD(head, elm, field) do { \
+ if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \
+ (head)->stqh_last = &STAILQ_NEXT((elm), field); \
+ STAILQ_FIRST((head)) = (elm); \
+} while (0)
+
+#undef STAILQ_INSERT_TAIL
+#define STAILQ_INSERT_TAIL(head, elm, field) do { \
+ STAILQ_NEXT((elm), field) = NULL; \
+ *(head)->stqh_last = (elm); \
+ (head)->stqh_last = &STAILQ_NEXT((elm), field); \
+} while (0)
+
+#undef STAILQ_LAST
+#define STAILQ_LAST(head, type, field) \
+ (STAILQ_EMPTY((head)) ? NULL : \
+ __containerof((head)->stqh_last, struct type, field.stqe_next))
+
+#undef STAILQ_NEXT
+#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
+
+#undef STAILQ_REMOVE
+#define STAILQ_REMOVE(head, elm, type, field) do { \
+ QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \
+ if (STAILQ_FIRST((head)) == (elm)) { \
+ STAILQ_REMOVE_HEAD((head), field); \
+ } \
+ else { \
+ struct type *curelm = STAILQ_FIRST((head)); \
+ while (STAILQ_NEXT(curelm, field) != (elm)) \
+ curelm = STAILQ_NEXT(curelm, field); \
+ STAILQ_REMOVE_AFTER(head, curelm, field); \
+ } \
+ TRASHIT(*oldnext); \
+} while (0)
+
+#undef STAILQ_REMOVE_AFTER
+#define STAILQ_REMOVE_AFTER(head, elm, field) do { \
+ if ((STAILQ_NEXT(elm, field) = \
+ STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \
+ (head)->stqh_last = &STAILQ_NEXT((elm), field); \
+} while (0)
+
+#undef STAILQ_REMOVE_HEAD
+#define STAILQ_REMOVE_HEAD(head, field) do { \
+ if ((STAILQ_FIRST((head)) = \
+ STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
+ (head)->stqh_last = &STAILQ_FIRST((head)); \
+} while (0)
+
+#undef STAILQ_SWAP
+#define STAILQ_SWAP(head1, head2, type) do { \
+ struct type *swap_first = STAILQ_FIRST(head1); \
+ struct type **swap_last = (head1)->stqh_last; \
+ STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \
+ (head1)->stqh_last = (head2)->stqh_last; \
+ STAILQ_FIRST(head2) = swap_first; \
+ (head2)->stqh_last = swap_last; \
+ if (STAILQ_EMPTY(head1)) \
+ (head1)->stqh_last = &STAILQ_FIRST(head1); \
+ if (STAILQ_EMPTY(head2)) \
+ (head2)->stqh_last = &STAILQ_FIRST(head2); \
+} while (0)
+
+
+/*
+ * List declarations.
+ */
+#undef LIST_HEAD
+#define LIST_HEAD(name, type) \
+struct name { \
+ struct type *lh_first; /* first element */ \
+}
+
+#undef LIST_HEAD_INITIALIZER
+#define LIST_HEAD_INITIALIZER(head) \
+ { NULL }
+
+#undef LIST_ENTRY
+#define LIST_ENTRY(type) \
+struct { \
+ struct type *le_next; /* next element */ \
+ struct type **le_prev; /* address of previous next element */ \
+}
+
+/*
+ * List functions.
+ */
+#undef LIST_EMPTY
+#define LIST_EMPTY(head) ((head)->lh_first == NULL)
+
+#undef LIST_FIRST
+#define LIST_FIRST(head) ((head)->lh_first)
+
+#undef LIST_FOREACH
+#define LIST_FOREACH(var, head, field) \
+ for ((var) = LIST_FIRST((head)); \
+ (var); \
+ (var) = LIST_NEXT((var), field))
+
+#undef LIST_FOREACH_FROM
+#define LIST_FOREACH_FROM(var, head, field) \
+ for ((var) = ((var) ? (var) : LIST_FIRST((head))); \
+ (var); \
+ (var) = LIST_NEXT((var), field))
+
+#undef LIST_FOREACH_SAFE
+#define LIST_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = LIST_FIRST((head)); \
+ (var) && ((tvar) = LIST_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#undef LIST_FOREACH_FROM_SAFE
+#define LIST_FOREACH_FROM_SAFE(var, head, field, tvar) \
+ for ((var) = ((var) ? (var) : LIST_FIRST((head))); \
+ (var) && ((tvar) = LIST_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#undef LIST_INIT
+#define LIST_INIT(head) do { \
+ LIST_FIRST((head)) = NULL; \
+} while (0)
+
+#undef LIST_INSERT_AFTER
+#define LIST_INSERT_AFTER(listelm, elm, field) do { \
+ if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
+ LIST_NEXT((listelm), field)->field.le_prev = \
+ &LIST_NEXT((elm), field); \
+ LIST_NEXT((listelm), field) = (elm); \
+ (elm)->field.le_prev = &LIST_NEXT((listelm), field); \
+} while (0)
+
+#undef LIST_INSERT_BEFORE
+#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
+ (elm)->field.le_prev = (listelm)->field.le_prev; \
+ LIST_NEXT((elm), field) = (listelm); \
+ *(listelm)->field.le_prev = (elm); \
+ (listelm)->field.le_prev = &LIST_NEXT((elm), field); \
+} while (0)
+
+#undef LIST_INSERT_HEAD
+#define LIST_INSERT_HEAD(head, elm, field) do { \
+ if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \
+ LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
+ LIST_FIRST((head)) = (elm); \
+ (elm)->field.le_prev = &LIST_FIRST((head)); \
+} while (0)
+
+#undef LIST_NEXT
+#define LIST_NEXT(elm, field) ((elm)->field.le_next)
+
+#undef LIST_PREV
+#define LIST_PREV(elm, head, type, field) \
+ ((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \
+ __containerof((elm)->field.le_prev, struct type, field.le_next))
+
+#undef LIST_REMOVE
+#define LIST_REMOVE(elm, field) do { \
+ QMD_SAVELINK(oldnext, (elm)->field.le_next); \
+ QMD_SAVELINK(oldprev, (elm)->field.le_prev); \
+ if (LIST_NEXT((elm), field) != NULL) \
+ LIST_NEXT((elm), field)->field.le_prev = \
+ (elm)->field.le_prev; \
+ *(elm)->field.le_prev = LIST_NEXT((elm), field); \
+ TRASHIT(*oldnext); \
+ TRASHIT(*oldprev); \
+} while (0)
+
+#undef LIST_SWAP
+#define LIST_SWAP(head1, head2, type, field) do { \
+ struct type *swap_tmp = LIST_FIRST((head1)); \
+ LIST_FIRST((head1)) = LIST_FIRST((head2)); \
+ LIST_FIRST((head2)) = swap_tmp; \
+ if ((swap_tmp = LIST_FIRST((head1))) != NULL) \
+ swap_tmp->field.le_prev = &LIST_FIRST((head1)); \
+ if ((swap_tmp = LIST_FIRST((head2))) != NULL) \
+ swap_tmp->field.le_prev = &LIST_FIRST((head2)); \
+} while (0)
+
+/*
+ * Tail queue declarations.
+ */
+#undef TAILQ_HEAD
+#define TAILQ_HEAD(name, type) \
+struct name { \
+ struct type *tqh_first; /* first element */ \
+ struct type **tqh_last; /* addr of last next element */ \
+ TRACEBUF \
+}
+
+#undef TAILQ_HEAD_INITIALIZER
+#define TAILQ_HEAD_INITIALIZER(head) \
+ { NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
+
+#undef TAILQ_ENTRY
+#define TAILQ_ENTRY(type) \
+struct { \
+ struct type *tqe_next; /* next element */ \
+ struct type **tqe_prev; /* address of previous next element */ \
+ TRACEBUF \
+}
+
+/*
+ * Tail queue functions.
+ */
+#undef TAILQ_CONCAT
+#define TAILQ_CONCAT(head1, head2, field) do { \
+ if (!TAILQ_EMPTY(head2)) { \
+ *(head1)->tqh_last = (head2)->tqh_first; \
+ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
+ (head1)->tqh_last = (head2)->tqh_last; \
+ TAILQ_INIT((head2)); \
+ QMD_TRACE_HEAD(head1); \
+ QMD_TRACE_HEAD(head2); \
+ } \
+} while (0)
+
+#undef TAILQ_EMPTY
+#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
+
+#undef TAILQ_FIRST
+#define TAILQ_FIRST(head) ((head)->tqh_first)
+
+#undef TAILQ_FOREACH
+#define TAILQ_FOREACH(var, head, field) \
+ for ((var) = TAILQ_FIRST((head)); \
+ (var); \
+ (var) = TAILQ_NEXT((var), field))
+
+#undef TAILQ_FOREACH_FROM
+#define TAILQ_FOREACH_FROM(var, head, field) \
+ for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \
+ (var); \
+ (var) = TAILQ_NEXT((var), field))
+
+#undef TAILQ_FOREACH_SAFE
+#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = TAILQ_FIRST((head)); \
+ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#undef TAILQ_FOREACH_FROM_SAFE
+#define TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \
+ for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \
+ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#undef TAILQ_FOREACH_REVERSE
+#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
+ for ((var) = TAILQ_LAST((head), headname); \
+ (var); \
+ (var) = TAILQ_PREV((var), headname, field))
+
+#undef TAILQ_FOREACH_REVERSE_FROM
+#define TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field) \
+ for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \
+ (var); \
+ (var) = TAILQ_PREV((var), headname, field))
+
+#undef TAILQ_FOREACH_REVERSE_SAFE
+#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
+ for ((var) = TAILQ_LAST((head), headname); \
+ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
+ (var) = (tvar))
+
+#undef TAILQ_FOREACH_REVERSE_FROM_SAFE
+#define TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \
+ for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \
+ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
+ (var) = (tvar))
+
+#undef TAILQ_INIT
+#define TAILQ_INIT(head) do { \
+ TAILQ_FIRST((head)) = NULL; \
+ (head)->tqh_last = &TAILQ_FIRST((head)); \
+ QMD_TRACE_HEAD(head); \
+} while (0)
+
+#undef TAILQ_INSERT_AFTER
+#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
+ TAILQ_NEXT((elm), field)->field.tqe_prev = \
+ &TAILQ_NEXT((elm), field); \
+ else { \
+ (head)->tqh_last = &TAILQ_NEXT((elm), field); \
+ QMD_TRACE_HEAD(head); \
+ } \
+ TAILQ_NEXT((listelm), field) = (elm); \
+ (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \
+ QMD_TRACE_ELEM(&(elm)->field); \
+ QMD_TRACE_ELEM(&listelm->field); \
+} while (0)
+
+#undef TAILQ_INSERT_BEFORE
+#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
+ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
+ TAILQ_NEXT((elm), field) = (listelm); \
+ *(listelm)->field.tqe_prev = (elm); \
+ (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
+ QMD_TRACE_ELEM(&(elm)->field); \
+ QMD_TRACE_ELEM(&listelm->field); \
+} while (0)
+
+#undef TAILQ_INSERT_HEAD
+#define TAILQ_INSERT_HEAD(head, elm, field) do { \
+ if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \
+ TAILQ_FIRST((head))->field.tqe_prev = \
+ &TAILQ_NEXT((elm), field); \
+ else \
+ (head)->tqh_last = &TAILQ_NEXT((elm), field); \
+ TAILQ_FIRST((head)) = (elm); \
+ (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \
+ QMD_TRACE_HEAD(head); \
+ QMD_TRACE_ELEM(&(elm)->field); \
+} while (0)
+
+#undef TAILQ_INSERT_TAIL
+#define TAILQ_INSERT_TAIL(head, elm, field) do { \
+ TAILQ_NEXT((elm), field) = NULL; \
+ (elm)->field.tqe_prev = (head)->tqh_last; \
+ *(head)->tqh_last = (elm); \
+ (head)->tqh_last = &TAILQ_NEXT((elm), field); \
+ QMD_TRACE_HEAD(head); \
+ QMD_TRACE_ELEM(&(elm)->field); \
+} while (0)
+
+#undef TAILQ_LAST
+#define TAILQ_LAST(head, headname) \
+ (*(((struct headname *)((head)->tqh_last))->tqh_last))
+
+#undef TAILQ_NEXT
+#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+
+#undef TAILQ_PREV
+#define TAILQ_PREV(elm, headname, field) \
+ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+
+#undef TAILQ_REMOVE
+#define TAILQ_REMOVE(head, elm, field) do { \
+ QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \
+ QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \
+ if ((TAILQ_NEXT((elm), field)) != NULL) \
+ TAILQ_NEXT((elm), field)->field.tqe_prev = \
+ (elm)->field.tqe_prev; \
+ else { \
+ (head)->tqh_last = (elm)->field.tqe_prev; \
+ QMD_TRACE_HEAD(head); \
+ } \
+ *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \
+ TRASHIT(*oldnext); \
+ TRASHIT(*oldprev); \
+ QMD_TRACE_ELEM(&(elm)->field); \
+} while (0)
+
+#undef TAILQ_SWAP
+#define TAILQ_SWAP(head1, head2, type, field) do { \
+ struct type *swap_first = (head1)->tqh_first; \
+ struct type **swap_last = (head1)->tqh_last; \
+ (head1)->tqh_first = (head2)->tqh_first; \
+ (head1)->tqh_last = (head2)->tqh_last; \
+ (head2)->tqh_first = swap_first; \
+ (head2)->tqh_last = swap_last; \
+ if ((swap_first = (head1)->tqh_first) != NULL) \
+ swap_first->field.tqe_prev = &(head1)->tqh_first; \
+ else \
+ (head1)->tqh_last = &(head1)->tqh_first; \
+ if ((swap_first = (head2)->tqh_first) != NULL) \
+ swap_first->field.tqe_prev = &(head2)->tqh_first; \
+ else \
+ (head2)->tqh_last = &(head2)->tqh_first; \
+} while (0)
+
+#endif /* !_SUDO_QUEUE_H_ */
diff --git a/include/sudo_conf.h b/include/sudo_conf.h
index 2c86b8e95..27a096d06 100644
--- a/include/sudo_conf.h
+++ b/include/sudo_conf.h
@@ -17,21 +17,20 @@
#ifndef _SUDO_CONF_H
#define _SUDO_CONF_H
-#include "list.h"
+#include "queue.h"
#define GROUP_SOURCE_ADAPTIVE 0
#define GROUP_SOURCE_STATIC 1
#define GROUP_SOURCE_DYNAMIC 2
struct plugin_info {
- struct plugin_info *prev; /* required */
- struct plugin_info *next; /* required */
+ TAILQ_ENTRY(plugin_info) entries;
const char *path;
const char *symbol_name;
char * const * options;
int lineno;
};
-TQ_DECLARE(plugin_info)
+TAILQ_HEAD(plugin_info_list, plugin_info);
/* Read main sudo.conf file. */
void sudo_conf_read(const char *);
diff --git a/include/sudo_event.h b/include/sudo_event.h
index 5b697e71c..bc1150b85 100644
--- a/include/sudo_event.h
+++ b/include/sudo_event.h
@@ -17,6 +17,8 @@
#ifndef _SUDO_EVENT_H
#define _SUDO_EVENT_H
+#include "queue.h"
+
/* Event types */
#define SUDO_EV_READ 0x01 /* fire when readable */
#define SUDO_EV_WRITE 0x02 /* fire when writable */
@@ -39,8 +41,7 @@ typedef void (*sudo_ev_callback_t)(int fd, int what, void *closure);
/* Member of struct sudo_event_base. */
struct sudo_event {
- struct sudo_event *prev; /* must be first element in struct */
- struct sudo_event *next; /* must be second element in struct */
+ TAILQ_ENTRY(sudo_event) entries;
struct sudo_event_base *base; /* base this event belongs to */
int fd; /* fd we are interested in */
short events; /* SUDO_EV_* flags */
@@ -49,11 +50,12 @@ struct sudo_event {
void *closure; /* user-provided data pointer */
};
-/* Tail queue of events. */
+TAILQ_HEAD(sudo_event_list, sudo_event);
+
struct sudo_event_base {
- struct sudo_event *first; /* must be first element in struct */
- struct sudo_event *last; /* must be second element in struct */
- struct sudo_event *pending; /* next event to be run in the event loop */
+ struct sudo_event_list events; /* tail queue of events */
+ /* XXX - also list of active events and timed events */
+ struct sudo_event *pending; /* next event to be run in the event loop XXX */
#ifdef HAVE_POLL
struct pollfd *pfds; /* array of struct pollfd */
int pfd_max; /* size of the pfds array */
diff --git a/plugins/sudoers/Makefile.in b/plugins/sudoers/Makefile.in
index 930bdd597..8a9e868bc 100644
--- a/plugins/sudoers/Makefile.in
+++ b/plugins/sudoers/Makefile.in
@@ -432,14 +432,14 @@ cleandir: realclean
afs.lo: $(authdir)/afs.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/afs.c
aix_auth.lo: $(authdir)/aix_auth.c $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h $(incdir)/fatal.h \
- $(incdir)/alloc.h $(incdir)/list.h $(incdir)/fileops.h \
+ $(incdir)/alloc.h $(incdir)/queue.h $(incdir)/fileops.h \
$(srcdir)/defaults.h $(devdir)/def_data.h $(srcdir)/logging.h \
$(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
$(incdir)/sudo_debug.h $(incdir)/gettext.h
@@ -447,10 +447,11 @@ aix_auth.lo: $(authdir)/aix_auth.c $(top_builddir)/config.h \
alias.lo: $(srcdir)/alias.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
- $(srcdir)/parse.h $(srcdir)/redblack.h $(devdir)/gram.h
+ $(srcdir)/parse.h $(incdir)/list.h $(srcdir)/redblack.h \
+ $(devdir)/gram.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/alias.c
audit.lo: $(srcdir)/audit.c $(top_builddir)/config.h \
$(top_srcdir)/compat/stdbool.h $(incdir)/missing.h \
@@ -467,7 +468,7 @@ boottime.lo: $(srcdir)/boottime.c $(top_builddir)/config.h $(incdir)/missing.h \
bsdauth.lo: $(authdir)/bsdauth.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/bsdauth.c
@@ -478,7 +479,7 @@ bsm_audit.lo: $(srcdir)/bsm_audit.c $(top_builddir)/config.h \
check.lo: $(srcdir)/check.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
$(srcdir)/check.h
@@ -486,11 +487,11 @@ check.lo: $(srcdir)/check.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
check_addr.o: $(srcdir)/regress/parser/check_addr.c $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h \
- $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/list.h \
+ $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/queue.h \
$(incdir)/fileops.h $(srcdir)/defaults.h $(devdir)/def_data.h \
$(srcdir)/logging.h $(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
$(incdir)/sudo_debug.h $(incdir)/gettext.h $(srcdir)/parse.h \
- $(srcdir)/interfaces.h
+ $(incdir)/list.h $(srcdir)/interfaces.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/parser/check_addr.c
check_base64.o: $(srcdir)/regress/parser/check_base64.c \
$(top_builddir)/config.h $(incdir)/missing.h
@@ -500,14 +501,14 @@ check_digest.o: $(srcdir)/regress/parser/check_digest.c \
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/parser/check_digest.c
check_fill.o: $(srcdir)/regress/parser/check_fill.c $(top_builddir)/config.h \
$(top_srcdir)/compat/stdbool.h $(incdir)/missing.h \
- $(incdir)/list.h $(srcdir)/parse.h $(srcdir)/toke.h \
- $(incdir)/sudo_plugin.h $(devdir)/gram.h
+ $(incdir)/list.h $(srcdir)/parse.h $(incdir)/list.h \
+ $(srcdir)/toke.h $(incdir)/sudo_plugin.h $(devdir)/gram.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/parser/check_fill.c
check_iolog_path.o: $(srcdir)/regress/iolog_path/check_iolog_path.c \
$(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h \
$(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
$(incdir)/sudo_debug.h $(incdir)/gettext.h \
@@ -523,30 +524,30 @@ check_wrap.o: $(srcdir)/regress/logging/check_wrap.c $(top_builddir)/config.h \
dce.lo: $(authdir)/dce.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/dce.c
defaults.lo: $(srcdir)/defaults.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h \
- $(incdir)/gettext.h $(srcdir)/parse.h $(devdir)/gram.h \
- $(devdir)/def_data.c
+ $(incdir)/gettext.h $(srcdir)/parse.h $(incdir)/list.h \
+ $(devdir)/gram.h $(devdir)/def_data.c
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/defaults.c
env.lo: $(srcdir)/env.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/env.c
find_path.lo: $(srcdir)/find_path.c $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h \
- $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/list.h \
+ $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/queue.h \
$(incdir)/fileops.h $(srcdir)/defaults.h $(devdir)/def_data.h \
$(srcdir)/logging.h $(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
$(incdir)/sudo_debug.h $(incdir)/gettext.h
@@ -555,7 +556,7 @@ find_path.o: find_path.lo
fwtk.lo: $(authdir)/fwtk.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/fwtk.c
@@ -565,7 +566,7 @@ getdate.o: $(devdir)/getdate.c $(top_builddir)/config.h \
getspwuid.lo: $(srcdir)/getspwuid.c $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h \
- $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/list.h \
+ $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/queue.h \
$(incdir)/fileops.h $(srcdir)/defaults.h $(devdir)/def_data.h \
$(srcdir)/logging.h $(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
$(incdir)/sudo_debug.h $(incdir)/gettext.h
@@ -573,7 +574,7 @@ getspwuid.lo: $(srcdir)/getspwuid.c $(top_builddir)/config.h \
goodpath.lo: $(srcdir)/goodpath.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/goodpath.c
@@ -581,16 +582,16 @@ goodpath.o: goodpath.lo
gram.lo: $(devdir)/gram.c $(top_builddir)/config.h $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h $(incdir)/fatal.h \
- $(incdir)/alloc.h $(incdir)/list.h $(incdir)/fileops.h \
+ $(incdir)/alloc.h $(incdir)/queue.h $(incdir)/fileops.h \
$(srcdir)/defaults.h $(devdir)/def_data.h $(srcdir)/logging.h \
$(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h \
- $(incdir)/gettext.h $(srcdir)/parse.h $(srcdir)/toke.h
+ $(incdir)/gettext.h $(srcdir)/parse.h $(incdir)/list.h $(srcdir)/toke.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(devdir)/gram.c
group_plugin.lo: $(srcdir)/group_plugin.c $(top_builddir)/config.h \
$(top_srcdir)/compat/dlfcn.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h \
$(incdir)/gettext.h
@@ -603,7 +604,7 @@ hexchar.o: hexchar.lo
interfaces.lo: $(srcdir)/interfaces.c $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h \
- $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/list.h \
+ $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/queue.h \
$(incdir)/fileops.h $(srcdir)/defaults.h $(devdir)/def_data.h \
$(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h \
@@ -613,7 +614,7 @@ interfaces.o: interfaces.lo
iolog.lo: $(srcdir)/iolog.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
$(srcdir)/iolog.h
@@ -621,7 +622,7 @@ iolog.lo: $(srcdir)/iolog.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
iolog_path.lo: $(srcdir)/iolog_path.c $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h \
- $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/list.h \
+ $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/queue.h \
$(incdir)/fileops.h $(srcdir)/defaults.h $(devdir)/def_data.h \
$(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h \
@@ -631,7 +632,7 @@ iolog_path.o: iolog_path.lo
kerb5.lo: $(authdir)/kerb5.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/kerb5.c
@@ -639,10 +640,10 @@ ldap.lo: $(srcdir)/ldap.c $(top_builddir)/config.h \
$(top_srcdir)/compat/dlfcn.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
- $(srcdir)/parse.h $(incdir)/lbuf.h
+ $(srcdir)/parse.h $(incdir)/list.h $(incdir)/lbuf.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/ldap.c
linux_audit.lo: $(srcdir)/linux_audit.c $(top_builddir)/config.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
@@ -658,14 +659,14 @@ locale.o: locale.lo
logging.lo: $(srcdir)/logging.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/logging.c
logwrap.lo: $(srcdir)/logwrap.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/logwrap.c
@@ -674,16 +675,16 @@ match.lo: $(srcdir)/match.c $(top_builddir)/config.h \
$(top_srcdir)/compat/fnmatch.h $(top_srcdir)/compat/glob.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h $(incdir)/fatal.h \
- $(incdir)/alloc.h $(incdir)/list.h $(incdir)/fileops.h \
+ $(incdir)/alloc.h $(incdir)/queue.h $(incdir)/fileops.h \
$(srcdir)/defaults.h $(devdir)/def_data.h $(srcdir)/logging.h \
$(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h \
- $(incdir)/gettext.h $(srcdir)/parse.h $(srcdir)/sha2.h \
- $(devdir)/gram.h
+ $(incdir)/gettext.h $(srcdir)/parse.h $(incdir)/list.h \
+ $(srcdir)/sha2.h $(devdir)/gram.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/match.c
match_addr.lo: $(srcdir)/match_addr.c $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h \
- $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/list.h \
+ $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/queue.h \
$(incdir)/fileops.h $(srcdir)/defaults.h $(devdir)/def_data.h \
$(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h \
@@ -697,29 +698,29 @@ net_ifs.o: $(top_srcdir)/src/net_ifs.c $(top_builddir)/config.h \
pam.lo: $(authdir)/pam.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/pam.c
parse.lo: $(srcdir)/parse.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
- $(srcdir)/parse.h $(incdir)/lbuf.h $(devdir)/gram.h
+ $(srcdir)/parse.h $(incdir)/list.h $(incdir)/lbuf.h $(devdir)/gram.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/parse.c
passwd.lo: $(authdir)/passwd.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/passwd.c
policy.lo: $(srcdir)/policy.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
$(srcdir)/sudoers_version.h $(srcdir)/interfaces.h
@@ -727,14 +728,14 @@ policy.lo: $(srcdir)/policy.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
prompt.lo: $(srcdir)/prompt.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/prompt.c
pwutil.lo: $(srcdir)/pwutil.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
$(srcdir)/redblack.h $(srcdir)/pwutil.h
@@ -743,7 +744,7 @@ pwutil.o: pwutil.lo
pwutil_impl.lo: $(srcdir)/pwutil_impl.c $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h \
- $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/list.h \
+ $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/queue.h \
$(incdir)/fileops.h $(srcdir)/defaults.h $(devdir)/def_data.h \
$(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h \
@@ -757,14 +758,14 @@ redblack.o: redblack.lo
rfc1938.lo: $(authdir)/rfc1938.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/rfc1938.c
secureware.lo: $(authdir)/secureware.c $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h \
- $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/list.h \
+ $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/queue.h \
$(incdir)/fileops.h $(srcdir)/defaults.h $(devdir)/def_data.h \
$(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h \
@@ -773,7 +774,7 @@ secureware.lo: $(authdir)/secureware.c $(top_builddir)/config.h \
securid5.lo: $(authdir)/securid5.c $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h $(incdir)/fatal.h \
- $(incdir)/alloc.h $(incdir)/list.h $(incdir)/fileops.h \
+ $(incdir)/alloc.h $(incdir)/queue.h $(incdir)/fileops.h \
$(srcdir)/defaults.h $(devdir)/def_data.h $(srcdir)/logging.h \
$(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
$(incdir)/sudo_debug.h $(incdir)/gettext.h
@@ -781,7 +782,7 @@ securid5.lo: $(authdir)/securid5.c $(top_builddir)/config.h \
set_perms.lo: $(srcdir)/set_perms.c $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h \
- $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/list.h \
+ $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/queue.h \
$(incdir)/fileops.h $(srcdir)/defaults.h $(devdir)/def_data.h \
$(srcdir)/logging.h $(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
$(incdir)/sudo_debug.h $(incdir)/gettext.h
@@ -793,7 +794,7 @@ sha2.o: sha2.lo
sia.lo: $(authdir)/sia.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/sia.c
@@ -801,15 +802,16 @@ sssd.lo: $(srcdir)/sssd.c $(top_builddir)/config.h \
$(top_srcdir)/compat/dlfcn.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
- $(srcdir)/parse.h $(incdir)/lbuf.h $(incdir)/sudo_debug.h
+ $(srcdir)/parse.h $(incdir)/list.h $(incdir)/lbuf.h \
+ $(incdir)/sudo_debug.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sssd.c
sudo_auth.lo: $(authdir)/sudo_auth.c $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h \
- $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/list.h \
+ $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/queue.h \
$(incdir)/fileops.h $(srcdir)/defaults.h $(devdir)/def_data.h \
$(srcdir)/logging.h $(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
$(incdir)/sudo_debug.h $(incdir)/gettext.h $(srcdir)/insults.h \
@@ -819,7 +821,7 @@ sudo_auth.lo: $(authdir)/sudo_auth.c $(top_builddir)/config.h \
sudo_nss.lo: $(srcdir)/sudo_nss.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h \
$(incdir)/gettext.h $(incdir)/lbuf.h
@@ -828,7 +830,7 @@ sudoers.lo: $(srcdir)/sudoers.c $(top_builddir)/config.h \
$(top_srcdir)/compat/getaddrinfo.h $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h $(incdir)/fatal.h \
- $(incdir)/alloc.h $(incdir)/list.h $(incdir)/fileops.h \
+ $(incdir)/alloc.h $(incdir)/queue.h $(incdir)/fileops.h \
$(srcdir)/defaults.h $(devdir)/def_data.h $(srcdir)/logging.h \
$(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
$(incdir)/sudo_debug.h $(incdir)/gettext.h \
@@ -839,7 +841,7 @@ sudoreplay.o: $(srcdir)/sudoreplay.c $(top_builddir)/config.h \
$(top_srcdir)/compat/getopt.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/alloc.h $(incdir)/fatal.h \
$(incdir)/gettext.h $(srcdir)/logging.h $(srcdir)/iolog.h \
- $(incdir)/sudo_plugin.h $(incdir)/sudo_conf.h $(incdir)/list.h \
+ $(incdir)/sudo_plugin.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
$(incdir)/sudo_debug.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudoreplay.c
testsudoers.o: $(srcdir)/testsudoers.c $(top_builddir)/config.h \
@@ -847,17 +849,17 @@ testsudoers.o: $(srcdir)/testsudoers.c $(top_builddir)/config.h \
$(top_builddir)/config.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h \
$(incdir)/gettext.h $(srcdir)/interfaces.h $(srcdir)/parse.h \
- $(incdir)/sudo_conf.h $(incdir)/list.h $(incdir)/secure_path.h \
- $(devdir)/gram.h
+ $(incdir)/list.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
+ $(incdir)/secure_path.h $(devdir)/gram.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/testsudoers.c
timestamp.lo: $(srcdir)/timestamp.c $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h \
- $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/list.h \
+ $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/queue.h \
$(incdir)/fileops.h $(srcdir)/defaults.h $(devdir)/def_data.h \
$(srcdir)/logging.h $(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
$(incdir)/sudo_debug.h $(incdir)/gettext.h $(srcdir)/check.h
@@ -867,28 +869,28 @@ timestr.lo: $(srcdir)/timestr.c $(top_builddir)/config.h $(incdir)/missing.h
toke.lo: $(devdir)/toke.c $(top_builddir)/config.h $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h $(incdir)/fatal.h \
- $(incdir)/alloc.h $(incdir)/list.h $(incdir)/fileops.h \
+ $(incdir)/alloc.h $(incdir)/queue.h $(incdir)/fileops.h \
$(srcdir)/defaults.h $(devdir)/def_data.h $(srcdir)/logging.h \
$(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h \
- $(incdir)/gettext.h $(srcdir)/parse.h $(srcdir)/toke.h \
- $(devdir)/gram.h $(incdir)/lbuf.h $(srcdir)/sha2.h \
+ $(incdir)/gettext.h $(srcdir)/parse.h $(incdir)/list.h \
+ $(srcdir)/toke.h $(devdir)/gram.h $(incdir)/lbuf.h $(srcdir)/sha2.h \
$(incdir)/secure_path.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(devdir)/toke.c
toke_util.lo: $(srcdir)/toke_util.c $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h \
- $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/list.h \
+ $(incdir)/fatal.h $(incdir)/alloc.h $(incdir)/queue.h \
$(incdir)/fileops.h $(srcdir)/defaults.h $(devdir)/def_data.h \
$(srcdir)/logging.h $(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
$(incdir)/sudo_debug.h $(incdir)/gettext.h $(srcdir)/parse.h \
- $(srcdir)/toke.h $(devdir)/gram.h
+ $(incdir)/list.h $(srcdir)/toke.h $(devdir)/gram.h
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/toke_util.c
toke_util.o: toke_util.lo
tsgetgrpw.o: $(srcdir)/tsgetgrpw.c $(top_builddir)/config.h \
$(srcdir)/tsgetgrpw.h $(top_builddir)/config.h \
$(srcdir)/sudoers.h $(top_srcdir)/compat/stdbool.h \
$(top_builddir)/pathnames.h $(incdir)/missing.h $(incdir)/fatal.h \
- $(incdir)/alloc.h $(incdir)/list.h $(incdir)/fileops.h \
+ $(incdir)/alloc.h $(incdir)/queue.h $(incdir)/fileops.h \
$(srcdir)/defaults.h $(devdir)/def_data.h $(srcdir)/logging.h \
$(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
$(incdir)/sudo_debug.h $(incdir)/gettext.h
@@ -897,10 +899,10 @@ visudo.o: $(srcdir)/visudo.c $(top_builddir)/config.h \
$(top_srcdir)/compat/getopt.h $(srcdir)/sudoers.h \
$(top_srcdir)/compat/stdbool.h $(top_builddir)/pathnames.h \
$(incdir)/missing.h $(incdir)/fatal.h $(incdir)/alloc.h \
- $(incdir)/list.h $(incdir)/fileops.h $(srcdir)/defaults.h \
+ $(incdir)/queue.h $(incdir)/fileops.h $(srcdir)/defaults.h \
$(devdir)/def_data.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
$(incdir)/sudo_plugin.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
- $(srcdir)/parse.h $(srcdir)/redblack.h $(incdir)/gettext.h \
- $(srcdir)/sudoers_version.h $(incdir)/sudo_conf.h $(incdir)/list.h \
- $(devdir)/gram.h
+ $(srcdir)/parse.h $(incdir)/list.h $(srcdir)/redblack.h \
+ $(incdir)/queue.h $(incdir)/gettext.h $(srcdir)/sudoers_version.h \
+ $(incdir)/sudo_conf.h $(incdir)/queue.h $(devdir)/gram.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/visudo.c
diff --git a/plugins/sudoers/ldap.c b/plugins/sudoers/ldap.c
index e7f621ba7..cb7be8cb6 100644
--- a/plugins/sudoers/ldap.c
+++ b/plugins/sudoers/ldap.c
@@ -371,8 +371,7 @@ struct sudo_ldap_handle {
};
struct sudo_nss sudo_nss_ldap = {
- &sudo_nss_ldap,
- NULL,
+ { NULL, NULL },
sudo_ldap_open,
sudo_ldap_close,
sudo_ldap_parse,
diff --git a/plugins/sudoers/parse.c b/plugins/sudoers/parse.c
index f99f2d514..f91e41308 100644
--- a/plugins/sudoers/parse.c
+++ b/plugins/sudoers/parse.c
@@ -51,8 +51,7 @@
/* sudoers nsswitch routines */
struct sudo_nss sudo_nss_file = {
- &sudo_nss_file,
- NULL,
+ { NULL, NULL },
sudo_file_open,
sudo_file_close,
sudo_file_parse,
diff --git a/plugins/sudoers/parse.h b/plugins/sudoers/parse.h
index a892e97b3..b396da52d 100644
--- a/plugins/sudoers/parse.h
+++ b/plugins/sudoers/parse.h
@@ -18,6 +18,8 @@
#ifndef _SUDOERS_PARSE_H
#define _SUDOERS_PARSE_H
+#include "list.h" /* XXX */
+
#undef UNSPEC
#define UNSPEC -1
#undef DENY
diff --git a/plugins/sudoers/sssd.c b/plugins/sudoers/sssd.c
index ca3a48296..9d57a519f 100644
--- a/plugins/sudoers/sssd.c
+++ b/plugins/sudoers/sssd.c
@@ -226,8 +226,7 @@ sudo_sss_filter_result(struct sudo_sss_handle *handle,
}
struct sudo_nss sudo_nss_sss = {
- &sudo_nss_sss,
- NULL,
+ { NULL, NULL },
sudo_sss_open,
sudo_sss_close,
sudo_sss_parse,
diff --git a/plugins/sudoers/sudo_nss.c b/plugins/sudoers/sudo_nss.c
index fd09dc626..26c5874f8 100644
--- a/plugins/sudoers/sudo_nss.c
+++ b/plugins/sudoers/sudo_nss.c
@@ -69,7 +69,7 @@ sudo_read_nss(void)
bool saw_files = false;
bool saw_ldap = false;
bool got_match = false;
- static struct sudo_nss_list snl;
+ static struct sudo_nss_list snl = TAILQ_HEAD_INITIALIZER(snl);
debug_decl(sudo_read_nss, SUDO_DEBUG_NSS)
if ((fp = fopen(_PATH_NSSWITCH_CONF, "r")) == NULL)
@@ -87,25 +87,25 @@ sudo_read_nss(void)
/* Parse line */
for ((cp = strtok(line + 8, " \t")); cp != NULL; (cp = strtok(NULL, " \t"))) {
if (strcasecmp(cp, "files") == 0 && !saw_files) {
- tq_append(&snl, &sudo_nss_file);
+ TAILQ_INSERT_TAIL(&snl, &sudo_nss_file, entries);
got_match = true;
#ifdef HAVE_LDAP
} else if (strcasecmp(cp, "ldap") == 0 && !saw_ldap) {
- tq_append(&snl, &sudo_nss_ldap);
+ TAILQ_INSERT_TAIL(&snl, &sudo_nss_ldap, entries);
got_match = true;
#endif
#ifdef HAVE_SSSD
} else if (strcasecmp(cp, "sss") == 0 && !saw_sss) {
- tq_append(&snl, &sudo_nss_sss);
+ TAILQ_INSERT_TAIL(&snl, &sudo_nss_sss, entries);
got_match = true;
#endif
} else if (strcasecmp(cp, "[NOTFOUND=return]") == 0 && got_match) {
/* NOTFOUND affects the most recent entry */
- tq_last(&snl)->ret_if_notfound = true;
+ TAILQ_LAST(&snl, sudo_nss_list)->ret_if_notfound = true;
got_match = false;
} else if (strcasecmp(cp, "[SUCCESS=return]") == 0 && got_match) {
/* SUCCESS affects the most recent entry */
- tq_last(&snl)->ret_if_found = true;
+ TAILQ_LAST(&snl, sudo_nss_list)->ret_if_found = true;
got_match = false;
} else
got_match = false;
@@ -118,8 +118,8 @@ sudo_read_nss(void)
nomatch:
/* Default to files only if no matches */
- if (tq_empty(&snl))
- tq_append(&snl, &sudo_nss_file);
+ if (TAILQ_EMPTY(&snl))
+ TAILQ_INSERT_TAIL(&snl, &sudo_nss_file, entries);
debug_return_ptr(&snl);
}
@@ -144,7 +144,7 @@ sudo_read_nss(void)
bool saw_files = false;
bool saw_ldap = false;
bool got_match = false;
- static struct sudo_nss_list snl;
+ static struct sudo_nss_list snl = TAILQ_HEAD_INITIALIZER(snl);
debug_decl(sudo_read_nss, SUDO_DEBUG_NSS)
if ((fp = fopen(_PATH_NETSVC_CONF, "r")) == NULL)
@@ -172,20 +172,20 @@ sudo_read_nss(void)
if (!saw_files && strncasecmp(cp, "files", 5) == 0 &&
(isspace((unsigned char)cp[5]) || cp[5] == '\0')) {
- tq_append(&snl, &sudo_nss_file);
+ TAILQ_INSERT_TAIL(&snl, &sudo_nss_file, entries);
got_match = true;
ep = &cp[5];
#ifdef HAVE_LDAP
} else if (!saw_ldap && strncasecmp(cp, "ldap", 4) == 0 &&
(isspace((unsigned char)cp[4]) || cp[4] == '\0')) {
- tq_append(&snl, &sudo_nss_ldap);
+ TAILQ_INSERT_TAIL(&snl, &sudo_nss_ldap, entries);
got_match = true;
ep = &cp[4];
#endif
#ifdef HAVE_SSSD
} else if (!saw_sss && strncasecmp(cp, "sss", 3) == 0 &&
(isspace((unsigned char)cp[3]) || cp[3] == '\0')) {
- tq_append(&snl, &sudo_nss_sss);
+ TAILQ_INSERT_TAIL(&snl, &sudo_nss_sss, entries);
got_match = true;
ep = &cp[3];
#endif
@@ -200,7 +200,7 @@ sudo_read_nss(void)
cp++;
if (strncasecmp(cp, "auth", 4) == 0 &&
(isspace((unsigned char)cp[4]) || cp[4] == '\0')) {
- tq_last(&snl)->ret_if_found = true;
+ TAILQ_LAST(&snl, sudo_nss_list)->ret_if_found = true;
}
}
}
@@ -211,8 +211,8 @@ sudo_read_nss(void)
nomatch:
/* Default to files only if no matches */
- if (tq_empty(&snl))
- tq_append(&snl, &sudo_nss_file);
+ if (TAILQ_EMPTY(&snl))
+ TAILQ_INSERT_TAIL(&snl, &sudo_nss_files, entries);
debug_return_ptr(&snl);
}
@@ -225,16 +225,16 @@ nomatch:
struct sudo_nss_list *
sudo_read_nss(void)
{
- static struct sudo_nss_list snl;
+ static struct sudo_nss_list snl = TAILQ_HEAD_INITIALIZER(snl);
debug_decl(sudo_read_nss, SUDO_DEBUG_NSS)
# ifdef HAVE_SSSD
- tq_append(&snl, &sudo_nss_sss);
+ TAILQ_INSERT_TAIL(&snl, &sudo_nss_sss, entries);
# endif
# ifdef HAVE_LDAP
- tq_append(&snl, &sudo_nss_ldap);
+ TAILQ_INSERT_TAIL(&snl, &sudo_nss_ldap, entries);
# endif
- tq_append(&snl, &sudo_nss_file);
+ TAILQ_INSERT_TAIL(&snl, &sudo_nss_file, entries);
debug_return_ptr(&snl);
}
@@ -283,7 +283,7 @@ display_privs(struct sudo_nss_list *snl, struct passwd *pw)
lbuf_append(&defs, _("Matching Defaults entries for %s on %s:\n"),
pw->pw_name, user_srunhost);
count = 0;
- tq_foreach_fwd(snl, nss) {
+ TAILQ_FOREACH(nss, snl, entries) {
count += nss->display_defaults(nss, pw, &defs);
}
if (count)
@@ -296,7 +296,7 @@ display_privs(struct sudo_nss_list *snl, struct passwd *pw)
lbuf_append(&defs, _("Runas and Command-specific defaults for %s:\n"),
pw->pw_name);
count = 0;
- tq_foreach_fwd(snl, nss) {
+ TAILQ_FOREACH(nss, snl, entries) {
count += nss->display_bound_defaults(nss, pw, &defs);
}
if (count)
@@ -309,7 +309,7 @@ display_privs(struct sudo_nss_list *snl, struct passwd *pw)
_("User %s may run the following commands on %s:\n"),
pw->pw_name, user_srunhost);
count = 0;
- tq_foreach_fwd(snl, nss) {
+ TAILQ_FOREACH(nss, snl, entries) {
count += nss->display_privs(nss, pw, &privs);
}
if (count == 0) {
@@ -338,7 +338,7 @@ display_cmnd(struct sudo_nss_list *snl, struct passwd *pw)
struct sudo_nss *nss;
debug_decl(display_cmnd, SUDO_DEBUG_NSS)
- tq_foreach_fwd(snl, nss) {
+ TAILQ_FOREACH(nss, snl, entries) {
if (nss->display_cmnd(nss, pw) == 0)
debug_return_bool(true);
}
diff --git a/plugins/sudoers/sudo_nss.h b/plugins/sudoers/sudo_nss.h
index 3e74f3ab8..40c3fa009 100644
--- a/plugins/sudoers/sudo_nss.h
+++ b/plugins/sudoers/sudo_nss.h
@@ -21,8 +21,7 @@ struct lbuf;
struct passwd;
struct sudo_nss {
- struct sudo_nss *prev;
- struct sudo_nss *next;
+ TAILQ_ENTRY(sudo_nss) entries;
int (*open)(struct sudo_nss *nss);
int (*close)(struct sudo_nss *nss);
int (*parse)(struct sudo_nss *nss);
@@ -37,7 +36,7 @@ struct sudo_nss {
short ret_if_notfound;
};
-TQ_DECLARE(sudo_nss)
+TAILQ_HEAD(sudo_nss_list, sudo_nss);
struct sudo_nss_list *sudo_read_nss(void);
diff --git a/plugins/sudoers/sudoers.c b/plugins/sudoers/sudoers.c
index 94a62d2b0..71525244c 100644
--- a/plugins/sudoers/sudoers.c
+++ b/plugins/sudoers/sudoers.c
@@ -150,14 +150,13 @@ sudoers_policy_init(void *info, char * const envp[])
set_perms(PERM_ROOT);
/* Open and parse sudoers, set global defaults */
- for (nss = snl->first; nss != NULL; nss = nss_next) {
- nss_next = nss->next;
+ TAILQ_FOREACH_SAFE(nss, snl, entries, nss_next) {
if (nss->open(nss) == 0 && nss->parse(nss) == 0) {
sources++;
if (nss->setdefs(nss) != 0)
log_warning(NO_STDERR, N_("problem with defaults entries"));
} else {
- tq_remove(snl, nss);
+ TAILQ_REMOVE(snl, nss, entries);
}
}
if (sources == 0) {
@@ -273,7 +272,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
*/
sudoers_setlocale(SUDOERS_LOCALE_SUDOERS, &oldlocale);
validated = FLAG_NO_USER | FLAG_NO_HOST;
- tq_foreach_fwd(snl, nss) {
+ TAILQ_FOREACH(nss, snl, entries) {
validated = nss->lookup(nss, validated, pwflag);
if (ISSET(validated, VALIDATE_OK)) {
@@ -413,7 +412,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
display_privs(snl, list_pw ? list_pw : sudo_user.pw); /* XXX - return val */
/* Cleanup sudoers sources */
- tq_foreach_fwd(snl, nss) {
+ TAILQ_FOREACH(nss, snl, entries) {
nss->close(nss);
}
if (def_group_plugin)
@@ -902,8 +901,9 @@ sudoers_cleanup(void)
debug_decl(sudoers_cleanup, SUDO_DEBUG_PLUGIN)
if (snl != NULL) {
- tq_foreach_fwd(snl, nss)
+ TAILQ_FOREACH(nss, snl, entries) {
nss->close(nss);
+ }
}
if (def_group_plugin)
group_plugin_unload();
diff --git a/plugins/sudoers/sudoers.h b/plugins/sudoers/sudoers.h
index 8118ea460..81a1bcfad 100644
--- a/plugins/sudoers/sudoers.h
+++ b/plugins/sudoers/sudoers.h
@@ -33,7 +33,7 @@
#include "missing.h"
#include "fatal.h"
#include "alloc.h"
-#include "list.h"
+#include "queue.h"
#include "fileops.h"
#include "defaults.h"
#include "logging.h"
diff --git a/plugins/sudoers/visudo.c b/plugins/sudoers/visudo.c
index 4d788e7a6..79418de27 100644
--- a/plugins/sudoers/visudo.c
+++ b/plugins/sudoers/visudo.c
@@ -79,20 +79,21 @@
#include "sudoers.h"
#include "parse.h"
#include "redblack.h"
+#include "queue.h"
#include "gettext.h"
#include "sudoers_version.h"
#include "sudo_conf.h"
#include <gram.h>
struct sudoersfile {
- struct sudoersfile *prev, *next;
+ TAILQ_ENTRY(sudoersfile) entries;
char *path;
char *tpath;
int fd;
int modified;
int doedit;
};
-TQ_DECLARE(sudoersfile)
+TAILQ_HEAD(sudoersfile_list, sudoersfile);
/*
* Function prototypes
@@ -131,7 +132,7 @@ extern bool parse_error;
*/
struct sudo_user sudo_user;
struct passwd *list_pw;
-static struct sudoersfile_list sudoerslist;
+static struct sudoersfile_list sudoerslist = TAILQ_HEAD_INITIALIZER(sudoerslist);
static struct rbtree *alias_freelist;
static bool checkonly;
static const char short_opts[] = "cf:hqsV";
@@ -250,10 +251,10 @@ main(int argc, char *argv[])
setup_signals();
/* Edit the sudoers file(s) */
- tq_foreach_fwd(&sudoerslist, sp) {
+ TAILQ_FOREACH(sp, &sudoerslist, entries) {
if (!sp->doedit)
continue;
- if (sp != tq_first(&sudoerslist)) {
+ if (sp != TAILQ_FIRST(&sudoerslist)) {
printf(_("press return to edit %s: "), sp->path);
while ((ch = getchar()) != EOF && ch != '\n')
continue;
@@ -266,7 +267,7 @@ main(int argc, char *argv[])
* and install the edited files as needed.
*/
if (reparse_sudoers(editor, args, strict, quiet)) {
- tq_foreach_fwd(&sudoerslist, sp) {
+ TAILQ_FOREACH(sp, &sudoerslist, entries) {
(void) install_sudoers(sp, oldperms);
}
}
@@ -482,8 +483,8 @@ reparse_sudoers(char *editor, char *args, bool strict, bool quiet)
/*
* Parse the edited sudoers files and do sanity checking
*/
- while ((sp = tq_first(&sudoerslist)) != NULL) {
- last = tq_last(&sudoerslist);
+ while ((sp = TAILQ_FIRST(&sudoerslist)) != NULL) {
+ last = TAILQ_LAST(&sudoerslist, sudoersfile_list);
fp = fopen(sp->tpath, "r+");
if (fp == NULL)
fatalx(_("unable to re-open temporary file (%s), %s unchanged."),
@@ -524,7 +525,7 @@ reparse_sudoers(char *editor, char *args, bool strict, bool quiet)
case 'e':
default:
/* Edit file with the parse error */
- tq_foreach_fwd(&sudoerslist, sp) {
+ TAILQ_FOREACH(sp, &sudoerslist, entries) {
if (errorfile == NULL || strcmp(sp->path, errorfile) == 0) {
edit_sudoers(sp, editor, args, errorlineno);
if (errorfile != NULL)
@@ -540,7 +541,7 @@ reparse_sudoers(char *editor, char *args, bool strict, bool quiet)
}
/* If any new #include directives were added, edit them too. */
- for (sp = last->next; sp != NULL; sp = sp->next) {
+ for (sp = TAILQ_NEXT(last, entries); sp != NULL; sp = TAILQ_NEXT(sp, entries)) {
printf(_("press return to edit %s: "), sp->path);
while ((ch = getchar()) != EOF && ch != '\n')
continue;
@@ -858,7 +859,7 @@ check_syntax(char *sudoers_path, bool quiet, bool strict, bool oldperms)
} else {
ok = false;
}
- tq_foreach_fwd(&sudoerslist, sp) {
+ TAILQ_FOREACH(sp, &sudoerslist, entries) {
if (oldperms || check_owner(sp->path, quiet)) {
if (!quiet)
(void) printf(_("%s: parsed OK\n"), sp->path);
@@ -890,7 +891,7 @@ open_sudoers(const char *path, bool doedit, bool *keepopen)
open_flags = O_RDWR | O_CREAT;
/* Check for existing entry */
- tq_foreach_fwd(&sudoerslist, entry) {
+ TAILQ_FOREACH(entry, &sudoerslist, entries) {
if (strcmp(path, entry->path) == 0)
break;
}
@@ -898,8 +899,6 @@ open_sudoers(const char *path, bool doedit, bool *keepopen)
entry = ecalloc(1, sizeof(*entry));
entry->path = estrdup(path);
/* entry->modified = 0; */
- entry->prev = entry;
- /* entry->next = NULL; */
entry->fd = open(entry->path, open_flags, SUDOERS_MODE);
/* entry->tpath = NULL; */
entry->doedit = doedit;
@@ -912,7 +911,7 @@ open_sudoers(const char *path, bool doedit, bool *keepopen)
fatalx(_("%s busy, try again later"), entry->path);
if ((fp = fdopen(entry->fd, "r")) == NULL)
fatal("%s", entry->path);
- tq_append(&sudoerslist, entry);
+ TAILQ_INSERT_TAIL(&sudoerslist, entry, entries);
} else {
/* Already exists, open .tmp version if there is one. */
if (entry->tpath != NULL) {
@@ -1271,7 +1270,7 @@ visudo_cleanup(void)
{
struct sudoersfile *sp;
- tq_foreach_fwd(&sudoerslist, sp) {
+ TAILQ_FOREACH(sp, &sudoerslist, entries) {
if (sp->tpath != NULL)
(void) unlink(sp->tpath);
}
@@ -1288,7 +1287,7 @@ quit(int signo)
struct sudoersfile *sp;
struct iovec iov[4];
- tq_foreach_fwd(&sudoerslist, sp) {
+ TAILQ_FOREACH(sp, &sudoerslist, entries) {
if (sp->tpath != NULL)
(void) unlink(sp->tpath);
}
diff --git a/src/Makefile.in b/src/Makefile.in
index 275bb3416..9a3f93e2a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -186,63 +186,61 @@ conversation.o: $(srcdir)/conversation.c $(top_builddir)/config.h \
$(srcdir)/sudo.h $(top_builddir)/pathnames.h \
$(top_srcdir)/compat/stdbool.h $(incdir)/missing.h \
$(incdir)/alloc.h $(incdir)/fatal.h $(incdir)/fileops.h \
- $(incdir)/list.h $(incdir)/sudo_conf.h $(incdir)/list.h \
- $(incdir)/sudo_debug.h $(incdir)/gettext.h \
- $(incdir)/sudo_plugin.h $(srcdir)/sudo_plugin_int.h
+ $(incdir)/sudo_conf.h $(incdir)/queue.h $(incdir)/sudo_debug.h \
+ $(incdir)/gettext.h $(incdir)/sudo_plugin.h \
+ $(srcdir)/sudo_plugin_int.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/conversation.c
env_hooks.o: $(srcdir)/env_hooks.c $(top_builddir)/config.h \
$(top_srcdir)/compat/dlfcn.h $(srcdir)/sudo.h \
$(top_builddir)/pathnames.h $(top_srcdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/alloc.h $(incdir)/fatal.h \
- $(incdir)/fileops.h $(incdir)/list.h $(incdir)/sudo_conf.h \
- $(incdir)/list.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
- $(incdir)/sudo_plugin.h
+ $(incdir)/fileops.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
+ $(incdir)/sudo_debug.h $(incdir)/gettext.h $(incdir)/sudo_plugin.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/env_hooks.c
exec.o: $(srcdir)/exec.c $(top_builddir)/config.h $(srcdir)/sudo.h \
$(top_builddir)/pathnames.h $(top_srcdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/alloc.h $(incdir)/fatal.h \
- $(incdir)/fileops.h $(incdir)/list.h $(incdir)/sudo_conf.h \
- $(incdir)/list.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
- $(srcdir)/sudo_exec.h $(incdir)/sudo_plugin.h \
+ $(incdir)/fileops.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
+ $(incdir)/sudo_debug.h $(incdir)/gettext.h $(srcdir)/sudo_exec.h \
+ $(incdir)/sudo_event.h $(incdir)/queue.h $(incdir)/sudo_plugin.h \
$(srcdir)/sudo_plugin_int.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/exec.c
exec_common.o: $(srcdir)/exec_common.c $(top_builddir)/config.h \
$(srcdir)/sudo.h $(top_builddir)/pathnames.h \
$(top_srcdir)/compat/stdbool.h $(incdir)/missing.h \
$(incdir)/alloc.h $(incdir)/fatal.h $(incdir)/fileops.h \
- $(incdir)/list.h $(incdir)/sudo_conf.h $(incdir)/list.h \
- $(incdir)/sudo_debug.h $(incdir)/gettext.h $(srcdir)/sudo_exec.h
+ $(incdir)/sudo_conf.h $(incdir)/queue.h $(incdir)/sudo_debug.h \
+ $(incdir)/gettext.h $(srcdir)/sudo_exec.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/exec_common.c
exec_pty.o: $(srcdir)/exec_pty.c $(top_builddir)/config.h $(srcdir)/sudo.h \
$(top_builddir)/pathnames.h $(top_srcdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/alloc.h $(incdir)/fatal.h \
- $(incdir)/fileops.h $(incdir)/list.h $(incdir)/sudo_conf.h \
- $(incdir)/list.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
- $(srcdir)/sudo_exec.h $(incdir)/sudo_plugin.h \
+ $(incdir)/fileops.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
+ $(incdir)/sudo_debug.h $(incdir)/gettext.h $(incdir)/sudo_event.h \
+ $(incdir)/queue.h $(srcdir)/sudo_exec.h $(incdir)/sudo_plugin.h \
$(srcdir)/sudo_plugin_int.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/exec_pty.c
get_pty.o: $(srcdir)/get_pty.c $(top_builddir)/config.h $(srcdir)/sudo.h \
$(top_builddir)/pathnames.h $(top_srcdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/alloc.h $(incdir)/fatal.h \
- $(incdir)/fileops.h $(incdir)/list.h $(incdir)/sudo_conf.h \
- $(incdir)/list.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
+ $(incdir)/fileops.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
+ $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/get_pty.c
hooks.o: $(srcdir)/hooks.c $(top_builddir)/config.h $(srcdir)/sudo.h \
$(top_builddir)/pathnames.h $(top_srcdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/alloc.h $(incdir)/fatal.h \
- $(incdir)/fileops.h $(incdir)/list.h $(incdir)/sudo_conf.h \
- $(incdir)/list.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
- $(incdir)/sudo_plugin.h $(srcdir)/sudo_plugin_int.h \
- $(incdir)/sudo_debug.h
+ $(incdir)/fileops.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
+ $(incdir)/sudo_debug.h $(incdir)/gettext.h $(incdir)/sudo_plugin.h \
+ $(srcdir)/sudo_plugin_int.h $(incdir)/sudo_debug.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/hooks.c
load_plugins.o: $(srcdir)/load_plugins.c $(top_builddir)/config.h \
$(top_srcdir)/compat/dlfcn.h $(srcdir)/sudo.h \
$(top_builddir)/pathnames.h $(top_srcdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/alloc.h $(incdir)/fatal.h \
- $(incdir)/fileops.h $(incdir)/list.h $(incdir)/sudo_conf.h \
- $(incdir)/list.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
+ $(incdir)/fileops.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
+ $(incdir)/sudo_debug.h $(incdir)/gettext.h \
$(incdir)/sudo_plugin.h $(srcdir)/sudo_plugin_int.h \
- $(incdir)/sudo_conf.h $(incdir)/list.h $(incdir)/sudo_debug.h
+ $(incdir)/sudo_conf.h $(incdir)/queue.h $(incdir)/sudo_debug.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/load_plugins.c
locale_stub.o: $(srcdir)/locale_stub.c $(top_builddir)/config.h \
$(incdir)/missing.h $(incdir)/fatal.h
@@ -254,56 +252,54 @@ net_ifs.o: $(srcdir)/net_ifs.c $(top_builddir)/config.h $(incdir)/missing.h \
openbsd.o: $(srcdir)/openbsd.c $(top_builddir)/config.h $(srcdir)/sudo.h \
$(top_builddir)/pathnames.h $(top_srcdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/alloc.h $(incdir)/fatal.h \
- $(incdir)/fileops.h $(incdir)/list.h $(incdir)/sudo_conf.h \
- $(incdir)/list.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
+ $(incdir)/fileops.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
+ $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/openbsd.c
parse_args.o: $(srcdir)/parse_args.c $(top_builddir)/config.h \
$(top_srcdir)/compat/getopt.h ./sudo_usage.h $(srcdir)/sudo.h \
$(top_builddir)/pathnames.h $(top_srcdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/alloc.h $(incdir)/fatal.h \
- $(incdir)/fileops.h $(incdir)/list.h $(incdir)/sudo_conf.h \
- $(incdir)/list.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
- $(incdir)/lbuf.h
+ $(incdir)/fileops.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
+ $(incdir)/sudo_debug.h $(incdir)/gettext.h $(incdir)/lbuf.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/parse_args.c
preload.o: $(srcdir)/preload.c $(top_builddir)/config.h $(incdir)/sudo_plugin.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/preload.c
selinux.o: $(srcdir)/selinux.c $(top_builddir)/config.h $(srcdir)/sudo.h \
$(top_builddir)/pathnames.h $(top_srcdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/alloc.h $(incdir)/fatal.h \
- $(incdir)/fileops.h $(incdir)/list.h $(incdir)/sudo_conf.h \
- $(incdir)/list.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
- $(srcdir)/sudo_exec.h
+ $(incdir)/fileops.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
+ $(incdir)/sudo_debug.h $(incdir)/gettext.h $(srcdir)/sudo_exec.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/selinux.c
sesh.o: $(srcdir)/sesh.c $(top_builddir)/config.h \
$(top_srcdir)/compat/stdbool.h $(incdir)/missing.h $(incdir)/alloc.h \
$(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/sudo_conf.h \
- $(incdir)/list.h $(incdir)/sudo_debug.h $(srcdir)/sudo_exec.h \
+ $(incdir)/queue.h $(incdir)/sudo_debug.h $(srcdir)/sudo_exec.h \
$(incdir)/sudo_plugin.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sesh.c
signal.o: $(srcdir)/signal.c $(top_builddir)/config.h $(srcdir)/sudo.h \
$(top_builddir)/pathnames.h $(top_srcdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/alloc.h $(incdir)/fatal.h \
- $(incdir)/fileops.h $(incdir)/list.h $(incdir)/sudo_conf.h \
- $(incdir)/list.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
+ $(incdir)/fileops.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
+ $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/signal.c
solaris.o: $(srcdir)/solaris.c $(top_builddir)/config.h $(srcdir)/sudo.h \
$(top_builddir)/pathnames.h $(top_srcdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/alloc.h $(incdir)/fatal.h \
- $(incdir)/fileops.h $(incdir)/list.h $(incdir)/sudo_conf.h \
- $(incdir)/list.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
+ $(incdir)/fileops.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
+ $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/solaris.c
sudo.o: $(srcdir)/sudo.c $(top_builddir)/config.h ./sudo_usage.h \
$(srcdir)/sudo.h $(top_builddir)/pathnames.h \
$(top_srcdir)/compat/stdbool.h $(incdir)/missing.h $(incdir)/alloc.h \
- $(incdir)/fatal.h $(incdir)/fileops.h $(incdir)/list.h \
- $(incdir)/sudo_conf.h $(incdir)/list.h $(incdir)/sudo_debug.h \
- $(incdir)/gettext.h $(incdir)/sudo_plugin.h $(srcdir)/sudo_plugin_int.h
+ $(incdir)/fatal.h $(incdir)/fileops.h $(incdir)/sudo_conf.h \
+ $(incdir)/queue.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
+ $(incdir)/sudo_plugin.h $(srcdir)/sudo_plugin_int.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo.c
sudo_edit.o: $(srcdir)/sudo_edit.c $(top_builddir)/config.h $(srcdir)/sudo.h \
$(top_builddir)/pathnames.h $(top_srcdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/alloc.h $(incdir)/fatal.h \
- $(incdir)/fileops.h $(incdir)/list.h $(incdir)/sudo_conf.h \
- $(incdir)/list.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
+ $(incdir)/fileops.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
+ $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo_edit.c
sudo_noexec.lo: $(srcdir)/sudo_noexec.c $(top_builddir)/config.h \
$(incdir)/missing.h
@@ -311,20 +307,18 @@ sudo_noexec.lo: $(srcdir)/sudo_noexec.c $(top_builddir)/config.h \
tgetpass.o: $(srcdir)/tgetpass.c $(top_builddir)/config.h $(srcdir)/sudo.h \
$(top_builddir)/pathnames.h $(top_srcdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/alloc.h $(incdir)/fatal.h \
- $(incdir)/fileops.h $(incdir)/list.h $(incdir)/sudo_conf.h \
- $(incdir)/list.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
- $(incdir)/sudo_plugin.h
+ $(incdir)/fileops.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
+ $(incdir)/sudo_debug.h $(incdir)/gettext.h $(incdir)/sudo_plugin.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/tgetpass.c
ttyname.o: $(srcdir)/ttyname.c $(top_builddir)/config.h $(srcdir)/sudo.h \
$(top_builddir)/pathnames.h $(top_srcdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/alloc.h $(incdir)/fatal.h \
- $(incdir)/fileops.h $(incdir)/list.h $(incdir)/sudo_conf.h \
- $(incdir)/list.h $(incdir)/sudo_debug.h $(incdir)/gettext.h
+ $(incdir)/fileops.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
+ $(incdir)/sudo_debug.h $(incdir)/gettext.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/ttyname.c
utmp.o: $(srcdir)/utmp.c $(top_builddir)/config.h $(srcdir)/sudo.h \
$(top_builddir)/pathnames.h $(top_srcdir)/compat/stdbool.h \
$(incdir)/missing.h $(incdir)/alloc.h $(incdir)/fatal.h \
- $(incdir)/fileops.h $(incdir)/list.h $(incdir)/sudo_conf.h \
- $(incdir)/list.h $(incdir)/sudo_debug.h $(incdir)/gettext.h \
- $(srcdir)/sudo_exec.h
+ $(incdir)/fileops.h $(incdir)/sudo_conf.h $(incdir)/queue.h \
+ $(incdir)/sudo_debug.h $(incdir)/gettext.h $(srcdir)/sudo_exec.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/utmp.c
diff --git a/src/exec.c b/src/exec.c
index ecc699fcf..8c6b4678f 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -65,14 +65,13 @@ struct exec_closure {
/* We keep a tailq of signals to forward to child. */
struct sigforward {
- struct sigforward *prev, *next;
+ TAILQ_ENTRY(sigforward) entries;
int signo;
};
-static struct {
- struct sigforward *first, *last;
- struct sudo_event *event;
-} sigfwd_list;
+TAILQ_HEAD(sigfwd_list, sigforward);
+static struct sigfwd_list sigfwd_list = TAILQ_HEAD_INITIALIZER(sigfwd_list);
static struct sudo_event *signal_event;
+static struct sudo_event *sigfwd_event;
static struct sudo_event *backchannel_event;
static pid_t ppgrp = -1;
@@ -318,9 +317,9 @@ exec_event_setup(int backchannel, struct exec_closure *ec)
fatal(_("unable to add event to queue"));
/* The signal forwarding event gets added on demand. */
- sigfwd_list.event = sudo_ev_alloc(backchannel,
+ sigfwd_event = sudo_ev_alloc(backchannel,
SUDO_EV_WRITE, forward_signals, NULL);
- if (sigfwd_list.event == NULL)
+ if (sigfwd_event == NULL)
fatal(NULL);
sudo_debug_printf(SUDO_DEBUG_INFO, "signal pipe fd %d\n", signal_pipe[0]);
@@ -373,7 +372,7 @@ sudo_execute(struct command_details *details, struct command_status *cstat)
* need to allocate a pty. It is OK to set log_io in the pty-only case
* as the io plugin tailqueue will be empty and no I/O logging will occur.
*/
- if (!tq_empty(&io_plugins) || ISSET(details->flags, CD_USE_PTY)) {
+ if (!TAILQ_EMPTY(&io_plugins) || ISSET(details->flags, CD_USE_PTY)) {
log_io = true;
if (ISSET(details->flags, CD_SET_UTMP))
utmp_user = details->utmp_user ? details->utmp_user : user_details.username;
@@ -494,12 +493,12 @@ sudo_execute(struct command_details *details, struct command_status *cstat)
#endif
/* Free things up. */
- while (!tq_empty(&sigfwd_list)) {
- struct sigforward *sigfwd = tq_first(&sigfwd_list);
- tq_remove(&sigfwd_list, sigfwd);
+ while (!TAILQ_EMPTY(&sigfwd_list)) {
+ struct sigforward *sigfwd = TAILQ_FIRST(&sigfwd_list);
+ TAILQ_REMOVE(&sigfwd_list, sigfwd, entries);
efree(sigfwd);
}
- sudo_ev_free(sigfwd_list.event);
+ sudo_ev_free(sigfwd_event);
sudo_ev_free(signal_event);
sudo_ev_free(backchannel_event);
sudo_ev_base_free(evbase);
@@ -782,8 +781,8 @@ forward_signals(int sock, int what, void *v)
ssize_t nsent;
debug_decl(forward_signals, SUDO_DEBUG_EXEC)
- while (!tq_empty(&sigfwd_list)) {
- sigfwd = tq_first(&sigfwd_list);
+ while (!TAILQ_EMPTY(&sigfwd_list)) {
+ sigfwd = TAILQ_FIRST(&sigfwd_list);
if (sigfwd->signo == SIGCONT_FG)
strlcpy(signame, "CONT_FG", sizeof(signame));
else if (sigfwd->signo == SIGCONT_BG)
@@ -797,16 +796,16 @@ forward_signals(int sock, int what, void *v)
do {
nsent = send(sock, &cstat, sizeof(cstat), 0);
} while (nsent == -1 && errno == EINTR);
- tq_remove(&sigfwd_list, sigfwd);
+ TAILQ_REMOVE(&sigfwd_list, sigfwd, entries);
efree(sigfwd);
if (nsent != sizeof(cstat)) {
if (errno == EPIPE) {
sudo_debug_printf(SUDO_DEBUG_ERROR,
"broken pipe writing to child over backchannel");
/* Other end of socket gone, empty out sigfwd_list. */
- while (!tq_empty(&sigfwd_list)) {
- sigfwd = tq_first(&sigfwd_list);
- tq_remove(&sigfwd_list, sigfwd);
+ while (!TAILQ_EMPTY(&sigfwd_list)) {
+ sigfwd = TAILQ_FIRST(&sigfwd_list);
+ TAILQ_REMOVE(&sigfwd_list, sigfwd, entries);
efree(sigfwd);
}
/* XXX - child (monitor) is dead, we should exit too? */
@@ -835,12 +834,10 @@ schedule_signal(struct sudo_event_base *evbase, int signo)
sudo_debug_printf(SUDO_DEBUG_DIAG, "scheduled SIG%s for child", signame);
sigfwd = ecalloc(1, sizeof(*sigfwd));
- sigfwd->prev = sigfwd;
- /* sigfwd->next = NULL; */
sigfwd->signo = signo;
- tq_append(&sigfwd_list, sigfwd);
+ TAILQ_INSERT_TAIL(&sigfwd_list, sigfwd, entries);
- if (sudo_ev_add(evbase, sigfwd_list.event, true) == -1)
+ if (sudo_ev_add(evbase, sigfwd_event, true) == -1)
fatal(_("unable to add event to queue"));
debug_return;
diff --git a/src/exec_pty.c b/src/exec_pty.c
index f6fd62378..a4a635e3f 100644
--- a/src/exec_pty.c
+++ b/src/exec_pty.c
@@ -117,7 +117,7 @@ pty_cleanup(void)
{
debug_decl(cleanup, SUDO_DEBUG_EXEC);
- if (!tq_empty(&io_plugins) && io_fds[SFD_USERTTY] != -1) {
+ if (!TAILQ_EMPTY(&io_plugins) && io_fds[SFD_USERTTY] != -1) {
check_foreground();
if (foreground)
term_restore(io_fds[SFD_USERTTY], 0);
@@ -202,7 +202,7 @@ log_ttyin(const char *buf, unsigned int n)
debug_decl(log_ttyin, SUDO_DEBUG_EXEC);
sigprocmask(SIG_BLOCK, &ttyblock, &omask);
- tq_foreach_fwd(&io_plugins, plugin) {
+ TAILQ_FOREACH(plugin, &io_plugins, entries) {
if (plugin->u.io->log_ttyin) {
if (!plugin->u.io->log_ttyin(buf, n)) {
rval = false;
@@ -225,7 +225,7 @@ log_stdin(const char *buf, unsigned int n)
debug_decl(log_stdin, SUDO_DEBUG_EXEC);
sigprocmask(SIG_BLOCK, &ttyblock, &omask);
- tq_foreach_fwd(&io_plugins, plugin) {
+ TAILQ_FOREACH(plugin, &io_plugins, entries) {
if (plugin->u.io->log_stdin) {
if (!plugin->u.io->log_stdin(buf, n)) {
rval = false;
@@ -248,7 +248,7 @@ log_ttyout(const char *buf, unsigned int n)
debug_decl(log_ttyout, SUDO_DEBUG_EXEC);
sigprocmask(SIG_BLOCK, &ttyblock, &omask);
- tq_foreach_fwd(&io_plugins, plugin) {
+ TAILQ_FOREACH(plugin, &io_plugins, entries) {
if (plugin->u.io->log_ttyout) {
if (!plugin->u.io->log_ttyout(buf, n)) {
rval = false;
@@ -271,7 +271,7 @@ log_stdout(const char *buf, unsigned int n)
debug_decl(log_stdout, SUDO_DEBUG_EXEC);
sigprocmask(SIG_BLOCK, &ttyblock, &omask);
- tq_foreach_fwd(&io_plugins, plugin) {
+ TAILQ_FOREACH(plugin, &io_plugins, entries) {
if (plugin->u.io->log_stdout) {
if (!plugin->u.io->log_stdout(buf, n)) {
rval = false;
@@ -294,7 +294,7 @@ log_stderr(const char *buf, unsigned int n)
debug_decl(log_stderr, SUDO_DEBUG_EXEC);
sigprocmask(SIG_BLOCK, &ttyblock, &omask);
- tq_foreach_fwd(&io_plugins, plugin) {
+ TAILQ_FOREACH(plugin, &io_plugins, entries) {
if (plugin->u.io->log_stderr) {
if (!plugin->u.io->log_stderr(buf, n)) {
rval = false;
diff --git a/src/load_plugins.c b/src/load_plugins.c
index 1817d0efd..c84dacbf1 100644
--- a/src/load_plugins.c
+++ b/src/load_plugins.c
@@ -231,7 +231,7 @@ sudo_load_plugin(struct plugin_container *policy_plugin,
}
} else if (plugin->type == SUDO_IO_PLUGIN) {
/* Check for duplicate entries. */
- tq_foreach_fwd(io_plugins, container) {
+ TAILQ_FOREACH(container, io_plugins, entries) {
if (strcmp(container->name, info->symbol_name) == 0) {
warningx(_("ignoring duplicate I/O plugin `%s' in %s, line %d"),
info->symbol_name, _PATH_SUDO_CONF, info->lineno);
@@ -242,13 +242,11 @@ sudo_load_plugin(struct plugin_container *policy_plugin,
}
if (handle != NULL) {
container = ecalloc(1, sizeof(*container));
- container->prev = container;
- /* container->next = NULL; */
container->handle = handle;
container->name = info->symbol_name;
container->options = info->options;
container->u.generic = plugin;
- tq_append(io_plugins, container);
+ TAILQ_INSERT_TAIL(io_plugins, container, entries);
}
}
@@ -272,7 +270,7 @@ sudo_load_plugins(struct plugin_container *policy_plugin,
/* Walk the plugin list from sudo.conf, if any. */
plugins = sudo_conf_plugins();
- tq_foreach_fwd(plugins, info) {
+ TAILQ_FOREACH(info, plugins, entries) {
rval = sudo_load_plugin(policy_plugin, io_plugins, info);
if (!rval)
goto done;
@@ -288,21 +286,17 @@ sudo_load_plugins(struct plugin_container *policy_plugin,
info->symbol_name = "sudoers_policy";
info->path = SUDOERS_PLUGIN;
/* info->options = NULL; */
- info->prev = info;
- /* info->next = NULL; */
rval = sudo_load_plugin(policy_plugin, io_plugins, info);
efree(info);
if (!rval)
goto done;
/* Default I/O plugin */
- if (tq_empty(io_plugins)) {
+ if (TAILQ_EMPTY(io_plugins)) {
info = ecalloc(1, sizeof(*info));
info->symbol_name = "sudoers_io";
info->path = SUDOERS_PLUGIN;
/* info->options = NULL; */
- info->prev = info;
- /* info->next = NULL; */
rval = sudo_load_plugin(policy_plugin, io_plugins, info);
efree(info);
if (!rval)
@@ -321,7 +315,7 @@ sudo_load_plugins(struct plugin_container *policy_plugin,
if (policy_plugin->u.policy->register_hooks != NULL)
policy_plugin->u.policy->register_hooks(SUDO_HOOK_VERSION, register_hook);
}
- tq_foreach_fwd(io_plugins, container) {
+ TAILQ_FOREACH(container, io_plugins, entries) {
if (container->u.io->version >= SUDO_API_MKVERSION(1, 2)) {
if (container->u.io->register_hooks != NULL)
container->u.io->register_hooks(SUDO_HOOK_VERSION, register_hook);
diff --git a/src/sudo.c b/src/sudo.c
index 15190d260..a3a36ba20 100644
--- a/src/sudo.c
+++ b/src/sudo.c
@@ -92,7 +92,7 @@
* Local variables
*/
struct plugin_container policy_plugin;
-struct plugin_container_list io_plugins;
+struct plugin_container_list io_plugins = TAILQ_HEAD_INITIALIZER(io_plugins);
struct user_details user_details;
const char *list_user; /* extern for parse_args.c */
static struct command_details command_details;
@@ -216,7 +216,7 @@ main(int argc, char *argv[], char *envp[])
switch (sudo_mode & MODE_MASK) {
case MODE_VERSION:
policy_show_version(&policy_plugin, !user_details.uid);
- tq_foreach_fwd(&io_plugins, plugin) {
+ TAILQ_FOREACH(plugin, &io_plugins, entries) {
ok = iolog_open(plugin, settings, user_info, NULL,
nargc, nargv, envp);
if (ok != -1)
@@ -250,8 +250,7 @@ main(int argc, char *argv[], char *envp[])
exit(1); /* plugin printed error message */
}
/* Open I/O plugins once policy plugin succeeds. */
- for (plugin = io_plugins.first; plugin != NULL; plugin = next) {
- next = plugin->next;
+ TAILQ_FOREACH_SAFE(plugin, &io_plugins, entries, next) {
ok = iolog_open(plugin, settings, user_info,
command_info, nargc, nargv, envp);
switch (ok) {
@@ -1051,7 +1050,7 @@ run_command(struct command_details *details)
sudo_debug_printf(SUDO_DEBUG_DEBUG,
"calling policy close with errno %d", cstat.val);
policy_close(&policy_plugin, 0, cstat.val);
- tq_foreach_fwd(&io_plugins, plugin) {
+ TAILQ_FOREACH(plugin, &io_plugins, entries) {
sudo_debug_printf(SUDO_DEBUG_DEBUG,
"calling I/O close with errno %d", cstat.val);
iolog_close(plugin, 0, cstat.val);
@@ -1063,7 +1062,7 @@ run_command(struct command_details *details)
sudo_debug_printf(SUDO_DEBUG_DEBUG,
"calling policy close with wait status %d", cstat.val);
policy_close(&policy_plugin, cstat.val, 0);
- tq_foreach_fwd(&io_plugins, plugin) {
+ TAILQ_FOREACH(plugin, &io_plugins, entries) {
sudo_debug_printf(SUDO_DEBUG_DEBUG,
"calling I/O close with wait status %d", cstat.val);
iolog_close(plugin, cstat.val, 0);
@@ -1262,7 +1261,7 @@ iolog_unlink(struct plugin_container *plugin)
deregister_hook);
}
/* Remove from io_plugins list and free. */
- tq_remove(&io_plugins, plugin);
+ TAILQ_REMOVE(&io_plugins, plugin, entries);
efree(plugin);
debug_return;
diff --git a/src/sudo.h b/src/sudo.h
index 7576d5ae4..9758c40c9 100644
--- a/src/sudo.h
+++ b/src/sudo.h
@@ -34,7 +34,6 @@
#include "alloc.h"
#include "fatal.h"
#include "fileops.h"
-#include "list.h"
#include "sudo_conf.h"
#include "sudo_debug.h"
#include "gettext.h"
diff --git a/src/sudo_plugin_int.h b/src/sudo_plugin_int.h
index 898ae4f49..a1d3e9baa 100644
--- a/src/sudo_plugin_int.h
+++ b/src/sudo_plugin_int.h
@@ -81,8 +81,7 @@ struct io_plugin_1_1 {
* Sudo plugin internals.
*/
struct plugin_container {
- struct plugin_container *prev; /* required */
- struct plugin_container *next; /* required */
+ TAILQ_ENTRY(plugin_container) entries;
const char *name;
char * const *options;
void *handle;
@@ -95,7 +94,7 @@ struct plugin_container {
struct io_plugin_1_1 *io_1_1;
} u;
};
-TQ_DECLARE(plugin_container)
+TAILQ_HEAD(plugin_container_list, plugin_container);
extern struct plugin_container policy_plugin;
extern struct plugin_container_list io_plugins;