From 2d61d38c23c8df472b7fdbbe27bdfa515c6fc86a Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 27 Jun 2014 10:48:31 -0600 Subject: [PATCH] Add sudo_ prefix to alloc.c functions and rename alloc.h -> sudo_alloc.h --- include/{alloc.h => sudo_alloc.h} | 20 +- lib/util/Makefile.in | 51 ++-- lib/util/aix.c | 4 +- lib/util/alloc.c | 82 +++--- lib/util/event.c | 6 +- lib/util/event_poll.c | 6 +- lib/util/event_select.c | 18 +- lib/util/fatal.c | 4 +- lib/util/gidlist.c | 4 +- lib/util/lbuf.c | 4 +- lib/util/sudo_conf.c | 22 +- lib/util/sudo_debug.c | 2 +- lib/util/util.exp | 30 +- plugins/sudoers/Makefile.in | 437 ++++++++++++++-------------- plugins/sudoers/alias.c | 2 +- plugins/sudoers/auth/bsdauth.c | 2 +- plugins/sudoers/auth/kerb5.c | 6 +- plugins/sudoers/auth/pam.c | 2 +- plugins/sudoers/auth/rfc1938.c | 2 +- plugins/sudoers/auth/sia.c | 2 +- plugins/sudoers/defaults.c | 44 +-- plugins/sudoers/env.c | 28 +- plugins/sudoers/find_path.c | 2 +- plugins/sudoers/getspwuid.c | 2 +- plugins/sudoers/gram.c | 36 +-- plugins/sudoers/gram.y | 36 +-- plugins/sudoers/group_plugin.c | 2 +- plugins/sudoers/interfaces.c | 6 +- plugins/sudoers/iolog.c | 2 +- plugins/sudoers/iolog_path.c | 2 +- plugins/sudoers/ldap.c | 48 +-- plugins/sudoers/linux_audit.c | 4 +- plugins/sudoers/locale.c | 10 +- plugins/sudoers/logging.c | 14 +- plugins/sudoers/match.c | 16 +- plugins/sudoers/parse.c | 8 +- plugins/sudoers/policy.c | 62 ++-- plugins/sudoers/prompt.c | 4 +- plugins/sudoers/pwutil.c | 14 +- plugins/sudoers/pwutil_impl.c | 12 +- plugins/sudoers/redblack.c | 6 +- plugins/sudoers/sssd.c | 30 +- plugins/sudoers/sudoers.c | 20 +- plugins/sudoers/sudoers.h | 2 +- plugins/sudoers/sudoreplay.c | 26 +- plugins/sudoers/testsudoers.c | 4 +- plugins/sudoers/visudo.c | 16 +- src/Makefile.in | 165 ++++++----- src/conversation.c | 2 +- src/env_hooks.c | 2 +- src/exec.c | 2 +- src/exec_common.c | 8 +- src/exec_pty.c | 2 +- src/hooks.c | 2 +- src/load_plugins.c | 8 +- src/net_ifs.c | 8 +- src/parse_args.c | 12 +- src/preserve_fds.c | 4 +- src/regress/ttyname/check_ttyname.c | 6 +- src/selinux.c | 6 +- src/sesh.c | 4 +- src/sudo.c | 36 +-- src/sudo.h | 2 +- src/sudo_edit.c | 8 +- src/ttyname.c | 20 +- 65 files changed, 736 insertions(+), 723 deletions(-) rename include/{alloc.h => sudo_alloc.h} (59%) diff --git a/include/alloc.h b/include/sudo_alloc.h similarity index 59% rename from include/alloc.h rename to include/sudo_alloc.h index f40518787..e54a3dc86 100644 --- a/include/alloc.h +++ b/include/sudo_alloc.h @@ -23,15 +23,15 @@ #undef efree #define efree(x) free((void *)(x)) -__dso_public int easprintf(char **, const char *, ...) __printflike(2, 3); -__dso_public int evasprintf(char **, const char *, va_list) __printflike(2, 0); -__dso_public void *ecalloc(size_t, size_t) __malloc_like; -__dso_public void *emalloc(size_t) __malloc_like; -__dso_public void *emallocarray(size_t, size_t) __malloc_like; -__dso_public void *erealloc(void *, size_t); -__dso_public void *ereallocarray(void *, size_t, size_t); -__dso_public void *erecalloc(void *, size_t, size_t, size_t); -__dso_public char *estrdup(const char *) __malloc_like; -__dso_public char *estrndup(const char *, size_t) __malloc_like; +__dso_public int sudo_easprintf(char **, const char *, ...) __printflike(2, 3); +__dso_public int sudo_evasprintf(char **, const char *, va_list) __printflike(2, 0); +__dso_public void *sudo_ecalloc(size_t, size_t) __malloc_like; +__dso_public void *sudo_emalloc(size_t) __malloc_like; +__dso_public void *sudo_emallocarray(size_t, size_t) __malloc_like; +__dso_public void *sudo_erealloc(void *, size_t); +__dso_public void *sudo_ereallocarray(void *, size_t, size_t); +__dso_public void *sudo_erecalloc(void *, size_t, size_t, size_t); +__dso_public char *sudo_estrdup(const char *) __malloc_like; +__dso_public char *sudo_estrndup(const char *, size_t) __malloc_like; #endif /* _SUDO_ALLOC_H */ diff --git a/lib/util/Makefile.in b/lib/util/Makefile.in index df2df7e51..7328ce1c3 100644 --- a/lib/util/Makefile.in +++ b/lib/util/Makefile.in @@ -280,12 +280,12 @@ realclean: distclean cleandir: realclean # Autogenerated dependencies, do not modify -aix.lo: $(srcdir)/aix.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ +aix.lo: $(srcdir)/aix.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/sudo_alloc.h \ $(incdir)/sudo_debug.h $(incdir)/sudo_util.h $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/aix.c -alloc.lo: $(srcdir)/alloc.c $(incdir)/alloc.h $(incdir)/fatal.h \ - $(incdir)/gettext.h $(incdir)/missing.h $(top_builddir)/config.h +alloc.lo: $(srcdir)/alloc.c $(incdir)/fatal.h $(incdir)/gettext.h \ + $(incdir)/missing.h $(incdir)/sudo_alloc.h $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/alloc.c atobool.lo: $(srcdir)/atobool.c $(incdir)/compat/stdbool.h $(incdir)/missing.h \ $(incdir)/sudo_debug.h $(incdir)/sudo_util.h \ @@ -314,25 +314,26 @@ conf_test.lo: $(srcdir)/regress/sudo_conf/conf_test.c \ $(incdir)/sudo_conf.h $(incdir)/sudo_util.h \ $(top_builddir)/config.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 $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/missing.h $(incdir)/queue.h \ +event.lo: $(srcdir)/event.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ $(incdir)/sudo_debug.h $(incdir)/sudo_event.h $(incdir)/sudo_util.h \ $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/event.c -event_poll.lo: $(srcdir)/event_poll.c $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +event_poll.lo: $(srcdir)/event_poll.c $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_event.h $(top_builddir)/config.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 $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +event_select.lo: $(srcdir)/event_select.c $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_event.h $(incdir)/sudo_util.h \ $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/event_select.c -fatal.lo: $(srcdir)/fatal.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_plugin.h $(top_builddir)/config.h +fatal.lo: $(srcdir)/fatal.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_plugin.h \ + $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/fatal.c fnm_test.lo: $(srcdir)/regress/fnmatch/fnm_test.c $(incdir)/compat/fnmatch.h \ $(incdir)/missing.h $(top_builddir)/config.h @@ -356,8 +357,8 @@ getline.lo: $(srcdir)/getline.c $(incdir)/missing.h $(top_builddir)/config.h getopt_long.lo: $(srcdir)/getopt_long.c $(incdir)/compat/getopt.h \ $(incdir)/fatal.h $(incdir)/missing.h $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/getopt_long.c -gidlist.lo: $(srcdir)/gidlist.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ +gidlist.lo: $(srcdir)/gidlist.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/sudo_alloc.h \ $(incdir)/sudo_debug.h $(incdir)/sudo_util.h \ $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/gidlist.c @@ -378,8 +379,8 @@ key_val.lo: $(srcdir)/key_val.c $(incdir)/compat/stdbool.h $(incdir)/missing.h \ $(incdir)/sudo_debug.h $(incdir)/sudo_util.h \ $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/key_val.c -lbuf.lo: $(srcdir)/lbuf.c $(incdir)/alloc.h $(incdir)/fatal.h \ - $(incdir)/missing.h $(incdir)/sudo_debug.h $(incdir)/sudo_lbuf.h \ +lbuf.lo: $(srcdir)/lbuf.c $(incdir)/fatal.h $(incdir)/missing.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h $(incdir)/sudo_lbuf.h \ $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/lbuf.c locale_stub.lo: $(top_srcdir)/src/locale_stub.c $(incdir)/fatal.h \ @@ -443,16 +444,16 @@ strsignal.lo: $(srcdir)/strsignal.c $(incdir)/gettext.h $(incdir)/missing.h \ strtonum.lo: $(srcdir)/strtonum.c $(incdir)/gettext.h $(incdir)/missing.h \ $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/strtonum.c -sudo_conf.lo: $(srcdir)/sudo_conf.c $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/secure_path.h \ +sudo_conf.lo: $(srcdir)/sudo_conf.c $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/secure_path.h $(incdir)/sudo_alloc.h \ $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.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 $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ - $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/sudo_debug.h \ +sudo_debug.lo: $(srcdir)/sudo_debug.c $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo_debug.c diff --git a/lib/util/aix.c b/lib/util/aix.c index 89520e437..719fae75b 100644 --- a/lib/util/aix.c +++ b/lib/util/aix.c @@ -35,7 +35,7 @@ #include "gettext.h" /* must be included before missing.h */ #include "missing.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "fatal.h" #include "sudo_debug.h" #include "sudo_util.h" @@ -187,7 +187,7 @@ aix_prep_user(char *user, const char *tty) debug_decl(aix_setauthdb, SUDO_DEBUG_UTIL) /* set usrinfo, like login(1) does */ - len = easprintf(&info, "NAME=%s%cLOGIN=%s%cLOGNAME=%s%cTTY=%s%c", + len = sudo_easprintf(&info, "NAME=%s%cLOGIN=%s%cLOGNAME=%s%cTTY=%s%c", user, '\0', user, '\0', user, '\0', tty ? tty : "", '\0'); (void)usrinfo(SETUINFO, info, len); efree(info); diff --git a/lib/util/alloc.c b/lib/util/alloc.c index f8b5a03f1..c6f94ba66 100644 --- a/lib/util/alloc.c +++ b/lib/util/alloc.c @@ -52,13 +52,13 @@ #include "gettext.h" /* must be included before missing.h */ #include "missing.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "fatal.h" /* * If there is no SIZE_MAX or SIZE_T_MAX we have to assume that size_t * could be signed (as it is on SunOS 4.x). This just means that - * emallocarray() and ereallocarray() cannot allocate huge amounts on such a + * sudo_emallocarray() and sudo_ereallocarray() cannot allocate huge amounts on such a * platform but that is OK since sudo doesn't need to do so anyway. */ #ifndef SIZE_MAX @@ -70,16 +70,16 @@ #endif /* SIZE_MAX */ /* - * emalloc() calls the system malloc(3) and exits with an error if + * sudo_emalloc() calls the system malloc(3) and exits with an error if * malloc(3) fails. */ void * -emalloc(size_t size) +sudo_emalloc(size_t size) { void *ptr; if (size == 0) - sudo_fatalx_nodebug(_("internal error, tried to emalloc(0)")); + sudo_fatalx_nodebug(_("internal error, tried allocate zero bytes")); if ((ptr = malloc(size)) == NULL) sudo_fatal_nodebug(NULL); @@ -87,18 +87,18 @@ emalloc(size_t size) } /* - * emallocarray() allocates nmemb * size bytes and exits with an error + * sudo_emallocarray() allocates nmemb * size bytes and exits with an error * if overflow would occur or if the system malloc(3) fails. */ void * -emallocarray(size_t nmemb, size_t size) +sudo_emallocarray(size_t nmemb, size_t size) { void *ptr; if (nmemb == 0 || size == 0) - sudo_fatalx_nodebug(_("internal error, tried to emallocarray(0)")); + sudo_fatalx_nodebug(_("internal error, tried allocate zero bytes")); if (nmemb > SIZE_MAX / size) - sudo_fatalx_nodebug(_("internal error, %s overflow"), "emallocarray"); + sudo_fatalx_nodebug(_("internal error, %s overflow"), "sudo_emallocarray"); size *= nmemb; if ((ptr = malloc(size)) == NULL) @@ -107,20 +107,20 @@ emallocarray(size_t nmemb, size_t size) } /* - * ecalloc() allocates nmemb * size bytes and exits with an error + * sudo_ecalloc() allocates nmemb * size bytes and exits with an error * if overflow would occur or if the system malloc(3) fails. * On success, the allocated space is zero-filled. */ void * -ecalloc(size_t nmemb, size_t size) +sudo_ecalloc(size_t nmemb, size_t size) { void *ptr; if (nmemb == 0 || size == 0) - sudo_fatalx_nodebug(_("internal error, tried to ecalloc(0)")); + sudo_fatalx_nodebug(_("internal error, tried allocate zero bytes")); if (nmemb != 1) { if (nmemb > SIZE_MAX / size) - sudo_fatalx_nodebug(_("internal error, %s overflow"), "ecalloc"); + sudo_fatalx_nodebug(_("internal error, %s overflow"), "sudo_ecalloc"); size *= nmemb; } if ((ptr = malloc(size)) == NULL) @@ -130,16 +130,16 @@ ecalloc(size_t nmemb, size_t size) } /* - * erealloc() calls the system realloc(3) and exits with an error if - * realloc(3) fails. You can call erealloc() with a NULL pointer even + * sudo_erealloc() calls the system realloc(3) and exits with an error if + * realloc(3) fails. You can call sudo_erealloc() with a NULL pointer even * if the system realloc(3) does not support this. */ void * -erealloc(void *ptr, size_t size) +sudo_erealloc(void *ptr, size_t size) { if (size == 0) - sudo_fatalx_nodebug(_("internal error, tried to erealloc(0)")); + sudo_fatalx_nodebug(_("internal error, tried allocate zero bytes")); ptr = ptr ? realloc(ptr, size) : malloc(size); if (ptr == NULL) @@ -148,19 +148,19 @@ erealloc(void *ptr, size_t size) } /* - * ereallocarray() realloc(3)s nmemb * size bytes and exits with an error - * if overflow would occur or if the system malloc(3)/realloc(3) fails. - * You can call erealloc() with a NULL pointer even if the system realloc(3) - * does not support this. + * sudo_ereallocarray() sudo_realloc(3)s nmemb * size bytes and exits with an + * error if overflow would occur or if the system malloc(3)/realloc(3) fails. + * You can call sudo_ereallocarray() with a NULL pointer even if the system + * realloc(3) does not support this. */ void * -ereallocarray(void *ptr, size_t nmemb, size_t size) +sudo_ereallocarray(void *ptr, size_t nmemb, size_t size) { if (nmemb == 0 || size == 0) - sudo_fatalx_nodebug(_("internal error, tried to ereallocarray(0)")); + sudo_fatalx_nodebug(_("internal error, tried allocate zero bytes")); if (nmemb > SIZE_MAX / size) - sudo_fatalx_nodebug(_("internal error, %s overflow"), "ereallocarray"); + sudo_fatalx_nodebug(_("internal error, %s overflow"), "sudo_ereallocarray"); size *= nmemb; ptr = ptr ? realloc(ptr, size) : malloc(size); @@ -170,20 +170,20 @@ ereallocarray(void *ptr, size_t nmemb, size_t size) } /* - * erecalloc() realloc(3)s nmemb * msize bytes and exits with an error + * sudo_ersudo_ecalloc() realloc(3)s nmemb * msize bytes and exits with an error * if overflow would occur or if the system malloc(3)/realloc(3) fails. - * On success, the new space is zero-filled. You can call erealloc() + * On success, the new space is zero-filled. You can call sudo_erealloc() * with a NULL pointer even if the system realloc(3) does not support this. */ void * -erecalloc(void *ptr, size_t onmemb, size_t nmemb, size_t msize) +ersudo_ecalloc(void *ptr, size_t onmemb, size_t nmemb, size_t msize) { size_t size; if (nmemb == 0 || msize == 0) - sudo_fatalx_nodebug(_("internal error, tried to erecalloc(0)")); + sudo_fatalx_nodebug(_("internal error, tried allocate zero bytes")); if (nmemb > SIZE_MAX / msize) - sudo_fatalx_nodebug(_("internal error, %s overflow"), "erecalloc"); + sudo_fatalx_nodebug(_("internal error, %s overflow"), "ersudo_ecalloc"); size = nmemb * msize; ptr = ptr ? realloc(ptr, size) : malloc(size); @@ -197,18 +197,18 @@ erecalloc(void *ptr, size_t onmemb, size_t nmemb, size_t msize) } /* - * estrdup() is like strdup(3) except that it exits with an error if - * malloc(3) fails. NOTE: unlike strdup(3), estrdup(NULL) is legal. + * sudo_estrdup() is like strdup(3) except that it exits with an error if + * malloc(3) fails. NOTE: unlike strdup(3), sudo_estrdup(NULL) is legal. */ char * -estrdup(const char *src) +sudo_estrdup(const char *src) { char *dst = NULL; size_t len; if (src != NULL) { len = strlen(src); - dst = (char *) emalloc(len + 1); + dst = (char *) sudo_emalloc(len + 1); (void) memcpy(dst, src, len); dst[len] = '\0'; } @@ -216,11 +216,11 @@ estrdup(const char *src) } /* - * estrdup() is like strndup(3) except that it exits with an error if - * malloc(3) fails. NOTE: unlike strdup(3), estrdup(NULL) is legal. + * sudo_estrndup() is like strndup(3) except that it exits with an error if + * malloc(3) fails. NOTE: unlike strdup(3), sudo_estrdup(NULL) is legal. */ char * -estrndup(const char *src, size_t maxlen) +sudo_estrndup(const char *src, size_t maxlen) { char *dst = NULL; size_t len = 0; @@ -230,7 +230,7 @@ estrndup(const char *src, size_t maxlen) len++; maxlen--; } - dst = (char *) emalloc(len + 1); + dst = (char *) sudo_emalloc(len + 1); (void) memcpy(dst, src, len); dst[len] = '\0'; } @@ -238,11 +238,11 @@ estrndup(const char *src, size_t maxlen) } /* - * easprintf() calls vasprintf() and exits with an error if vasprintf() + * sudo_easprintf() calls vasprintf() and exits with an error if vasprintf() * returns -1 (out of memory). */ int -easprintf(char **ret, const char *fmt, ...) +sudo_easprintf(char **ret, const char *fmt, ...) { int len; va_list ap; @@ -257,11 +257,11 @@ easprintf(char **ret, const char *fmt, ...) } /* - * evasprintf() calls vasprintf() and exits with an error if vasprintf() + * sudo_evasprintf() calls vasprintf() and exits with an error if vasprintf() * returns -1 (out of memory). */ int -evasprintf(char **ret, const char *format, va_list args) +sudo_evasprintf(char **ret, const char *format, va_list args) { int len; diff --git a/lib/util/event.c b/lib/util/event.c index db8023168..8891c7b00 100644 --- a/lib/util/event.c +++ b/lib/util/event.c @@ -44,7 +44,7 @@ #include #include "missing.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "fatal.h" #include "sudo_debug.h" #include "sudo_event.h" @@ -58,7 +58,7 @@ sudo_ev_base_alloc(void) struct sudo_event_base *base; debug_decl(sudo_ev_base_alloc, SUDO_DEBUG_EVENT) - base = ecalloc(1, sizeof(*base)); + base = sudo_ecalloc(1, sizeof(*base)); TAILQ_INIT(&base->events); TAILQ_INIT(&base->timeouts); if (sudo_ev_base_alloc_impl(base) != 0) { @@ -93,7 +93,7 @@ sudo_ev_alloc(int fd, short events, sudo_ev_callback_t callback, void *closure) /* XXX - sanity check events value */ - ev = ecalloc(1, sizeof(*ev)); + ev = sudo_ecalloc(1, sizeof(*ev)); ev->fd = fd; ev->events = events; ev->pfd_idx = -1; diff --git a/lib/util/event_poll.c b/lib/util/event_poll.c index dfe1153f8..67b42fefb 100644 --- a/lib/util/event_poll.c +++ b/lib/util/event_poll.c @@ -45,7 +45,7 @@ #include #include "missing.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "fatal.h" #include "sudo_debug.h" #include "sudo_event.h" @@ -60,7 +60,7 @@ sudo_ev_base_alloc_impl(struct sudo_event_base *base) base->pfd_high = -1; base->pfd_max = 32; - base->pfds = ereallocarray(NULL, base->pfd_max, sizeof(struct pollfd)); + base->pfds = sudo_ereallocarray(NULL, base->pfd_max, sizeof(struct pollfd)); for (i = 0; i < base->pfd_max; i++) { base->pfds[i].fd = -1; } @@ -87,7 +87,7 @@ sudo_ev_add_impl(struct sudo_event_base *base, struct sudo_event *ev) int i; base->pfd_max <<= 1; base->pfds = - ereallocarray(base->pfds, base->pfd_max, sizeof(struct pollfd)); + sudo_ereallocarray(base->pfds, base->pfd_max, sizeof(struct pollfd)); for (i = base->pfd_free; i < base->pfd_max; i++) { base->pfds[i].fd = -1; } diff --git a/lib/util/event_select.c b/lib/util/event_select.c index bac3b4d9f..d1eab7ef1 100644 --- a/lib/util/event_select.c +++ b/lib/util/event_select.c @@ -50,7 +50,7 @@ #include #include "missing.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "fatal.h" #include "sudo_debug.h" #include "sudo_event.h" @@ -64,10 +64,10 @@ sudo_ev_base_alloc_impl(struct sudo_event_base *base) debug_decl(sudo_ev_base_alloc_impl, SUDO_DEBUG_EVENT) base->maxfd = NFDBITS - 1; - base->readfds_in = ecalloc(1, sizeof(fd_mask)); - base->writefds_in = ecalloc(1, sizeof(fd_mask)); - base->readfds_out = ecalloc(1, sizeof(fd_mask)); - base->writefds_out = ecalloc(1, sizeof(fd_mask)); + base->readfds_in = sudo_ecalloc(1, sizeof(fd_mask)); + base->writefds_in = sudo_ecalloc(1, sizeof(fd_mask)); + base->readfds_out = sudo_ecalloc(1, sizeof(fd_mask)); + base->writefds_out = sudo_ecalloc(1, sizeof(fd_mask)); debug_return_int(0); } @@ -92,10 +92,10 @@ sudo_ev_add_impl(struct sudo_event_base *base, struct sudo_event *ev) if (ev->fd > base->maxfd) { const int o = (base->maxfd + 1) / NFDBITS; const int n = howmany(ev->fd + 1, NFDBITS); - base->readfds_in = erecalloc(base->readfds_in, o, n, sizeof(fd_mask)); - base->writefds_in = erecalloc(base->writefds_in, o, n, sizeof(fd_mask)); - base->readfds_out = erecalloc(base->readfds_out, o, n, sizeof(fd_mask)); - base->writefds_out = erecalloc(base->writefds_out, o, n, sizeof(fd_mask)); + base->readfds_in = ersudo_ecalloc(base->readfds_in, o, n, sizeof(fd_mask)); + base->writefds_in = ersudo_ecalloc(base->writefds_in, o, n, sizeof(fd_mask)); + base->readfds_out = ersudo_ecalloc(base->readfds_out, o, n, sizeof(fd_mask)); + base->writefds_out = ersudo_ecalloc(base->writefds_out, o, n, sizeof(fd_mask)); base->maxfd = (n * NFDBITS) - 1; } diff --git a/lib/util/fatal.c b/lib/util/fatal.c index 404c2c91b..f2cbb37ec 100644 --- a/lib/util/fatal.c +++ b/lib/util/fatal.c @@ -32,7 +32,7 @@ #include "gettext.h" /* must be included before missing.h */ #include "missing.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "fatal.h" #include "queue.h" #include "sudo_plugin.h" @@ -137,7 +137,7 @@ _warning(int use_errno, const char *fmt, va_list ap) int serrno = errno; char *str; - evasprintf(&str, fmt, ap); + sudo_evasprintf(&str, fmt, ap); if (use_errno) { if (fmt != NULL) { sudo_printf(SUDO_CONV_ERROR_MSG, diff --git a/lib/util/gidlist.c b/lib/util/gidlist.c index 12f182cc3..62d828395 100644 --- a/lib/util/gidlist.c +++ b/lib/util/gidlist.c @@ -33,7 +33,7 @@ #include "gettext.h" /* must be included before missing.h */ #include "missing.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "fatal.h" #include "sudo_debug.h" #include "sudo_util.h" @@ -67,7 +67,7 @@ sudo_parse_gids(const char *gidstr, const gid_t *basegid, GETGROUPS_T **gidsp) ngids++; /* Allocate and fill in array. */ if (ngids != 0) { - gids = emallocarray(ngids, sizeof(GETGROUPS_T)); + gids = sudo_emallocarray(ngids, sizeof(GETGROUPS_T)); ngids = 0; if (basegid != NULL) gids[ngids++] = *basegid; diff --git a/lib/util/lbuf.c b/lib/util/lbuf.c index b7cb1cbd5..7504de835 100644 --- a/lib/util/lbuf.c +++ b/lib/util/lbuf.c @@ -43,7 +43,7 @@ #include #include "missing.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "fatal.h" #include "sudo_lbuf.h" #include "sudo_debug.h" @@ -83,7 +83,7 @@ sudo_lbuf_expand(struct sudo_lbuf *lbuf, int extra) do { lbuf->size += 256; } while (lbuf->len + extra + 1 >= lbuf->size); - lbuf->buf = erealloc(lbuf->buf, lbuf->size); + lbuf->buf = sudo_erealloc(lbuf->buf, lbuf->size); } } diff --git a/lib/util/sudo_conf.c b/lib/util/sudo_conf.c index 992688271..07d63dacf 100644 --- a/lib/util/sudo_conf.c +++ b/lib/util/sudo_conf.c @@ -51,7 +51,7 @@ #define SUDO_ERROR_WRAP 0 #include "missing.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "fatal.h" #include "pathnames.h" #include "sudo_plugin.h" @@ -234,8 +234,8 @@ set_debug(const char *entry, const char *conf_file) debug_flags++; /* Set debug file and parse the flags (init debug as soon as possible). */ - debug_file = estrndup(entry, filelen); - debug_flags = estrdup(debug_flags); + debug_file = sudo_estrndup(entry, filelen); + debug_flags = sudo_estrdup(debug_flags); sudo_debug_init(debug_file, debug_flags); efree(debug_file); @@ -260,7 +260,7 @@ set_path(const char *entry, const char *conf_file) for (cur = sudo_conf_data.paths; cur->pname != NULL; cur++) { if (strncasecmp(name, cur->pname, cur->pnamelen) == 0 && isblank((unsigned char)name[cur->pnamelen])) { - cur->pval = estrdup(path); + cur->pval = sudo_estrdup(path); break; } } @@ -293,24 +293,24 @@ set_plugin(const char *entry, const char *conf_file) while (isblank((unsigned char)*ep)) ep++; } - options = emallocarray(nopts + 1, sizeof(*options)); + options = sudo_emallocarray(nopts + 1, sizeof(*options)); /* Fill in options array, there is at least one element. */ for (nopts = 0; (ep = strpbrk(cp, " \t")) != NULL; ) { - options[nopts++] = estrndup(cp, (size_t)(ep - cp)); + options[nopts++] = sudo_estrndup(cp, (size_t)(ep - cp)); while (isblank((unsigned char)*ep)) ep++; cp = ep; } - options[nopts++] = estrdup(cp); + options[nopts++] = sudo_estrdup(cp); options[nopts] = NULL; } else { /* No extra options. */ pathlen = strlen(path); } - info = ecalloc(1, sizeof(*info)); - info->symbol_name = estrndup(name, namelen); - info->path = estrndup(path, pathlen); + info = sudo_ecalloc(1, sizeof(*info)); + info->symbol_name = sudo_estrndup(name, namelen); + info->path = sudo_estrndup(path, pathlen); info->options = options; info->lineno = conf_lineno; TAILQ_INSERT_TAIL(&sudo_conf_data.plugins, info, entries); @@ -390,7 +390,7 @@ sudo_conf_read(const char *conf_file) struct stat sb; FILE *fp; char *cp, *line = NULL; - char *prev_locale = estrdup(setlocale(LC_ALL, NULL)); + char *prev_locale = sudo_estrdup(setlocale(LC_ALL, NULL)); size_t linesize = 0; /* Parse sudo.conf in the "C" locale. */ diff --git a/lib/util/sudo_debug.c b/lib/util/sudo_debug.c index 7e09580ab..9e91fa7cf 100644 --- a/lib/util/sudo_debug.c +++ b/lib/util/sudo_debug.c @@ -51,7 +51,7 @@ #include "gettext.h" /* must be included before missing.h */ #include "missing.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "fatal.h" #include "sudo_plugin.h" #include "sudo_debug.h" diff --git a/lib/util/util.exp b/lib/util/util.exp index 6d4af99ff..31bd4b7f8 100644 --- a/lib/util/util.exp +++ b/lib/util/util.exp @@ -26,20 +26,6 @@ atobool atoid atomode closefrom_fallback -easprintf -ecalloc -emalloc -emallocarray -erealloc -ereallocarray -erecalloc -estrdup -estrndup -evasprintf -sudo_fatal_callback_deregister -sudo_fatal_callback_register -sudo_fatal_nodebug -sudo_fatalx_nodebug getprogname initprogname isblank @@ -81,6 +67,15 @@ sudo_dso_load sudo_dso_preload_table sudo_dso_strerror sudo_dso_unload +sudo_easprintf +sudo_ecalloc +sudo_emalloc +sudo_emallocarray +sudo_erealloc +sudo_ereallocarray +sudo_erecalloc +sudo_estrdup +sudo_estrndup sudo_ev_add sudo_ev_alloc sudo_ev_base_alloc @@ -94,6 +89,11 @@ sudo_ev_loop sudo_ev_loopbreak sudo_ev_loopcontinue sudo_ev_loopexit +sudo_evasprintf +sudo_fatal_callback_deregister +sudo_fatal_callback_register +sudo_fatal_nodebug +sudo_fatalx_nodebug sudo_fnmatch sudo_freeaddrinfo sudo_futimes @@ -141,9 +141,9 @@ sudo_term_raw sudo_term_restore sudo_utimes sudo_vasprintf -sudo_vsnprintf sudo_vfatal_nodebug sudo_vfatalx_nodebug +sudo_vsnprintf sudo_vwarn_nodebug sudo_vwarnx_nodebug sudo_warn_gettext diff --git a/plugins/sudoers/Makefile.in b/plugins/sudoers/Makefile.in index bb37ce25d..b9e7fa8a6 100644 --- a/plugins/sudoers/Makefile.in +++ b/plugins/sudoers/Makefile.in @@ -438,24 +438,24 @@ realclean: distclean cleandir: realclean # Autogenerated dependencies, do not modify -afs.lo: $(authdir)/afs.c $(devdir)/def_data.h $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +afs.lo: $(authdir)/afs.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/afs.c -aix_auth.lo: $(authdir)/aix_auth.c $(devdir)/def_data.h $(incdir)/alloc.h \ +aix_auth.lo: $(authdir)/aix_auth.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ - $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ - $(srcdir)/sudoers.h $(top_builddir)/config.h \ + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ + $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/aix_auth.c alias.lo: $(srcdir)/alias.c $(devdir)/def_data.h $(devdir)/gram.h \ - $(incdir)/alloc.h $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ - $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \ $(srcdir)/redblack.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ @@ -472,28 +472,29 @@ base64.o: base64.lo boottime.lo: $(srcdir)/boottime.c $(incdir)/compat/stdbool.h \ $(incdir)/missing.h $(incdir)/sudo_debug.h $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/boottime.c -bsdauth.lo: $(authdir)/bsdauth.c $(devdir)/def_data.h $(incdir)/alloc.h \ +bsdauth.lo: $(authdir)/bsdauth.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ - $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ - $(top_builddir)/config.h $(top_builddir)/pathnames.h + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ + $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(top_builddir)/config.h \ + $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/bsdauth.c bsm_audit.lo: $(srcdir)/bsm_audit.c $(incdir)/fatal.h $(incdir)/gettext.h \ $(incdir)/missing.h $(incdir)/sudo_debug.h $(srcdir)/bsm_audit.h \ $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/bsm_audit.c -check.lo: $(srcdir)/check.c $(devdir)/def_data.h $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +check.lo: $(srcdir)/check.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/check.h \ $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ $(srcdir)/sudoers.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/check.c check_addr.o: $(srcdir)/regress/parser/check_addr.c $(devdir)/def_data.h \ - $(incdir)/alloc.h $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ - $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ $(incdir)/sudo_util.h $(srcdir)/defaults.h \ $(srcdir)/interfaces.h $(srcdir)/logging.h $(srcdir)/parse.h \ @@ -514,9 +515,9 @@ check_fill.o: $(srcdir)/regress/parser/check_fill.c $(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 \ $(devdir)/def_data.c $(devdir)/def_data.h \ - $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_debug.h \ + $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ $(srcdir)/defaults.h $(srcdir)/logging.h \ $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ @@ -532,351 +533,362 @@ check_wrap.o: $(srcdir)/regress/logging/check_wrap.c \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ $(top_builddir)/config.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/logging/check_wrap.c -dce.lo: $(authdir)/dce.c $(devdir)/def_data.h $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +dce.lo: $(authdir)/dce.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/dce.c defaults.lo: $(srcdir)/defaults.c $(devdir)/def_data.c $(devdir)/def_data.h \ - $(devdir)/gram.h $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ - $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ - $(srcdir)/parse.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ - $(top_builddir)/config.h $(top_builddir)/pathnames.h + $(devdir)/gram.h $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ + $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ + $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \ + $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(top_builddir)/config.h \ + $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/defaults.c -env.lo: $(srcdir)/env.c $(devdir)/def_data.h $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +env.lo: $(srcdir)/env.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/env.c -find_path.lo: $(srcdir)/find_path.c $(devdir)/def_data.h $(incdir)/alloc.h \ +find_path.lo: $(srcdir)/find_path.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ - $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ - $(srcdir)/sudoers.h $(top_builddir)/config.h \ - $(top_builddir)/pathnames.h + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ + $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ + $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/find_path.c find_path.o: find_path.lo -fwtk.lo: $(authdir)/fwtk.c $(devdir)/def_data.h $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +fwtk.lo: $(authdir)/fwtk.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/fwtk.c getdate.o: $(devdir)/getdate.c $(incdir)/missing.h $(top_builddir)/config.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(devdir)/getdate.c -getspwuid.lo: $(srcdir)/getspwuid.c $(devdir)/def_data.h $(incdir)/alloc.h \ +getspwuid.lo: $(srcdir)/getspwuid.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ - $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ - $(srcdir)/sudoers.h $(top_builddir)/config.h \ - $(top_builddir)/pathnames.h + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ + $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ + $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/getspwuid.c -goodpath.lo: $(srcdir)/goodpath.c $(devdir)/def_data.h $(incdir)/alloc.h \ +goodpath.lo: $(srcdir)/goodpath.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ - $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ - $(srcdir)/sudoers.h $(top_builddir)/config.h \ + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ + $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/goodpath.c goodpath.o: goodpath.lo -gram.lo: $(devdir)/gram.c $(devdir)/def_data.h $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +gram.lo: $(devdir)/gram.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ $(srcdir)/logging.h $(srcdir)/parse.h $(srcdir)/sudo_nss.h \ $(srcdir)/sudoers.h $(srcdir)/toke.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(devdir)/gram.c group_plugin.lo: $(srcdir)/group_plugin.c $(devdir)/def_data.h \ - $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_debug.h $(incdir)/sudo_dso.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ - $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ - $(srcdir)/sudoers.h $(top_builddir)/config.h \ - $(top_builddir)/pathnames.h + $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ + $(incdir)/sudo_dso.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/defaults.h \ + $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ + $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/group_plugin.c group_plugin.o: group_plugin.lo hexchar.lo: $(srcdir)/hexchar.c $(incdir)/missing.h $(incdir)/sudo_debug.h \ $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/hexchar.c hexchar.o: hexchar.lo -interfaces.lo: $(srcdir)/interfaces.c $(devdir)/def_data.h $(incdir)/alloc.h \ +interfaces.lo: $(srcdir)/interfaces.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ - $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ - $(incdir)/sudo_util.h $(srcdir)/defaults.h \ - $(srcdir)/interfaces.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ - $(srcdir)/sudoers.h $(top_builddir)/config.h \ - $(top_builddir)/pathnames.h + $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ + $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ + $(srcdir)/defaults.h $(srcdir)/interfaces.h $(srcdir)/logging.h \ + $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ + $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/interfaces.c interfaces.o: interfaces.lo -iolog.lo: $(srcdir)/iolog.c $(devdir)/def_data.h $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +iolog.lo: $(srcdir)/iolog.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ $(srcdir)/iolog.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ $(srcdir)/sudoers.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/iolog.c -iolog_path.lo: $(srcdir)/iolog_path.c $(devdir)/def_data.h $(incdir)/alloc.h \ +iolog_path.lo: $(srcdir)/iolog_path.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ - $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ - $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ - $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ - $(top_builddir)/config.h $(top_builddir)/pathnames.h + $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ + $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ + $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ + $(srcdir)/sudoers.h $(top_builddir)/config.h \ + $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/iolog_path.c iolog_path.o: iolog_path.lo -kerb5.lo: $(authdir)/kerb5.c $(devdir)/def_data.h $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +kerb5.lo: $(authdir)/kerb5.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/kerb5.c -ldap.lo: $(srcdir)/ldap.c $(devdir)/def_data.h $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +ldap.lo: $(srcdir)/ldap.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_dso.h $(incdir)/sudo_lbuf.h $(incdir)/sudo_plugin.h \ $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ $(srcdir)/parse.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/ldap.c -linux_audit.lo: $(srcdir)/linux_audit.c $(incdir)/alloc.h $(incdir)/fatal.h \ - $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/sudo_debug.h \ - $(srcdir)/linux_audit.h $(top_builddir)/config.h +linux_audit.lo: $(srcdir)/linux_audit.c $(incdir)/fatal.h $(incdir)/gettext.h \ + $(incdir)/missing.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_debug.h $(srcdir)/linux_audit.h \ + $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/linux_audit.c -locale.lo: $(srcdir)/locale.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ +locale.lo: $(srcdir)/locale.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/sudo_alloc.h \ $(srcdir)/logging.h $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/locale.c locale.o: locale.lo -logging.lo: $(srcdir)/logging.c $(devdir)/def_data.h $(incdir)/alloc.h \ +logging.lo: $(srcdir)/logging.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ - $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ - $(top_builddir)/config.h $(top_builddir)/pathnames.h + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ + $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(top_builddir)/config.h \ + $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/logging.c -logwrap.lo: $(srcdir)/logwrap.c $(devdir)/def_data.h $(incdir)/alloc.h \ +logwrap.lo: $(srcdir)/logwrap.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ - $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ - $(top_builddir)/config.h $(top_builddir)/pathnames.h + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ + $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(top_builddir)/config.h \ + $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/logwrap.c logwrap.o: logwrap.lo match.lo: $(srcdir)/match.c $(devdir)/def_data.h $(devdir)/gram.h \ - $(incdir)/alloc.h $(incdir)/compat/fnmatch.h $(incdir)/compat/glob.h \ + $(incdir)/compat/fnmatch.h $(incdir)/compat/glob.h \ $(incdir)/compat/sha2.h $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ - $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ - $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \ - $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(top_builddir)/config.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ + $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ + $(srcdir)/logging.h $(srcdir)/parse.h $(srcdir)/sudo_nss.h \ + $(srcdir)/sudoers.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/match.c -match_addr.lo: $(srcdir)/match_addr.c $(devdir)/def_data.h $(incdir)/alloc.h \ +match_addr.lo: $(srcdir)/match_addr.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ - $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ - $(incdir)/sudo_util.h $(srcdir)/defaults.h \ - $(srcdir)/interfaces.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ - $(srcdir)/sudoers.h $(top_builddir)/config.h \ - $(top_builddir)/pathnames.h + $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ + $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ + $(srcdir)/defaults.h $(srcdir)/interfaces.h $(srcdir)/logging.h \ + $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ + $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/match_addr.c match_addr.o: match_addr.lo -net_ifs.o: $(top_srcdir)/src/net_ifs.c $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_conf.h \ +net_ifs.o: $(top_srcdir)/src/net_ifs.c $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h \ $(incdir)/sudo_debug.h $(top_builddir)/config.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(top_srcdir)/src/net_ifs.c -pam.lo: $(authdir)/pam.c $(devdir)/def_data.h $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +pam.lo: $(authdir)/pam.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/pam.c parse.lo: $(srcdir)/parse.c $(devdir)/def_data.h $(devdir)/gram.h \ - $(incdir)/alloc.h $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ - $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ $(incdir)/sudo_debug.h $(incdir)/sudo_lbuf.h $(incdir)/sudo_plugin.h \ $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ $(srcdir)/parse.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/parse.c -passwd.lo: $(authdir)/passwd.c $(devdir)/def_data.h $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +passwd.lo: $(authdir)/passwd.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/passwd.c -policy.lo: $(srcdir)/policy.c $(devdir)/def_data.h $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +policy.lo: $(srcdir)/policy.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ $(srcdir)/interfaces.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ $(srcdir)/sudoers.h $(srcdir)/sudoers_version.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/policy.c -prompt.lo: $(srcdir)/prompt.c $(devdir)/def_data.h $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +prompt.lo: $(srcdir)/prompt.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/prompt.c -pwutil.lo: $(srcdir)/pwutil.c $(devdir)/def_data.h $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +pwutil.lo: $(srcdir)/pwutil.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ $(srcdir)/logging.h $(srcdir)/pwutil.h $(srcdir)/redblack.h \ $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/pwutil.c pwutil.o: pwutil.lo -pwutil_impl.lo: $(srcdir)/pwutil_impl.c $(devdir)/def_data.h $(incdir)/alloc.h \ +pwutil_impl.lo: $(srcdir)/pwutil_impl.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ - $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ - $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ - $(srcdir)/pwutil.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ + $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ + $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/pwutil.h \ + $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/pwutil_impl.c pwutil_impl.o: pwutil_impl.lo -redblack.lo: $(srcdir)/redblack.c $(incdir)/alloc.h $(incdir)/missing.h \ +redblack.lo: $(srcdir)/redblack.c $(incdir)/missing.h $(incdir)/sudo_alloc.h \ $(incdir)/sudo_debug.h $(srcdir)/redblack.h \ $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/redblack.c redblack.o: redblack.lo -rfc1938.lo: $(authdir)/rfc1938.c $(devdir)/def_data.h $(incdir)/alloc.h \ +rfc1938.lo: $(authdir)/rfc1938.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ - $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ - $(top_builddir)/config.h $(top_builddir)/pathnames.h + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ + $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(top_builddir)/config.h \ + $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/rfc1938.c -secureware.lo: $(authdir)/secureware.c $(devdir)/def_data.h $(incdir)/alloc.h \ +secureware.lo: $(authdir)/secureware.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ - $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ - $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ - $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ - $(top_builddir)/config.h $(top_builddir)/pathnames.h + $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ + $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ + $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ + $(srcdir)/sudoers.h $(top_builddir)/config.h \ + $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/secureware.c -securid5.lo: $(authdir)/securid5.c $(devdir)/def_data.h $(incdir)/alloc.h \ +securid5.lo: $(authdir)/securid5.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ - $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ - $(srcdir)/sudoers.h $(top_builddir)/config.h \ + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ + $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/securid5.c -set_perms.lo: $(srcdir)/set_perms.c $(devdir)/def_data.h $(incdir)/alloc.h \ +set_perms.lo: $(srcdir)/set_perms.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ - $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ - $(srcdir)/sudoers.h $(top_builddir)/config.h \ - $(top_builddir)/pathnames.h + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ + $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ + $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/set_perms.c -sia.lo: $(authdir)/sia.c $(devdir)/def_data.h $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +sia.lo: $(authdir)/sia.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/sia.c -sssd.lo: $(srcdir)/sssd.c $(devdir)/def_data.h $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ +sssd.lo: $(srcdir)/sssd.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_dso.h $(incdir)/sudo_lbuf.h $(incdir)/sudo_plugin.h \ $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ $(srcdir)/parse.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sssd.c -sudo_auth.lo: $(authdir)/sudo_auth.c $(devdir)/def_data.h $(incdir)/alloc.h \ +sudo_auth.lo: $(authdir)/sudo_auth.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ - $(srcdir)/defaults.h $(srcdir)/ins_2001.h \ + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/ins_2001.h \ $(srcdir)/ins_classic.h $(srcdir)/ins_csops.h \ $(srcdir)/ins_goons.h $(srcdir)/insults.h $(srcdir)/logging.h \ $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/sudo_auth.c -sudo_nss.lo: $(srcdir)/sudo_nss.c $(devdir)/def_data.h $(incdir)/alloc.h \ +sudo_nss.lo: $(srcdir)/sudo_nss.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_lbuf.h $(incdir)/sudo_plugin.h \ - $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ - $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(top_builddir)/config.h \ + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_lbuf.h \ + $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ + $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ + $(srcdir)/sudoers.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo_nss.c -sudoers.lo: $(srcdir)/sudoers.c $(devdir)/def_data.h $(incdir)/alloc.h \ +sudoers.lo: $(srcdir)/sudoers.c $(devdir)/def_data.h \ $(incdir)/compat/getaddrinfo.h $(incdir)/compat/stdbool.h \ $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/secure_path.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ - $(srcdir)/auth/sudo_auth.h $(srcdir)/defaults.h \ - $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ - $(top_builddir)/config.h $(top_builddir)/pathnames.h + $(incdir)/queue.h $(incdir)/secure_path.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/auth/sudo_auth.h \ + $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ + $(srcdir)/sudoers.h $(top_builddir)/config.h \ + $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudoers.c -sudoreplay.o: $(srcdir)/sudoreplay.c $(incdir)/alloc.h \ - $(incdir)/compat/getopt.h $(incdir)/compat/stdbool.h \ - $(incdir)/compat/timespec.h $(incdir)/fatal.h \ - $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ - $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_event.h $(incdir)/sudo_plugin.h \ - $(incdir)/sudo_util.h $(srcdir)/iolog.h $(srcdir)/logging.h \ - $(top_builddir)/config.h $(top_builddir)/pathnames.h +sudoreplay.o: $(srcdir)/sudoreplay.c $(incdir)/compat/getopt.h \ + $(incdir)/compat/stdbool.h $(incdir)/compat/timespec.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_event.h \ + $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/iolog.h \ + $(srcdir)/logging.h $(top_builddir)/config.h \ + $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudoreplay.c testsudoers.o: $(srcdir)/testsudoers.c $(devdir)/def_data.h $(devdir)/gram.h \ - $(incdir)/alloc.h $(incdir)/compat/fnmatch.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ - $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ - $(incdir)/secure_path.h $(incdir)/sudo_conf.h \ + $(incdir)/compat/fnmatch.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/secure_path.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h \ $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ $(incdir)/sudo_util.h $(srcdir)/defaults.h \ $(srcdir)/interfaces.h $(srcdir)/logging.h $(srcdir)/parse.h \ $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/tsgetgrpw.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/testsudoers.c -timestamp.lo: $(srcdir)/timestamp.c $(devdir)/def_data.h $(incdir)/alloc.h \ +timestamp.lo: $(srcdir)/timestamp.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/compat/timespec.h \ $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/secure_path.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/check.h \ - $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ - $(srcdir)/sudoers.h $(top_builddir)/config.h \ - $(top_builddir)/pathnames.h + $(incdir)/queue.h $(incdir)/secure_path.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/check.h $(srcdir)/defaults.h \ + $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ + $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/timestamp.c timestr.lo: $(srcdir)/timestr.c $(incdir)/missing.h $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/timestr.c toke.lo: $(devdir)/toke.c $(devdir)/def_data.h $(devdir)/gram.h \ - $(incdir)/alloc.h $(incdir)/compat/sha2.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/secure_path.h $(incdir)/sudo_debug.h \ + $(incdir)/compat/sha2.h $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/secure_path.h $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_lbuf.h $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \ $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/toke.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(devdir)/toke.c toke_util.lo: $(srcdir)/toke_util.c $(devdir)/def_data.h $(devdir)/gram.h \ - $(incdir)/alloc.h $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ - $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ $(srcdir)/parse.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ @@ -884,18 +896,18 @@ toke_util.lo: $(srcdir)/toke_util.c $(devdir)/def_data.h $(devdir)/gram.h \ $(top_builddir)/pathnames.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 $(devdir)/def_data.h $(incdir)/alloc.h \ +tsgetgrpw.o: $(srcdir)/tsgetgrpw.c $(devdir)/def_data.h \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ - $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ - $(srcdir)/sudoers.h $(srcdir)/tsgetgrpw.h \ + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ + $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/tsgetgrpw.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/tsgetgrpw.c visudo.o: $(srcdir)/visudo.c $(devdir)/def_data.h $(devdir)/gram.h \ - $(incdir)/alloc.h $(incdir)/compat/getopt.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_conf.h \ + $(incdir)/compat/getopt.h $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h \ $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \ $(srcdir)/redblack.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ @@ -903,10 +915,11 @@ visudo.o: $(srcdir)/visudo.c $(devdir)/def_data.h $(devdir)/gram.h \ $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/visudo.c visudo_json.o: $(srcdir)/visudo_json.c $(devdir)/def_data.h $(devdir)/gram.h \ - $(incdir)/alloc.h $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ - $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ - $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \ - $(srcdir)/parse.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_debug.h \ + $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ + $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \ + $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/visudo_json.c diff --git a/plugins/sudoers/alias.c b/plugins/sudoers/alias.c index 0c1fc7183..f4eb93aba 100644 --- a/plugins/sudoers/alias.c +++ b/plugins/sudoers/alias.c @@ -127,7 +127,7 @@ alias_add(char *name, int type, struct member *members) struct alias *a; debug_decl(alias_add, SUDO_DEBUG_ALIAS) - a = ecalloc(1, sizeof(*a)); + a = sudo_ecalloc(1, sizeof(*a)); a->name = name; a->type = type; /* a->used = false; */ diff --git a/plugins/sudoers/auth/bsdauth.c b/plugins/sudoers/auth/bsdauth.c index d734e1e45..8b546be4d 100644 --- a/plugins/sudoers/auth/bsdauth.c +++ b/plugins/sudoers/auth/bsdauth.c @@ -144,7 +144,7 @@ bsdauth_verify(struct passwd *pw, char *prompt, sudo_auth *auth) len = strlen(prompt) - 1; while (isspace(prompt[len]) || prompt[len] == ':') prompt[len--] = '\0'; - easprintf(&s, "%s [echo on]: ", prompt); + sudo_easprintf(&s, "%s [echo on]: ", prompt); pass = auth_getpass(prompt, def_passwd_timeout * 60, SUDO_CONV_PROMPT_ECHO_ON); free(s); diff --git a/plugins/sudoers/auth/kerb5.c b/plugins/sudoers/auth/kerb5.c index bac9e5526..807ab7cef 100644 --- a/plugins/sudoers/auth/kerb5.c +++ b/plugins/sudoers/auth/kerb5.c @@ -80,7 +80,7 @@ static krb5_error_code krb5_get_init_creds_opt_alloc(krb5_context context, krb5_get_init_creds_opt **opts) { - *opts = emalloc(sizeof(krb5_get_init_creds_opt)); + *opts = sudo_emalloc(sizeof(krb5_get_init_creds_opt)); krb5_get_init_creds_opt_init(*opts); return 0; } @@ -120,7 +120,7 @@ sudo_krb5_setup(struct passwd *pw, char **promptp, sudo_auth *auth) /* Only rewrite prompt if user didn't specify their own. */ /*if (!strcmp(prompt, PASSPROMPT)) { */ - easprintf(&krb5_prompt, "Password for %s: ", pname); + sudo_easprintf(&krb5_prompt, "Password for %s: ", pname); /*}*/ free(pname); } @@ -140,7 +140,7 @@ sudo_krb5_init(struct passwd *pw, sudo_auth *auth) auth->data = (void *) &sudo_krb5_data; /* Stash all our data here */ if (sudo_krb5_instance != NULL) { - easprintf(&pname, "%s%s%s", pw->pw_name, + sudo_easprintf(&pname, "%s%s%s", pw->pw_name, sudo_krb5_instance[0] != '/' ? "/" : "", sudo_krb5_instance); } diff --git a/plugins/sudoers/auth/pam.c b/plugins/sudoers/auth/pam.c index ee27b4969..ffe1b65e1 100644 --- a/plugins/sudoers/auth/pam.c +++ b/plugins/sudoers/auth/pam.c @@ -360,7 +360,7 @@ converse(int num_msg, PAM_CONST struct pam_message **msg, goto done; #endif } - pr->resp = estrdup(pass); + pr->resp = sudo_estrdup(pass); memset_s(pass, SUDO_CONV_REPL_MAX, 0, strlen(pass)); break; case PAM_TEXT_INFO: diff --git a/plugins/sudoers/auth/rfc1938.c b/plugins/sudoers/auth/rfc1938.c index f4f0e0316..3ce8e391b 100644 --- a/plugins/sudoers/auth/rfc1938.c +++ b/plugins/sudoers/auth/rfc1938.c @@ -110,7 +110,7 @@ sudo_rfc1938_setup(struct passwd *pw, char **promptp, sudo_auth *auth) /* Get space for new prompt with embedded challenge */ if (np_size < op_len + strlen(challenge) + 7) { np_size = op_len + strlen(challenge) + 7; - new_prompt = (char *) erealloc(new_prompt, np_size); + new_prompt = (char *) sudo_erealloc(new_prompt, np_size); } if (def_long_otp_prompt) diff --git a/plugins/sudoers/auth/sia.c b/plugins/sudoers/auth/sia.c index 49e0447ca..d7da16067 100644 --- a/plugins/sudoers/auth/sia.c +++ b/plugins/sudoers/auth/sia.c @@ -94,7 +94,7 @@ sudo_sia_setup(struct passwd *pw, char **promptp, sudo_auth *auth) /* Rebuild argv for sia_ses_init() */ sudo_argc = NewArgc + 1; - sudo_argv = emallocarray(sudo_argc + 1, sizeof(char *)); + sudo_argv = sudo_emallocarray(sudo_argc + 1, sizeof(char *)); sudo_argv[0] = "sudo"; for (i = 0; i < NewArgc; i++) sudo_argv[i + 1] = NewArgv[i]; diff --git a/plugins/sudoers/defaults.c b/plugins/sudoers/defaults.c index e0a13cad6..dcd666db7 100644 --- a/plugins/sudoers/defaults.c +++ b/plugins/sudoers/defaults.c @@ -418,17 +418,17 @@ init_defaults(void) #ifdef UMASK_OVERRIDE def_umask_override = true; #endif - def_iolog_file = estrdup("%{seq}"); - def_iolog_dir = estrdup(_PATH_SUDO_IO_LOGDIR); - def_sudoers_locale = estrdup("C"); + def_iolog_file = sudo_estrdup("%{seq}"); + def_iolog_dir = sudo_estrdup(_PATH_SUDO_IO_LOGDIR); + def_sudoers_locale = sudo_estrdup("C"); def_env_reset = ENV_RESET; def_set_logname = true; def_closefrom = STDERR_FILENO + 1; - def_pam_service = estrdup("sudo"); + def_pam_service = sudo_estrdup("sudo"); #ifdef HAVE_PAM_LOGIN - def_pam_login_service = estrdup("sudo-i"); + def_pam_login_service = sudo_estrdup("sudo-i"); #else - def_pam_login_service = estrdup("sudo"); + def_pam_login_service = sudo_estrdup("sudo"); #endif #ifdef NO_PAM_SESSION def_pam_session = false; @@ -467,27 +467,27 @@ init_defaults(void) #endif /* Now do the strings */ - def_mailto = estrdup(MAILTO); - def_mailsub = estrdup(N_(MAILSUBJECT)); - def_badpass_message = estrdup(_(INCORRECT_PASSWORD)); - def_lecture_status_dir = estrdup(_PATH_SUDO_LECTURE_DIR); - def_timestampdir = estrdup(_PATH_SUDO_TIMEDIR); - def_passprompt = estrdup(_(PASSPROMPT)); - def_runas_default = estrdup(RUNAS_DEFAULT); + def_mailto = sudo_estrdup(MAILTO); + def_mailsub = sudo_estrdup(N_(MAILSUBJECT)); + def_badpass_message = sudo_estrdup(_(INCORRECT_PASSWORD)); + def_lecture_status_dir = sudo_estrdup(_PATH_SUDO_LECTURE_DIR); + def_timestampdir = sudo_estrdup(_PATH_SUDO_TIMEDIR); + def_passprompt = sudo_estrdup(_(PASSPROMPT)); + def_runas_default = sudo_estrdup(RUNAS_DEFAULT); #ifdef _PATH_SUDO_SENDMAIL - def_mailerpath = estrdup(_PATH_SUDO_SENDMAIL); - def_mailerflags = estrdup("-t"); + def_mailerpath = sudo_estrdup(_PATH_SUDO_SENDMAIL); + def_mailerflags = sudo_estrdup("-t"); #endif #if (LOGGING & SLOG_FILE) - def_logfile = estrdup(_PATH_SUDO_LOGFILE); + def_logfile = sudo_estrdup(_PATH_SUDO_LOGFILE); #endif #ifdef EXEMPTGROUP - def_exempt_group = estrdup(EXEMPTGROUP); + def_exempt_group = sudo_estrdup(EXEMPTGROUP); #endif #ifdef SECURE_PATH - def_secure_path = estrdup(SECURE_PATH); + def_secure_path = sudo_estrdup(SECURE_PATH); #endif - def_editor = estrdup(EDITOR); + def_editor = sudo_estrdup(EDITOR); def_set_utmp = true; def_pam_setcred = true; @@ -709,7 +709,7 @@ store_str(char *val, struct sudo_defs_types *def, int op) if (op == false) def->sd_un.str = NULL; else - def->sd_un.str = estrdup(val); + def->sd_un.str = sudo_estrdup(val); if (def->callback) debug_return_bool(def->callback(val)); debug_return_bool(true); @@ -871,8 +871,8 @@ list_op(char *val, size_t len, struct sudo_defs_types *def, enum list_ops op) /* Add new node to the head of the list. */ if (op == add) { - cur = ecalloc(1, sizeof(struct list_member)); - cur->value = estrndup(val, len); + cur = sudo_ecalloc(1, sizeof(struct list_member)); + cur->value = sudo_estrndup(val, len); SLIST_INSERT_HEAD(&def->sd_un.list, cur, entries); } debug_return; diff --git a/plugins/sudoers/env.c b/plugins/sudoers/env.c index 0877d40fd..320abeef8 100644 --- a/plugins/sudoers/env.c +++ b/plugins/sudoers/env.c @@ -227,7 +227,7 @@ env_init(char * const envp[]) env.env_len = len; env.env_size = len + 1 + 128; - env.envp = emallocarray(env.env_size, sizeof(char *)); + env.envp = sudo_emallocarray(env.env_size, sizeof(char *)); #ifdef ENV_DEBUG memset(env.envp, 0, env.env_size * sizeof(char *)); #endif @@ -374,7 +374,7 @@ sudo_setenv2(const char *var, const char *val, bool dupcheck, bool overwrite) debug_decl(sudo_setenv2, SUDO_DEBUG_ENV) esize = strlen(var) + 1 + strlen(val) + 1; - estring = emalloc(esize); + estring = sudo_emalloc(esize); /* Build environment string and insert it. */ if (strlcpy(estring, var, esize) >= esize || @@ -754,7 +754,7 @@ rebuild_env(void) env.env_len = 0; env.env_size = 128; old_envp = env.envp; - env.envp = emallocarray(env.env_size, sizeof(char *)); + env.envp = sudo_emallocarray(env.env_size, sizeof(char *)); #ifdef ENV_DEBUG memset(env.envp, 0, env.env_size * sizeof(char *)); #else @@ -866,9 +866,9 @@ rebuild_env(void) if (ISSET(sudo_mode, MODE_LOGIN_SHELL) || !ISSET(didvar, KEPT_MAIL)) { cp = _PATH_MAILDIR; if (cp[sizeof(_PATH_MAILDIR) - 2] == '/') - easprintf(&cp, "MAIL=%s%s", _PATH_MAILDIR, runas_pw->pw_name); + sudo_easprintf(&cp, "MAIL=%s%s", _PATH_MAILDIR, runas_pw->pw_name); else - easprintf(&cp, "MAIL=%s/%s", _PATH_MAILDIR, runas_pw->pw_name); + sudo_easprintf(&cp, "MAIL=%s/%s", _PATH_MAILDIR, runas_pw->pw_name); if (sudo_putenv(cp, ISSET(didvar, DID_MAIL), true) == -1) { free(cp); goto bad; @@ -943,7 +943,7 @@ rebuild_env(void) /* Add the SUDO_COMMAND envariable (cmnd + args). */ if (user_args) { - easprintf(&cp, "SUDO_COMMAND=%s %s", user_cmnd, user_args); + sudo_easprintf(&cp, "SUDO_COMMAND=%s %s", user_cmnd, user_args); if (sudo_putenv(cp, true, true) == -1) { efree(cp); goto bad; @@ -1034,7 +1034,7 @@ validate_env_vars(char * const env_vars[]) do { bsize += 1024; } while (blen + len >= bsize); - bad = erealloc(bad, bsize); + bad = sudo_erealloc(bad, bsize); bad[blen] = '\0'; } strlcat(bad, *ep, bsize); @@ -1108,7 +1108,7 @@ read_env_file(const char *path, int overwrite) val_len -= 2; } - cp = emalloc(var_len + 1 + val_len + 1); + cp = sudo_emalloc(var_len + 1 + val_len + 1); memcpy(cp, var, var_len + 1); /* includes '=' */ memcpy(cp + var_len + 1, val, val_len + 1); /* includes NUL */ @@ -1132,22 +1132,22 @@ init_envtables(void) /* Fill in the "env_delete" list. */ for (p = initial_badenv_table; *p; p++) { - cur = ecalloc(1, sizeof(struct list_member)); - cur->value = estrdup(*p); + cur = sudo_ecalloc(1, sizeof(struct list_member)); + cur->value = sudo_estrdup(*p); SLIST_INSERT_HEAD(&def_env_delete, cur, entries); } /* Fill in the "env_check" list. */ for (p = initial_checkenv_table; *p; p++) { - cur = ecalloc(1, sizeof(struct list_member)); - cur->value = estrdup(*p); + cur = sudo_ecalloc(1, sizeof(struct list_member)); + cur->value = sudo_estrdup(*p); SLIST_INSERT_HEAD(&def_env_check, cur, entries); } /* Fill in the "env_keep" list. */ for (p = initial_keepenv_table; *p; p++) { - cur = ecalloc(1, sizeof(struct list_member)); - cur->value = estrdup(*p); + cur = sudo_ecalloc(1, sizeof(struct list_member)); + cur->value = sudo_estrdup(*p); SLIST_INSERT_HEAD(&def_env_keep, cur, entries); } } diff --git a/plugins/sudoers/find_path.c b/plugins/sudoers/find_path.c index d806eecf6..aa877eb17 100644 --- a/plugins/sudoers/find_path.c +++ b/plugins/sudoers/find_path.c @@ -84,7 +84,7 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path, if (path == NULL) debug_return_int(NOT_FOUND); - path = estrdup(path); + path = sudo_estrdup(path); origpath = path; do { diff --git a/plugins/sudoers/getspwuid.c b/plugins/sudoers/getspwuid.c index 126394244..2df9e42de 100644 --- a/plugins/sudoers/getspwuid.c +++ b/plugins/sudoers/getspwuid.c @@ -142,7 +142,7 @@ sudo_getepw(const struct passwd *pw) done: #endif /* If no shadow password, fall back on regular password. */ - debug_return_str(estrdup(epw ? epw : pw->pw_passwd)); + debug_return_str(sudo_estrdup(epw ? epw : pw->pw_passwd)); } void diff --git a/plugins/sudoers/gram.c b/plugins/sudoers/gram.c index cfc2f0918..b585c78cf 100644 --- a/plugins/sudoers/gram.c +++ b/plugins/sudoers/gram.c @@ -696,7 +696,7 @@ sudoerserror(const char *s) /* Save the line the first error occurred on. */ if (errorlineno == -1) { errorlineno = sudolineno; - errorfile = estrdup(sudoers); + errorfile = sudo_estrdup(sudoers); } if (sudoers_warnings && s != NULL) { LEXTRACE("<*> "); @@ -722,7 +722,7 @@ new_default(char *var, char *val, int op) struct defaults *d; debug_decl(new_default, SUDO_DEBUG_PARSER) - d = ecalloc(1, sizeof(struct defaults)); + d = sudo_ecalloc(1, sizeof(struct defaults)); d->var = var; d->val = val; /* d->type = 0; */ @@ -739,7 +739,7 @@ new_member(char *name, int type) struct member *m; debug_decl(new_member, SUDO_DEBUG_PARSER) - m = ecalloc(1, sizeof(struct member)); + m = sudo_ecalloc(1, sizeof(struct member)); m->name = name; m->type = type; HLTQ_INIT(m, entries); @@ -753,9 +753,9 @@ new_digest(int digest_type, const char *digest_str) struct sudo_digest *dig; debug_decl(new_digest, SUDO_DEBUG_PARSER) - dig = emalloc(sizeof(*dig)); + dig = sudo_emalloc(sizeof(*dig)); dig->digest_type = digest_type; - dig->digest_str = estrdup(digest_str); + dig->digest_str = sudo_estrdup(digest_str); debug_return_ptr(dig); } @@ -776,7 +776,7 @@ add_defaults(int type, struct member *bmem, struct defaults *defs) /* * We use a single binding for each entry in defs. */ - binding = emalloc(sizeof(*binding)); + binding = sudo_emalloc(sizeof(*binding)); if (bmem != NULL) HLTQ_TO_TAILQ(binding, bmem, entries); else @@ -806,7 +806,7 @@ add_userspec(struct member *members, struct privilege *privs) struct userspec *u; debug_decl(add_userspec, SUDO_DEBUG_PARSER) - u = ecalloc(1, sizeof(*u)); + u = sudo_ecalloc(1, sizeof(*u)); HLTQ_TO_TAILQ(&u->users, members, entries); HLTQ_TO_TAILQ(&u->privileges, privs, entries); TAILQ_INSERT_TAIL(&userspecs, u, entries); @@ -933,7 +933,7 @@ init_parser(const char *path, bool quiet) init_lexer(); efree(sudoers); - sudoers = path ? estrdup(path) : NULL; + sudoers = path ? sudo_estrdup(path) : NULL; parse_error = false; errorlineno = -1; @@ -1273,7 +1273,7 @@ break; case 26: #line 246 "gram.y" { - struct privilege *p = ecalloc(1, sizeof(*p)); + struct privilege *p = sudo_ecalloc(1, sizeof(*p)); HLTQ_TO_TAILQ(&p->hostlist, yyvsp[-2].member, entries); HLTQ_TO_TAILQ(&p->cmndlist, yyvsp[0].cmndspec, entries); HLTQ_INIT(p, entries); @@ -1369,17 +1369,17 @@ break; case 36: #line 324 "gram.y" { - struct cmndspec *cs = ecalloc(1, sizeof(*cs)); + struct cmndspec *cs = sudo_ecalloc(1, sizeof(*cs)); if (yyvsp[-4].runas != NULL) { if (yyvsp[-4].runas->runasusers != NULL) { cs->runasuserlist = - emalloc(sizeof(*cs->runasuserlist)); + sudo_emalloc(sizeof(*cs->runasuserlist)); HLTQ_TO_TAILQ(cs->runasuserlist, yyvsp[-4].runas->runasusers, entries); } if (yyvsp[-4].runas->runasgroups != NULL) { cs->runasgrouplist = - emalloc(sizeof(*cs->runasgrouplist)); + sudo_emalloc(sizeof(*cs->runasgrouplist)); HLTQ_TO_TAILQ(cs->runasgrouplist, yyvsp[-4].runas->runasgroups, entries); } @@ -1565,7 +1565,7 @@ break; case 61: #line 466 "gram.y" { - yyval.runas = ecalloc(1, sizeof(struct runascontainer)); + yyval.runas = sudo_ecalloc(1, sizeof(struct runascontainer)); yyval.runas->runasusers = new_member(NULL, MYSELF); /* $$->runasgroups = NULL; */ } @@ -1573,7 +1573,7 @@ break; case 62: #line 471 "gram.y" { - yyval.runas = ecalloc(1, sizeof(struct runascontainer)); + yyval.runas = sudo_ecalloc(1, sizeof(struct runascontainer)); yyval.runas->runasusers = yyvsp[0].member; /* $$->runasgroups = NULL; */ } @@ -1581,7 +1581,7 @@ break; case 63: #line 476 "gram.y" { - yyval.runas = ecalloc(1, sizeof(struct runascontainer)); + yyval.runas = sudo_ecalloc(1, sizeof(struct runascontainer)); yyval.runas->runasusers = yyvsp[-2].member; yyval.runas->runasgroups = yyvsp[0].member; } @@ -1589,7 +1589,7 @@ break; case 64: #line 481 "gram.y" { - yyval.runas = ecalloc(1, sizeof(struct runascontainer)); + yyval.runas = sudo_ecalloc(1, sizeof(struct runascontainer)); /* $$->runasusers = NULL; */ yyval.runas->runasgroups = yyvsp[0].member; } @@ -1597,7 +1597,7 @@ break; case 65: #line 486 "gram.y" { - yyval.runas = ecalloc(1, sizeof(struct runascontainer)); + yyval.runas = sudo_ecalloc(1, sizeof(struct runascontainer)); yyval.runas->runasusers = new_member(NULL, MYSELF); /* $$->runasgroups = NULL; */ } @@ -1684,7 +1684,7 @@ break; case 79: #line 535 "gram.y" { - struct sudo_command *c = ecalloc(1, sizeof(*c)); + struct sudo_command *c = sudo_ecalloc(1, sizeof(*c)); c->cmnd = yyvsp[0].command.cmnd; c->args = yyvsp[0].command.args; yyval.member = new_member((char *)c, COMMAND); diff --git a/plugins/sudoers/gram.y b/plugins/sudoers/gram.y index 951491aec..2a49ff6a7 100644 --- a/plugins/sudoers/gram.y +++ b/plugins/sudoers/gram.y @@ -244,7 +244,7 @@ privileges : privilege ; privilege : hostlist '=' cmndspeclist { - struct privilege *p = ecalloc(1, sizeof(*p)); + struct privilege *p = sudo_ecalloc(1, sizeof(*p)); HLTQ_TO_TAILQ(&p->hostlist, $1, entries); HLTQ_TO_TAILQ(&p->cmndlist, $3, entries); HLTQ_INIT(p, entries); @@ -322,17 +322,17 @@ cmndspeclist : cmndspec ; cmndspec : runasspec selinux solarisprivs cmndtag digcmnd { - struct cmndspec *cs = ecalloc(1, sizeof(*cs)); + struct cmndspec *cs = sudo_ecalloc(1, sizeof(*cs)); if ($1 != NULL) { if ($1->runasusers != NULL) { cs->runasuserlist = - emalloc(sizeof(*cs->runasuserlist)); + sudo_emalloc(sizeof(*cs->runasuserlist)); HLTQ_TO_TAILQ(cs->runasuserlist, $1->runasusers, entries); } if ($1->runasgroups != NULL) { cs->runasgrouplist = - emalloc(sizeof(*cs->runasgrouplist)); + sudo_emalloc(sizeof(*cs->runasgrouplist)); HLTQ_TO_TAILQ(cs->runasgrouplist, $1->runasgroups, entries); } @@ -464,27 +464,27 @@ runasspec : /* empty */ { ; runaslist : /* empty */ { - $$ = ecalloc(1, sizeof(struct runascontainer)); + $$ = sudo_ecalloc(1, sizeof(struct runascontainer)); $$->runasusers = new_member(NULL, MYSELF); /* $$->runasgroups = NULL; */ } | userlist { - $$ = ecalloc(1, sizeof(struct runascontainer)); + $$ = sudo_ecalloc(1, sizeof(struct runascontainer)); $$->runasusers = $1; /* $$->runasgroups = NULL; */ } | userlist ':' grouplist { - $$ = ecalloc(1, sizeof(struct runascontainer)); + $$ = sudo_ecalloc(1, sizeof(struct runascontainer)); $$->runasusers = $1; $$->runasgroups = $3; } | ':' grouplist { - $$ = ecalloc(1, sizeof(struct runascontainer)); + $$ = sudo_ecalloc(1, sizeof(struct runascontainer)); /* $$->runasusers = NULL; */ $$->runasgroups = $2; } | ':' { - $$ = ecalloc(1, sizeof(struct runascontainer)); + $$ = sudo_ecalloc(1, sizeof(struct runascontainer)); $$->runasusers = new_member(NULL, MYSELF); /* $$->runasgroups = NULL; */ } @@ -533,7 +533,7 @@ cmnd : ALL { $$ = new_member($1, ALIAS); } | COMMAND { - struct sudo_command *c = ecalloc(1, sizeof(*c)); + struct sudo_command *c = sudo_ecalloc(1, sizeof(*c)); c->cmnd = $1.cmnd; c->args = $1.args; $$ = new_member((char *)c, COMMAND); @@ -681,7 +681,7 @@ sudoerserror(const char *s) /* Save the line the first error occurred on. */ if (errorlineno == -1) { errorlineno = sudolineno; - errorfile = estrdup(sudoers); + errorfile = sudo_estrdup(sudoers); } if (sudoers_warnings && s != NULL) { LEXTRACE("<*> "); @@ -707,7 +707,7 @@ new_default(char *var, char *val, int op) struct defaults *d; debug_decl(new_default, SUDO_DEBUG_PARSER) - d = ecalloc(1, sizeof(struct defaults)); + d = sudo_ecalloc(1, sizeof(struct defaults)); d->var = var; d->val = val; /* d->type = 0; */ @@ -724,7 +724,7 @@ new_member(char *name, int type) struct member *m; debug_decl(new_member, SUDO_DEBUG_PARSER) - m = ecalloc(1, sizeof(struct member)); + m = sudo_ecalloc(1, sizeof(struct member)); m->name = name; m->type = type; HLTQ_INIT(m, entries); @@ -738,9 +738,9 @@ new_digest(int digest_type, const char *digest_str) struct sudo_digest *dig; debug_decl(new_digest, SUDO_DEBUG_PARSER) - dig = emalloc(sizeof(*dig)); + dig = sudo_emalloc(sizeof(*dig)); dig->digest_type = digest_type; - dig->digest_str = estrdup(digest_str); + dig->digest_str = sudo_estrdup(digest_str); debug_return_ptr(dig); } @@ -761,7 +761,7 @@ add_defaults(int type, struct member *bmem, struct defaults *defs) /* * We use a single binding for each entry in defs. */ - binding = emalloc(sizeof(*binding)); + binding = sudo_emalloc(sizeof(*binding)); if (bmem != NULL) HLTQ_TO_TAILQ(binding, bmem, entries); else @@ -791,7 +791,7 @@ add_userspec(struct member *members, struct privilege *privs) struct userspec *u; debug_decl(add_userspec, SUDO_DEBUG_PARSER) - u = ecalloc(1, sizeof(*u)); + u = sudo_ecalloc(1, sizeof(*u)); HLTQ_TO_TAILQ(&u->users, members, entries); HLTQ_TO_TAILQ(&u->privileges, privs, entries); TAILQ_INSERT_TAIL(&userspecs, u, entries); @@ -918,7 +918,7 @@ init_parser(const char *path, bool quiet) init_lexer(); efree(sudoers); - sudoers = path ? estrdup(path) : NULL; + sudoers = path ? sudo_estrdup(path) : NULL; parse_error = false; errorlineno = -1; diff --git a/plugins/sudoers/group_plugin.c b/plugins/sudoers/group_plugin.c index 4574b3a56..9f07933eb 100644 --- a/plugins/sudoers/group_plugin.c +++ b/plugins/sudoers/group_plugin.c @@ -135,7 +135,7 @@ group_plugin_load(char *plugin_info) } } if (ac != 0) { - argv = emallocarray(ac, sizeof(char *)); + argv = sudo_emallocarray(ac, sizeof(char *)); ac = 0; for ((cp = strtok(args, " \t")); cp; (cp = strtok(NULL, " \t"))) argv[ac++] = cp; diff --git a/plugins/sudoers/interfaces.c b/plugins/sudoers/interfaces.c index 358d4447e..6457196d1 100644 --- a/plugins/sudoers/interfaces.c +++ b/plugins/sudoers/interfaces.c @@ -64,7 +64,7 @@ set_interfaces(const char *ai) struct interface *ifp; debug_decl(set_interfaces, SUDO_DEBUG_NETIF) - addrinfo = estrdup(ai); + addrinfo = sudo_estrdup(ai); for (addr = strtok(addrinfo, " \t"); addr != NULL; addr = strtok(NULL, " \t")) { /* Separate addr and mask. */ if ((mask = strchr(addr, '/')) == NULL) @@ -72,7 +72,7 @@ set_interfaces(const char *ai) *mask++ = '\0'; /* Parse addr and store in list. */ - ifp = ecalloc(1, sizeof(*ifp)); + ifp = sudo_ecalloc(1, sizeof(*ifp)); if (strchr(addr, ':')) { /* IPv6 */ #ifdef HAVE_STRUCT_IN6_ADDR @@ -111,7 +111,7 @@ dump_interfaces(const char *ai) char *cp, *addrinfo; debug_decl(set_interfaces, SUDO_DEBUG_NETIF) - addrinfo = estrdup(ai); + addrinfo = sudo_estrdup(ai); sudo_printf(SUDO_CONV_INFO_MSG, _("Local IP address and netmask pairs:\n")); for (cp = strtok(addrinfo, " \t"); cp != NULL; cp = strtok(NULL, " \t")) diff --git a/plugins/sudoers/iolog.c b/plugins/sudoers/iolog.c index da8853545..8d9928afd 100644 --- a/plugins/sudoers/iolog.c +++ b/plugins/sudoers/iolog.c @@ -610,7 +610,7 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation, /* If no I/O log path defined we need to figure it out ourselves. */ if (details.iolog_path == NULL) { /* Get next session ID and convert it into a path. */ - tofree = emalloc(sizeof(_PATH_SUDO_IO_LOGDIR) + sizeof(sessid) + 2); + tofree = sudo_emalloc(sizeof(_PATH_SUDO_IO_LOGDIR) + sizeof(sessid) + 2); memcpy(tofree, _PATH_SUDO_IO_LOGDIR, sizeof(_PATH_SUDO_IO_LOGDIR)); if (!io_nextid(tofree, NULL, sessid)) { rval = false; diff --git a/plugins/sudoers/iolog_path.c b/plugins/sudoers/iolog_path.c index d060c3828..1ff7e92f0 100644 --- a/plugins/sudoers/iolog_path.c +++ b/plugins/sudoers/iolog_path.c @@ -172,7 +172,7 @@ expand_iolog_path(const char *prefix, const char *dir, const char *file, /* Expanded path must be <= PATH_MAX */ if (prefix != NULL) prelen = strlen(prefix); - dst = path = emalloc(prelen + PATH_MAX); + dst = path = sudo_emalloc(prelen + PATH_MAX); *path = '\0'; pathend = path + prelen + PATH_MAX; diff --git a/plugins/sudoers/ldap.c b/plugins/sudoers/ldap.c index 62982c92c..9f0018313 100644 --- a/plugins/sudoers/ldap.c +++ b/plugins/sudoers/ldap.c @@ -424,7 +424,7 @@ sudo_ldap_conf_add_ports(void) } efree(ldap_conf.host); - ldap_conf.host = estrdup(hostbuf); + ldap_conf.host = sudo_estrdup(hostbuf); debug_return_bool(true); toobig: @@ -452,7 +452,7 @@ sudo_ldap_parse_uri(const struct ldap_config_str_list *uri_list) hostbuf[0] = '\0'; STAILQ_FOREACH(entry, uri_list, entries) { - buf = estrdup(entry->val); + buf = sudo_estrdup(entry->val); for ((uri = strtok(buf, " \t")); uri != NULL; (uri = strtok(NULL, " \t"))) { if (strncasecmp(uri, "ldap://", 7) == 0) { nldap++; @@ -505,7 +505,7 @@ sudo_ldap_parse_uri(const struct ldap_config_str_list *uri_list) /* Store parsed URI(s) in host for ldap_create() or ldap_init(). */ efree(ldap_conf.host); - ldap_conf.host = estrdup(hostbuf); + ldap_conf.host = sudo_estrdup(hostbuf); rc = LDAP_SUCCESS; @@ -535,7 +535,7 @@ sudo_ldap_join_uri(struct ldap_config_str_list *uri_list) } len += strlen(uri->val) + 1; } - buf = cp = emalloc(len); + buf = cp = sudo_emalloc(len); buf[0] = '\0'; STAILQ_FOREACH(uri, uri_list, entries) { cp += strlcpy(cp, uri->val, len - (cp - buf)); @@ -882,7 +882,7 @@ sudo_ldap_extract_digest(char **cmnd, struct sudo_digest *digest) ep++; if (*ep != '\0') { digest->digest_type = digest_type; - digest->digest_str = estrndup(cp, (size_t)(ep - cp)); + digest->digest_str = sudo_estrndup(cp, (size_t)(ep - cp)); cp = ep + 1; while (isblank((unsigned char)*cp)) cp++; @@ -938,10 +938,10 @@ sudo_ldap_check_command(LDAP *ld, LDAPMessage *entry, int *setenv_implied) /* check for !command */ if (*val == '!') { foundbang = true; - allowed_cmnd = estrdup(1 + val); /* !command */ + allowed_cmnd = sudo_estrdup(1 + val); /* !command */ } else { foundbang = false; - allowed_cmnd = estrdup(val); /* command */ + allowed_cmnd = sudo_estrdup(val); /* command */ } /* split optional args away from command */ @@ -1025,7 +1025,7 @@ sudo_ldap_parse_options(LDAP *ld, LDAPMessage *entry) /* walk through options */ for (p = bv; *p != NULL; p++) { - var = estrdup((*p)->bv_val); + var = sudo_estrdup((*p)->bv_val); DPRINTF2("ldap sudoOption: '%s'", var); /* check for equals sign past first char */ @@ -1122,9 +1122,9 @@ sudo_ldap_build_default_filter(void) debug_decl(sudo_ldap_build_default_filter, SUDO_DEBUG_LDAP) if (ldap_conf.search_filter) - easprintf(&filt, "(&%s(cn=defaults))", ldap_conf.search_filter); + sudo_easprintf(&filt, "(&%s(cn=defaults))", ldap_conf.search_filter); else - filt = estrdup("cn=defaults"); + filt = sudo_estrdup("cn=defaults"); debug_return_str(filt); } @@ -1266,7 +1266,7 @@ sudo_ldap_build_pass1(struct passwd *pw) /* If timed, add space for time limits. */ if (ldap_conf.timed) sz += TIMEFILTER_LENGTH; - buf = emalloc(sz); + buf = sudo_emalloc(sz); *buf = '\0'; /* @@ -1364,14 +1364,14 @@ sudo_ldap_build_pass2(void) * those get ANDed in to the expression. */ if (def_group_plugin) { - easprintf(&filt, "%s%s(|(sudoUser=%s*)(sudoUser=%%:*))%s%s", + sudo_easprintf(&filt, "%s%s(|(sudoUser=%s*)(sudoUser=%%:*))%s%s", (ldap_conf.timed || ldap_conf.search_filter) ? "(&" : "", ldap_conf.search_filter ? ldap_conf.search_filter : "", def_use_netgroups ? "+" : "", ldap_conf.timed ? timebuffer : "", (ldap_conf.timed || ldap_conf.search_filter) ? ")" : ""); } else { - easprintf(&filt, "%s%s(sudoUser=*)(sudoUser=+*)%s%s", + sudo_easprintf(&filt, "%s%s(sudoUser=*)(sudoUser=+*)%s%s", (ldap_conf.timed || ldap_conf.search_filter) ? "(&" : "", ldap_conf.search_filter ? ldap_conf.search_filter : "", ldap_conf.timed ? timebuffer : "", @@ -1394,7 +1394,7 @@ sudo_ldap_read_secret(const char *path) *cp = '\0'; /* copy to bindpw and binddn */ efree(ldap_conf.bindpw); - ldap_conf.bindpw = estrdup(buf); + ldap_conf.bindpw = sudo_estrdup(buf); efree(ldap_conf.binddn); ldap_conf.binddn = ldap_conf.rootbinddn; ldap_conf.rootbinddn = NULL; @@ -1442,7 +1442,7 @@ sudo_ldap_parse_keyword(const char *keyword, const char *value, break; case CONF_STR: efree(*(char **)(cur->valp)); - *(char **)(cur->valp) = *value ? estrdup(value) : NULL; + *(char **)(cur->valp) = *value ? sudo_estrdup(value) : NULL; break; case CONF_LIST_STR: { @@ -1452,7 +1452,7 @@ sudo_ldap_parse_keyword(const char *keyword, const char *value, if (len > 0) { head = (struct ldap_config_str_list *)cur->valp; - str = emalloc(sizeof(*str) + len); + str = sudo_emalloc(sizeof(*str) + len); memcpy(str->val, value, len + 1); STAILQ_INSERT_TAIL(head, str, entries); } @@ -1538,7 +1538,7 @@ sudo_ldap_read_config(void) ldap_conf.use_sasl = -1; ldap_conf.rootuse_sasl = -1; ldap_conf.deref = -1; - ldap_conf.search_filter = estrdup(DEFAULT_SEARCH_FILTER); + ldap_conf.search_filter = sudo_estrdup(DEFAULT_SEARCH_FILTER); STAILQ_INIT(&ldap_conf.uri); STAILQ_INIT(&ldap_conf.base); @@ -1569,7 +1569,7 @@ sudo_ldap_read_config(void) fclose(fp); if (!ldap_conf.host) - ldap_conf.host = estrdup("localhost"); + ldap_conf.host = sudo_estrdup("localhost"); DPRINTF1("LDAP Config Summary"); DPRINTF1("==================="); @@ -1710,7 +1710,7 @@ sudo_ldap_read_config(void) if (ldap_conf.search_filter && ldap_conf.search_filter[0] != '(') { size_t len = strlen(ldap_conf.search_filter); cp = ldap_conf.search_filter; - ldap_conf.search_filter = emalloc(len + 3); + ldap_conf.search_filter = sudo_emalloc(len + 3); ldap_conf.search_filter[0] = '('; memcpy(ldap_conf.search_filter + 1, cp, len); ldap_conf.search_filter[len + 1] = ')'; @@ -2338,7 +2338,7 @@ sudo_ldap_result_alloc(void) struct ldap_result *result; debug_decl(sudo_ldap_result_alloc, SUDO_DEBUG_LDAP) - result = ecalloc(1, sizeof(*result)); + result = sudo_ecalloc(1, sizeof(*result)); STAILQ_INIT(&result->searches); debug_return_ptr(result); @@ -2379,7 +2379,7 @@ sudo_ldap_result_add_search(struct ldap_result *lres, LDAP *ldap, debug_decl(sudo_ldap_result_add_search, SUDO_DEBUG_LDAP) /* Create new entry and add it to the end of the chain. */ - news = ecalloc(1, sizeof(*news)); + news = sudo_ecalloc(1, sizeof(*news)); news->ldap = ldap; news->searchresult = searchresult; STAILQ_INSERT_TAIL(&lres->searches, news, entries); @@ -2573,7 +2573,7 @@ sudo_ldap_open(struct sudo_nss *nss) goto done; /* Create a handle container. */ - handle = ecalloc(1, sizeof(struct sudo_ldap_handle)); + handle = sudo_ecalloc(1, sizeof(struct sudo_ldap_handle)); handle->ld = ld; /* handle->result = NULL; */ /* handle->username = NULL; */ @@ -2810,7 +2810,7 @@ sudo_ldap_result_add_entry(struct ldap_result *lres, LDAPMessage *entry) */ if (++lres->nentries > lres->allocated_entries) { lres->allocated_entries += ALLOCATION_INCREMENT; - lres->entries = ereallocarray(lres->entries, lres->allocated_entries, + lres->entries = sudo_ereallocarray(lres->entries, lres->allocated_entries, sizeof(lres->entries[0])); } @@ -2941,7 +2941,7 @@ sudo_ldap_result_get(struct sudo_nss *nss, struct passwd *pw) /* Store everything in the sudo_nss handle. */ handle->result = lres; - handle->username = estrdup(pw->pw_name); + handle->username = sudo_estrdup(pw->pw_name); handle->grlist = user_group_list; debug_return_ptr(lres); diff --git a/plugins/sudoers/linux_audit.c b/plugins/sudoers/linux_audit.c index 66cc6ae21..deafa263b 100644 --- a/plugins/sudoers/linux_audit.c +++ b/plugins/sudoers/linux_audit.c @@ -36,7 +36,7 @@ #include "missing.h" #include "fatal.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "sudo_debug.h" #include "linux_audit.h" @@ -82,7 +82,7 @@ linux_audit_command(char *argv[], int result) /* Convert argv to a flat string. */ for (size = 0, av = argv; *av != NULL; av++) size += strlen(*av) + 1; - command = cp = emalloc(size); + command = cp = sudo_emalloc(size); for (av = argv; *av != NULL; av++) { n = strlcpy(cp, *av, size - (cp - command)); if (n >= size - (cp - command)) { diff --git a/plugins/sudoers/locale.c b/plugins/sudoers/locale.c index 5ae99a368..22ef35f1b 100644 --- a/plugins/sudoers/locale.c +++ b/plugins/sudoers/locale.c @@ -43,7 +43,7 @@ #include "missing.h" #include "fatal.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "logging.h" static int current_locale = SUDOERS_LOCALE_USER; @@ -61,11 +61,11 @@ sudoers_initlocale(const char *ulocale, const char *slocale) { if (ulocale != NULL) { efree(user_locale); - user_locale = estrdup(ulocale); + user_locale = sudo_estrdup(ulocale); } if (slocale != NULL) { efree(sudoers_locale); - sudoers_locale = estrdup(slocale); + sudoers_locale = sudo_estrdup(slocale); } } @@ -88,7 +88,7 @@ sudoers_setlocale(int newlocale, int *prevlocale) current_locale = SUDOERS_LOCALE_USER; res = setlocale(LC_ALL, user_locale ? user_locale : ""); if (res != NULL && user_locale == NULL) - user_locale = estrdup(setlocale(LC_ALL, NULL)); + user_locale = sudo_estrdup(setlocale(LC_ALL, NULL)); } break; case SUDOERS_LOCALE_SUDOERS: @@ -100,7 +100,7 @@ sudoers_setlocale(int newlocale, int *prevlocale) if (res == NULL && sudoers_locale != NULL) { if (strcmp(sudoers_locale, "C") != 0) { efree(sudoers_locale); - sudoers_locale = estrdup("C"); + sudoers_locale = sudo_estrdup("C"); res = setlocale(LC_ALL, "C"); } } diff --git a/plugins/sudoers/logging.c b/plugins/sudoers/logging.c index e6b265fc6..c9465fd81 100644 --- a/plugins/sudoers/logging.c +++ b/plugins/sudoers/logging.c @@ -203,10 +203,10 @@ do_logfile(char *msg) } } else { if (def_log_host) { - len = easprintf(&full_line, "%s : %s : HOST=%s : %s", + len = sudo_easprintf(&full_line, "%s : %s : HOST=%s : %s", timestr, user_name, user_srunhost, msg); } else { - len = easprintf(&full_line, "%s : %s : %s", + len = sudo_easprintf(&full_line, "%s : %s : %s", timestr, user_name, msg); } @@ -443,10 +443,10 @@ vlog_warning(int flags, const char *fmt, va_list ap) /* Expand printf-style format + args (with a special case). */ if (fmt == INCORRECT_PASSWORD_ATTEMPT) { unsigned int tries = va_arg(ap, unsigned int); - easprintf(&message, ngettext("%u incorrect password attempt", + sudo_easprintf(&message, ngettext("%u incorrect password attempt", "%u incorrect password attempts", tries), tries); } else { - evasprintf(&message, _(fmt), ap); + sudo_evasprintf(&message, _(fmt), ap); } /* Log to debug file. */ @@ -670,7 +670,7 @@ send_mail(const char *fmt, ...) (void) close(pfd[1]); /* Build up an argv based on the mailer path and flags */ - mflags = estrdup(def_mailerflags); + mflags = sudo_estrdup(def_mailerflags); if ((argv[0] = strrchr(mpath, '/'))) argv[0]++; else @@ -833,7 +833,7 @@ new_logline(const char *message, int serrno) for (ep = sudo_user.env_vars; *ep != NULL; ep++) evlen += strlen(*ep) + 1; - evstr = emalloc(evlen); + evstr = sudo_emalloc(evlen); evstr[0] = '\0'; for (ep = sudo_user.env_vars; *ep != NULL; ep++) { strlcat(evstr, *ep, evlen); @@ -853,7 +853,7 @@ new_logline(const char *message, int serrno) /* * Allocate and build up the line. */ - line = emalloc(++len); + line = sudo_emalloc(++len); line[0] = '\0'; if (message != NULL) { diff --git a/plugins/sudoers/match.c b/plugins/sudoers/match.c index 23a31374f..37c1dbe3f 100644 --- a/plugins/sudoers/match.c +++ b/plugins/sudoers/match.c @@ -411,7 +411,7 @@ command_matches(const char *sudoers_cmnd, const char *sudoers_args, const struct strcmp(user_cmnd, "sudoedit") == 0 && command_args_match(sudoers_cmnd, sudoers_args)) { efree(safe_cmnd); - safe_cmnd = estrdup(sudoers_cmnd); + safe_cmnd = sudo_estrdup(sudoers_cmnd); rc = true; } goto done; @@ -459,7 +459,7 @@ command_matches_fnmatch(const char *sudoers_cmnd, const char *sudoers_args) if (command_args_match(sudoers_cmnd, sudoers_args)) { if (safe_cmnd) free(safe_cmnd); - safe_cmnd = estrdup(user_cmnd); + safe_cmnd = sudo_estrdup(user_cmnd); debug_return_bool(true); } debug_return_bool(false); @@ -521,7 +521,7 @@ command_matches_glob(const char *sudoers_cmnd, const char *sudoers_args) (user_stat->st_dev == sudoers_stat.st_dev && user_stat->st_ino == sudoers_stat.st_ino)) { efree(safe_cmnd); - safe_cmnd = estrdup(cp); + safe_cmnd = sudo_estrdup(cp); break; } } @@ -531,7 +531,7 @@ command_matches_glob(const char *sudoers_cmnd, const char *sudoers_args) if (command_args_match(sudoers_cmnd, sudoers_args)) { efree(safe_cmnd); - safe_cmnd = estrdup(user_cmnd); + safe_cmnd = sudo_estrdup(user_cmnd); debug_return_bool(true); } debug_return_bool(false); @@ -554,7 +554,7 @@ command_matches_normal(const char *sudoers_cmnd, const char *sudoers_args, const if (strcmp(user_cmnd, sudoers_cmnd) == 0) { if (command_args_match(sudoers_cmnd, sudoers_args)) { efree(safe_cmnd); - safe_cmnd = estrdup(sudoers_cmnd); + safe_cmnd = sudo_estrdup(sudoers_cmnd); debug_return_bool(true); } } @@ -712,7 +712,7 @@ command_matches_normal(const char *sudoers_cmnd, const char *sudoers_args, const debug_return_bool(false); } efree(safe_cmnd); - safe_cmnd = estrdup(sudoers_cmnd); + safe_cmnd = sudo_estrdup(sudoers_cmnd); debug_return_bool(true); } #endif /* SUDOERS_NAME_MATCH */ @@ -766,7 +766,7 @@ command_matches_dir(const char *sudoers_dir, size_t dlen) (user_stat->st_dev == sudoers_stat.st_dev && user_stat->st_ino == sudoers_stat.st_ino)) { efree(safe_cmnd); - safe_cmnd = estrdup(buf); + safe_cmnd = sudo_estrdup(buf); break; } } @@ -916,7 +916,7 @@ sudo_getdomainname(void) #ifdef HAVE_GETDOMAINNAME char *buf, *cp; - buf = emalloc(HOST_NAME_MAX + 1); + buf = sudo_emalloc(HOST_NAME_MAX + 1); if (getdomainname(buf, HOST_NAME_MAX + 1) == 0 && *buf != '\0') { domain = buf; for (cp = buf; *cp != '\0'; cp++) { diff --git a/plugins/sudoers/parse.c b/plugins/sudoers/parse.c index 8f8108ef3..b3cc4a40a 100644 --- a/plugins/sudoers/parse.c +++ b/plugins/sudoers/parse.c @@ -231,16 +231,16 @@ sudo_file_lookup(struct sudo_nss *nss, int validated, int pwflag) #ifdef HAVE_SELINUX /* Set role and type if not specified on command line. */ if (user_role == NULL) - user_role = cs->role ? estrdup(cs->role) : def_role; + user_role = cs->role ? sudo_estrdup(cs->role) : def_role; if (user_type == NULL) - user_type = cs->type ? estrdup(cs->type) : def_type; + user_type = cs->type ? sudo_estrdup(cs->type) : def_type; #endif /* HAVE_SELINUX */ #ifdef HAVE_PRIV_SET /* Set Solaris privilege sets */ if (runas_privs == NULL) - runas_privs = cs->privs ? estrdup(cs->privs) : def_privs; + runas_privs = cs->privs ? sudo_estrdup(cs->privs) : def_privs; if (runas_limitprivs == NULL) - runas_limitprivs = cs->limitprivs ? estrdup(cs->limitprivs) : def_limitprivs; + runas_limitprivs = cs->limitprivs ? sudo_estrdup(cs->limitprivs) : def_limitprivs; #endif /* HAVE_PRIV_SET */ /* * If user is running command as himself, diff --git a/plugins/sudoers/policy.c b/plugins/sudoers/policy.c index 8071d9594..6cd71bd99 100644 --- a/plugins/sudoers/policy.c +++ b/plugins/sudoers/policy.c @@ -277,7 +277,7 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group) for (cur = info->user_info; *cur != NULL; cur++) { if (MATCHES(*cur, "user=")) { - user_name = estrdup(*cur + sizeof("user=") - 1); + user_name = sudo_estrdup(*cur + sizeof("user=") - 1); continue; } if (MATCHES(*cur, "uid=")) { @@ -303,19 +303,19 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group) continue; } if (MATCHES(*cur, "cwd=")) { - user_cwd = estrdup(*cur + sizeof("cwd=") - 1); + user_cwd = sudo_estrdup(*cur + sizeof("cwd=") - 1); continue; } if (MATCHES(*cur, "tty=")) { - user_tty = user_ttypath = estrdup(*cur + sizeof("tty=") - 1); + user_tty = user_ttypath = sudo_estrdup(*cur + sizeof("tty=") - 1); if (strncmp(user_tty, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) user_tty += sizeof(_PATH_DEV) - 1; continue; } if (MATCHES(*cur, "host=")) { - user_host = user_shost = estrdup(*cur + sizeof("host=") - 1); + user_host = user_shost = sudo_estrdup(*cur + sizeof("host=") - 1); if ((p = strchr(user_host, '.'))) - user_shost = estrndup(user_host, (size_t)(p - user_host)); + user_shost = sudo_estrndup(user_host, (size_t)(p - user_host)); continue; } if (MATCHES(*cur, "lines=")) { @@ -348,13 +348,13 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group) continue; } } - user_runhost = user_srunhost = estrdup(remhost ? remhost : user_host); + user_runhost = user_srunhost = sudo_estrdup(remhost ? remhost : user_host); if ((p = strchr(user_runhost, '.'))) - user_srunhost = estrndup(user_runhost, (size_t)(p - user_runhost)); + user_srunhost = sudo_estrndup(user_runhost, (size_t)(p - user_runhost)); if (user_cwd == NULL) - user_cwd = estrdup("unknown"); + user_cwd = sudo_estrdup("unknown"); if (user_tty == NULL) - user_tty = estrdup("unknown"); /* user_ttypath remains NULL */ + user_tty = sudo_estrdup("unknown"); /* user_ttypath remains NULL */ if (groups != NULL && groups[0] != '\0') { /* sudo_parse_gids() will print a warning on error. */ @@ -399,48 +399,48 @@ sudoers_policy_exec_setup(char *argv[], char *envp[], mode_t cmnd_umask, debug_decl(sudoers_policy_exec_setup, SUDO_DEBUG_PLUGIN) /* Increase the length of command_info as needed, it is *not* checked. */ - command_info = ecalloc(32, sizeof(char **)); + command_info = sudo_ecalloc(32, sizeof(char **)); command_info[info_len++] = sudo_new_key_val("command", safe_cmnd); if (def_log_input || def_log_output) { if (iolog_path) command_info[info_len++] = iolog_path; if (def_log_input) { - command_info[info_len++] = estrdup("iolog_stdin=true"); - command_info[info_len++] = estrdup("iolog_ttyin=true"); + command_info[info_len++] = sudo_estrdup("iolog_stdin=true"); + command_info[info_len++] = sudo_estrdup("iolog_ttyin=true"); } if (def_log_output) { - command_info[info_len++] = estrdup("iolog_stdout=true"); - command_info[info_len++] = estrdup("iolog_stderr=true"); - command_info[info_len++] = estrdup("iolog_ttyout=true"); + command_info[info_len++] = sudo_estrdup("iolog_stdout=true"); + command_info[info_len++] = sudo_estrdup("iolog_stderr=true"); + command_info[info_len++] = sudo_estrdup("iolog_ttyout=true"); } if (def_compress_io) { - command_info[info_len++] = estrdup("iolog_compress=true"); + command_info[info_len++] = sudo_estrdup("iolog_compress=true"); } if (def_maxseq) { - easprintf(&command_info[info_len++], "maxseq=%u", def_maxseq); + sudo_easprintf(&command_info[info_len++], "maxseq=%u", def_maxseq); } } if (ISSET(sudo_mode, MODE_EDIT)) - command_info[info_len++] = estrdup("sudoedit=true"); + command_info[info_len++] = sudo_estrdup("sudoedit=true"); if (ISSET(sudo_mode, MODE_LOGIN_SHELL)) { /* Set cwd to run user's homedir. */ command_info[info_len++] = sudo_new_key_val("cwd", runas_pw->pw_dir); } if (def_stay_setuid) { - easprintf(&command_info[info_len++], "runas_uid=%u", + sudo_easprintf(&command_info[info_len++], "runas_uid=%u", (unsigned int)user_uid); - easprintf(&command_info[info_len++], "runas_gid=%u", + sudo_easprintf(&command_info[info_len++], "runas_gid=%u", (unsigned int)user_gid); - easprintf(&command_info[info_len++], "runas_euid=%u", + sudo_easprintf(&command_info[info_len++], "runas_euid=%u", (unsigned int)runas_pw->pw_uid); - easprintf(&command_info[info_len++], "runas_egid=%u", + sudo_easprintf(&command_info[info_len++], "runas_egid=%u", runas_gr ? (unsigned int)runas_gr->gr_gid : (unsigned int)runas_pw->pw_gid); } else { - easprintf(&command_info[info_len++], "runas_uid=%u", + sudo_easprintf(&command_info[info_len++], "runas_uid=%u", (unsigned int)runas_pw->pw_uid); - easprintf(&command_info[info_len++], "runas_gid=%u", + sudo_easprintf(&command_info[info_len++], "runas_gid=%u", runas_gr ? (unsigned int)runas_gr->gr_gid : (unsigned int)runas_pw->pw_gid); } @@ -456,7 +456,7 @@ sudoers_policy_exec_setup(char *argv[], char *envp[], mode_t cmnd_umask, /* We reserve an extra spot in the list for the effective gid. */ glsize = sizeof("runas_groups=") - 1 + ((grlist->ngids + 1) * (MAX_UID_T_LEN + 1)); - gid_list = emalloc(glsize); + gid_list = sudo_emalloc(glsize); memcpy(gid_list, "runas_groups=", sizeof("runas_groups=") - 1); cp = gid_list + sizeof("runas_groups=") - 1; @@ -484,19 +484,19 @@ sudoers_policy_exec_setup(char *argv[], char *envp[], mode_t cmnd_umask, sudo_grlist_delref(grlist); } if (def_closefrom >= 0) - easprintf(&command_info[info_len++], "closefrom=%d", def_closefrom); + sudo_easprintf(&command_info[info_len++], "closefrom=%d", def_closefrom); if (def_noexec) - command_info[info_len++] = estrdup("noexec=true"); + command_info[info_len++] = sudo_estrdup("noexec=true"); if (def_exec_background) - command_info[info_len++] = estrdup("exec_background=true"); + command_info[info_len++] = sudo_estrdup("exec_background=true"); if (def_set_utmp) - command_info[info_len++] = estrdup("set_utmp=true"); + command_info[info_len++] = sudo_estrdup("set_utmp=true"); if (def_use_pty) - command_info[info_len++] = estrdup("use_pty=true"); + command_info[info_len++] = sudo_estrdup("use_pty=true"); if (def_utmp_runas) command_info[info_len++] = sudo_new_key_val("utmp_user", runas_pw->pw_name); if (cmnd_umask != 0777) - easprintf(&command_info[info_len++], "umask=0%o", (unsigned int)cmnd_umask); + sudo_easprintf(&command_info[info_len++], "umask=0%o", (unsigned int)cmnd_umask); #ifdef HAVE_LOGIN_CAP_H if (def_use_loginclass) command_info[info_len++] = sudo_new_key_val("login_class", login_class); diff --git a/plugins/sudoers/prompt.c b/plugins/sudoers/prompt.c index d1ca097d9..37cabf717 100644 --- a/plugins/sudoers/prompt.c +++ b/plugins/sudoers/prompt.c @@ -97,7 +97,7 @@ expand_prompt(const char *old_prompt, const char *auth_user) } if (subst) { - new_prompt = emalloc(++len); + new_prompt = sudo_emalloc(++len); endp = new_prompt + len; for (p = old_prompt, np = new_prompt; *p; p++) { if (p[0] =='%') { @@ -152,7 +152,7 @@ expand_prompt(const char *old_prompt, const char *auth_user) } *np = '\0'; } else - new_prompt = estrdup(old_prompt); + new_prompt = sudo_estrdup(old_prompt); debug_return_str(new_prompt); diff --git a/plugins/sudoers/pwutil.c b/plugins/sudoers/pwutil.c index b27fff692..842ea96c5 100644 --- a/plugins/sudoers/pwutil.c +++ b/plugins/sudoers/pwutil.c @@ -139,7 +139,7 @@ sudo_getpwuid(uid_t uid) #endif item = sudo_make_pwitem(uid, NULL); if (item == NULL) { - item = ecalloc(1, sizeof(*item)); + item = sudo_ecalloc(1, sizeof(*item)); item->refcnt = 1; item->k.uid = uid; /* item->d.pw = NULL; */ @@ -183,7 +183,7 @@ sudo_getpwnam(const char *name) item = sudo_make_pwitem((uid_t)-1, name); if (item == NULL) { len = strlen(name) + 1; - item = ecalloc(1, sizeof(*item) + len); + item = sudo_ecalloc(1, sizeof(*item) + len); item->refcnt = 1; item->k.name = (char *) item + sizeof(*item); memcpy(item->k.name, name, len); @@ -231,7 +231,7 @@ sudo_mkpwent(const char *user, uid_t uid, gid_t gid, const char *home, home_len + 1 /* pw_dir */ + shell_len + 1 /* pw_shell */; for (i = 0; i < 2; i++) { - pwitem = ecalloc(1, len); + pwitem = sudo_ecalloc(1, len); pw = &pwitem->pw; pw->pw_uid = uid; pw->pw_gid = gid; @@ -390,7 +390,7 @@ sudo_getgrgid(gid_t gid) */ item = sudo_make_gritem(gid, NULL); if (item == NULL) { - item = ecalloc(1, sizeof(*item)); + item = sudo_ecalloc(1, sizeof(*item)); item->refcnt = 1; item->k.gid = gid; /* item->d.gr = NULL; */ @@ -428,7 +428,7 @@ sudo_getgrnam(const char *name) item = sudo_make_gritem((gid_t)-1, name); if (item == NULL) { len = strlen(name) + 1; - item = ecalloc(1, sizeof(*item) + len); + item = sudo_ecalloc(1, sizeof(*item) + len); item->refcnt = 1; item->k.name = (char *) item + sizeof(*item); memcpy(item->k.name, name, len); @@ -462,7 +462,7 @@ sudo_fakegrnam(const char *group) len = sizeof(*gritem) + name_len + 1; for (i = 0; i < 2; i++) { - gritem = ecalloc(1, len); + gritem = sudo_ecalloc(1, len); gr = &gritem->gr; gr->gr_gid = (gid_t) atoid(group + 1, NULL, NULL, &errstr); gr->gr_name = (char *)(gritem + 1); @@ -594,7 +594,7 @@ sudo_get_grlist(const struct passwd *pw) if (item == NULL) { /* Should not happen. */ len = strlen(pw->pw_name) + 1; - item = ecalloc(1, sizeof(*item) + len); + item = sudo_ecalloc(1, sizeof(*item) + len); item->refcnt = 1; item->k.name = (char *) item + sizeof(*item); memcpy(item->k.name, pw->pw_name, len); diff --git a/plugins/sudoers/pwutil_impl.c b/plugins/sudoers/pwutil_impl.c index 699dffe4e..625997383 100644 --- a/plugins/sudoers/pwutil_impl.c +++ b/plugins/sudoers/pwutil_impl.c @@ -116,7 +116,7 @@ sudo_make_pwitem(uid_t uid, const char *name) total += strlen(name) + 1; /* Allocate space for struct item, struct passwd and the strings. */ - pwitem = ecalloc(1, total); + pwitem = sudo_ecalloc(1, total); newpw = &pwitem->pw; /* @@ -183,7 +183,7 @@ sudo_make_gritem(gid_t gid, const char *name) if (name != NULL) total += strlen(name) + 1; - gritem = ecalloc(1, total); + gritem = sudo_ecalloc(1, total); /* * Copy in group contents and make strings relative to space @@ -245,7 +245,7 @@ sudo_make_grlist_item(const struct passwd *pw, char * const *unused1, } else { if (sudo_user.max_groups > 0) { ngids = sudo_user.max_groups; - gids = emallocarray(ngids, sizeof(GETGROUPS_T)); + gids = sudo_emallocarray(ngids, sizeof(GETGROUPS_T)); (void)getgrouplist(pw->pw_name, pw->pw_gid, gids, &ngids); } else { #if defined(HAVE_SYSCONF) && defined(_SC_NGROUPS_MAX) @@ -253,10 +253,10 @@ sudo_make_grlist_item(const struct passwd *pw, char * const *unused1, if (ngids < 0) #endif ngids = NGROUPS_MAX * 2; - gids = emallocarray(ngids, sizeof(GETGROUPS_T)); + gids = sudo_emallocarray(ngids, sizeof(GETGROUPS_T)); if (getgrouplist(pw->pw_name, pw->pw_gid, gids, &ngids) == -1) { efree(gids); - gids = emallocarray(ngids, sizeof(GETGROUPS_T)); + gids = sudo_emallocarray(ngids, sizeof(GETGROUPS_T)); if (getgrouplist(pw->pw_name, pw->pw_gid, gids, &ngids) == -1) ngids = -1; } @@ -285,7 +285,7 @@ sudo_make_grlist_item(const struct passwd *pw, char * const *unused1, total += groupname_len * ngids; again: - grlitem = ecalloc(1, total); + grlitem = sudo_ecalloc(1, total); /* * Copy in group list and make pointers relative to space diff --git a/plugins/sudoers/redblack.c b/plugins/sudoers/redblack.c index cf02a41ff..23e3a0112 100644 --- a/plugins/sudoers/redblack.c +++ b/plugins/sudoers/redblack.c @@ -55,7 +55,7 @@ #endif /* STDC_HEADERS */ #include "missing.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "sudo_debug.h" #include "redblack.h" @@ -92,7 +92,7 @@ rbcreate(int (*compar)(const void *, const void*)) struct rbtree *tree; debug_decl(rbcreate, SUDO_DEBUG_RBTREE) - tree = (struct rbtree *) emalloc(sizeof(*tree)); + tree = (struct rbtree *) sudo_emalloc(sizeof(*tree)); tree->compar = compar; /* @@ -187,7 +187,7 @@ rbinsert(struct rbtree *tree, void *data) node = res < 0 ? node->left : node->right; } - node = (struct rbnode *) emalloc(sizeof(*node)); + node = (struct rbnode *) sudo_emalloc(sizeof(*node)); node->data = data; node->left = node->right = rbnil(tree); node->parent = parent; diff --git a/plugins/sudoers/sssd.c b/plugins/sudoers/sssd.c index 39459ad3b..90030fe95 100644 --- a/plugins/sudoers/sssd.c +++ b/plugins/sudoers/sssd.c @@ -128,14 +128,14 @@ sudo_sss_attrcpy(struct sss_sudo_attr *dst, const struct sss_sudo_attr *src) debug_decl(sudo_sss_attrcpy, SUDO_DEBUG_SSSD) sudo_debug_printf(SUDO_DEBUG_DEBUG, "dst=%p, src=%p", dst, src); - sudo_debug_printf(SUDO_DEBUG_INFO, "emalloc: cnt=%d", src->num_values); + sudo_debug_printf(SUDO_DEBUG_INFO, "sudo_emalloc: cnt=%d", src->num_values); - dst->name = estrdup(src->name); + dst->name = sudo_estrdup(src->name); dst->num_values = src->num_values; - dst->values = emallocarray(dst->num_values, sizeof(char *)); + dst->values = sudo_emallocarray(dst->num_values, sizeof(char *)); for (i = 0; i < dst->num_values; ++i) - dst->values[i] = estrdup(src->values[i]); + dst->values[i] = sudo_estrdup(src->values[i]); debug_return; } @@ -147,10 +147,10 @@ sudo_sss_rulecpy(struct sss_sudo_rule *dst, const struct sss_sudo_rule *src) debug_decl(sudo_sss_rulecpy, SUDO_DEBUG_SSSD) sudo_debug_printf(SUDO_DEBUG_DEBUG, "dst=%p, src=%p", dst, src); - sudo_debug_printf(SUDO_DEBUG_INFO, "emalloc: cnt=%d", src->num_attrs); + sudo_debug_printf(SUDO_DEBUG_INFO, "sudo_emalloc: cnt=%d", src->num_attrs); dst->num_attrs = src->num_attrs; - dst->attrs = emallocarray(dst->num_attrs, sizeof(struct sss_sudo_attr)); + dst->attrs = sudo_emallocarray(dst->num_attrs, sizeof(struct sss_sudo_attr)); for (i = 0; i < dst->num_attrs; ++i) sudo_sss_attrcpy(dst->attrs + i, src->attrs + i); @@ -182,11 +182,11 @@ sudo_sss_filter_result(struct sudo_sss_handle *handle, if (in_res == NULL) debug_return_ptr(NULL); - sudo_debug_printf(SUDO_DEBUG_DEBUG, "emalloc: cnt=%d", in_res->num_rules); + sudo_debug_printf(SUDO_DEBUG_DEBUG, "sudo_emalloc: cnt=%d", in_res->num_rules); - out_res = emalloc(sizeof(struct sss_sudo_result)); + out_res = sudo_emalloc(sizeof(struct sss_sudo_result)); out_res->rules = in_res->num_rules > 0 ? - emallocarray(in_res->num_rules, sizeof(struct sss_sudo_rule)) : NULL; + sudo_emallocarray(in_res->num_rules, sizeof(struct sss_sudo_rule)) : NULL; out_res->num_rules = 0; for (i = l = 0; i < in_res->num_rules; ++i) { @@ -210,7 +210,7 @@ sudo_sss_filter_result(struct sudo_sss_handle *handle, in_res->num_rules, l); if (l > 0) { out_res->rules = - ereallocarray(out_res->rules, l, sizeof(struct sss_sudo_rule)); + sudo_ereallocarray(out_res->rules, l, sizeof(struct sss_sudo_rule)); } else { efree(out_res->rules); out_res->rules = NULL; @@ -244,7 +244,7 @@ static int sudo_sss_open(struct sudo_nss *nss) debug_decl(sudo_sss_open, SUDO_DEBUG_SSSD); /* Create a handle container. */ - handle = emalloc(sizeof(struct sudo_sss_handle)); + handle = sudo_emalloc(sizeof(struct sudo_sss_handle)); /* Load symbols */ handle->ssslib = sudo_dso_load(path, SUDO_DSO_LAZY); @@ -817,7 +817,7 @@ sudo_sss_extract_digest(char **cmnd, struct sudo_digest *digest) ep++; if (*ep != '\0') { digest->digest_type = digest_type; - digest->digest_str = estrndup(cp, (size_t)(ep - cp)); + digest->digest_str = sudo_estrndup(cp, (size_t)(ep - cp)); cp = ep + 1; while (isblank((unsigned char)*cp)) cp++; @@ -887,10 +887,10 @@ sudo_sss_check_command(struct sudo_sss_handle *handle, /* check for !command */ if (*val == '!') { foundbang = true; - allowed_cmnd = estrdup(1 + val); /* !command */ + allowed_cmnd = sudo_estrdup(1 + val); /* !command */ } else { foundbang = false; - allowed_cmnd = estrdup(val); /* command */ + allowed_cmnd = sudo_estrdup(val); /* command */ } /* split optional args away from command */ @@ -945,7 +945,7 @@ sudo_sss_parse_options(struct sudo_sss_handle *handle, struct sss_sudo_rule *rul for (i = 0; val_array[i] != NULL; i++) { sudo_debug_printf(SUDO_DEBUG_INFO, "sssd/ldap sudoOption: '%s'", val_array[i]); - v = estrdup(val_array[i]); + v = sudo_estrdup(val_array[i]); /* check for equals sign past first char */ val = strchr(v, '='); diff --git a/plugins/sudoers/sudoers.c b/plugins/sudoers/sudoers.c index a5aecccf3..13483326d 100644 --- a/plugins/sudoers/sudoers.c +++ b/plugins/sudoers/sudoers.c @@ -248,17 +248,17 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[], */ if (argc == 0) { NewArgc = 1; - NewArgv = emallocarray(NewArgc + 1, sizeof(char *)); + NewArgv = sudo_emallocarray(NewArgc + 1, sizeof(char *)); NewArgv[0] = user_cmnd; NewArgv[1] = NULL; } else { /* Must leave an extra slot before NewArgv for bash's --login */ NewArgc = argc; - NewArgv = emallocarray(NewArgc + 2, sizeof(char *)); + NewArgv = sudo_emallocarray(NewArgc + 2, sizeof(char *)); memcpy(++NewArgv, argv, argc * sizeof(char *)); NewArgv[NewArgc] = NULL; if (ISSET(sudo_mode, MODE_LOGIN_SHELL) && runas_pw != NULL) - NewArgv[0] = estrdup(runas_pw->pw_shell); + NewArgv[0] = sudo_estrdup(runas_pw->pw_shell); } /* If given the -P option, set the "preserve_groups" flag. */ @@ -305,7 +305,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[], sudoers_setlocale(oldlocale, NULL); if (safe_cmnd == NULL) - safe_cmnd = estrdup(user_cmnd); + safe_cmnd = sudo_estrdup(user_cmnd); /* If only a group was specified, set runas_pw based on invoking user. */ if (runas_pw == NULL) { @@ -643,7 +643,7 @@ set_cmnd(void) debug_decl(set_cmnd, SUDO_DEBUG_PLUGIN) /* Allocate user_stat for find_path() and match functions. */ - user_stat = ecalloc(1, sizeof(struct stat)); + user_stat = sudo_ecalloc(1, sizeof(struct stat)); /* Default value for cmnd, overridden below. */ if (user_cmnd == NULL) @@ -684,7 +684,7 @@ set_cmnd(void) /* Alloc and build up user_args. */ for (size = 0, av = NewArgv + 1; *av; av++) size += strlen(*av) + 1; - user_args = emalloc(size); + user_args = sudo_emalloc(size); if (ISSET(sudo_mode, MODE_SHELL|MODE_LOGIN_SHELL)) { /* * When running a command via a shell, the sudo front-end @@ -883,10 +883,10 @@ set_fqdn(void) if (user_shost != user_host) efree(user_shost); efree(user_host); - user_host = estrdup(res0->ai_canonname); + user_host = sudo_estrdup(res0->ai_canonname); freeaddrinfo(res0); if ((p = strchr(user_host, '.')) != NULL) - user_shost = estrndup(user_host, (size_t)(p - user_host)); + user_shost = sudo_estrndup(user_host, (size_t)(p - user_host)); else user_shost = user_host; } @@ -1008,7 +1008,7 @@ resolve_editor(const char *ed, size_t edlen, int nfiles, char **files, char ***a debug_decl(resolve_editor, SUDO_DEBUG_PLUGIN) /* Note: editor becomes part of argv_out and is not freed. */ - editor = emalloc(edlen + 1); + editor = sudo_emalloc(edlen + 1); memcpy(editor, ed, edlen); editor[edlen] = '\0'; @@ -1033,7 +1033,7 @@ resolve_editor(const char *ed, size_t edlen, int nfiles, char **files, char ***a efree(editor); debug_return_str(NULL); } - nargv = (char **) emallocarray(nargc + 1 + nfiles + 1, sizeof(char *)); + nargv = (char **) sudo_emallocarray(nargc + 1 + nfiles + 1, sizeof(char *)); for (ac = 0; cp != NULL && ac < nargc; ac++) { nargv[ac] = cp; cp = strtok(NULL, " \t"); diff --git a/plugins/sudoers/sudoers.h b/plugins/sudoers/sudoers.h index 7878c49b2..6edb9ea4b 100644 --- a/plugins/sudoers/sudoers.h +++ b/plugins/sudoers/sudoers.h @@ -35,7 +35,7 @@ #include #include "missing.h" #include "fatal.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "queue.h" #include "defaults.h" #include "logging.h" diff --git a/plugins/sudoers/sudoreplay.c b/plugins/sudoers/sudoreplay.c index e33d235bf..264ff3f20 100644 --- a/plugins/sudoers/sudoreplay.c +++ b/plugins/sudoers/sudoreplay.c @@ -87,7 +87,7 @@ #include "gettext.h" /* must be included before missing.h */ #include "missing.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "fatal.h" #include "logging.h" #include "iolog.h" @@ -503,8 +503,8 @@ replay_session(const double max_wait, const char *decimal) /* Store the line in iov followed by \r\n pair. */ if (iovcnt + 3 > iovmax) { iov = iovmax ? - ereallocarray(iov, iovmax <<= 1, sizeof(*iov)) : - emallocarray(iovmax = 32, sizeof(*iov)); + sudo_ereallocarray(iov, iovmax <<= 1, sizeof(*iov)) : + sudo_emallocarray(iovmax = 32, sizeof(*iov)); } linelen = (size_t)(ep - cp) + 1; iov[iovcnt].iov_base = cp; @@ -704,7 +704,7 @@ parse_expr(struct search_node_list *head, char *argv[], bool sub_expr) } /* Allocate new search node */ - sn = ecalloc(1, sizeof(*sn)); + sn = sudo_ecalloc(1, sizeof(*sn)); sn->type = type; sn->or = or; sn->negated = not; @@ -822,7 +822,7 @@ parse_logfile(char *logfile) * 2) cwd * 3) command with args */ - li = ecalloc(1, sizeof(*li)); + li = sudo_ecalloc(1, sizeof(*li)); if (getline(&buf, &bufsize, fp) == -1 || getline(&li->cwd, &cwdsize, fp) == -1 || getline(&li->cmd, &cmdsize, fp) == -1) { @@ -861,7 +861,7 @@ parse_logfile(char *logfile) sudo_warn(U_("%s: user field is missing"), logfile); goto bad; } - li->user = estrndup(cp, (size_t)(ep - cp)); + li->user = sudo_estrndup(cp, (size_t)(ep - cp)); /* runas user */ cp = ep + 1; @@ -869,7 +869,7 @@ parse_logfile(char *logfile) sudo_warn(U_("%s: runas user field is missing"), logfile); goto bad; } - li->runas_user = estrndup(cp, (size_t)(ep - cp)); + li->runas_user = sudo_estrndup(cp, (size_t)(ep - cp)); /* runas group */ cp = ep + 1; @@ -878,16 +878,16 @@ parse_logfile(char *logfile) goto bad; } if (cp != ep) - li->runas_group = estrndup(cp, (size_t)(ep - cp)); + li->runas_group = sudo_estrndup(cp, (size_t)(ep - cp)); /* tty, followed by optional rows + columns */ cp = ep + 1; if ((ep = strchr(cp, ':')) == NULL) { /* just the tty */ - li->tty = estrdup(cp); + li->tty = sudo_estrdup(cp); } else { /* tty followed by rows + columns */ - li->tty = estrndup(cp, (size_t)(ep - cp)); + li->tty = sudo_estrndup(cp, (size_t)(ep - cp)); cp = ep + 1; /* need to NULL out separator to use strtonum() */ if ((ep = strchr(cp, ':')) != NULL) { @@ -1021,7 +1021,7 @@ find_sessions(const char *dir, REGEX_T *re, const char *user, const char *tty) pathbuf[sdlen] = '\0'; /* Store potential session dirs for sorting. */ - sessions = emallocarray(sessions_size, sizeof(char *)); + sessions = sudo_emallocarray(sessions_size, sizeof(char *)); while ((dp = readdir(d)) != NULL) { /* Skip "." and ".." */ if (dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || @@ -1041,9 +1041,9 @@ find_sessions(const char *dir, REGEX_T *re, const char *user, const char *tty) /* Add name to session list. */ if (sessions_len + 1 > sessions_size) { sessions_size <<= 1; - sessions = ereallocarray(sessions, sessions_size, sizeof(char *)); + sessions = sudo_ereallocarray(sessions, sessions_size, sizeof(char *)); } - sessions[sessions_len++] = estrdup(dp->d_name); + sessions[sessions_len++] = sudo_estrdup(dp->d_name); } closedir(d); diff --git a/plugins/sudoers/testsudoers.c b/plugins/sudoers/testsudoers.c index 5189739cd..74bfd86ce 100644 --- a/plugins/sudoers/testsudoers.c +++ b/plugins/sudoers/testsudoers.c @@ -219,7 +219,7 @@ main(int argc, char *argv[]) } if ((p = strchr(user_host, '.'))) { *p = '\0'; - user_shost = estrdup(user_host); + user_shost = sudo_estrdup(user_host); *p = '.'; } else { user_shost = user_host; @@ -235,7 +235,7 @@ main(int argc, char *argv[]) for (size = 0, from = argv; *from; from++) size += strlen(*from) + 1; - user_args = (char *) emalloc(size); + user_args = (char *) sudo_emalloc(size); for (to = user_args, from = argv; *from; from++) { n = strlcpy(to, *from, size - (to - user_args)); if (n >= size - (to - user_args)) diff --git a/plugins/sudoers/visudo.c b/plugins/sudoers/visudo.c index 59b8bd47b..72085fad6 100644 --- a/plugins/sudoers/visudo.c +++ b/plugins/sudoers/visudo.c @@ -330,7 +330,7 @@ edit_sudoers(struct sudoersfile *sp, char *editor, char *args, int lineno) /* Create the temp file if needed and set timestamp. */ if (sp->tpath == NULL) { - easprintf(&sp->tpath, "%s.tmp", sp->path); + sudo_easprintf(&sp->tpath, "%s.tmp", sp->path); tfd = open(sp->tpath, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (tfd < 0) sudo_fatal("%s", sp->tpath); @@ -400,7 +400,7 @@ edit_sudoers(struct sudoersfile *sp, char *editor, char *args, int lineno) } /* Build up argument vector for the command */ - av = emallocarray(ac, sizeof(char *)); + av = sudo_emallocarray(ac, sizeof(char *)); if ((av[0] = strrchr(editor, '/')) != NULL) av[0]++; else @@ -897,8 +897,8 @@ open_sudoers(const char *path, bool doedit, bool *keepopen) break; } if (entry == NULL) { - entry = ecalloc(1, sizeof(*entry)); - entry->path = estrdup(path); + entry = sudo_ecalloc(1, sizeof(*entry)); + entry->path = sudo_estrdup(path); /* entry->modified = 0; */ entry->fd = open(entry->path, open_flags, SUDOERS_MODE); /* entry->tpath = NULL; */ @@ -978,7 +978,7 @@ get_editor(char **args) /* Should never happen since we already checked above. */ sudo_fatal(U_("unable to stat editor (%s)"), UserEditor); } - EditorPath = estrdup(def_editor); + EditorPath = sudo_estrdup(def_editor); Editor = strtok(EditorPath, ":"); do { EditorArgs = get_args(Editor); @@ -1014,7 +1014,7 @@ get_editor(char **args) */ if (Editor == NULL || *Editor == '\0') { efree(EditorPath); - EditorPath = estrdup(def_editor); + EditorPath = sudo_estrdup(def_editor); Editor = strtok(EditorPath, ":"); do { EditorArgs = get_args(Editor); @@ -1061,11 +1061,11 @@ get_hostname(void) if (gethostname(thost, sizeof(thost)) != -1) { thost[sizeof(thost) - 1] = '\0'; - user_host = estrdup(thost); + user_host = sudo_estrdup(thost); if ((p = strchr(user_host, '.'))) { *p = '\0'; - user_shost = estrdup(user_host); + user_shost = sudo_estrdup(user_host); *p = '.'; } else { user_shost = user_host; diff --git a/src/Makefile.in b/src/Makefile.in index a7c5aaf86..661847d96 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -210,88 +210,87 @@ realclean: distclean cleandir: realclean # Autogenerated dependencies, do not modify -check_ttyname.o: $(srcdir)/regress/ttyname/check_ttyname.c $(incdir)/alloc.h \ +check_ttyname.o: $(srcdir)/regress/ttyname/check_ttyname.c \ $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ - $(incdir)/missing.h $(incdir)/sudo_util.h \ - $(top_builddir)/config.h + $(incdir)/missing.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_util.h $(top_builddir)/config.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/ttyname/check_ttyname.c -conversation.o: $(srcdir)/conversation.c $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ - $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ - $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/sudo.h \ +conversation.o: $(srcdir)/conversation.c $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/sudo.h \ $(srcdir)/sudo_plugin_int.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/conversation.c -env_hooks.o: $(srcdir)/env_hooks.c $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_conf.h \ +env_hooks.o: $(srcdir)/env_hooks.c $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h \ $(incdir)/sudo_debug.h $(incdir)/sudo_dso.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/sudo.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/env_hooks.c -exec.o: $(srcdir)/exec.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ +exec.o: $(srcdir)/exec.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_event.h $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h \ $(srcdir)/sudo.h $(srcdir)/sudo_exec.h $(srcdir)/sudo_plugin_int.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/exec.c -exec_common.o: $(srcdir)/exec_common.c $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ - $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ - $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_util.h $(srcdir)/sudo.h $(srcdir)/sudo_exec.h \ - $(top_builddir)/config.h $(top_builddir)/pathnames.h +exec_common.o: $(srcdir)/exec_common.c $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_util.h $(srcdir)/sudo.h \ + $(srcdir)/sudo_exec.h $(top_builddir)/config.h \ + $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/exec_common.c -exec_pty.o: $(srcdir)/exec_pty.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_event.h $(incdir)/sudo_plugin.h \ - $(incdir)/sudo_util.h $(srcdir)/sudo.h $(srcdir)/sudo_exec.h \ - $(srcdir)/sudo_plugin_int.h $(top_builddir)/config.h \ - $(top_builddir)/pathnames.h +exec_pty.o: $(srcdir)/exec_pty.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_event.h \ + $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/sudo.h \ + $(srcdir)/sudo_exec.h $(srcdir)/sudo_plugin_int.h \ + $(top_builddir)/config.h $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/exec_pty.c -get_pty.o: $(srcdir)/get_pty.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ +get_pty.o: $(srcdir)/get_pty.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_util.h $(srcdir)/sudo.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/get_pty.c -hooks.o: $(srcdir)/hooks.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ +hooks.o: $(srcdir)/hooks.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/sudo.h \ $(srcdir)/sudo_plugin_int.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/hooks.c -load_plugins.o: $(srcdir)/load_plugins.c $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ - $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ - $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_dso.h $(incdir)/sudo_plugin.h \ - $(incdir)/sudo_util.h $(srcdir)/sudo.h \ +load_plugins.o: $(srcdir)/load_plugins.c $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_dso.h \ + $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/sudo.h \ $(srcdir)/sudo_plugin_int.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/load_plugins.c locale_stub.o: $(srcdir)/locale_stub.c $(incdir)/fatal.h $(incdir)/gettext.h \ $(incdir)/missing.h $(top_builddir)/config.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/locale_stub.c -net_ifs.o: $(srcdir)/net_ifs.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ +net_ifs.o: $(srcdir)/net_ifs.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ $(top_builddir)/config.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/net_ifs.c -openbsd.o: $(srcdir)/openbsd.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ +openbsd.o: $(srcdir)/openbsd.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_util.h $(srcdir)/sudo.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/openbsd.c -parse_args.o: $(srcdir)/parse_args.c $(incdir)/alloc.h \ - $(incdir)/compat/getopt.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ +parse_args.o: $(srcdir)/parse_args.c $(incdir)/compat/getopt.h \ + $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ + $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_alloc.h \ + $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_lbuf.h $(incdir)/sudo_util.h $(srcdir)/sudo.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h \ ./sudo_usage.h @@ -299,67 +298,67 @@ parse_args.o: $(srcdir)/parse_args.c $(incdir)/alloc.h \ preload.o: $(srcdir)/preload.c $(incdir)/missing.h $(incdir)/sudo_dso.h \ $(incdir)/sudo_plugin.h $(top_builddir)/config.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/preload.c -preserve_fds.o: $(srcdir)/preserve_fds.c $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ - $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ - $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_util.h $(srcdir)/sudo.h \ +preserve_fds.o: $(srcdir)/preserve_fds.c $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_util.h $(srcdir)/sudo.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/preserve_fds.c -selinux.o: $(srcdir)/selinux.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ +selinux.o: $(srcdir)/selinux.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_util.h $(srcdir)/sudo.h $(srcdir)/sudo_exec.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/selinux.c -sesh.o: $(srcdir)/sesh.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ +sesh.o: $(srcdir)/sesh.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(srcdir)/sudo_exec.h $(top_builddir)/config.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sesh.c -signal.o: $(srcdir)/signal.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ +signal.o: $(srcdir)/signal.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_util.h $(srcdir)/sudo.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/signal.c -solaris.o: $(srcdir)/solaris.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ +solaris.o: $(srcdir)/solaris.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_dso.h $(incdir)/sudo_util.h $(srcdir)/sudo.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/solaris.c -sudo.o: $(srcdir)/sudo.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ +sudo.o: $(srcdir)/sudo.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/sudo.h \ $(srcdir)/sudo_plugin_int.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h ./sudo_usage.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo.c -sudo_edit.o: $(srcdir)/sudo_edit.c $(incdir)/alloc.h \ - $(incdir)/compat/stdbool.h $(incdir)/fatal.h $(incdir)/gettext.h \ - $(incdir)/missing.h $(incdir)/queue.h $(incdir)/sudo_conf.h \ +sudo_edit.o: $(srcdir)/sudo_edit.c $(incdir)/compat/stdbool.h \ + $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ + $(incdir)/queue.h $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h \ $(incdir)/sudo_debug.h $(incdir)/sudo_util.h $(srcdir)/sudo.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo_edit.c sudo_noexec.lo: $(srcdir)/sudo_noexec.c $(incdir)/missing.h \ $(top_builddir)/config.h $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo_noexec.c -tgetpass.o: $(srcdir)/tgetpass.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_util.h $(srcdir)/sudo.h \ - $(top_builddir)/config.h $(top_builddir)/pathnames.h +tgetpass.o: $(srcdir)/tgetpass.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_util.h $(srcdir)/sudo.h $(top_builddir)/config.h \ + $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/tgetpass.c -ttyname.o: $(srcdir)/ttyname.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ +ttyname.o: $(srcdir)/ttyname.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_util.h $(srcdir)/sudo.h $(top_builddir)/config.h \ $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/ttyname.c -utmp.o: $(srcdir)/utmp.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \ - $(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \ - $(incdir)/queue.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ +utmp.o: $(srcdir)/utmp.c $(incdir)/compat/stdbool.h $(incdir)/fatal.h \ + $(incdir)/gettext.h $(incdir)/missing.h $(incdir)/queue.h \ + $(incdir)/sudo_alloc.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ $(incdir)/sudo_util.h $(srcdir)/sudo.h $(srcdir)/sudo_exec.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/utmp.c diff --git a/src/conversation.c b/src/conversation.c index e61a7e306..418b8c07f 100644 --- a/src/conversation.c +++ b/src/conversation.c @@ -80,7 +80,7 @@ sudo_conversation(int num_msgs, const struct sudo_conv_message msgs[], pass = tgetpass(msg->msg, msg->timeout, flags); if (pass == NULL) goto err; - repl->reply = estrdup(pass); + repl->reply = sudo_estrdup(pass); memset_s(pass, SUDO_CONV_REPL_MAX, 0, strlen(pass)); break; case SUDO_CONV_INFO_MSG: diff --git a/src/env_hooks.c b/src/env_hooks.c index 37257bc17..3a41d1731 100644 --- a/src/env_hooks.c +++ b/src/env_hooks.c @@ -125,7 +125,7 @@ rpl_putenv(PUTENV_CONST char *string) /* Append at the end if not already found. */ if (!found) { size_t env_len = (size_t)(ep - environ); - char **envp = ereallocarray(priv_environ, env_len + 2, sizeof(char *)); + char **envp = sudo_ereallocarray(priv_environ, env_len + 2, sizeof(char *)); if (environ != priv_environ) memcpy(envp, environ, env_len * sizeof(char *)); envp[env_len++] = (char *)string; diff --git a/src/exec.c b/src/exec.c index e80c74ce5..4e8247e3d 100644 --- a/src/exec.c +++ b/src/exec.c @@ -844,7 +844,7 @@ schedule_signal(struct sudo_event_base *evbase, int signo) snprintf(signame, sizeof(signame), "%d", signo); sudo_debug_printf(SUDO_DEBUG_DIAG, "scheduled SIG%s for child", signame); - sigfwd = ecalloc(1, sizeof(*sigfwd)); + sigfwd = sudo_ecalloc(1, sizeof(*sigfwd)); sigfwd->signo = signo; TAILQ_INSERT_TAIL(&sigfwd_list, sigfwd, entries); diff --git a/src/exec_common.c b/src/exec_common.c index ae4bc6283..6a4a8930c 100644 --- a/src/exec_common.c +++ b/src/exec_common.c @@ -100,14 +100,14 @@ disable_execute(char *const envp[]) if (!enabled) env_size++; #endif - nenvp = emallocarray(env_size, sizeof(*envp)); + nenvp = sudo_emallocarray(env_size, sizeof(*envp)); memcpy(nenvp, envp, env_len * sizeof(*envp)); nenvp[env_len] = NULL; /* Prepend our LD_PRELOAD to existing value or add new entry at the end. */ if (preload_idx == -1) { # ifdef RTLD_PRELOAD_DEFAULT - easprintf(&preload, "%s=%s%s%s", RTLD_PRELOAD_VAR, sudo_conf_noexec_path(), RTLD_PRELOAD_DELIM, RTLD_PRELOAD_DEFAULT); + sudo_easprintf(&preload, "%s=%s%s%s", RTLD_PRELOAD_VAR, sudo_conf_noexec_path(), RTLD_PRELOAD_DELIM, RTLD_PRELOAD_DEFAULT); # else preload = sudo_new_key_val(RTLD_PRELOAD_VAR, sudo_conf_noexec_path()); # endif @@ -116,7 +116,7 @@ disable_execute(char *const envp[]) nenvp[env_len++] = preload; nenvp[env_len] = NULL; } else { - easprintf(&preload, "%s=%s%s%s", RTLD_PRELOAD_VAR, sudo_conf_noexec_path(), RTLD_PRELOAD_DELIM, nenvp[preload_idx]); + sudo_easprintf(&preload, "%s=%s%s%s", RTLD_PRELOAD_VAR, sudo_conf_noexec_path(), RTLD_PRELOAD_DELIM, nenvp[preload_idx]); nenvp[preload_idx] = preload; } # ifdef RTLD_PRELOAD_ENABLE_VAR @@ -151,7 +151,7 @@ sudo_execve(const char *path, char *const argv[], char *const envp[], bool noexe for (argc = 0; argv[argc] != NULL; argc++) continue; - nargv = emallocarray(argc + 2, sizeof(char *)); + nargv = sudo_emallocarray(argc + 2, sizeof(char *)); nargv[0] = "sh"; nargv[1] = (char *)path; memcpy(nargv + 2, argv + 1, argc * sizeof(char *)); diff --git a/src/exec_pty.c b/src/exec_pty.c index 3b2cd0561..687f5ff3d 100644 --- a/src/exec_pty.c +++ b/src/exec_pty.c @@ -605,7 +605,7 @@ io_buf_new(int rfd, int wfd, bool (*action)(const char *, unsigned int), (void) fcntl(wfd, F_SETFL, n | O_NONBLOCK); /* Allocate and add to head of list. */ - iob = emalloc(sizeof(*iob)); + iob = sudo_emalloc(sizeof(*iob)); iob->revent = sudo_ev_alloc(rfd, SUDO_EV_READ, io_callback, iob); iob->wevent = sudo_ev_alloc(wfd, SUDO_EV_WRITE, io_callback, iob); iob->len = 0; diff --git a/src/hooks.c b/src/hooks.c index 9dd5aedab..966b60930 100644 --- a/src/hooks.c +++ b/src/hooks.c @@ -177,7 +177,7 @@ register_hook_internal(struct sudo_hook_list *head, struct sudo_hook_entry *hook; debug_decl(register_hook_internal, SUDO_DEBUG_HOOKS) - hook = ecalloc(1, sizeof(*hook)); + hook = sudo_ecalloc(1, sizeof(*hook)); hook->u.generic_fn = hook_fn; hook->closure = closure; SLIST_INSERT_HEAD(head, hook, entries); diff --git a/src/load_plugins.c b/src/load_plugins.c index 453a27246..0e1649459 100644 --- a/src/load_plugins.c +++ b/src/load_plugins.c @@ -112,7 +112,7 @@ sudo_stat_plugin(struct plugin_info *info, char *fullpath, if (len >= 3 && info->path[len - 3] == '.' && info->path[len - 2] == 's' && info->path[len - 1] == 'o') { const char *sopath = info->path; - char *slpath = estrdup(info->path); + char *slpath = sudo_estrdup(info->path); int serrno = errno; slpath[len - 1] = 'l'; @@ -253,7 +253,7 @@ sudo_load_plugin(struct plugin_container *policy_plugin, } } if (handle != NULL) { - container = ecalloc(1, sizeof(*container)); + container = sudo_ecalloc(1, sizeof(*container)); container->handle = handle; container->name = info->symbol_name; container->options = info->options; @@ -294,7 +294,7 @@ sudo_load_plugins(struct plugin_container *policy_plugin, */ if (policy_plugin->handle == NULL) { /* Default policy plugin */ - info = ecalloc(1, sizeof(*info)); + info = sudo_ecalloc(1, sizeof(*info)); info->symbol_name = "sudoers_policy"; info->path = SUDOERS_PLUGIN; /* info->options = NULL; */ @@ -305,7 +305,7 @@ sudo_load_plugins(struct plugin_container *policy_plugin, /* Default I/O plugin */ if (TAILQ_EMPTY(io_plugins)) { - info = ecalloc(1, sizeof(*info)); + info = sudo_ecalloc(1, sizeof(*info)); info->symbol_name = "sudoers_io"; info->path = SUDOERS_PLUGIN; /* info->options = NULL; */ diff --git a/src/net_ifs.c b/src/net_ifs.c index 7c1151ae8..5ace3d0cf 100644 --- a/src/net_ifs.c +++ b/src/net_ifs.c @@ -88,7 +88,7 @@ struct rtentry; #include "gettext.h" /* must be included before missing.h */ #include "missing.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "fatal.h" #include "sudo_conf.h" #include "sudo_debug.h" @@ -143,7 +143,7 @@ get_net_ifs(char **addrinfo) if (num_interfaces == 0) debug_return_int(0); ailen = num_interfaces * 2 * INET6_ADDRSTRLEN; - *addrinfo = cp = emalloc(ailen); + *addrinfo = cp = sudo_emalloc(ailen); /* Store the IP addr/netmask pairs. */ for (ifa = ifaddrs; ifa != NULL; ifa = ifa -> ifa_next) { @@ -239,7 +239,7 @@ get_net_ifs(char **addrinfo) * Get interface configuration or return. */ for (;;) { - ifconf_buf = emalloc(buflen); + ifconf_buf = sudo_emalloc(buflen); ifconf = (struct ifconf *) ifconf_buf; ifconf->ifc_len = buflen - sizeof(struct ifconf); ifconf->ifc_buf = (caddr_t) (ifconf_buf + sizeof(struct ifconf)); @@ -264,7 +264,7 @@ get_net_ifs(char **addrinfo) if ((n = ifconf->ifc_len / sizeof(struct ifreq)) == 0) debug_return_int(0); ailen = n * 2 * INET6_ADDRSTRLEN; - *addrinfo = cp = emalloc(ailen); + *addrinfo = cp = sudo_emalloc(ailen); /* For each interface, store the ip address and netmask. */ for (i = 0; i < ifconf->ifc_len; ) { diff --git a/src/parse_args.c b/src/parse_args.c index 70daed106..30b2a597c 100644 --- a/src/parse_args.c +++ b/src/parse_args.c @@ -184,7 +184,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp, int env_size = 32; debug_decl(parse_args, SUDO_DEBUG_ARGS) - env_add = emallocarray(env_size, sizeof(char *)); + env_add = sudo_emallocarray(env_size, sizeof(char *)); /* Pass progname to plugin so it can call initprogname() */ sudo_settings[ARG_PROGNAME].value = getprogname(); @@ -207,7 +207,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp, /* Set max_groups from sudo.conf. */ i = sudo_conf_max_groups(); if (i != -1) { - easprintf(&cp, "%d", i); + sudo_easprintf(&cp, "%d", i); sudo_settings[ARG_MAX_GROUPS].value = cp; } @@ -372,7 +372,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp, } else if (!got_end_of_args && is_envar) { if (nenv == env_size - 2) { env_size *= 2; - env_add = ereallocarray(env_add, env_size, sizeof(char *)); + env_add = sudo_ereallocarray(env_add, env_size, sizeof(char *)); } env_add[nenv++] = argv[optind]; @@ -461,7 +461,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp, size_t cmnd_size = (size_t) (argv[argc - 1] - argv[0]) + strlen(argv[argc - 1]) + 1; - cmnd = dst = emallocarray(cmnd_size, 2); + cmnd = dst = sudo_emallocarray(cmnd_size, 2); for (av = argv; *av != NULL; av++) { for (src = *av; *src != '\0'; src++) { /* quote potential meta characters */ @@ -478,7 +478,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp, ac += 2; /* -c cmnd */ } - av = emallocarray(ac + 1, sizeof(char *)); + av = sudo_emallocarray(ac + 1, sizeof(char *)); av[0] = (char *)user_details.shell; /* plugin may override shell */ if (cmnd != NULL) { av[1] = "-c"; @@ -496,7 +496,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp, #ifdef _PATH_SUDO_PLUGIN_DIR sudo_settings[ARG_PLUGIN_DIR].value = sudo_conf_plugin_dir_path(); #endif - settings = emallocarray(NUM_SETTINGS + 1, sizeof(char *)); + settings = sudo_emallocarray(NUM_SETTINGS + 1, sizeof(char *)); for (i = 0, j = 0; i < NUM_SETTINGS; i++) { if (sudo_settings[i].value) { sudo_debug_printf(SUDO_DEBUG_INFO, "settings: %s=%s", diff --git a/src/preserve_fds.c b/src/preserve_fds.c index 587fb88c3..3c452879a 100644 --- a/src/preserve_fds.c +++ b/src/preserve_fds.c @@ -59,7 +59,7 @@ add_preserved_fd(struct preserved_fd_list *pfds, int fd) struct preserved_fd *pfd, *pfd_new; debug_decl(add_preserved_fd, SUDO_DEBUG_UTIL) - pfd_new = emalloc(sizeof(*pfd)); + pfd_new = sudo_emalloc(sizeof(*pfd)); pfd_new->lowfd = fd; pfd_new->highfd = fd; pfd_new->flags = fcntl(fd, F_GETFD); @@ -143,7 +143,7 @@ closefrom_except(int startfd, struct preserved_fd_list *pfds) } /* Create bitmap of preserved (relocated) fds. */ - fdsp = ecalloc(howmany(lastfd + 1, NFDBITS), sizeof(fd_mask)); + fdsp = sudo_ecalloc(howmany(lastfd + 1, NFDBITS), sizeof(fd_mask)); TAILQ_FOREACH(pfd, pfds, entries) { FD_SET(pfd->lowfd, fdsp); } diff --git a/src/regress/ttyname/check_ttyname.c b/src/regress/ttyname/check_ttyname.c index dc25fe9b8..7cbf3f987 100644 --- a/src/regress/ttyname/check_ttyname.c +++ b/src/regress/ttyname/check_ttyname.c @@ -39,7 +39,7 @@ #include #include "missing.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "fatal.h" #include "sudo_util.h" @@ -57,7 +57,7 @@ main(int argc, char *argv[]) /* Lookup tty name via sudo (using kernel info if possible). */ if ((tty_sudo = get_process_ttyname()) == NULL) - tty_sudo = estrdup("none"); + tty_sudo = sudo_estrdup("none"); /* Lookup tty name via libc and compare to kernel tty. */ for (fd = STDERR_FILENO; fd >= STDIN_FILENO; fd--) { @@ -65,7 +65,7 @@ main(int argc, char *argv[]) if (cp != NULL) { if (tty_libc == NULL || strcmp(cp, tty_libc) != 0) { efree(tty_libc); - tty_libc = estrdup(cp); + tty_libc = sudo_estrdup(cp); } if (tty_sudo != NULL && strcmp(tty_libc, tty_sudo) == 0) { rval = 0; diff --git a/src/selinux.c b/src/selinux.c index e9f50f5c3..ccb1463e0 100644 --- a/src/selinux.c +++ b/src/selinux.c @@ -77,7 +77,7 @@ audit_role_change(const security_context_t old_context, sudo_fatal(U_("unable to open audit system")); } else { /* audit role change using the same format as newrole(1) */ - easprintf(&message, "newrole: old-context=%s new-context=%s", + sudo_easprintf(&message, "newrole: old-context=%s new-context=%s", old_context, new_context); rc = audit_log_user_message(au_fd, AUDIT_USER_ROLE_CHANGE, message, NULL, NULL, ttyn, 1); @@ -284,7 +284,7 @@ get_exec_context(security_context_t old_context, const char *role, const char *t /* * Convert "context" back into a string and verify it. */ - new_context = estrdup(context_str(context)); + new_context = sudo_estrdup(context_str(context)); if (security_check_context(new_context) < 0) { sudo_warnx(U_("%s is not a valid context"), new_context); errno = EINVAL; @@ -398,7 +398,7 @@ selinux_execve(const char *path, char *const argv[], char *const envp[], */ for (argc = 0; argv[argc] != NULL; argc++) continue; - nargv = emallocarray(argc + 2, sizeof(char *)); + nargv = sudo_emallocarray(argc + 2, sizeof(char *)); if (noexec) nargv[0] = *argv[0] == '-' ? "-sesh-noexec" : "sesh-noexec"; else diff --git a/src/sesh.c b/src/sesh.c index b268cae72..95ee72574 100644 --- a/src/sesh.c +++ b/src/sesh.c @@ -34,7 +34,7 @@ #include "gettext.h" /* must be included before missing.h */ #include "missing.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "fatal.h" #include "sudo_conf.h" #include "sudo_debug.h" @@ -70,7 +70,7 @@ main(int argc, char *argv[], char *envp[]) /* Shift argv and make a copy of the command to execute. */ argv++; argc--; - cmnd = estrdup(argv[0]); + cmnd = sudo_estrdup(argv[0]); /* If invoked as a login shell, modify argv[0] accordingly. */ if (login_shell) { diff --git a/src/sudo.c b/src/sudo.c index 3d3aa8388..b50d3b0e0 100644 --- a/src/sudo.c +++ b/src/sudo.c @@ -354,7 +354,7 @@ fill_group_list(struct user_details *ud, int system_maxgroups) */ ud->ngroups = sudo_conf_max_groups(); if (ud->ngroups > 0) { - ud->groups = emallocarray(ud->ngroups, sizeof(GETGROUPS_T)); + ud->groups = sudo_emallocarray(ud->ngroups, sizeof(GETGROUPS_T)); /* No error on insufficient space if user specified max_groups. */ (void)getgrouplist(ud->username, ud->gid, ud->groups, &ud->ngroups); rval = 0; @@ -369,7 +369,7 @@ fill_group_list(struct user_details *ud, int system_maxgroups) for (tries = 0; tries < 10 && rval == -1; tries++) { ud->ngroups <<= 1; efree(ud->groups); - ud->groups = emallocarray(ud->ngroups, sizeof(GETGROUPS_T)); + ud->groups = sudo_emallocarray(ud->ngroups, sizeof(GETGROUPS_T)); rval = getgrouplist(ud->username, ud->gid, ud->groups, &ud->ngroups); } } @@ -396,7 +396,7 @@ get_user_groups(struct user_details *ud) if ((ud->ngroups = getgroups(0, NULL)) > 0) { /* Use groups from kernel if not too many or source is static. */ if (ud->ngroups < maxgroups || group_source == GROUP_SOURCE_STATIC) { - ud->groups = emallocarray(ud->ngroups, sizeof(GETGROUPS_T)); + ud->groups = sudo_emallocarray(ud->ngroups, sizeof(GETGROUPS_T)); if (getgroups(ud->ngroups, ud->groups) < 0) { efree(ud->groups); ud->groups = NULL; @@ -417,7 +417,7 @@ get_user_groups(struct user_details *ud) * Format group list as a comma-separated string of gids. */ glsize = sizeof("groups=") - 1 + (ud->ngroups * (MAX_UID_T_LEN + 1)); - gid_list = emalloc(glsize); + gid_list = sudo_emalloc(glsize); memcpy(gid_list, "groups=", sizeof("groups=") - 1); cp = gid_list + sizeof("groups=") - 1; for (i = 0; i < ud->ngroups; i++) { @@ -442,7 +442,7 @@ get_user_info(struct user_details *ud) debug_decl(get_user_info, SUDO_DEBUG_UTIL) /* XXX - bound check number of entries */ - user_info = emallocarray(32, sizeof(char *)); + user_info = sudo_emallocarray(32, sizeof(char *)); ud->pid = getpid(); ud->ppid = getppid(); @@ -473,18 +473,18 @@ get_user_info(struct user_details *ud) if ((ud->shell = getenv("SHELL")) == NULL || ud->shell[0] == '\0') { ud->shell = pw->pw_shell[0] ? pw->pw_shell : _PATH_BSHELL; } - ud->shell = estrdup(ud->shell); + ud->shell = sudo_estrdup(ud->shell); - easprintf(&user_info[++i], "pid=%d", (int)ud->pid); - easprintf(&user_info[++i], "ppid=%d", (int)ud->ppid); - easprintf(&user_info[++i], "pgid=%d", (int)ud->pgid); - easprintf(&user_info[++i], "tcpgid=%d", (int)ud->tcpgid); - easprintf(&user_info[++i], "sid=%d", (int)ud->sid); + sudo_easprintf(&user_info[++i], "pid=%d", (int)ud->pid); + sudo_easprintf(&user_info[++i], "ppid=%d", (int)ud->ppid); + sudo_easprintf(&user_info[++i], "pgid=%d", (int)ud->pgid); + sudo_easprintf(&user_info[++i], "tcpgid=%d", (int)ud->tcpgid); + sudo_easprintf(&user_info[++i], "sid=%d", (int)ud->sid); - easprintf(&user_info[++i], "uid=%u", (unsigned int)ud->uid); - easprintf(&user_info[++i], "euid=%u", (unsigned int)ud->euid); - easprintf(&user_info[++i], "gid=%u", (unsigned int)ud->gid); - easprintf(&user_info[++i], "egid=%u", (unsigned int)ud->egid); + sudo_easprintf(&user_info[++i], "uid=%u", (unsigned int)ud->uid); + sudo_easprintf(&user_info[++i], "euid=%u", (unsigned int)ud->euid); + sudo_easprintf(&user_info[++i], "gid=%u", (unsigned int)ud->gid); + sudo_easprintf(&user_info[++i], "egid=%u", (unsigned int)ud->egid); if ((cp = get_user_groups(ud)) != NULL) user_info[++i] = cp; @@ -514,8 +514,8 @@ get_user_info(struct user_details *ud) ud->host = user_info[i] + sizeof("host=") - 1; sudo_get_ttysize(&ud->ts_lines, &ud->ts_cols); - easprintf(&user_info[++i], "lines=%d", ud->ts_lines); - easprintf(&user_info[++i], "cols=%d", ud->ts_cols); + sudo_easprintf(&user_info[++i], "lines=%d", ud->ts_lines); + sudo_easprintf(&user_info[++i], "cols=%d", ud->ts_cols); user_info[++i] = NULL; @@ -745,7 +745,7 @@ sudo_check_suid(const char *sudo) int len; char *cp, *colon; - cp = path = estrdup(path); + cp = path = sudo_estrdup(path); do { if ((colon = strchr(cp, ':'))) *colon = '\0'; diff --git a/src/sudo.h b/src/sudo.h index a33250246..a34f5c0a8 100644 --- a/src/sudo.h +++ b/src/sudo.h @@ -33,7 +33,7 @@ #include "gettext.h" /* must be included before missing.h */ #include "missing.h" -#include "alloc.h" +#include "sudo_alloc.h" #include "fatal.h" #include "sudo_conf.h" #include "sudo_debug.h" diff --git a/src/sudo_edit.c b/src/sudo_edit.c index 100bff3a3..5f3b966f0 100644 --- a/src/sudo_edit.c +++ b/src/sudo_edit.c @@ -147,7 +147,7 @@ sudo_edit(struct command_details *command_details) * For each file specified by the user, make a temporary version * and copy the contents of the original to it. */ - tf = emallocarray(nfiles, sizeof(*tf)); + tf = sudo_emallocarray(nfiles, sizeof(*tf)); memset(tf, 0, nfiles * sizeof(*tf)); for (i = 0, j = 0; i < nfiles; i++) { rc = -1; @@ -181,10 +181,10 @@ sudo_edit(struct command_details *command_details) cp = tf[j].ofile; suff = strrchr(cp, '.'); if (suff != NULL) { - easprintf(&tf[j].tfile, "%.*s/%.*sXXXXXXXX%s", tmplen, tmpdir, + sudo_easprintf(&tf[j].tfile, "%.*s/%.*sXXXXXXXX%s", tmplen, tmpdir, (int)(size_t)(suff - cp), cp, suff); } else { - easprintf(&tf[j].tfile, "%.*s/%s.XXXXXXXX", tmplen, tmpdir, cp); + sudo_easprintf(&tf[j].tfile, "%.*s/%s.XXXXXXXX", tmplen, tmpdir, cp); } if (seteuid(user_details.uid) != 0) sudo_fatal("seteuid(%d)", (int)user_details.uid); @@ -232,7 +232,7 @@ sudo_edit(struct command_details *command_details) * to create a new argv. */ nargc = editor_argc + nfiles; - nargv = (char **) emallocarray(nargc + 1, sizeof(char *)); + nargv = (char **) sudo_emallocarray(nargc + 1, sizeof(char *)); for (ac = 0; ac < editor_argc; ac++) nargv[ac] = command_details->argv[ac]; for (i = 0; i < nfiles && ac < nargc; ) diff --git a/src/ttyname.c b/src/ttyname.c index 55371c2fc..e0f7bc072 100644 --- a/src/ttyname.c +++ b/src/ttyname.c @@ -132,12 +132,12 @@ sudo_ttyname_dev(dev_t tdev) if (*dev != '/') { /* devname() doesn't use the /dev/ prefix, add one... */ size_t len = sizeof(_PATH_DEV) + strlen(dev); - tty = emalloc(len); + tty = sudo_emalloc(len); strlcpy(tty, _PATH_DEV, len); strlcat(tty, dev, len); } else { /* Should not happen but just in case... */ - tty = estrdup(dev); + tty = sudo_estrdup(dev); } } debug_return_str(tty); @@ -158,7 +158,7 @@ sudo_ttyname_dev(dev_t tdev) tty = _ttyname_dev(tdev, buf, sizeof(buf)); - debug_return_str(estrdup(tty)); + debug_return_str(sudo_estrdup(tty)); } #elif defined(HAVE_STRUCT_PSINFO_PR_TTYDEV) || defined(HAVE_PSTAT_GETPROC) || defined(__linux__) /* @@ -263,14 +263,14 @@ sudo_ttyname_scan(const char *dir, dev_t rdev, bool builtin) /* Add to list of subdirs to search. */ if (num_subdirs + 1 > max_subdirs) { max_subdirs += 64; - subdirs = ereallocarray(subdirs, max_subdirs, sizeof(char *)); + subdirs = sudo_ereallocarray(subdirs, max_subdirs, sizeof(char *)); } - subdirs[num_subdirs++] = estrdup(pathbuf); + subdirs[num_subdirs++] = sudo_estrdup(pathbuf); } continue; } if (S_ISCHR(sb.st_mode) && sb.st_rdev == rdev) { - devname = estrdup(pathbuf); + devname = sudo_estrdup(pathbuf); sudo_debug_printf(SUDO_DEBUG_INFO, "resolved dev %u as %s", (unsigned int)rdev, pathbuf); goto done; @@ -315,7 +315,7 @@ sudo_ttyname_dev(dev_t rdev) (unsigned int)minor(rdev)); if (stat(buf, &sb) == 0) { if (S_ISCHR(sb.st_mode) && sb.st_rdev == rdev) - tty = estrdup(buf); + tty = sudo_estrdup(buf); } sudo_debug_printf(SUDO_DEBUG_INFO, "comparing dev %u to %s: %s", (unsigned int)rdev, buf, tty ? "yes" : "no"); @@ -326,7 +326,7 @@ sudo_ttyname_dev(dev_t rdev) } else { if (stat(devname, &sb) == 0) { if (S_ISCHR(sb.st_mode) && sb.st_rdev == rdev) - tty = estrdup(devname); + tty = sudo_estrdup(devname); } } } @@ -367,7 +367,7 @@ get_process_ttyname(void) mib[5] = 1; do { size += size / 10; - ki_proc = erealloc(ki_proc, size); + ki_proc = sudo_erealloc(ki_proc, size); rc = sysctl(mib, sudo_kp_namelen, ki_proc, &size, NULL, 0); } while (rc == -1 && errno == ENOMEM); if (rc != -1) { @@ -508,6 +508,6 @@ get_process_ttyname(void) tty = ttyname(STDERR_FILENO); } - debug_return_str(estrdup(tty)); + debug_return_str(sudo_estrdup(tty)); } #endif