]> granicus.if.org Git - sudo/commitdiff
Use non-exiting allocatings in the sudoers plugin.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 17 Jun 2015 12:49:59 +0000 (06:49 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 17 Jun 2015 12:49:59 +0000 (06:49 -0600)
36 files changed:
plugins/sudoers/Makefile.in
plugins/sudoers/alias.c
plugins/sudoers/auth/aix_auth.c
plugins/sudoers/auth/bsdauth.c
plugins/sudoers/auth/kerb5.c
plugins/sudoers/auth/pam.c
plugins/sudoers/auth/passwd.c
plugins/sudoers/auth/rfc1938.c
plugins/sudoers/auth/secureware.c
plugins/sudoers/auth/sia.c
plugins/sudoers/check.c
plugins/sudoers/defaults.c
plugins/sudoers/defaults.h
plugins/sudoers/env.c
plugins/sudoers/find_path.c
plugins/sudoers/getspwuid.c
plugins/sudoers/group_plugin.c
plugins/sudoers/interfaces.c
plugins/sudoers/interfaces.h
plugins/sudoers/iolog.c
plugins/sudoers/iolog_path.c
plugins/sudoers/linux_audit.c
plugins/sudoers/locale.c
plugins/sudoers/logging.h
plugins/sudoers/match.c
plugins/sudoers/parse.c
plugins/sudoers/policy.c
plugins/sudoers/prompt.c
plugins/sudoers/regress/iolog_path/check_iolog_path.c
plugins/sudoers/regress/parser/check_addr.c
plugins/sudoers/sudoers.c
plugins/sudoers/sudoers.h
plugins/sudoers/sudoers_debug.c
plugins/sudoers/sudoreplay.c
plugins/sudoers/testsudoers.c
plugins/sudoers/visudo.c

index f0d8187ec54aa94245374353094d48878d8cfe54..8bc9c0a3d27d5c6943031298adbb36e068dbb13d 100644 (file)
@@ -465,46 +465,44 @@ cleandir: realclean
 
 # Autogenerated dependencies, do not modify
 afs.lo: $(authdir)/afs.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \
-        $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-        $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+        $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+        $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
         $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
         $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
         $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-             $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-             $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-             $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-             $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-             $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+             $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+             $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+             $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+             $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+             $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+             $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
              $(srcdir)/sudoers_debug.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
+          $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+          $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
+          $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
+          $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
+          $(srcdir)/logging.h $(srcdir)/parse.h $(srcdir)/redblack.h \
+          $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
+          $(top_builddir)/config.h $(top_builddir)/pathnames.h
+       $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/alias.c
+audit.lo: $(srcdir)/audit.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \
           $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
           $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
           $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-          $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \
-          $(srcdir)/redblack.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-          $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
-          $(top_builddir)/pathnames.h
-       $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/alias.c
-audit.lo: $(srcdir)/audit.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \
-          $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-          $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-          $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-          $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/bsm_audit.h \
-          $(srcdir)/defaults.h $(srcdir)/linux_audit.h $(srcdir)/logging.h \
-          $(srcdir)/solaris_audit.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-          $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
-          $(top_builddir)/pathnames.h
+          $(srcdir)/bsm_audit.h $(srcdir)/defaults.h $(srcdir)/linux_audit.h \
+          $(srcdir)/logging.h $(srcdir)/solaris_audit.h $(srcdir)/sudo_nss.h \
+          $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
+          $(top_builddir)/config.h $(top_builddir)/pathnames.h
        $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/audit.c
 base64.lo: $(srcdir)/base64.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \
-           $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h \
-           $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
+           $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
+           $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
            $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
            $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
            $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
@@ -513,53 +511,50 @@ base64.lo: $(srcdir)/base64.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \
        $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/base64.c
 base64.o: base64.lo
 boottime.lo: $(srcdir)/boottime.c $(devdir)/def_data.h \
-             $(incdir)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-             $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-             $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-             $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-             $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-             $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+             $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+             $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+             $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+             $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+             $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+             $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
              $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
              $(top_builddir)/pathnames.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-            $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-            $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-            $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-            $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-            $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-            $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
-            $(top_builddir)/pathnames.h
+            $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+            $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+            $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+            $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+            $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+            $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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 $(devdir)/def_data.h \
-              $(incdir)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-              $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-              $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-              $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-              $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-              $(srcdir)/bsm_audit.h $(srcdir)/defaults.h $(srcdir)/logging.h \
-              $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+              $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+              $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+              $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+              $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+              $(incdir)/sudo_util.h $(srcdir)/bsm_audit.h $(srcdir)/defaults.h \
+              $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
               $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
               $(top_builddir)/pathnames.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)/compat/stdbool.h \
-          $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-          $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-          $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-          $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/check.h \
-          $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
-          $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
+          $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+          $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+          $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
+          $(srcdir)/check.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+          $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-              $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-              $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-              $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-              $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-              $(srcdir)/defaults.h $(srcdir)/interfaces.h $(srcdir)/logging.h \
-              $(srcdir)/parse.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+              $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+              $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+              $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+              $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.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)/sudoers_debug.h $(top_builddir)/config.h \
               $(top_builddir)/pathnames.h
        $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/parser/check_addr.c
@@ -581,15 +576,14 @@ check_hexchar.o: $(srcdir)/regress/parser/check_hexchar.c \
        $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/parser/check_hexchar.c
 check_iolog_path.o: $(srcdir)/regress/iolog_path/check_iolog_path.c \
                     $(devdir)/def_data.c $(devdir)/def_data.h \
-                    $(incdir)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-                    $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-                    $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-                    $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-                    $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-                    $(srcdir)/defaults.h $(srcdir)/logging.h \
-                    $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-                    $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
-                    $(top_builddir)/pathnames.h
+                    $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+                    $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+                    $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+                    $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+                    $(incdir)/sudo_util.h $(srcdir)/defaults.h \
+                    $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
+                    $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
+                    $(top_builddir)/config.h $(top_builddir)/pathnames.h
        $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/iolog_path/check_iolog_path.c
 check_symbols.o: $(srcdir)/regress/check_symbols/check_symbols.c \
                  $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
@@ -602,8 +596,8 @@ check_wrap.o: $(srcdir)/regress/logging/check_wrap.c \
               $(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)/compat/stdbool.h \
-        $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-        $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+        $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+        $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
         $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
         $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
         $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
@@ -611,207 +605,194 @@ dce.lo: $(authdir)/dce.c $(devdir)/def_data.h $(incdir)/compat/stdbool.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)/compat/stdbool.h \
-             $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h \
-             $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
-             $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
-             $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
-             $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
-             $(srcdir)/parse.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-             $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
-             $(top_builddir)/pathnames.h
+             $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
+             $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
+             $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
+             $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
+             $(srcdir)/logging.h $(srcdir)/parse.h $(srcdir)/sudo_nss.h \
+             $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/compat/stdbool.h \
-        $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-        $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+        $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+        $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
         $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
         $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
         $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-              $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-              $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-              $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-              $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-              $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
-              $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
-              $(top_builddir)/config.h $(top_builddir)/pathnames.h
+              $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+              $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+              $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+              $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+              $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+              $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+              $(srcdir)/sudoers_debug.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)/compat/stdbool.h \
-         $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-         $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-         $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-         $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-         $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-         $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
-         $(top_builddir)/pathnames.h
+         $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+         $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+         $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
+         $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
+         $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/sudo_compat.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-              $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-              $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-              $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-              $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-              $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
-              $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
-              $(top_builddir)/config.h $(top_builddir)/pathnames.h
+              $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+              $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+              $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+              $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+              $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+              $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+              $(srcdir)/sudoers_debug.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-             $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-             $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-             $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-             $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-             $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+             $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+             $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+             $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+             $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+             $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+             $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
              $(srcdir)/sudoers_debug.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)/compat/stdbool.h \
-         $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-         $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-         $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-         $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-         $(srcdir)/logging.h $(srcdir)/parse.h $(srcdir)/sudo_nss.h \
-         $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h $(srcdir)/toke.h \
-         $(top_builddir)/config.h $(top_builddir)/pathnames.h
+         $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+         $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+         $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
+         $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \
+         $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-                 $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-                 $(incdir)/sudo_debug.h $(incdir)/sudo_dso.h \
-                 $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
-                 $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
-                 $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-                 $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-                 $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
-                 $(top_builddir)/pathnames.h
+                 $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+                 $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+                 $(incdir)/sudo_dso.h $(incdir)/sudo_fatal.h \
+                 $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
+                 $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
+                 $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
+                 $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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 $(devdir)/def_data.h \
-            $(incdir)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-            $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-            $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-            $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-            $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-            $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-            $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
-            $(top_builddir)/pathnames.h
+            $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+            $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+            $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+            $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+            $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+            $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
+            $(top_builddir)/config.h $(top_builddir)/pathnames.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-               $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-               $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-               $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-               $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-               $(srcdir)/defaults.h $(srcdir)/interfaces.h $(srcdir)/logging.h \
-               $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-               $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
-               $(top_builddir)/pathnames.h
+               $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+               $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+               $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+               $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+               $(incdir)/sudo_util.h $(srcdir)/defaults.h \
+               $(srcdir)/interfaces.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
+               $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/compat/stdbool.h \
-          $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-          $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-          $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-          $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-          $(srcdir)/iolog.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
-          $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
+          $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+          $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+          $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
+          $(srcdir)/defaults.h $(srcdir)/iolog.h $(srcdir)/logging.h \
+          $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-               $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-               $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-               $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-               $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-               $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
-               $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
-               $(top_builddir)/config.h $(top_builddir)/pathnames.h
+               $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+               $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+               $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+               $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+               $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+               $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+               $(srcdir)/sudoers_debug.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)/compat/stdbool.h \
-          $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-          $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-          $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-          $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-          $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-          $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
-          $(top_builddir)/pathnames.h
+          $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+          $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+          $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
+          $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
+          $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/compat/stdbool.h \
-         $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-         $(incdir)/sudo_debug.h $(incdir)/sudo_dso.h $(incdir)/sudo_fatal.h \
-         $(incdir)/sudo_gettext.h $(incdir)/sudo_lbuf.h \
-         $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-         $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \
-         $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
-         $(top_builddir)/config.h $(top_builddir)/pathnames.h
+         $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+         $(incdir)/sudo_dso.h $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+         $(incdir)/sudo_lbuf.h $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+         $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+         $(srcdir)/parse.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+         $(srcdir)/sudoers_debug.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 $(devdir)/def_data.h \
-                $(incdir)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-                $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-                $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-                $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-                $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-                $(srcdir)/defaults.h $(srcdir)/linux_audit.h \
-                $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+                $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+                $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+                $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+                $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+                $(incdir)/sudo_util.h $(srcdir)/defaults.h \
+                $(srcdir)/linux_audit.h $(srcdir)/logging.h \
+                $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
                 $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
                 $(top_builddir)/pathnames.h
        $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/linux_audit.c
 locale.lo: $(srcdir)/locale.c $(incdir)/compat/stdbool.h \
-           $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h \
-           $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h $(srcdir)/logging.h \
-           $(top_builddir)/config.h
+           $(incdir)/sudo_compat.h $(incdir)/sudo_fatal.h \
+           $(incdir)/sudo_gettext.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-            $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-            $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-            $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-            $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-            $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-            $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
-            $(top_builddir)/pathnames.h
+            $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+            $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+            $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+            $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+            $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+            $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-            $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-            $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-            $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-            $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-            $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-            $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
-            $(top_builddir)/pathnames.h
+            $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+            $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+            $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+            $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+            $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+            $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/compat/fnmatch.h $(incdir)/compat/glob.h \
           $(incdir)/compat/sha2.h $(incdir)/compat/stdbool.h \
-          $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-          $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-          $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-          $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-          $(srcdir)/logging.h $(srcdir)/parse.h $(srcdir)/sudo_nss.h \
-          $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
+          $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+          $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+          $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
+          $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \
+          $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-               $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-               $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-               $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-               $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-               $(srcdir)/defaults.h $(srcdir)/interfaces.h $(srcdir)/logging.h \
-               $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-               $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
-               $(top_builddir)/pathnames.h
+               $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+               $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+               $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+               $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+               $(incdir)/sudo_util.h $(srcdir)/defaults.h \
+               $(srcdir)/interfaces.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
+               $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/compat/stdbool.h \
@@ -821,26 +802,25 @@ net_ifs.o: $(top_srcdir)/src/net_ifs.c $(incdir)/compat/stdbool.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)/compat/stdbool.h \
-        $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-        $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+        $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+        $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
         $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
         $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
         $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-          $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
-          $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
-          $(incdir)/sudo_lbuf.h $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
-          $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
-          $(srcdir)/parse.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-          $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
-          $(top_builddir)/pathnames.h
+          $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+          $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
+          $(incdir)/sudo_gettext.h $(incdir)/sudo_lbuf.h \
+          $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
+          $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \
+          $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/compat/stdbool.h \
-           $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h \
-           $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
+           $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
+           $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
            $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
            $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
            $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
@@ -848,8 +828,8 @@ passwd.lo: $(authdir)/passwd.c $(devdir)/def_data.h $(incdir)/compat/stdbool.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)/compat/stdbool.h \
-           $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h \
-           $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
+           $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
+           $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
            $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
            $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
            $(srcdir)/interfaces.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
@@ -858,8 +838,8 @@ policy.lo: $(srcdir)/policy.c $(devdir)/def_data.h $(incdir)/compat/stdbool.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)/compat/stdbool.h \
-           $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h \
-           $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
+           $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
+           $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
            $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
            $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
            $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
@@ -867,8 +847,8 @@ prompt.lo: $(srcdir)/prompt.c $(devdir)/def_data.h $(incdir)/compat/stdbool.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)/compat/stdbool.h \
-           $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h \
-           $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
+           $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
+           $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
            $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
            $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
            $(srcdir)/logging.h $(srcdir)/pwutil.h $(srcdir)/redblack.h \
@@ -877,103 +857,100 @@ pwutil.lo: $(srcdir)/pwutil.c $(devdir)/def_data.h $(incdir)/compat/stdbool.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-                $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-                $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-                $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-                $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-                $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/pwutil.h \
-                $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+                $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+                $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+                $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+                $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+                $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+                $(srcdir)/pwutil.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
                 $(srcdir)/sudoers_debug.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 $(devdir)/def_data.h \
-             $(incdir)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-             $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-             $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-             $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-             $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-             $(srcdir)/logging.h $(srcdir)/redblack.h $(srcdir)/sudo_nss.h \
-             $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
-             $(top_builddir)/config.h $(top_builddir)/pathnames.h
+             $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+             $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+             $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+             $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+             $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+             $(srcdir)/redblack.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+             $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
+             $(top_builddir)/pathnames.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-            $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-            $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-            $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-            $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-            $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-            $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
-            $(top_builddir)/pathnames.h
+            $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+            $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+            $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+            $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+            $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+            $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-               $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-               $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-               $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-               $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-               $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
-               $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
-               $(top_builddir)/config.h $(top_builddir)/pathnames.h
+               $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+               $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+               $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+               $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+               $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+               $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+               $(srcdir)/sudoers_debug.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-             $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-             $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-             $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-             $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-             $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+             $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+             $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+             $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+             $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+             $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+             $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
              $(srcdir)/sudoers_debug.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-              $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-              $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-              $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-              $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-              $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
-              $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
-              $(top_builddir)/config.h $(top_builddir)/pathnames.h
+              $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+              $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+              $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+              $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+              $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+              $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+              $(srcdir)/sudoers_debug.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)/compat/stdbool.h \
-        $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-        $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+        $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+        $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
         $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
         $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
         $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
         $(top_builddir)/pathnames.h
        $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(authdir)/sia.c
 solaris_audit.lo: $(srcdir)/solaris_audit.c $(devdir)/def_data.h \
-                  $(incdir)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-                  $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-                  $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-                  $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-                  $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-                  $(srcdir)/defaults.h $(srcdir)/logging.h \
-                  $(srcdir)/solaris_audit.h $(srcdir)/sudo_nss.h \
-                  $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
-                  $(top_builddir)/config.h $(top_builddir)/pathnames.h
+                  $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+                  $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+                  $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+                  $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+                  $(incdir)/sudo_util.h $(srcdir)/defaults.h \
+                  $(srcdir)/logging.h $(srcdir)/solaris_audit.h \
+                  $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+                  $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
+                  $(top_builddir)/pathnames.h
        $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/solaris_audit.c
 sssd.lo: $(srcdir)/sssd.c $(devdir)/def_data.h $(incdir)/compat/stdbool.h \
-         $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-         $(incdir)/sudo_debug.h $(incdir)/sudo_dso.h $(incdir)/sudo_fatal.h \
-         $(incdir)/sudo_gettext.h $(incdir)/sudo_lbuf.h \
-         $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-         $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \
-         $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
-         $(top_builddir)/config.h $(top_builddir)/pathnames.h
+         $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+         $(incdir)/sudo_dso.h $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+         $(incdir)/sudo_lbuf.h $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+         $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+         $(srcdir)/parse.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+         $(srcdir)/sudoers_debug.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-              $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-              $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-              $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-              $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-              $(srcdir)/defaults.h $(srcdir)/ins_2001.h \
+              $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+              $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+              $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+              $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.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 \
@@ -981,13 +958,12 @@ sudo_auth.lo: $(authdir)/sudo_auth.c $(devdir)/def_data.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-             $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-             $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-             $(incdir)/sudo_gettext.h $(incdir)/sudo_lbuf.h \
-             $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
-             $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
-             $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+             $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+             $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+             $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+             $(incdir)/sudo_lbuf.h $(incdir)/sudo_plugin.h \
+             $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
+             $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
              $(srcdir)/sudoers_debug.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
@@ -998,113 +974,106 @@ sudo_printf.o: $(srcdir)/sudo_printf.c $(incdir)/compat/stdbool.h \
        $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudo_printf.c
 sudoers.lo: $(srcdir)/sudoers.c $(devdir)/def_data.h \
             $(incdir)/compat/getaddrinfo.h $(incdir)/compat/stdbool.h \
-            $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h \
-            $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
-            $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
-            $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
-            $(incdir)/sudo_util.h $(srcdir)/auth/sudo_auth.h \
-            $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
-            $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
-            $(top_builddir)/config.h $(top_builddir)/pathnames.h
+            $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
+            $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
+            $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
+            $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
+            $(srcdir)/auth/sudo_auth.h $(srcdir)/defaults.h \
+            $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+            $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
+            $(top_builddir)/pathnames.h
        $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudoers.c
 sudoers_debug.lo: $(srcdir)/sudoers_debug.c $(devdir)/def_data.h \
-                  $(incdir)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-                  $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-                  $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-                  $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-                  $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-                  $(srcdir)/defaults.h $(srcdir)/logging.h \
-                  $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+                  $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+                  $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+                  $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+                  $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+                  $(incdir)/sudo_util.h $(srcdir)/defaults.h \
+                  $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
                   $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
                   $(top_builddir)/pathnames.h
        $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/sudoers_debug.c
 sudoers_debug.o: sudoers_debug.lo
 sudoreplay.o: $(srcdir)/sudoreplay.c $(incdir)/compat/getopt.h \
               $(incdir)/compat/stdbool.h $(incdir)/compat/timespec.h \
-              $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h \
-              $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
-              $(incdir)/sudo_event.h $(incdir)/sudo_fatal.h \
-              $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-              $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/iolog.h \
-              $(srcdir)/logging.h $(top_builddir)/config.h \
-              $(top_builddir)/pathnames.h
+              $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
+              $(incdir)/sudo_debug.h $(incdir)/sudo_event.h \
+              $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+              $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.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)/compat/fnmatch.h $(incdir)/compat/stdbool.h \
-               $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h \
-               $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
-               $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
-               $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
-               $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-               $(srcdir)/interfaces.h $(srcdir)/logging.h $(srcdir)/parse.h \
-               $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+               $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
+               $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
+               $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
+               $(incdir)/sudo_queue.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)/sudoers_debug.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)/compat/stdbool.h $(incdir)/compat/timespec.h \
-              $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h \
-              $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
-              $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
-              $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
-              $(incdir)/sudo_util.h $(srcdir)/check.h $(srcdir)/defaults.h \
-              $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-              $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
-              $(top_builddir)/pathnames.h
+              $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
+              $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
+              $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
+              $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/check.h \
+              $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \
+              $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/sudo_compat.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)/compat/sha2.h $(incdir)/compat/stdbool.h \
-         $(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-         $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-         $(incdir)/sudo_gettext.h $(incdir)/sudo_lbuf.h \
+         $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+         $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h $(incdir)/sudo_lbuf.h \
          $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
          $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \
          $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-              $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-              $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-              $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-              $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-              $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \
-              $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+              $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+              $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+              $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+              $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+              $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+              $(srcdir)/parse.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
               $(srcdir)/sudoers_debug.h $(srcdir)/toke.h \
               $(top_builddir)/config.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-             $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-             $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-             $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-             $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
-             $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+             $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+             $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+             $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+             $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+             $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+             $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
              $(srcdir)/sudoers_debug.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)/compat/getopt.h $(incdir)/compat/stdbool.h \
-          $(incdir)/compat/timespec.h $(incdir)/sudo_alloc.h \
-          $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
-          $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
-          $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-          $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \
-          $(srcdir)/redblack.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
-          $(srcdir)/sudoers_debug.h $(srcdir)/sudoers_version.h \
-          $(top_builddir)/config.h $(top_builddir)/pathnames.h
+          $(incdir)/compat/timespec.h $(incdir)/sudo_compat.h \
+          $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
+          $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
+          $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \
+          $(srcdir)/logging.h $(srcdir)/parse.h $(srcdir)/redblack.h \
+          $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \
+          $(srcdir)/sudoers_version.h $(top_builddir)/config.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)/compat/stdbool.h $(incdir)/sudo_alloc.h \
-               $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \
-               $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
-               $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
-               $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \
-               $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \
-               $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
+               $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \
+               $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \
+               $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
+               $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \
+               $(incdir)/sudo_util.h $(srcdir)/defaults.h $(srcdir)/logging.h \
+               $(srcdir)/parse.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \
                $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \
                $(top_builddir)/pathnames.h
        $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/visudo_json.c
index ca063dd60e0494cb2b893084b66852f088735aa8..7b31fb2a85ebb918893b1e87d4158a70d90c605b 100644 (file)
@@ -184,17 +184,17 @@ alias_free(void *v)
     void *next;
     debug_decl(alias_free, SUDOERS_DEBUG_ALIAS)
 
-    sudo_efree(a->name);
+    free(a->name);
     TAILQ_FOREACH_SAFE(m, &a->members, entries, next) {
        if (m->type == COMMAND) {
                c = (struct sudo_command *) m->name;
-               sudo_efree(c->cmnd);
-               sudo_efree(c->args);
+               free(c->cmnd);
+               free(c->args);
        }
-       sudo_efree(m->name);
-       sudo_efree(m);
+       free(m->name);
+       free(m);
     }
-    sudo_efree(a);
+    free(a);
 
     debug_return;
 }
index 7c89d71d056ec0fab513e59fd1d6c3a919871c46..3471dc3910db9a1f1e29391c3b50f3161c3c9023 100644 (file)
@@ -149,7 +149,7 @@ sudo_aix_verify(struct passwd *pw, char *prompt, sudo_auth *auth)
            SUDO_CONV_PROMPT_ECHO_OFF);
        if (pass == NULL)
            break;
-       sudo_efree(message);
+       free(message);
        message = NULL;
        result = authenticate(pw->pw_name, pass, &reenter, &message);
        memset_s(pass, SUDO_CONV_REPL_MAX, 0, strlen(pass));
@@ -170,7 +170,7 @@ sudo_aix_verify(struct passwd *pw, char *prompt, sudo_auth *auth)
        }
        rval = pass ? AUTH_FAILURE : AUTH_INTR;
     }
-    sudo_efree(message);
+    free(message);
     debug_return_int(rval);
 }
 
index 484bdda64818c89ff8fbb03711569482b8ffa9ca..7ecc583084f68a1e6469d39260fadcf20588c935 100644 (file)
@@ -146,7 +146,10 @@ bsdauth_verify(struct passwd *pw, char *prompt, sudo_auth *auth)
            len = strlen(prompt) - 1;
            while (isspace(prompt[len]) || prompt[len] == ':')
                prompt[len--] = '\0';
-           sudo_easprintf(&s, "%s [echo on]: ", prompt);
+           if (asprintf(&s, "%s [echo on]: ", prompt) == -1) {
+               log_warningx(0, N_("unable to allocate memory"));
+               debug_return_int(AUTH_FATAL);
+           }
            pass = auth_getpass(prompt, def_passwd_timeout * 60,
                SUDO_CONV_PROMPT_ECHO_ON);
            free(s);
index 9104d1373ba5895abdf26935090f7a536e557e73..6bfb1d71dc2d766032b9c654836f617f15e290b3 100644 (file)
@@ -124,7 +124,11 @@ 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)) { */
-           sudo_easprintf(&krb5_prompt, "Password for %s: ", pname);
+           if (asprintf(&krb5_prompt, "Password for %s: ", pname) == -1) {
+               log_warningx(0, N_("unable to allocate memory"));
+               free(pname);
+               debug_return_int(AUTH_FATAL);
+           }
        /*}*/
        free(pname);
     }
@@ -144,8 +148,12 @@ 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) {
-       sudo_easprintf(&pname, "%s%s%s", pw->pw_name,
+       int len = asprintf(&pname, "%s%s%s", pw->pw_name,
            sudo_krb5_instance[0] != '/' ? "/" : "", sudo_krb5_instance);
+       if (len == -1) {
+           log_warningx(0, N_("unable to allocate memory"));
+           debug_return_int(AUTH_FATAL);
+       }
     }
 
 #ifdef HAVE_KRB5_INIT_SECURE_CONTEXT
@@ -175,7 +183,7 @@ sudo_krb5_init(struct passwd *pw, sudo_auth *auth)
 
 done:
     if (sudo_krb5_instance != NULL)
-       sudo_efree(pname);
+       free(pname);
     debug_return_int(error ? AUTH_FAILURE : AUTH_SUCCESS);
 }
 
index 2df852d7e9bcab998c21a3c38699aacf92ea339f..85d3ce81ad863686a5adea2af748a13ecbdf1e6a 100644 (file)
@@ -261,12 +261,11 @@ sudo_pam_begin_session(struct passwd *pw, char **user_envp[], sudo_auth *auth)
        char **pam_envp = pam_getenvlist(pamh);
        if (pam_envp != NULL) {
            /* Merge pam env with user env. */
-           env_init(*user_envp);
-           if (!env_merge(pam_envp))
+           if (!env_init(*user_envp) || !env_merge(pam_envp))
                status = AUTH_FAILURE;
            *user_envp = env_get();
-           env_init(NULL);
-           sudo_efree(pam_envp);
+           (void)env_init(NULL);
+           free(pam_envp);
            /* XXX - we leak any duplicates that were in pam_envp */
        }
     }
@@ -376,7 +375,11 @@ converse(int num_msg, PAM_CONST struct pam_message **msg,
                    ret = PAM_CONV_ERR;
                    goto done;
                }
-               pr->resp = sudo_estrdup(pass);
+               if ((pr->resp = strdup(pass)) == NULL) {
+                   sudo_warnx(U_("unable to allocate memory"));
+                   ret = PAM_BUF_ERR;
+                   goto done;
+               }
                memset_s(pass, SUDO_CONV_REPL_MAX, 0, strlen(pass));
                break;
            case PAM_TEXT_INFO:
index a7da4985a9e800d055e5371fc23685786b85389d..75955e7bfcc33d7bd2f42ccfcbcc0f28fd5da1a8 100644 (file)
@@ -59,7 +59,7 @@ sudo_passwd_init(struct passwd *pw, sudo_auth *auth)
     sudo_setspent();
     auth->data = sudo_getepw(pw);
     sudo_endspent();
-    debug_return_int(AUTH_SUCCESS);
+    debug_return_int(auth->data ? AUTH_SUCCESS : AUTH_FATAL);
 }
 
 int
@@ -118,7 +118,7 @@ sudo_passwd_cleanup(pw, auth)
 
     if (pw_epasswd != NULL) {
        memset_s(pw_epasswd, SUDO_CONV_REPL_MAX, 0, strlen(pw_epasswd));
-       sudo_efree(pw_epasswd);
+       free(pw_epasswd);
     }
     debug_return_int(AUTH_SUCCESS);
 }
index b893dda8ae8e58deee13a3ee894ec255b8459304..fbe199019434d9872b34adff2bcd4c55e4424d7b 100644 (file)
@@ -67,6 +67,7 @@ int
 sudo_rfc1938_setup(struct passwd *pw, char **promptp, sudo_auth *auth)
 {
     char challenge[256];
+    size_t challenge_len;
     static char *orig_prompt = NULL, *new_prompt = NULL;
     static int op_len, np_size;
     static struct RFC1938 rfc1938;
@@ -110,9 +111,15 @@ 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 = sudo_erealloc(new_prompt, np_size);
+    challenge_len = strlen(challenge);
+    if (np_size < op_len + challenge_len + 7) {
+       char *p = realloc(new_prompt, op_len + challenge_len + 7);
+       if (p == NULL) {
+           sudo_warnx(U_("unable to allocate memory"));
+           debug_return_int(AUTH_FATAL);
+       }
+       np_size = op_len + challenge_len + 7;
+       new_prompt = p;
     }
 
     if (def_long_otp_prompt)
index 1f29dad434508346e5732f951b09247493cd00b2..df0631b92cafc8bb3b5194eb5c0dde6de6ab069f 100644 (file)
 #include "sudoers.h"
 #include "sudo_auth.h"
 
+#ifdef __alpha
+extern int crypt_type;
+#endif
+
 int
 sudo_secureware_init(struct passwd *pw, sudo_auth *auth)
 {
-#ifdef __alpha
-    extern int crypt_type;
     debug_decl(sudo_secureware_init, SUDOERS_DEBUG_AUTH)
 
+#ifdef __alpha
     if (crypt_type == INT_MAX)
        debug_return_int(AUTH_FAILURE);                 /* no shadow */
-#else
-    debug_decl(secureware_init, SUDOERS_DEBUG_AUTH)
 #endif
+
     sudo_setspent();
     auth->data = sudo_getepw(pw);
     sudo_endspent();
-    debug_return_int(AUTH_SUCCESS);
+    debug_return_int(auth->data ? AUTH_SUCCESS : AUTH_FATAL);
 }
 
 int
@@ -82,10 +84,7 @@ sudo_secureware_verify(struct passwd *pw, char *pass, sudo_auth *auth)
     if (pass[0] == '\0')
        debug_return_int(pw_epasswd[0] ? AUTH_FAILURE : AUTH_SUCCESS);
 
-#ifdef __alpha
-    {
-       extern int crypt_type;
-
+#if defined(__alpha)
 # ifdef HAVE_DISPCRYPT
        epass = dispcrypt(pass, pw_epasswd, crypt_type);
 # else
@@ -94,7 +93,6 @@ sudo_secureware_verify(struct passwd *pw, char *pass, sudo_auth *auth)
        else if (crypt_type == AUTH_CRYPT_CRYPT16)
            epass = crypt(pass, pw_epasswd);
 # endif /* HAVE_DISPCRYPT */
-    }
 #elif defined(HAVE_BIGCRYPT)
     epass = bigcrypt(pass, pw_epasswd);
 #endif /* __alpha */
@@ -114,7 +112,7 @@ sudo_secureware_cleanup(pw, auth)
 
     if (pw_epasswd != NULL) {
        memset_s(pw_epasswd, SUDO_CONV_REPL_MAX, 0, strlen(pw_epasswd));
-       sudo_efree(pw_epasswd);
+       free(pw_epasswd);
     }
     debug_return_int(AUTH_SUCCESS);
 }
index 86c1aeefa728345eb8eb6a8f886d034bfadb9d9c..610b789d3704c93a8e765559b5553be52b6d4f2a 100644 (file)
@@ -116,7 +116,7 @@ sudo_sia_setup(struct passwd *pw, char **promptp, sudo_auth *auth)
     sudo_argc = NewArgc + 1;
     sudo_argv = reallocarray(NULL, sudo_argc + 1, sizeof(char *));
     if (sudo_argv == NULL) {
-       log_warning(0, N_("unable to allocate memory"));
+       log_warningx(0, N_("unable to allocate memory"));
        debug_return_int(AUTH_FATAL);
     }
     sudo_argv[0] = "sudo";
index d27218cdea64fed728c0e935812e1b80040520bf..b152eb6893e81238ee97b6d58ef0fe8a90e31dce 100644 (file)
@@ -102,7 +102,7 @@ check_user_interactive(int validated, int mode, struct passwd *auth_pw)
        rval = verify_user(auth_pw, prompt, validated);
        if (rval == true && lectured)
            set_lectured();
-       sudo_efree(prompt);
+       free(prompt);
     }
     /* Only update timestamp if user was validated. */
     if (rval == true && ISSET(validated, VALIDATE_SUCCESS) &&
index 0c8ffb2a24c3e6140aa13c4596026e72ad7863d0..1e3547ecc65f16feb273103ceb1bbfd39c88392d 100644 (file)
@@ -93,13 +93,13 @@ static struct strmap priorities[] = {
 static bool store_int(char *, struct sudo_defs_types *, int);
 static bool store_list(char *, struct sudo_defs_types *, int);
 static bool store_mode(char *, struct sudo_defs_types *, int);
-static bool store_str(char *, struct sudo_defs_types *, int);
+static int  store_str(char *, struct sudo_defs_types *, int);
 static bool store_syslogfac(char *, struct sudo_defs_types *, int);
 static bool store_syslogpri(char *, struct sudo_defs_types *, int);
 static bool store_tuple(char *, struct sudo_defs_types *, int);
 static bool store_uint(char *, struct sudo_defs_types *, int);
 static bool store_float(char *, struct sudo_defs_types *, int);
-static void list_op(char *, size_t, struct sudo_defs_types *, enum list_ops);
+static bool list_op(char *, size_t, struct sudo_defs_types *, enum list_ops);
 static const char *logfac2str(int);
 static const char *logpri2str(int);
 
@@ -244,8 +244,14 @@ set_default(char *var, char *val, int op)
                sudo_warnx(U_("values for `%s' must start with a '/'"), var);
                debug_return_bool(false);
            }
-           if (!store_str(val, cur, op)) {
+           switch (store_str(val, cur, op)) {
+           case true:
+               /* OK */
+               break;
+           case false:
                sudo_warnx(U_("value `%s' is invalid for option `%s'"), val, var);
+               /* FALLTHROUGH */
+           default:
                debug_return_bool(false);
            }
            break;
@@ -340,7 +346,7 @@ set_default(char *var, char *val, int op)
  * Set default options to compiled-in values.
  * Any of these may be overridden at runtime by a "Defaults" file.
  */
-void
+bool
 init_defaults(void)
 {
     static int firsttime = 1;
@@ -352,11 +358,11 @@ init_defaults(void)
        for (def = sudo_defs_table; def->name; def++) {
            switch (def->type & T_MASK) {
                case T_STR:
-                   sudo_efree(def->sd_un.str);
+                   free(def->sd_un.str);
                    def->sd_un.str = NULL;
                    break;
                case T_LIST:
-                   list_op(NULL, 0, def, freeall);
+                   (void)list_op(NULL, 0, def, freeall);
                    break;
            }
            memset(&def->sd_un, 0, sizeof(def->sd_un));
@@ -418,17 +424,23 @@ init_defaults(void)
 #ifdef UMASK_OVERRIDE
     def_umask_override = true;
 #endif
-    def_iolog_file = sudo_estrdup("%{seq}");
-    def_iolog_dir = sudo_estrdup(_PATH_SUDO_IO_LOGDIR);
-    def_sudoers_locale = sudo_estrdup("C");
+    if ((def_iolog_file = strdup("%{seq}")) == NULL)
+       goto oom;
+    if ((def_iolog_dir = strdup(_PATH_SUDO_IO_LOGDIR)) == NULL)
+       goto oom;
+    if ((def_sudoers_locale = strdup("C")) == NULL)
+       goto oom;
     def_env_reset = ENV_RESET;
     def_set_logname = true;
     def_closefrom = STDERR_FILENO + 1;
-    def_pam_service = sudo_estrdup("sudo");
+    if ((def_pam_service = strdup("sudo")) == NULL)
+       goto oom;
 #ifdef HAVE_PAM_LOGIN
-    def_pam_login_service = sudo_estrdup("sudo-i");
+    if ((def_pam_login_service = strdup("sudo-i")) == NULL)
+       goto oom;
 #else
-    def_pam_login_service = sudo_estrdup("sudo");
+    if ((def_pam_login_service = strdup("sudo")) == NULL)
+       goto oom;
 #endif
 #ifdef NO_PAM_SESSION
     def_pam_session = false;
@@ -467,36 +479,53 @@ init_defaults(void)
 #endif
 
     /* Now do the strings */
-    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);
+    if ((def_mailto = strdup(MAILTO)) == NULL)
+       goto oom;
+    if ((def_mailsub = strdup(N_(MAILSUBJECT))) == NULL)
+       goto oom;
+    if ((def_badpass_message = strdup(_(INCORRECT_PASSWORD))) == NULL)
+       goto oom;
+    if ((def_lecture_status_dir = strdup(_PATH_SUDO_LECTURE_DIR)) == NULL)
+       goto oom;
+    if ((def_timestampdir = strdup(_PATH_SUDO_TIMEDIR)) == NULL)
+       goto oom;
+    if ((def_passprompt = strdup(_(PASSPROMPT))) == NULL)
+       goto oom;
+    if ((def_runas_default = strdup(RUNAS_DEFAULT)) == NULL)
+       goto oom;
 #ifdef _PATH_SUDO_SENDMAIL
-    def_mailerpath = sudo_estrdup(_PATH_SUDO_SENDMAIL);
-    def_mailerflags = sudo_estrdup("-t");
+    if ((def_mailerpath = strdup(_PATH_SUDO_SENDMAIL)) == NULL)
+       goto oom;
+    if ((def_mailerflags = strdup("-t")) == NULL)
+       goto oom;
 #endif
 #if (LOGGING & SLOG_FILE)
-    def_logfile = sudo_estrdup(_PATH_SUDO_LOGFILE);
+    if ((def_logfile = strdup(_PATH_SUDO_LOGFILE)) == NULL)
+       goto oom;
 #endif
 #ifdef EXEMPTGROUP
-    def_exempt_group = sudo_estrdup(EXEMPTGROUP);
+    if ((def_exempt_group = strdup(EXEMPTGROUP)) == NULL)
+       goto oom;
 #endif
 #ifdef SECURE_PATH
-    def_secure_path = sudo_estrdup(SECURE_PATH);
+    if ((def_secure_path = strdup(SECURE_PATH)) == NULL)
+       goto oom;
 #endif
-    def_editor = sudo_estrdup(EDITOR);
+    if ((def_editor = strdup(EDITOR)) == NULL)
+       goto oom;
     def_set_utmp = true;
     def_pam_setcred = true;
 
     /* Finally do the lists (currently just environment tables). */
-    init_envtables();
+    if (!init_envtables())
+       goto oom;
 
     firsttime = 0;
 
-    debug_return;
+    debug_return_bool(true);
+oom:
+    sudo_warnx(U_("unable to allocate memory"));
+    debug_return_bool(false);
 }
 
 /*
@@ -518,21 +547,10 @@ update_defaults(int what)
                    rc = false;
                break;
            case DEFAULTS_USER:
-#if 1
-               if (ISSET(what, SETDEF_USER)) {
-                   int m;
-                   m = userlist_matches(sudo_user.pw, def->binding);
-                   if (m == ALLOW) {
-                       if (!set_default(def->var, def->val, def->op))
-                           rc = false;
-                   }
-               }
-#else
                if (ISSET(what, SETDEF_USER) &&
                    userlist_matches(sudo_user.pw, def->binding) == ALLOW &&
                    !set_default(def->var, def->val, def->op))
                    rc = false;
-#endif
                break;
            case DEFAULTS_RUNAS:
                if (ISSET(what, SETDEF_RUNAS) &&
@@ -700,19 +718,23 @@ store_tuple(char *val, struct sudo_defs_types *def, int op)
     debug_return_bool(true);
 }
 
-static bool
+static int
 store_str(char *val, struct sudo_defs_types *def, int op)
 {
     debug_decl(store_str, SUDOERS_DEBUG_DEFAULTS)
 
-    sudo_efree(def->sd_un.str);
-    if (op == false)
+    free(def->sd_un.str);
+    if (op == false) {
        def->sd_un.str = NULL;
-    else
-       def->sd_un.str = sudo_estrdup(val);
+    } else {
+       if ((def->sd_un.str = strdup(val)) == NULL) {
+           sudo_warnx(U_("unable to allocate memory"));
+           debug_return_int(-1);
+       }
+    }
     if (def->callback)
-       debug_return_bool(def->callback(val));
-    debug_return_bool(true);
+       debug_return_int(def->callback(val));
+    debug_return_int(true);
 }
 
 static bool
@@ -723,7 +745,7 @@ store_list(char *str, struct sudo_defs_types *def, int op)
 
     /* Remove all old members. */
     if (op == false || op == true)
-       list_op(NULL, 0, def, freeall);
+       (void)list_op(NULL, 0, def, freeall);
 
     /* Split str into multiple space-separated words and act on each one. */
     if (op != false) {
@@ -738,7 +760,8 @@ store_list(char *str, struct sudo_defs_types *def, int op)
            /* Find end position and perform operation. */
            for (end = start; *end && !isblank((unsigned char)*end); end++)
                ;
-           list_op(start, end - start, def, op == '-' ? delete : add);
+           if (!list_op(start, end - start, def, op == '-' ? delete : add))
+               debug_return_bool(false);
        } while (*end++ != '\0');
     }
     debug_return_bool(true);
@@ -836,7 +859,7 @@ store_mode(char *val, struct sudo_defs_types *def, int op)
     debug_return_bool(true);
 }
 
-static void
+static bool
 list_op(char *val, size_t len, struct sudo_defs_types *def, enum list_ops op)
 {
     struct list_member *cur, *prev = NULL;
@@ -845,25 +868,25 @@ list_op(char *val, size_t len, struct sudo_defs_types *def, enum list_ops op)
     if (op == freeall) {
        while ((cur = SLIST_FIRST(&def->sd_un.list)) != NULL) {
            SLIST_REMOVE_HEAD(&def->sd_un.list, entries);
-           sudo_efree(cur->value);
-           sudo_efree(cur);
+           free(cur->value);
+           free(cur);
        }
-       debug_return;
+       debug_return_bool(true);
     }
 
     SLIST_FOREACH(cur, &def->sd_un.list, entries) {
        if ((strncmp(cur->value, val, len) == 0 && cur->value[len] == '\0')) {
 
            if (op == add)
-               debug_return;           /* already exists */
+               debug_return_bool(true); /* already exists */
 
            /* Delete node */
            if (prev == NULL)
                SLIST_REMOVE_HEAD(&def->sd_un.list, entries);
            else
                SLIST_REMOVE_AFTER(prev, entries);
-           sudo_efree(cur->value);
-           sudo_efree(cur);
+           free(cur->value);
+           free(cur);
            break;
        }
        prev = cur;
@@ -871,9 +894,13 @@ 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 = sudo_ecalloc(1, sizeof(struct list_member));
-       cur->value = sudo_estrndup(val, len);
+       cur = calloc(1, sizeof(struct list_member));
+       if (cur == NULL || (cur->value = strndup(val, len)) == NULL) {
+           sudo_warnx(U_("unable to allocate memory"));
+           free(cur);
+           debug_return_bool(false);
+       }
        SLIST_INSERT_HEAD(&def->sd_un.list, cur, entries);
     }
-    debug_return;
+    debug_return_bool(true);
 }
index e12f64dc705a62ccdd8de7b02081b8731f95738a..03f327bddbca0caa5fff3760595ad5012e0b3953 100644 (file)
@@ -110,7 +110,7 @@ struct sudo_defs_types {
  * Prototypes
  */
 void dump_default(void);
-void init_defaults(void);
+bool init_defaults(void);
 bool set_default(char *var, char *val, int op);
 bool update_defaults(int what);
 bool check_defaults(int what, bool quiet);
index 17953af2569065524a1ffd9649fed16942e56ea6..252657c888fc7730ca08d0f619009132162fe559 100644 (file)
@@ -211,7 +211,7 @@ static const char *initial_keepenv_table[] = {
 /*
  * Initialize env based on envp.
  */
-void
+bool
 env_init(char * const envp[])
 {
     char * const *ep;
@@ -220,7 +220,7 @@ env_init(char * const envp[])
 
     if (envp == NULL) {
        /* Free the old envp we allocated, if any. */
-       sudo_efree(env.old_envp);
+       free(env.old_envp);
 
        /* Reset to initial state but keep a pointer to what we allocated. */
        env.old_envp = env.envp;
@@ -235,7 +235,13 @@ env_init(char * const envp[])
 
        env.env_len = len;
        env.env_size = len + 1 + 128;
-       env.envp = sudo_emallocarray(env.env_size, sizeof(char *));
+       env.envp = reallocarray(NULL, env.env_size, sizeof(char *));
+       if (env.envp == NULL) {
+           env.env_size = 0;
+           env.env_len = 0;
+           sudo_warnx(U_("unable to allocate memory"));
+           debug_return_bool(false);
+       }
 #ifdef ENV_DEBUG
        memset(env.envp, 0, env.env_size * sizeof(char *));
 #endif
@@ -243,11 +249,11 @@ env_init(char * const envp[])
        env.envp[len] = NULL;
 
        /* Free the old envp we allocated, if any. */
-       sudo_efree(env.old_envp);
+       free(env.old_envp);
        env.old_envp = NULL;
     }
 
-    debug_return;
+    debug_return_bool(true);
 }
 
 /*
@@ -398,7 +404,8 @@ sudo_setenv2(const char *var, const char *val, bool dupcheck, bool overwrite)
     debug_decl(sudo_setenv2, SUDOERS_DEBUG_ENV)
 
     esize = strlen(var) + 1 + strlen(val) + 1;
-    estring = sudo_emalloc(esize);
+    if ((estring = malloc(esize)) == NULL)
+       debug_return_int(-1);
 
     /* Build environment string and insert it. */
     if (strlcpy(estring, var, esize) >= esize ||
@@ -411,7 +418,7 @@ sudo_setenv2(const char *var, const char *val, bool dupcheck, bool overwrite)
        rval = sudo_putenv(estring, dupcheck, overwrite);
     }
     if (rval == -1)
-       sudo_efree(estring);
+       free(estring);
     debug_return_int(rval);
 }
 
@@ -821,6 +828,16 @@ env_update_didvar(const char *ep, unsigned int *didvar)
     }
 }
 
+#define CHECK_PUTENV(a, b, c)  do {                                           \
+    if (sudo_putenv((a), (b), (c)) == -1)                                     \
+       goto bad;                                                              \
+} while (0)
+
+#define CHECK_SETENV2(a, b, c, d)      do {                                   \
+    if (sudo_setenv2((a), (b), (c), (d)) == -1)                                       \
+       goto bad;                                                              \
+} while (0)
+
 /*
  * Build a new environment and ether clear potentially dangerous
  * variables from the old one or start with a clean slate.
@@ -843,9 +860,13 @@ rebuild_env(void)
     didvar = 0;
     env.env_len = 0;
     env.env_size = 128;
-    sudo_efree(env.old_envp);
+    free(env.old_envp);
     env.old_envp = env.envp;
-    env.envp = sudo_emallocarray(env.env_size, sizeof(char *));
+    env.envp = reallocarray(NULL, env.env_size, sizeof(char *));
+    if (env.envp == NULL) {
+       env.env_size = 0;
+       goto bad;
+    }
 #ifdef ENV_DEBUG
     memset(env.envp, 0, env.env_size * sizeof(char *));
 #else
@@ -905,8 +926,7 @@ rebuild_env(void)
 
            if (keepit) {
                /* Preserve variable. */
-               if (sudo_putenv(*ep, false, false) == -1)
-                   goto bad;
+               CHECK_PUTENV(*ep, false, false);
                env_update_didvar(*ep, &didvar);
            }
        }
@@ -918,25 +938,25 @@ rebuild_env(void)
         * on sudoers options).
         */
        if (ISSET(sudo_mode, MODE_LOGIN_SHELL)) {
-           sudo_setenv2("SHELL", runas_pw->pw_shell,
+           CHECK_SETENV2("SHELL", runas_pw->pw_shell,
                ISSET(didvar, DID_SHELL), true);
-           sudo_setenv2("LOGNAME", runas_pw->pw_name,
+           CHECK_SETENV2("LOGNAME", runas_pw->pw_name,
                ISSET(didvar, DID_LOGNAME), true);
-           sudo_setenv2("USER", runas_pw->pw_name,
+           CHECK_SETENV2("USER", runas_pw->pw_name,
                ISSET(didvar, DID_USER), true);
-           sudo_setenv2("USERNAME", runas_pw->pw_name,
+           CHECK_SETENV2("USERNAME", runas_pw->pw_name,
                ISSET(didvar, DID_USERNAME), true);
        } else {
            if (!ISSET(didvar, DID_SHELL))
-               sudo_setenv2("SHELL", sudo_user.pw->pw_shell, false, true);
+               CHECK_SETENV2("SHELL", sudo_user.pw->pw_shell, false, true);
            /* We will set LOGNAME later in the !def_set_logname case. */
            if (!def_set_logname) {
                if (!ISSET(didvar, DID_LOGNAME))
-                   sudo_setenv2("LOGNAME", user_name, false, true);
+                   CHECK_SETENV2("LOGNAME", user_name, false, true);
                if (!ISSET(didvar, DID_USER))
-                   sudo_setenv2("USER", user_name, false, true);
+                   CHECK_SETENV2("USER", user_name, false, true);
                if (!ISSET(didvar, DID_USERNAME))
-                   sudo_setenv2("USERNAME", user_name, false, true);
+                   CHECK_SETENV2("USERNAME", user_name, false, true);
            }
        }
 
@@ -950,10 +970,13 @@ rebuild_env(void)
         */
        if (ISSET(sudo_mode, MODE_LOGIN_SHELL) || !ISSET(didvar, KEPT_MAIL)) {
            cp = _PATH_MAILDIR;
-           if (cp[sizeof(_PATH_MAILDIR) - 2] == '/')
-               sudo_easprintf(&cp, "MAIL=%s%s", _PATH_MAILDIR, runas_pw->pw_name);
-           else
-               sudo_easprintf(&cp, "MAIL=%s/%s", _PATH_MAILDIR, runas_pw->pw_name);
+           if (cp[sizeof(_PATH_MAILDIR) - 2] == '/') {
+               if (asprintf(&cp, "MAIL=%s%s", _PATH_MAILDIR, runas_pw->pw_name) == -1)
+                   goto bad;
+           } else {
+               if (asprintf(&cp, "MAIL=%s/%s", _PATH_MAILDIR, runas_pw->pw_name) == -1)
+                   goto bad;
+           }
            if (sudo_putenv(cp, ISSET(didvar, DID_MAIL), true) == -1) {
                free(cp);
                goto bad;
@@ -973,15 +996,13 @@ rebuild_env(void)
                    SET(didvar, DID_PATH);
                else if (strncmp(*ep, "TERM=", 5) == 0)
                    SET(didvar, DID_TERM);
-               if (sudo_putenv(*ep, false, false) == -1)
-                   goto bad;
+               CHECK_PUTENV(*ep, false, false);
            }
        }
     }
     /* Replace the PATH envariable with a secure one? */
     if (def_secure_path && !user_is_exempt()) {
-       if (sudo_setenv2("PATH", def_secure_path, true, true) == -1)
-           goto bad;
+       CHECK_SETENV2("PATH", def_secure_path, true, true);
        SET(didvar, DID_PATH);
     }
 
@@ -993,58 +1014,50 @@ rebuild_env(void)
      */
     if (def_set_logname && !ISSET(sudo_mode, MODE_LOGIN_SHELL)) {
        if (!ISSET(didvar, KEPT_LOGNAME))
-           sudo_setenv2("LOGNAME", runas_pw->pw_name, true, true);
+           CHECK_SETENV2("LOGNAME", runas_pw->pw_name, true, true);
        if (!ISSET(didvar, KEPT_USER))
-           sudo_setenv2("USER", runas_pw->pw_name, true, true);
+           CHECK_SETENV2("USER", runas_pw->pw_name, true, true);
        if (!ISSET(didvar, KEPT_USERNAME))
-           sudo_setenv2("USERNAME", runas_pw->pw_name, true, true);
+           CHECK_SETENV2("USERNAME", runas_pw->pw_name, true, true);
     }
 
     /* Set $HOME to target user if not preserving user's value. */
     if (reset_home)
-       sudo_setenv2("HOME", runas_pw->pw_dir, true, true);
+       CHECK_SETENV2("HOME", runas_pw->pw_dir, true, true);
 
     /* Provide default values for $TERM and $PATH if they are not set. */
-    if (!ISSET(didvar, DID_TERM)) {
-       if (sudo_putenv("TERM=unknown", false, false) == -1)
-           goto bad;
-    }
-    if (!ISSET(didvar, DID_PATH)) {
-       if (sudo_setenv2("PATH", _PATH_STDPATH, false, true) == -1)
-           goto bad;
-    }
+    if (!ISSET(didvar, DID_TERM))
+       CHECK_PUTENV("TERM=unknown", false, false);
+    if (!ISSET(didvar, DID_PATH))
+       CHECK_SETENV2("PATH", _PATH_STDPATH, false, true);
 
     /* Set PS1 if SUDO_PS1 is set. */
-    if (ps1 != NULL) {
-       if (sudo_putenv(ps1, true, true) == -1)
-           goto bad;
-    }
+    if (ps1 != NULL)
+       CHECK_PUTENV(ps1, true, true);
 
     /* Add the SUDO_COMMAND envariable (cmnd + args). */
     if (user_args) {
-       sudo_easprintf(&cp, "SUDO_COMMAND=%s %s", user_cmnd, user_args);
+       if (asprintf(&cp, "SUDO_COMMAND=%s %s", user_cmnd, user_args) == -1)
+           goto bad;
        if (sudo_putenv(cp, true, true) == -1) {
-           sudo_efree(cp);
+           free(cp);
            goto bad;
        }
     } else {
-       if (sudo_setenv2("SUDO_COMMAND", user_cmnd, true, true) == -1)
-           goto bad;
+       CHECK_SETENV2("SUDO_COMMAND", user_cmnd, true, true);
     }
 
     /* Add the SUDO_USER, SUDO_UID, SUDO_GID environment variables. */
-    if (sudo_setenv2("SUDO_USER", user_name, true, true) == -1)
-       goto bad;
+    CHECK_SETENV2("SUDO_USER", user_name, true, true);
     snprintf(idbuf, sizeof(idbuf), "%u", (unsigned int) user_uid);
-    if (sudo_setenv2("SUDO_UID", idbuf, true, true) == -1)
-       goto bad;
+    CHECK_SETENV2("SUDO_UID", idbuf, true, true);
     snprintf(idbuf, sizeof(idbuf), "%u", (unsigned int) user_gid);
-    if (sudo_setenv2("SUDO_GID", idbuf, true, true) == -1)
-       goto bad;
+    CHECK_SETENV2("SUDO_GID", idbuf, true, true);
 
     debug_return_bool(true);
 
 bad:
+    sudo_warn(U_("unable to rebuild the environment"));
     debug_return_bool(false);
 }
 
@@ -1177,7 +1190,11 @@ read_env_file(const char *path, int overwrite)
            val_len -= 2;
        }
 
-       cp = sudo_emalloc(var_len + 1 + val_len + 1);
+       if ((cp = malloc(var_len + 1 + val_len + 1)) == NULL) {
+           /* XXX - no undo on failure */
+           rval = false;
+           break;
+       }
        memcpy(cp, var, var_len + 1); /* includes '=' */
        memcpy(cp + var_len + 1, val, val_len + 1); /* includes NUL */
 
@@ -1193,32 +1210,43 @@ read_env_file(const char *path, int overwrite)
     debug_return_bool(rval);
 }
 
-void
+bool
 init_envtables(void)
 {
     struct list_member *cur;
     const char **p;
+    debug_decl(init_envtables, SUDOERS_DEBUG_ENV)
 
     /* Fill in the "env_delete" list. */
     for (p = initial_badenv_table; *p; p++) {
-       cur = sudo_ecalloc(1, sizeof(struct list_member));
-       cur->value = sudo_estrdup(*p);
+       cur = calloc(1, sizeof(struct list_member));
+       if (cur == NULL || (cur->value = strdup(*p)) == NULL) {
+           free(cur);
+           debug_return_bool(false);
+       }
        SLIST_INSERT_HEAD(&def_env_delete, cur, entries);
     }
 
     /* Fill in the "env_check" list. */
     for (p = initial_checkenv_table; *p; p++) {
-       cur = sudo_ecalloc(1, sizeof(struct list_member));
-       cur->value = sudo_estrdup(*p);
+       cur = calloc(1, sizeof(struct list_member));
+       if (cur == NULL || (cur->value = strdup(*p)) == NULL) {
+           free(cur);
+           debug_return_bool(false);
+       }
        SLIST_INSERT_HEAD(&def_env_check, cur, entries);
     }
 
     /* Fill in the "env_keep" list. */
     for (p = initial_keepenv_table; *p; p++) {
-       cur = sudo_ecalloc(1, sizeof(struct list_member));
-       cur->value = sudo_estrdup(*p);
+       cur = calloc(1, sizeof(struct list_member));
+       if (cur == NULL || (cur->value = strdup(*p)) == NULL) {
+           free(cur);
+           debug_return_bool(false);
+       }
        SLIST_INSERT_HEAD(&def_env_keep, cur, entries);
     }
+    debug_return_bool(true);
 }
 
 int
index 8c7b7fccac99cc65eb5a4db507458ef7a611d2a7..4ca0f5ea012af1bd3d27c75b8e2eda6db41a8860 100644 (file)
  * but it is in '.' and IGNORE_DOT is set.
  */
 int
-find_path(char *infile, char **outfile, struct stat *sbp, char *path,
-    int ignore_dot)
+find_path(const char *infile, char **outfile, struct stat *sbp,
+    const char *path, int ignore_dot)
 {
-    static char command[PATH_MAX]; /* qualified filename */
-    char *n;                   /* for traversing path */
-    char *origpath;            /* so we can free path later */
-    bool found = false;                /* did we find the command? */
-    bool checkdot = false;     /* check current dir? */
-    int len;                   /* length parameter */
+    static char command[PATH_MAX];
+    const char *cp, *ep, *pathend;
+    bool found = false;
+    bool checkdot = false;
+    int len;
     debug_decl(find_path, SUDOERS_DEBUG_UTIL)
 
     if (strlen(infile) >= PATH_MAX) {
@@ -73,7 +72,7 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path,
      * If we were given a fully qualified or relative path
      * there is no need to look at $PATH.
      */
-    if (strchr(infile, '/')) {
+    if (strchr(infile, '/') != NULL) {
        strlcpy(command, infile, sizeof(command));      /* paranoia */
        if (sudo_goodpath(command, sbp)) {
            *outfile = command;
@@ -84,39 +83,32 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path,
 
     if (path == NULL)
        debug_return_int(NOT_FOUND);
-    path = sudo_estrdup(path);
-    origpath = path;
 
-    do {
-       if ((n = strchr(path, ':')))
-           *n = '\0';
+    pathend = path + strlen(path);
+    for (cp = sudo_strsplit(path, pathend, ":", &ep); cp != NULL;
+       cp = sudo_strsplit(NULL, pathend, ":", &ep)) {
 
        /*
-        * Search current dir last if it is in PATH This will miss sneaky
-        * things like using './' or './/'
+        * Search current dir last if it is in PATH.
+        * This will miss sneaky things like using './' or './/' (XXX)
         */
-       if (*path == '\0' || (*path == '.' && *(path + 1) == '\0')) {
+       if (cp == ep || (*cp == '.' && cp + 1 == ep)) {
            checkdot = 1;
-           path = n + 1;
            continue;
        }
 
        /*
         * Resolve the path and exit the loop if found.
         */
-       len = snprintf(command, sizeof(command), "%s/%s", path, infile);
+       len = snprintf(command, sizeof(command), "%.*s/%s",
+           (int)(ep - cp), cp, infile);
        if (len <= 0 || (size_t)len >= sizeof(command)) {
-           sudo_efree(origpath);
            errno = ENAMETOOLONG;
            debug_return_int(NOT_FOUND_ERROR);
        }
        if ((found = sudo_goodpath(command, sbp)))
            break;
-
-       path = n + 1;
-
-    } while (n);
-    sudo_efree(origpath);
+    }
 
     /*
      * Check current dir if dot was in the PATH
index 70709b2c29020926653979b1dac70a42041e3dc8..95f959b732c6b6a69b3196387083652bd4810f86 100644 (file)
@@ -142,7 +142,7 @@ sudo_getepw(const struct passwd *pw)
 done:
 #endif
     /* If no shadow password, fall back on regular password. */
-    debug_return_str(sudo_estrdup(epw ? epw : pw->pw_passwd));
+    debug_return_str(strdup(epw ? epw : pw->pw_passwd));
 }
 
 void
index 8ac5c7bf7a69da7752714e37fd5600bde3d08006..20e094d2f8bf269091283cb662ac03ee6795771d 100644 (file)
@@ -135,7 +135,11 @@ group_plugin_load(char *plugin_info)
             }
         }
        if (ac != 0)    {
-           argv = sudo_emallocarray(ac, sizeof(char *));
+           argv = reallocarray(NULL, ac, sizeof(char *));
+           if (argv == NULL) {
+               sudo_warnx(U_("unable to allocate memory"));
+               goto done;
+           }
            ac = 0;
            for ((cp = strtok(args, " \t")); cp; (cp = strtok(NULL, " \t")))
                argv[ac++] = cp;
@@ -145,7 +149,7 @@ group_plugin_load(char *plugin_info)
     rc = (group_plugin->init)(GROUP_API_VERSION, sudo_printf, argv);
 
 done:
-    sudo_efree(argv);
+    free(argv);
 
     if (rc != true) {
        if (group_handle != NULL) {
index fd2dbdbe67990a8716ebe93fe5b53a0a87af1fee..d8a2868bbb7c33a38bfda8d1639a32c43c262ced 100644 (file)
@@ -57,14 +57,16 @@ static struct interface_list interfaces;
  * Parse a space-delimited list of IP address/netmask pairs and
  * store in a list of interface structures.
  */
-void
+bool
 set_interfaces(const char *ai)
 {
     char *addrinfo, *addr, *mask;
     struct interface *ifp;
+    bool rval = false;
     debug_decl(set_interfaces, SUDOERS_DEBUG_NETIF)
 
-    addrinfo = sudo_estrdup(ai);
+    if ((addrinfo = strdup(ai)) == NULL)
+       debug_return_bool(false);
     for (addr = strtok(addrinfo, " \t"); addr != NULL; addr = strtok(NULL, " \t")) {
        /* Separate addr and mask. */
        if ((mask = strchr(addr, '/')) == NULL)
@@ -72,7 +74,8 @@ set_interfaces(const char *ai)
        *mask++ = '\0';
 
        /* Parse addr and store in list. */
-       ifp = sudo_ecalloc(1, sizeof(*ifp));
+       if ((ifp = calloc(1, sizeof(*ifp))) == NULL)
+           goto done;
        if (strchr(addr, ':')) {
            /* IPv6 */
 #ifdef HAVE_STRUCT_IN6_ADDR
@@ -81,7 +84,7 @@ set_interfaces(const char *ai)
                inet_pton(AF_INET6, mask, &ifp->netmask.ip6) != 1)
 #endif
            {
-               sudo_efree(ifp);
+               free(ifp);
                continue;
            }
        } else {
@@ -89,14 +92,17 @@ set_interfaces(const char *ai)
            ifp->family = AF_INET;
            if (inet_pton(AF_INET, addr, &ifp->addr.ip4) != 1 ||
                inet_pton(AF_INET, mask, &ifp->netmask.ip4) != 1) {
-               sudo_efree(ifp);
+               free(ifp);
                continue;
            }
        }
        SLIST_INSERT_HEAD(&interfaces, ifp, entries);
     }
-    sudo_efree(addrinfo);
-    debug_return;
+    rval = true;
+
+done:
+    free(addrinfo);
+    debug_return_bool(rval);
 }
 
 struct interface_list *
@@ -111,12 +117,15 @@ dump_interfaces(const char *ai)
     char *cp, *addrinfo;
     debug_decl(set_interfaces, SUDOERS_DEBUG_NETIF)
 
-    addrinfo = sudo_estrdup(ai);
+    if ((addrinfo = strdup(ai)) == NULL) {
+       sudo_warnx(U_("unable to allocate memory"));
+    } else {
+       sudo_printf(SUDO_CONV_INFO_MSG,
+           _("Local IP address and netmask pairs:\n"));
+       for (cp = strtok(addrinfo, " \t"); cp != NULL; cp = strtok(NULL, " \t"))
+           sudo_printf(SUDO_CONV_INFO_MSG, "\t%s\n", cp);
 
-    sudo_printf(SUDO_CONV_INFO_MSG, _("Local IP address and netmask pairs:\n"));
-    for (cp = strtok(addrinfo, " \t"); cp != NULL; cp = strtok(NULL, " \t"))
-       sudo_printf(SUDO_CONV_INFO_MSG, "\t%s\n", cp);
-
-    sudo_efree(addrinfo);
+       free(addrinfo);
+    }
     debug_return;
 }
index a0857af457b50201478919837e995c61acd3fb6b..07cf9f582788104ca11da639fe2bc523ee230595 100644 (file)
@@ -49,7 +49,7 @@ SLIST_HEAD(interface_list, interface);
  */
 int get_net_ifs(char **addrinfo);
 void dump_interfaces(const char *);
-void set_interfaces(const char *);
+bool set_interfaces(const char *);
 struct interface_list *get_interfaces(void);
 
 #endif /* SUDOERS_INTERFACES_H */
index 380b45ec737a31bba69c46d0316108aadfe4bad5..6d9a5afcb30bfe8e57ddf7c9644be99b47865169 100644 (file)
@@ -571,7 +571,7 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
     char pathbuf[PATH_MAX], sessid[7];
     char *tofree = NULL;
     char * const *cur;
-    const char *plugin_path = NULL;
+    const char *cp, *plugin_path = NULL;
     size_t len;
     int i, rval = -1;
     debug_decl(sudoers_io_open, SUDOERS_DEBUG_PLUGIN)
@@ -593,10 +593,11 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
     }
 
     /* Initialize the debug subsystem.  */
-    for (cur = settings; *cur != NULL; cur++) {
-       if (strncmp(*cur, "debug_flags=", sizeof("debug_flags=") - 1) == 0) {
-           sudoers_debug_parse_flags(&debug_files,
-               *cur + sizeof("debug_flags=") - 1);
+    for (cur = settings; (cp = *cur) != NULL; cur++) {
+       if (strncmp(cp, "debug_flags=", sizeof("debug_flags=") - 1) == 0) {
+           cp += sizeof("debug_flags=") - 1;
+           if (!sudoers_debug_parse_flags(&debug_files, cp))
+               debug_return_int(-1);
            continue;
        }
        if (strncmp(*cur, "plugin_path=", sizeof("plugin_path=") - 1) == 0) {
@@ -617,7 +618,11 @@ 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 = sudo_emalloc(sizeof(_PATH_SUDO_IO_LOGDIR) + sizeof(sessid) + 2);
+       tofree = malloc(sizeof(_PATH_SUDO_IO_LOGDIR) + sizeof(sessid) + 2);
+       if (tofree == NULL) {
+           sudo_warnx(U_("unable to allocate memory"));
+           goto done;
+       }
        memcpy(tofree, _PATH_SUDO_IO_LOGDIR, sizeof(_PATH_SUDO_IO_LOGDIR));
        if (!io_nextid(tofree, NULL, sessid)) {
            rval = false;
@@ -665,7 +670,7 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
     rval = true;
 
 done:
-    sudo_efree(tofree);
+    free(tofree);
     if (details.runas_pw)
        sudo_pw_delref(details.runas_pw);
     sudo_endpwent();
index d462b5eb129c224fb57df59ee29d38adb8ad3936..355bb857bdda4caa2028dc43ee67acd4fdd8ad80 100644 (file)
@@ -172,7 +172,11 @@ 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 = sudo_emalloc(prelen + PATH_MAX);
+    dst = path = malloc(prelen + PATH_MAX);
+    if (path == NULL) {
+       sudo_warnx(U_("unable to allocate memory"));
+       goto bad;
+    }
     *path = '\0';
     pathend = path + prelen + PATH_MAX;
 
@@ -282,6 +286,6 @@ expand_iolog_path(const char *prefix, const char *dir, const char *file,
 
     debug_return_str(path);
 bad:
-    sudo_efree(path);
+    free(path);
     debug_return_str(NULL);
 }
index ba6fd88b97cd8e714365472238ce2701d30ce068..076500bd795d986c680158eea3c11fda7f230b0c 100644 (file)
@@ -78,7 +78,11 @@ 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 = sudo_emalloc(size);
+    command = cp = malloc(size);
+    if (command == NULL) {
+       sudo_warn(U_("unable to allocate memory"));
+       goto done;
+    }
     for (av = argv; *av != NULL; av++) {
        n = strlcpy(cp, *av, size - (cp - command));
        if (n >= size - (cp - command)) {
@@ -101,7 +105,7 @@ linux_audit_command(char *argv[], int result)
     rc = 0;
 
 done:
-    sudo_efree(command);
+    free(command);
 
     debug_return_int(rc);
 }
index 06cb78b38d36b2bd6766fbc4f1389dd993e99a15..d2810e63e066e7b73a7b0e5691d2bd9d8fa5f04b 100644 (file)
@@ -43,7 +43,6 @@
 
 #include "sudo_compat.h"
 #include "sudo_fatal.h"
-#include "sudo_alloc.h"
 #include "logging.h"
 
 static int current_locale = SUDOERS_LOCALE_USER;
@@ -56,17 +55,20 @@ sudoers_getlocale(void)
     return current_locale;
 }
 
-void
+bool
 sudoers_initlocale(const char *ulocale, const char *slocale)
 {
     if (ulocale != NULL) {
-       sudo_efree(user_locale);
-       user_locale = sudo_estrdup(ulocale);
+       free(user_locale);
+       if ((user_locale = strdup(ulocale)) == NULL)
+           return false;
     }
     if (slocale != NULL) {
-       sudo_efree(sudoers_locale);
-       sudoers_locale = sudo_estrdup(slocale);
+       free(sudoers_locale);
+       if ((sudoers_locale = strdup(slocale)) == NULL)
+           return false;
     }
+    return true;
 }
 
 /*
@@ -87,8 +89,11 @@ sudoers_setlocale(int newlocale, int *prevlocale)
            if (current_locale != SUDOERS_LOCALE_USER) {
                current_locale = SUDOERS_LOCALE_USER;
                res = setlocale(LC_ALL, user_locale ? user_locale : "");
-               if (res != NULL && user_locale == NULL)
-                   user_locale = sudo_estrdup(setlocale(LC_ALL, NULL));
+               if (res != NULL && user_locale == NULL) {
+                   user_locale = strdup(setlocale(LC_ALL, NULL));
+                   if (user_locale == NULL)
+                       res = NULL;
+               }
            }
            break;
        case SUDOERS_LOCALE_SUDOERS:
@@ -99,9 +104,10 @@ sudoers_setlocale(int newlocale, int *prevlocale)
                res = setlocale(LC_ALL, sudoers_locale ? sudoers_locale : "C");
                if (res == NULL && sudoers_locale != NULL) {
                    if (strcmp(sudoers_locale, "C") != 0) {
-                       sudo_efree(sudoers_locale);
-                       sudoers_locale = sudo_estrdup("C");
-                       res = setlocale(LC_ALL, "C");
+                       free(sudoers_locale);
+                       sudoers_locale = strdup("C");
+                       if (sudoers_locale != NULL)
+                           res = setlocale(LC_ALL, "C");
                    }
                }
            }
index 578a615164e1a8243109c88628cdddeb520af626..2e41a2d1add7a91c5aff756e30f8ac979f3a75fb 100644 (file)
@@ -73,7 +73,7 @@ bool log_denial(int status, bool inform_user);
 bool log_failure(int status, int flags);
 bool log_warning(int flags, const char *fmt, ...) __printflike(2, 3);
 bool log_warningx(int flags, const char *fmt, ...) __printflike(2, 3);
-void sudoers_initlocale(const char *ulocale, const char *slocale);
+bool sudoers_initlocale(const char *ulocale, const char *slocale);
 void writeln_wrap(FILE *fp, char *line, size_t len, size_t maxlen);
 
 #endif /* SUDOERS_LOGGING_H */
index 441bfdaf92b5dfe5c1e172094c617b3c4b74c3b7..40e6cebb79cee101380659748cb4b2a2c48106f4 100644 (file)
@@ -413,8 +413,7 @@ command_matches(const char *sudoers_cmnd, const char *sudoers_args, const struct
        if (strcmp(sudoers_cmnd, "sudoedit") == 0 &&
            strcmp(user_cmnd, "sudoedit") == 0 &&
            command_args_match(sudoers_cmnd, sudoers_args)) {
-           sudo_efree(safe_cmnd);
-           safe_cmnd = sudo_estrdup(sudoers_cmnd);
+           /* No need to set safe_cmnd since user_cmnd matches sudoers_cmnd */
            rc = true;
        }
        goto done;
@@ -460,9 +459,7 @@ command_matches_fnmatch(const char *sudoers_cmnd, const char *sudoers_args)
     if (fnmatch(sudoers_cmnd, user_cmnd, FNM_PATHNAME) != 0)
        debug_return_bool(false);
     if (command_args_match(sudoers_cmnd, sudoers_args)) {
-       if (safe_cmnd)
-           free(safe_cmnd);
-       safe_cmnd = sudo_estrdup(user_cmnd);
+       /* No need to set safe_cmnd since user_cmnd matches sudoers_cmnd */
        debug_return_bool(true);
     }
     debug_return_bool(false);
@@ -523,8 +520,11 @@ command_matches_glob(const char *sudoers_cmnd, const char *sudoers_args)
        if (user_stat == NULL ||
            (user_stat->st_dev == sudoers_stat.st_dev &&
            user_stat->st_ino == sudoers_stat.st_ino)) {
-           sudo_efree(safe_cmnd);
-           safe_cmnd = sudo_estrdup(cp);
+           free(safe_cmnd);
+           if ((safe_cmnd = strdup(cp)) == NULL) {
+               sudo_warnx(U_("unable to allocate memory"));
+               cp = NULL;              /* fail closed */
+           }
            break;
        }
     }
@@ -533,8 +533,7 @@ command_matches_glob(const char *sudoers_cmnd, const char *sudoers_args)
        debug_return_bool(false);
 
     if (command_args_match(sudoers_cmnd, sudoers_args)) {
-       sudo_efree(safe_cmnd);
-       safe_cmnd = sudo_estrdup(user_cmnd);
+       /* safe_cmnd was set above. */
        debug_return_bool(true);
     }
     debug_return_bool(false);
@@ -556,9 +555,10 @@ 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)) {
-           sudo_efree(safe_cmnd);
-           safe_cmnd = sudo_estrdup(sudoers_cmnd);
-           debug_return_bool(true);
+           free(safe_cmnd);
+           if ((safe_cmnd = strdup(sudoers_cmnd)) != NULL)
+               debug_return_bool(true);
+           sudo_warnx(U_("unable to allocate memory"));
        }
     }
     debug_return_bool(false);
@@ -714,8 +714,11 @@ command_matches_normal(const char *sudoers_cmnd, const char *sudoers_args, const
        /* XXX - log functions not available but we should log very loudly */
        debug_return_bool(false);
     }
-    sudo_efree(safe_cmnd);
-    safe_cmnd = sudo_estrdup(sudoers_cmnd);
+    free(safe_cmnd);
+    if ((safe_cmnd = strdup(sudoers_cmnd)) == NULL) {
+       sudo_warnx(U_("unable to allocate memory"));
+       debug_return_bool(false);
+    }
     debug_return_bool(true);
 }
 #endif /* SUDOERS_NAME_MATCH */
@@ -768,8 +771,11 @@ command_matches_dir(const char *sudoers_dir, size_t dlen)
        if (user_stat == NULL ||
            (user_stat->st_dev == sudoers_stat.st_dev &&
            user_stat->st_ino == sudoers_stat.st_ino)) {
-           sudo_efree(safe_cmnd);
-           safe_cmnd = sudo_estrdup(buf);
+           free(safe_cmnd);
+           if ((safe_cmnd = strdup(buf)) == NULL) {
+               sudo_warnx(U_("unable to allocate memory"));
+               dent = NULL;
+           }
            break;
        }
     }
@@ -944,7 +950,7 @@ sudo_getdomainname(void)
                for (cp = domain; *cp != '\0'; cp++) {
                    /* Check for illegal characters, Linux may use "(none)". */
                    if (*cp == '(' || *cp == ')' || *cp == ',' || *cp == ' ') {
-                       sudo_efree(domain);
+                       free(domain);
                        domain = NULL;
                        break;
                    }
index 7d28e545eba526c3b7a4f3d2e2197485f3188df7..fdb7b3098668b2938bfc51095ac0de11932ae672 100644 (file)
@@ -237,17 +237,57 @@ sudo_file_lookup(struct sudo_nss *nss, int validated, int pwflag)
                        tags = &cs->tags;
 #ifdef HAVE_SELINUX
                        /* Set role and type if not specified on command line. */
-                       if (user_role == NULL)
-                           user_role = cs->role ? sudo_estrdup(cs->role) : def_role;
-                       if (user_type == NULL)
-                           user_type = cs->type ? sudo_estrdup(cs->type) : def_type;
+                       if (user_role == NULL) {
+                           if (cs->role != NULL) {
+                               user_role = strdup(cs->role);
+                               if (user_role == NULL) {
+                                   sudo_warnx(U_("unable to allocate memory"));
+                                   SET(validated, VALIDATE_ERROR);
+                                   goto done;
+                               }
+                           } else {
+                               user_role = def_role;
+                           }
+                       }
+                       if (user_type == NULL) {
+                           if (cs->type != NULL) {
+                               user_type = strdup(cs->type);
+                               if (user_type == NULL) {
+                                   sudo_warnx(U_("unable to allocate memory"));
+                                   SET(validated, VALIDATE_ERROR);
+                                   goto done;
+                               }
+                           } else {
+                               user_type = def_type;
+                           }
+                       }
 #endif /* HAVE_SELINUX */
 #ifdef HAVE_PRIV_SET
                        /* Set Solaris privilege sets */
-                       if (runas_privs == NULL)
-                           runas_privs = cs->privs ? sudo_estrdup(cs->privs) : def_privs;
-                       if (runas_limitprivs == NULL)
-                           runas_limitprivs = cs->limitprivs ? sudo_estrdup(cs->limitprivs) : def_limitprivs;
+                       if (runas_privs == NULL) {
+                           if (cs->privs != NULL) {
+                               runas_privs = strdup(cs->privs);
+                               if (runas_privs == NULL) {
+                                   sudo_warnx(U_("unable to allocate memory"));
+                                   SET(validated, VALIDATE_ERROR);
+                                   goto done;
+                               }
+                           } else {
+                               runas_privs = def_privs;
+                           }
+                       }
+                       if (runas_limitprivs == NULL) {
+                           if (cs->limitprivs != NULL) {
+                               runas_limitprivs = strdup(cs->limitprivs);
+                               if (runas_limitprivs == NULL) {
+                                   sudo_warnx(U_("unable to allocate memory"));
+                                   SET(validated, VALIDATE_ERROR);
+                                   goto done;
+                               }
+                           } else {
+                               runas_limitprivs = def_limitprivs;
+                           }
+                       }
 #endif /* HAVE_PRIV_SET */
                        /*
                         * If user is running command as himself,
@@ -307,6 +347,9 @@ sudo_file_lookup(struct sudo_nss *nss, int validated, int pwflag)
            }
        }
     }
+#if defined(HAVE_SELINUX) || defined(HAVE_PRIV_SET)
+done:
+#endif
     (void) restore_perms();
     debug_return_int(validated);
 }
index ddf99d0294dea5d18b90c69e9b9f55e9eb8bd05f..fdc53beca721142afdf394f4463ff06bf23e38f4 100644 (file)
@@ -248,7 +248,10 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
 #endif /* HAVE_BSD_AUTH_H */
        if (MATCHES(*cur, "network_addrs=")) {
            interfaces_string = *cur + sizeof("network_addrs=") - 1;
-           set_interfaces(interfaces_string);
+           if (!set_interfaces(interfaces_string)) {
+               sudo_warn(U_("unable to parse network address list"));
+               goto bad;
+           }
            continue;
        }
        if (MATCHES(*cur, "max_groups=")) {
@@ -269,7 +272,8 @@ 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 = sudo_estrdup(*cur + sizeof("user=") - 1);
+           if ((user_name = strdup(*cur + sizeof("user=") - 1)) == NULL)
+               goto oom;
            continue;
        }
        if (MATCHES(*cur, "uid=")) {
@@ -295,19 +299,28 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
            continue;
        }
        if (MATCHES(*cur, "cwd=")) {
-           user_cwd = sudo_estrdup(*cur + sizeof("cwd=") - 1);
+           if ((user_cwd = strdup(*cur + sizeof("cwd=") - 1)) == NULL)
+               goto oom;
            continue;
        }
        if (MATCHES(*cur, "tty=")) {
-           user_tty = user_ttypath = sudo_estrdup(*cur + sizeof("tty=") - 1);
+           if ((user_ttypath = strdup(*cur + sizeof("tty=") - 1)) == NULL)
+               goto oom;
+           user_tty = user_ttypath;
            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 = sudo_estrdup(*cur + sizeof("host=") - 1);
-           if ((p = strchr(user_host, '.')))
-               user_shost = sudo_estrndup(user_host, (size_t)(p - user_host));
+           if ((user_host = strdup(*cur + sizeof("host=") - 1)) == NULL)
+               goto oom;
+           if ((p = strchr(user_host, '.')) != NULL) {
+               user_shost = strndup(user_host, (size_t)(p - user_host));
+               if (user_shost == NULL)
+                   goto oom;
+           } else {
+               user_shost = user_host;
+           }
            continue;
        }
        if (MATCHES(*cur, "lines=")) {
@@ -340,13 +353,24 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
            continue;
        }
     }
-    user_runhost = user_srunhost = sudo_estrdup(remhost ? remhost : user_host);
-    if ((p = strchr(user_runhost, '.')))
-       user_srunhost = sudo_estrndup(user_runhost, (size_t)(p - user_runhost));
-    if (user_cwd == NULL)
-       user_cwd = sudo_estrdup("unknown");
-    if (user_tty == NULL)
-       user_tty = sudo_estrdup("unknown"); /* user_ttypath remains NULL */
+    if ((user_runhost = strdup(remhost ? remhost : user_host)) == NULL)
+       goto oom;
+    if ((p = strchr(user_runhost, '.')) != NULL) {
+       user_srunhost = strndup(user_runhost, (size_t)(p - user_runhost));
+       if (user_srunhost == NULL)
+           goto oom;
+    } else {
+       user_srunhost = user_runhost;
+    }
+    if (user_cwd == NULL) {
+       if ((user_cwd = strdup("unknown")) == NULL)
+           goto oom;
+    }
+    if (user_tty == NULL) {
+       if ((user_tty = strdup("unknown")) == NULL)
+           goto oom;
+       /* user_ttypath remains NULL */
+    }
 
     if (groups != NULL && groups[0] != '\0') {
        /* sudo_parse_gids() will print a warning on error. */
@@ -368,6 +392,8 @@ sudoers_policy_deserialize_info(void *v, char **runas_user, char **runas_group)
 #undef MATCHES
     debug_return_int(flags);
 
+oom:
+    sudo_warnx(U_("unable to allocate memory"));
 bad:
     debug_return_int(MODE_ERROR);
 }
@@ -573,7 +599,7 @@ sudoers_policy_open(unsigned int version, sudo_conv_t conversation,
 {
     struct sudo_conf_debug_file_list debug_files = TAILQ_HEAD_INITIALIZER(debug_files);
     struct sudoers_policy_open_info info;
-    const char *plugin_path = NULL;
+    const char *cp, *plugin_path = NULL;
     char * const *cur;
     debug_decl(sudoers_policy_open, SUDOERS_DEBUG_PLUGIN)
 
@@ -586,14 +612,15 @@ sudoers_policy_open(unsigned int version, sudo_conv_t conversation,
        args = NULL;
 
     /* Initialize the debug subsystem.  */
-    for (cur = settings; *cur != NULL; cur++) {
-       if (strncmp(*cur, "debug_flags=", sizeof("debug_flags=") - 1) == 0) {
-           sudoers_debug_parse_flags(&debug_files,
-               *cur + sizeof("debug_flags=") - 1);
+    for (cur = settings; (cp = *cur) != NULL; cur++) {
+       if (strncmp(cp, "debug_flags=", sizeof("debug_flags=") - 1) == 0) {
+           cp += sizeof("debug_flags=") - 1;
+           if (!sudoers_debug_parse_flags(&debug_files, cp))
+               debug_return_int(-1);
            continue;
        }
-       if (strncmp(*cur, "plugin_path=", sizeof("plugin_path=") - 1) == 0) {
-           plugin_path = *cur + sizeof("plugin_path=") - 1;
+       if (strncmp(cp, "plugin_path=", sizeof("plugin_path=") - 1) == 0) {
+           plugin_path = cp + sizeof("plugin_path=") - 1;
            continue;
        }
     }
@@ -771,6 +798,14 @@ sudoers_policy_version(int verbose)
     debug_return_int(true);
 }
 
+static struct sudo_hook sudoers_hooks[] = {
+    { SUDO_HOOK_VERSION, SUDO_HOOK_SETENV, sudoers_hook_setenv, NULL },
+    { SUDO_HOOK_VERSION, SUDO_HOOK_UNSETENV, sudoers_hook_unsetenv, NULL },
+    { SUDO_HOOK_VERSION, SUDO_HOOK_GETENV, sudoers_hook_getenv, NULL },
+    { SUDO_HOOK_VERSION, SUDO_HOOK_PUTENV, sudoers_hook_putenv, NULL },
+    { -1, -1, NULL, NULL }
+};
+
 /*
  * Register environment function hooks.
  * Note that we have not registered sudoers with the debug subsystem yet.
@@ -778,26 +813,16 @@ sudoers_policy_version(int verbose)
 static void
 sudoers_policy_register_hooks(int version, int (*register_hook)(struct sudo_hook *hook))
 {
-    struct sudo_hook hook;
+    struct sudo_hook *hook;
 
-    memset(&hook, 0, sizeof(hook));
-    hook.hook_version = SUDO_HOOK_VERSION;
-
-    hook.hook_type = SUDO_HOOK_SETENV;
-    hook.hook_fn = sudoers_hook_setenv;
-    register_hook(&hook);
-
-    hook.hook_type = SUDO_HOOK_UNSETENV;
-    hook.hook_fn = sudoers_hook_unsetenv;
-    register_hook(&hook);
-
-    hook.hook_type = SUDO_HOOK_GETENV;
-    hook.hook_fn = sudoers_hook_getenv;
-    register_hook(&hook);
-
-    hook.hook_type = SUDO_HOOK_PUTENV;
-    hook.hook_fn = sudoers_hook_putenv;
-    register_hook(&hook);
+    for (hook = sudoers_hooks; hook->hook_fn != NULL; hook++) {
+       if (register_hook(hook) != 0) {
+           sudo_warn_nodebug(
+               U_("unable to register hook of type %d (version %d.%d)"),
+               hook->hook_type,SUDO_HOOK_VERSION_GET_MAJOR(hook->hook_version),
+               SUDO_HOOK_VERSION_GET_MINOR(hook->hook_version));
+       }
+    }
 }
 
 __dso_public struct policy_plugin sudoers_policy = {
index 584c29ebf88410adbe884c0bcb41ea943b971fa9..a8950876df28045d72d2923ad204b1b4511a33da 100644 (file)
@@ -96,8 +96,12 @@ expand_prompt(const char *old_prompt, const char *auth_user)
        }
     }
 
+    if ((new_prompt = malloc(++len)) == NULL) {
+       sudo_warnx(U_("unable to allocate memory"));
+       debug_return_str(NULL);
+    }
+
     if (subst) {
-       new_prompt = sudo_emalloc(++len);
        endp = new_prompt + len;
        for (p = old_prompt, np = new_prompt; *p; p++) {
            if (p[0] =='%') {
@@ -151,13 +155,16 @@ expand_prompt(const char *old_prompt, const char *auth_user)
                goto oflow;
        }
        *np = '\0';
-    } else
-       new_prompt = sudo_estrdup(old_prompt);
+    } else {
+       /* Nothing to expand. */
+       memcpy(new_prompt, old_prompt, len);    /* len includes NUL */
+    }
 
     debug_return_str(new_prompt);
 
 oflow:
     /* We pre-allocate enough space, so this should never happen. */
+    free(new_prompt);
     sudo_warnx(U_("internal error, %s overflow"), __func__);
     debug_return_str(NULL);
 }
index 78c7f5aea6145978f8c4ab209a343f9270989eae..4803b8b1566f6115f31f9c34e5b5b0087bf7de12 100644 (file)
@@ -80,6 +80,8 @@ do_check(char *dir_in, char *file_in, char *tdir_out, char *tfile_out)
     strftime(file_out, sizeof(file_out), tfile_out, timeptr);
 
     path = expand_iolog_path(NULL, dir_in, file_in, &slash);
+    if (path == NULL)
+       sudo_fatalx("unable to expand I/O log path");
     *slash = '\0';
     if (strcmp(path, dir_out) != 0) {
        sudo_warnx("%s: expected %s, got %s", dir_in, dir_out, path);
index fd07124d83aeb1cd9aa3afd45855d8fa13079caa..bf82a23b45d06619134c40e61efb39fc703e0fa3 100644 (file)
@@ -131,7 +131,10 @@ main(int argc, char *argv[])
            continue;
 
        if (strncmp(line, "interfaces:", sizeof("interfaces:") - 1) == 0) {
-           set_interfaces(line + sizeof("interfaces:") - 1);
+           if (!set_interfaces(line + sizeof("interfaces:") - 1)) {
+               sudo_warn("unable to parse interfaces list");
+               errors++;
+           }
        } else if (strncmp(line, "address:", sizeof("address:") - 1) == 0) {
            errors += check_addr(line + sizeof("address:") - 1);
            ntests++;
index 981c66e1dfc1f4bba2046d0b68b1ffd08ec423f7..3212f6d66d80667aa45ced45058142c805c99db7 100644 (file)
@@ -88,7 +88,7 @@ static bool cb_sudoers_locale(const char *);
 static int set_cmnd(void);
 static void create_admin_success_flag(void);
 static bool init_vars(char * const *);
-static void set_fqdn(void);
+static bool set_fqdn(void);
 static bool set_loginclass(struct passwd *);
 static bool set_runasgr(const char *, bool);
 static bool set_runaspw(const char *, bool);
@@ -178,10 +178,14 @@ sudoers_policy_init(void *info, char * const envp[])
     sudo_fatal_callback_register(sudoers_cleanup);
 
     /* Initialize environment functions (including replacements). */
-    env_init(envp);
+    if (!env_init(envp))
+       debug_return_int(-1);
 
     /* Setup defaults data structures. */
-    init_defaults();
+    if (!init_defaults()) {
+       sudo_warnx(U_("unable to initialize sudoers default values"));
+       debug_return_int(-1);
+    }
 
     /* Parse info from front-end. */
     sudo_mode = sudoers_policy_deserialize_info(info, &runas_user, &runas_group);
@@ -299,17 +303,34 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
      */
     if (argc == 0) {
        NewArgc = 1;
-       NewArgv = sudo_emallocarray(NewArgc + 1, sizeof(char *));
+       NewArgv = reallocarray(NULL, NewArgc + 1, sizeof(char *));
+       if (NewArgv == NULL) {
+           sudo_warnx(U_("unable to allocate memory"));
+           rval = -1;
+           goto done;
+       }
        NewArgv[0] = user_cmnd;
        NewArgv[1] = NULL;
     } else {
        /* Must leave an extra slot before NewArgv for bash's --login */
        NewArgc = argc;
-       NewArgv = sudo_emallocarray(NewArgc + 2, sizeof(char *));
+       NewArgv = reallocarray(NULL, NewArgc + 2, sizeof(char *));
+       if (NewArgv == NULL) {
+           sudo_warnx(U_("unable to allocate memory"));
+           rval = -1;
+           goto done;
+       }
        memcpy(++NewArgv, argv, argc * sizeof(char *));
        NewArgv[NewArgc] = NULL;
-       if (ISSET(sudo_mode, MODE_LOGIN_SHELL) && runas_pw != NULL)
-           NewArgv[0] = sudo_estrdup(runas_pw->pw_shell);
+       if (ISSET(sudo_mode, MODE_LOGIN_SHELL) && runas_pw != NULL) {
+           NewArgv[0] = strdup(runas_pw->pw_shell);
+           if (NewArgv[0] == NULL) {
+               sudo_warnx(U_("unable to allocate memory"));
+               free(NewArgv);
+               rval = -1;
+               goto done;
+           }
+       }
     }
 
     /* If given the -P option, set the "preserve_groups" flag. */
@@ -359,8 +380,13 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
     /* Restore user's locale. */
     sudoers_setlocale(oldlocale, NULL);
 
-    if (safe_cmnd == NULL)
-       safe_cmnd = sudo_estrdup(user_cmnd);
+    if (safe_cmnd == NULL) {
+       if ((safe_cmnd = strdup(user_cmnd)) == NULL) {
+           sudo_warnx(U_("unable to allocate memory"));
+           rval = -1;
+           goto done;
+       }
+    }
 
     /* If only a group was specified, set runas_pw based on invoking user. */
     if (runas_pw == NULL) {
@@ -488,6 +514,8 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
            const char prefix[] = "iolog_path=";
            iolog_path = expand_iolog_path(prefix, def_iolog_dir,
                def_iolog_file, &sudo_user.iolog_file);
+           if (iolog_path == NULL)
+               goto bad;
            sudo_user.iolog_file++;
        }
     }
@@ -577,7 +605,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
     if (ISSET(sudo_mode, MODE_EDIT)) {
        int edit_argc;
 
-       sudo_efree(safe_cmnd);
+       free(safe_cmnd);
        safe_cmnd = find_editor(NewArgc - 1, NewArgv + 1, &edit_argc, &edit_argv);
        if (safe_cmnd == NULL || audit_success(edit_argc, edit_argv) != 0)
            goto bad;
@@ -594,7 +622,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
        env_get(), cmnd_umask, iolog_path, closure);
 
     /* Zero out stashed copy of environment, it is owned by the front-end. */
-    env_init(NULL);
+    (void)env_init(NULL);
 
     goto done;
 
@@ -626,7 +654,10 @@ init_vars(char * const envp[])
     bool unknown_user = false;
     debug_decl(init_vars, SUDOERS_DEBUG_PLUGIN)
 
-    sudoers_initlocale(setlocale(LC_ALL, NULL), def_sudoers_locale);
+    if (!sudoers_initlocale(setlocale(LC_ALL, NULL), def_sudoers_locale)) {
+       sudo_warnx(U_("unable to allocate memory"));
+       debug_return_bool(false);
+    }
 
     for (ep = envp; *ep; ep++) {
        /* XXX - don't fill in if empty string */
@@ -708,7 +739,11 @@ set_cmnd(void)
     debug_decl(set_cmnd, SUDOERS_DEBUG_PLUGIN)
 
     /* Allocate user_stat for find_path() and match functions. */
-    user_stat = sudo_ecalloc(1, sizeof(struct stat));
+    user_stat = calloc(1, sizeof(struct stat));
+    if (user_stat == NULL) {
+       sudo_warnx(U_("unable to allocate memory"));
+       debug_return_int(NOT_FOUND_ERROR);
+    }
 
     /* Default value for cmnd, overridden below. */
     if (user_cmnd == NULL)
@@ -749,7 +784,10 @@ set_cmnd(void)
            /* Alloc and build up user_args. */
            for (size = 0, av = NewArgv + 1; *av; av++)
                size += strlen(*av) + 1;
-           user_args = sudo_emalloc(size);
+           if (size == 0 || (user_args = malloc(size)) == NULL) {
+               sudo_warnx(U_("unable to allocate memory"));
+               debug_return_int(-1);
+           }
            if (ISSET(sudo_mode, MODE_SHELL|MODE_LOGIN_SHELL)) {
                /*
                 * When running a command via a shell, the sudo front-end
@@ -927,72 +965,105 @@ set_loginclass(struct passwd *pw)
 # define AI_FQDN AI_CANONNAME
 #endif
 
+/*
+ * Look up the fully qualified domain name of host.
+ * Returns true on success, setting longp and shortp.
+ * Returns false on failure, longp and shortp are unchanged.
+ */
+static bool
+resolve_host(const char *host, char **longp, char **shortp)
+{
+    struct addrinfo *res0, hint;
+    char *cp, *lname, *sname;
+    debug_decl(resolve_host, SUDOERS_DEBUG_PLUGIN)
+
+    memset(&hint, 0, sizeof(hint));
+    hint.ai_family = PF_UNSPEC;
+    hint.ai_flags = AI_FQDN;
+
+    if (getaddrinfo(host, NULL, &hint, &res0) != 0)
+       debug_return_bool(false);
+    if ((lname = strdup(res0->ai_canonname)) == NULL) {
+       freeaddrinfo(res0);
+       debug_return_bool(false);
+    }
+    if ((cp = strchr(lname, '.')) != NULL) {
+       sname = strndup(lname, (size_t)(cp - lname));
+       if (sname == NULL) {
+           free(lname);
+           freeaddrinfo(res0);
+           debug_return_bool(false);
+       }
+    } else {
+       sname = lname;
+    }
+    freeaddrinfo(res0);
+    *longp = lname;
+    *shortp = sname;
+
+    debug_return_bool(true);
+}
+
 /*
  * Look up the fully qualified domain name of user_host and user_runhost.
  * Sets user_host, user_shost, user_runhost and user_srunhost.
  * Use AI_FQDN if available since "canonical" is not always the same as fqdn.
  */
-static void
+static bool
 set_fqdn(void)
 {
-    struct addrinfo *res0, hint;
     bool remote;
-    char *p;
+    char *lhost, *shost;
     debug_decl(set_fqdn, SUDOERS_DEBUG_PLUGIN)
 
     /* If the -h flag was given we need to resolve both host and runhost. */
     remote = strcmp(user_runhost, user_host) != 0;
 
-    memset(&hint, 0, sizeof(hint));
-    hint.ai_family = PF_UNSPEC;
-    hint.ai_flags = AI_FQDN;
-
-    /* First resolve user_host, sets user_host and user_shost. */
-    if (getaddrinfo(user_host, NULL, &hint, &res0) != 0) {
-       log_warningx(SLOG_SEND_MAIL|SLOG_RAW_MSG,
-           N_("unable to resolve host %s"), user_host);
-    } else {
-       if (user_shost != user_host)
-           sudo_efree(user_shost);
-       sudo_efree(user_host);
-       user_host = user_shost = sudo_estrdup(res0->ai_canonname);
-       freeaddrinfo(res0);
-       if ((p = strchr(user_host, '.')) != NULL)
-           user_shost = sudo_estrndup(user_host, (size_t)(p - user_host));
+    /* First resolve user_host, setting user_host and user_shost. */
+    if (!resolve_host(user_host, &lhost, &shost)) {
+       if (!resolve_host(user_runhost, &lhost, &shost)) {
+           log_warning(SLOG_SEND_MAIL|SLOG_RAW_MSG,
+               N_("unable to resolve host %s"), user_host);
+           debug_return_bool(false);
+       }
     }
-
-    /* Next resolve user_runhost, sets user_runhost and user_srunhost. */
+    if (user_shost != user_host)
+       free(user_shost);
+    free(user_host);
+    user_host = lhost;
+    user_shost = shost;
+
+    /* Next resolve user_runhost, setting user_runhost and user_srunhost. */
+    lhost = shost = NULL;
     if (remote) {
-       if (getaddrinfo(user_runhost, NULL, &hint, &res0) != 0) {
-           log_warningx(SLOG_SEND_MAIL|SLOG_RAW_MSG,
-               N_("unable to resolve host %s"), user_runhost);
-       } else {
-           if (user_srunhost != user_runhost)
-               sudo_efree(user_srunhost);
-           sudo_efree(user_runhost);
-           user_runhost = user_srunhost = sudo_estrdup(res0->ai_canonname);
-           freeaddrinfo(res0);
-           if ((p = strchr(user_runhost, '.'))) {
-               user_srunhost =
-                   sudo_estrndup(user_runhost, (size_t)(p - user_runhost));
-           }
-       }
+       /* Failure checked below. */
+       (void)resolve_host(user_runhost, &lhost, &shost);
     } else {
        /* Not remote, just use user_host. */
-       if (user_srunhost != user_runhost)
-           sudo_efree(user_srunhost);
-       sudo_efree(user_runhost);
-       user_runhost = user_srunhost = sudo_estrdup(user_host);
-       if ((p = strchr(user_runhost, '.'))) {
-           user_srunhost =
-               sudo_estrndup(user_runhost, (size_t)(p - user_runhost));
+       if ((lhost = strdup(user_host)) != NULL) {
+           if (user_shost != user_host)
+               shost = strdup(lhost);
+           else
+               shost = lhost;
        }
     }
+    if (lhost == NULL || shost == NULL) {
+       free(lhost);
+       free(shost);
+       log_warning(SLOG_SEND_MAIL|SLOG_RAW_MSG,
+           N_("unable to resolve host %s"), user_runhost);
+       debug_return_bool(false);
+    }
+    if (user_srunhost != user_runhost)
+       free(user_srunhost);
+    free(user_runhost);
+    user_runhost = lhost;
+    user_srunhost = shost;
 
     sudo_debug_printf(SUDO_DEBUG_INFO|SUDO_DEBUG_LINENO,
        "host %s, shost %s, runhost %s, srunhost %s",
        user_host, user_shost, user_runhost, user_srunhost);
-    debug_return;
+    debug_return_bool(true);
 }
 
 /*
@@ -1075,8 +1146,7 @@ cb_runas_default(const char *user)
 static bool
 cb_sudoers_locale(const char *locale)
 {
-    sudoers_initlocale(NULL, locale);
-    return true;
+    return sudoers_initlocale(NULL, locale);
 }
 
 /*
index b44c118e0a98b40f0384f17f71905a6fede71bfa..2e389fdac98d58bf673913bb0a1d271d9c85169d 100644 (file)
@@ -35,7 +35,6 @@
 #include <pathnames.h>
 #include "sudo_compat.h"
 #include "sudo_fatal.h"
-#include "sudo_alloc.h"
 #include "sudo_queue.h"
 #include "defaults.h"
 #include "logging.h"
@@ -227,7 +226,7 @@ struct timeval;
 bool sudo_goodpath(const char *, struct stat *);
 
 /* findpath.c */
-int find_path(char *, char **, struct stat *, char *, int);
+int find_path(const char *, char **, struct stat *, const char *, int);
 
 /* check.c */
 int check_user(int validate, int mode);
@@ -326,8 +325,8 @@ char *expand_iolog_path(const char *prefix, const char *dir, const char *file,
 char **env_get(void);
 bool env_merge(char * const envp[]);
 bool env_swap_old(void);
-void env_init(char * const envp[]);
-void init_envtables(void);
+bool env_init(char * const envp[]);
+bool init_envtables(void);
 bool insert_env_vars(char * const envp[]);
 bool read_env_file(const char *, int);
 bool rebuild_env(void);
@@ -354,7 +353,7 @@ extern sudo_conv_t sudo_conv;
 extern sudo_printf_t sudo_printf;
 
 /* sudoers_debug.c */
-void sudoers_debug_parse_flags(struct sudo_conf_debug_file_list *debug_files, const char *entry);
+bool sudoers_debug_parse_flags(struct sudo_conf_debug_file_list *debug_files, const char *entry);
 void sudoers_debug_register(const char *plugin_path, struct sudo_conf_debug_file_list *debug_files);
 void sudoers_debug_deregister(void);
 
index 62e73ecfd1c5ba5137b75a4e7bad1f54ff6db689..8eab1b0425c37afe6252d9658483e98a7d34eade 100644 (file)
@@ -77,7 +77,7 @@ unsigned int sudoers_subsystem_ids[NUM_SUBSYSTEMS];
  * Parse the "filename flags,..." debug_flags entry and insert a new
  * sudo_debug_file struct into debug_files.
  */
-void
+bool
 sudoers_debug_parse_flags(struct sudo_conf_debug_file_list *debug_files,
     const char *entry)
 {
@@ -87,22 +87,33 @@ sudoers_debug_parse_flags(struct sudo_conf_debug_file_list *debug_files,
 
     /* Already initialized? */
     if (sudoers_debug_instance != SUDO_DEBUG_INSTANCE_INITIALIZER)
-       return;
+       return true;
 
-    /* Process new-style debug flags: filename flags,... */
+    /* Only process new-style debug flags: filename flags,... */
     filename = entry;
     if (*filename != '/' || (flags = strpbrk(filename, " \t")) == NULL)
-       return;
+       return true;
     namelen = (size_t)(flags - filename);
     while (isblank((unsigned char)*flags))
        flags++;
-    if (*flags == '\0')
-       return;
-
-    debug_file = sudo_emalloc(sizeof(*debug_file));
-    debug_file->debug_file = sudo_estrndup(filename, namelen);
-    debug_file->debug_flags = sudo_estrdup(flags);
-    TAILQ_INSERT_TAIL(debug_files, debug_file, entries);
+    if (*flags != '\0') {
+       if ((debug_file = calloc(1, sizeof(*debug_file))) == NULL)
+           goto oom;
+       if ((debug_file->debug_file = strndup(filename, namelen)) == NULL)
+           goto oom;
+       if ((debug_file->debug_flags = strdup(flags)) == NULL)
+           goto oom;
+       TAILQ_INSERT_TAIL(debug_files, debug_file, entries);
+    }
+    return true;
+oom:
+    if (debug_file != NULL) {
+       free(debug_file->debug_file);
+       free(debug_file->debug_flags);
+       free(debug_file);
+    }
+    sudo_warnx_nodebug(U_("unable to allocate memory"));
+    return false;
 }
 
 /*
@@ -123,9 +134,9 @@ sudoers_debug_register(const char *program,
        }
        TAILQ_FOREACH_SAFE(debug_file, debug_files, entries, debug_next) {
            TAILQ_REMOVE(debug_files, debug_file, entries);
-           sudo_efree(debug_file->debug_file);
-           sudo_efree(debug_file->debug_flags);
-           sudo_efree(debug_file);
+           free(debug_file->debug_file);
+           free(debug_file->debug_flags);
+           free(debug_file);
        }
     }
 }
index 5883437007a379935d6788109c6c31b28100c1ad..5ea72bc2c2a3d8a59bbfada5ee8be2164ccd89e5 100644 (file)
@@ -85,7 +85,6 @@
 #include "sudo_gettext.h"      /* must be included before sudo_compat.h */
 
 #include "sudo_compat.h"
-#include "sudo_alloc.h"
 #include "sudo_fatal.h"
 #include "logging.h"
 #include "iolog.h"
@@ -493,8 +492,10 @@ 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 ?
-                           sudo_ereallocarray(iov, iovmax <<= 1, sizeof(*iov)) :
-                           sudo_emallocarray(iovmax = 32, sizeof(*iov));
+                           reallocarray(iov, iovmax <<= 1, sizeof(*iov)) :
+                           reallocarray(NULL, iovmax = 32, sizeof(*iov));
+                       if (iov == NULL)
+                           sudo_fatalx(U_("unable to allocate memory"));
                    }
                    linelen = (size_t)(nl - line) + 1;
                    iov[iovcnt].iov_base = line;
@@ -537,7 +538,7 @@ replay_session(const double max_wait, const char *decimal)
            sudo_ev_loop(evbase, 0);
        }
        if (iov != &iovb)
-           sudo_efree(iov);
+           free(iov);
     }
     debug_return;
 }
@@ -689,7 +690,8 @@ parse_expr(struct search_node_list *head, char *argv[], bool sub_expr)
        }
 
        /* Allocate new search node */
-       sn = sudo_ecalloc(1, sizeof(*sn));
+       if ((sn = calloc(1, sizeof(*sn))) == NULL)
+           sudo_fatalx(U_("unable to allocate memory"));
        sn->type = type;
        sn->or = or;
        sn->negated = not;
@@ -800,7 +802,8 @@ parse_logfile(char *logfile)
      *  2) cwd
      *  3) command with args
      */
-    li = sudo_ecalloc(1, sizeof(*li));
+    if ((li = calloc(1, sizeof(*li))) == NULL)
+       sudo_fatalx(U_("unable to allocate memory"));
     if (getline(&buf, &bufsize, fp) == -1 ||
        getline(&li->cwd, &cwdsize, fp) == -1 ||
        getline(&li->cmd, &cmdsize, fp) == -1) {
@@ -839,7 +842,8 @@ parse_logfile(char *logfile)
        sudo_warn(U_("%s: user field is missing"), logfile);
        goto bad;
     }
-    li->user = sudo_estrndup(cp, (size_t)(ep - cp));
+    if ((li->user = strndup(cp, (size_t)(ep - cp))) == NULL)
+       sudo_fatalx(U_("unable to allocate memory"));
 
     /* runas user */
     cp = ep + 1;
@@ -847,7 +851,8 @@ parse_logfile(char *logfile)
        sudo_warn(U_("%s: runas user field is missing"), logfile);
        goto bad;
     }
-    li->runas_user = sudo_estrndup(cp, (size_t)(ep - cp));
+    if ((li->runas_user = strndup(cp, (size_t)(ep - cp))) == NULL)
+       sudo_fatalx(U_("unable to allocate memory"));
 
     /* runas group */
     cp = ep + 1;
@@ -855,17 +860,21 @@ parse_logfile(char *logfile)
        sudo_warn(U_("%s: runas group field is missing"), logfile);
        goto bad;
     }
-    if (cp != ep)
-       li->runas_group = sudo_estrndup(cp, (size_t)(ep - cp));
+    if (cp != ep) {
+       if ((li->runas_group = strndup(cp, (size_t)(ep - cp))) == NULL)
+           sudo_fatalx(U_("unable to allocate memory"));
+    }
 
     /* tty, followed by optional rows + columns */
     cp = ep + 1;
     if ((ep = strchr(cp, ':')) == NULL) {
        /* just the tty */
-       li->tty = sudo_estrdup(cp);
+       if ((li->tty = strdup(cp)) == NULL)
+           sudo_fatalx(U_("unable to allocate memory"));
     } else {
        /* tty followed by rows + columns */
-       li->tty = sudo_estrndup(cp, (size_t)(ep - cp));
+       if ((li->tty = strndup(cp, (size_t)(ep - cp))) == NULL)
+           sudo_fatalx(U_("unable to allocate memory"));
        cp = ep + 1;
        /* need to NULL out separator to use strtonum() */
        if ((ep = strchr(cp, ':')) != NULL) {
@@ -886,13 +895,13 @@ parse_logfile(char *logfile)
        }
     }
     fclose(fp);
-    sudo_efree(buf);
+    free(buf);
     debug_return_ptr(li);
 
 bad:
     if (fp != NULL)
        fclose(fp);
-    sudo_efree(buf);
+    free(buf);
     free_log_info(li);
     debug_return_ptr(NULL);
 }
@@ -901,13 +910,13 @@ static void
 free_log_info(struct log_info *li)
 {
     if (li != NULL) {
-       sudo_efree(li->cwd);
-       sudo_efree(li->user);
-       sudo_efree(li->runas_user);
-       sudo_efree(li->runas_group);
-       sudo_efree(li->tty);
-       sudo_efree(li->cmd);
-       sudo_efree(li);
+       free(li->cwd);
+       free(li->user);
+       free(li->runas_user);
+       free(li->runas_group);
+       free(li->tty);
+       free(li->cmd);
+       free(li);
     }
 }
 
@@ -974,7 +983,7 @@ find_sessions(const char *dir, regex_t *re, const char *user, const char *tty)
     DIR *d;
     struct dirent *dp;
     struct stat sb;
-    size_t sdlen, sessions_len = 0, sessions_size = 36*36;
+    size_t sdlen, sessions_len = 0, sessions_size = 0;
     unsigned int i;
     int len;
     char pathbuf[PATH_MAX], **sessions = NULL;
@@ -999,7 +1008,6 @@ find_sessions(const char *dir, regex_t *re, const char *user, const char *tty)
     pathbuf[sdlen] = '\0';
 
     /* Store potential session dirs for sorting. */
-    sessions = sudo_emallocarray(sessions_size, sizeof(char *));
     while ((dp = readdir(d)) != NULL) {
        /* Skip "." and ".." */
        if (dp->d_name[0] == '.' && (dp->d_name[1] == '\0' ||
@@ -1018,10 +1026,16 @@ 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 = sudo_ereallocarray(sessions, sessions_size, sizeof(char *));
+           if (sessions_size == 0)
+               sessions_size = 36 * 36 / 2;
+           sessions = reallocarray(sessions, sessions_size, 2 * sizeof(char *));
+           if (sessions == NULL)
+               sudo_fatalx(U_("unable to allocate memory"));
+           sessions_size *= 2;
        }
-       sessions[sessions_len++] = sudo_estrdup(dp->d_name);
+       if ((sessions[sessions_len] = strdup(dp->d_name)) == NULL)
+           sudo_fatalx(U_("unable to allocate memory"));
+       sessions_len++;
     }
     closedir(d);
 
@@ -1034,7 +1048,7 @@ find_sessions(const char *dir, regex_t *re, const char *user, const char *tty)
            errno = ENAMETOOLONG;
            sudo_fatal("%s/%s/log", dir, sessions[i]);
        }
-       sudo_efree(sessions[i]);
+       free(sessions[i]);
 
        /* Check for dir with a log file. */
        if (lstat(pathbuf, &sb) == 0 && S_ISREG(sb.st_mode)) {
@@ -1046,7 +1060,7 @@ find_sessions(const char *dir, regex_t *re, const char *user, const char *tty)
                find_sessions(pathbuf, re, user, tty);
        }
     }
-    sudo_efree(sessions);
+    free(sessions);
 
     debug_return_int(0);
 }
index 569b7e3d38f5aa992928baa50bad13108907f6ce..6fbb3bb4e1fa0336141fb86cee71a9b9e2e7b7c2 100644 (file)
@@ -137,7 +137,8 @@ main(int argc, char *argv[])
 
     initprogname(argc > 0 ? argv[0] : "testsudoers");
 
-    sudoers_initlocale(setlocale(LC_ALL, ""), def_sudoers_locale);
+    if (!sudoers_initlocale(setlocale(LC_ALL, ""), def_sudoers_locale))
+       sudo_fatalx(U_("unable to allocate memory"));
     bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have own domain */
     textdomain("sudoers");
 
@@ -220,7 +221,8 @@ main(int argc, char *argv[])
     }
     if ((p = strchr(user_host, '.'))) {
        *p = '\0';
-       user_shost = sudo_estrdup(user_host);
+       if ((user_shost = strdup(user_host)) == NULL)
+           sudo_fatalx(U_("unable to allocate memory"));
        *p = '.';
     } else {
        user_shost = user_host;
@@ -236,7 +238,8 @@ main(int argc, char *argv[])
        for (size = 0, from = argv; *from; from++)
            size += strlen(*from) + 1;
 
-       user_args = sudo_emalloc(size);
+       if ((user_args = malloc(size)) == NULL)
+           sudo_fatalx(U_("unable to allocate memory"));
        for (to = user_args, from = argv; *from; from++) {
            n = strlcpy(to, *from, size - (to - user_args));
            if (n >= size - (to - user_args))
@@ -248,14 +251,17 @@ main(int argc, char *argv[])
     }
 
     /* Initialize default values. */
-    init_defaults();
+    if (!init_defaults())
+       sudo_fatalx(U_("unable to initialize sudoers default values"));
 
     /* Set runas callback. */
     sudo_defs_table[I_RUNAS_DEFAULT].callback = cb_runas_default;
 
     /* Load ip addr/mask for each interface. */
-    if (get_net_ifs(&p) > 0)
-       set_interfaces(p);
+    if (get_net_ifs(&p) > 0) {
+       if (!set_interfaces(p))
+           sudo_fatal(U_("unable to parse network address list"));
+    }
 
     /* Allocate space for data structures in the parser. */
     init_parser("sudoers", false);
@@ -459,10 +465,10 @@ open_sudoers(const char *sudoers, bool doedit, bool *keepopen)
     debug_return_ptr(fp);
 }
 
-void
+bool
 init_envtables(void)
 {
-    return;
+    return(true);
 }
 
 bool
index b2e2839963d0b4b7f7b13b420e772b83d3c20f19..e127a2cbcfeb53f2bffa46e257a06732e59c545f 100644 (file)
@@ -163,7 +163,8 @@ main(int argc, char *argv[])
 #endif
 
     initprogname(argc > 0 ? argv[0] : "visudo");
-    sudoers_initlocale(setlocale(LC_ALL, ""), def_sudoers_locale);
+    if (!sudoers_initlocale(setlocale(LC_ALL, ""), def_sudoers_locale))
+       sudo_fatalx(U_("unable to allocate memory"));
     bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have visudo domain */
     textdomain("sudoers");
 
@@ -232,7 +233,8 @@ main(int argc, char *argv[])
     get_hostname();
 
     /* Setup defaults data structures. */
-    init_defaults();
+    if (!init_defaults())
+       sudo_fatalx(U_("unable to initialize sudoers default values"));
 
     if (checkonly) {
        exitcode = check_syntax(sudoers_file, quiet, strict, oldperms) ? 0 : 1;
@@ -339,7 +341,8 @@ edit_sudoers(struct sudoersfile *sp, char *editor, char *args, int lineno)
 
     /* Create the temp file if needed and set timestamp. */
     if (sp->tpath == NULL) {
-       sudo_easprintf(&sp->tpath, "%s.tmp", sp->path);
+       if (asprintf(&sp->tpath, "%s.tmp", sp->path) == -1)
+           sudo_fatalx(U_("unable to allocate memory"));
        tfd = open(sp->tpath, O_WRONLY | O_CREAT | O_TRUNC, 0600);
        if (tfd < 0)
            sudo_fatal("%s", sp->tpath);
@@ -409,7 +412,9 @@ edit_sudoers(struct sudoersfile *sp, char *editor, char *args, int lineno)
     }
 
     /* Build up argument vector for the command */
-    av = sudo_emallocarray(ac, sizeof(char *));
+    av = reallocarray(NULL, ac, sizeof(char *));
+    if (av == NULL)
+       sudo_fatalx(U_("unable to allocate memory"));
     if ((av[0] = strrchr(editor, '/')) != NULL)
        av[0]++;
     else
@@ -510,7 +515,8 @@ reparse_sudoers(char *editor, char *args, bool strict, bool quiet)
                sp->tpath, sp->path);
 
        /* Clean slate for each parse */
-       init_defaults();
+       if (!init_defaults())
+           sudo_fatalx(U_("unable to initialize sudoers default values"));
        init_parser(sp->path, quiet);
 
        /* Parse the sudoers temp file(s) */
@@ -636,7 +642,7 @@ install_sudoers(struct sudoersfile *sp, bool oldperms)
      * mv(1) in case sp->tpath and sp->path are on different file systems.
      */
     if (rename(sp->tpath, sp->path) == 0) {
-       sudo_efree(sp->tpath);
+       free(sp->tpath);
        sp->tpath = NULL;
     } else {
        if (errno == EXDEV) {
@@ -658,11 +664,11 @@ install_sudoers(struct sudoersfile *sp, bool oldperms)
                sudo_warnx(U_("command failed: '%s %s %s', %s unchanged"),
                    _PATH_MV, sp->tpath, sp->path, sp->path);
                (void) unlink(sp->tpath);
-               sudo_efree(sp->tpath);
+               free(sp->tpath);
                sp->tpath = NULL;
                goto done;
            }
-           sudo_efree(sp->tpath);
+           free(sp->tpath);
            sp->tpath = NULL;
        } else {
            sudo_warn(U_("error renaming %s, %s unchanged"), sp->tpath, sp->path);
@@ -676,10 +682,10 @@ done:
 }
 
 /* STUB */
-void
+bool
 init_envtables(void)
 {
-    return;
+    return true;
 }
 
 /* STUB */
@@ -915,15 +921,16 @@ open_sudoers(const char *path, bool doedit, bool *keepopen)
            break;
     }
     if (entry == NULL) {
-       entry = sudo_ecalloc(1, sizeof(*entry));
-       entry->path = sudo_estrdup(path);
+       entry = calloc(1, sizeof(*entry));
+       if (entry == NULL || (entry->path = strdup(path)) == NULL)
+           sudo_fatalx(U_("unable to allocate memory"));
        /* entry->modified = 0; */
        entry->fd = open(entry->path, open_flags, sudoers_mode);
        /* entry->tpath = NULL; */
        entry->doedit = doedit;
        if (entry->fd == -1) {
            sudo_warn("%s", entry->path);
-           sudo_efree(entry);
+           free(entry);
            debug_return_ptr(NULL);
        }
        if (!checkonly && !sudo_lock_file(entry->fd, SUDO_TLOCK))
@@ -996,7 +1003,8 @@ get_editor(char **args)
            /* Should never happen since we already checked above. */
            sudo_fatal(U_("unable to stat editor (%s)"), UserEditor);
        }
-       EditorPath = sudo_estrdup(def_editor);
+       if ((EditorPath = strdup(def_editor)) == NULL)
+           sudo_fatalx(U_("unable to allocate memory"));
        Editor = strtok(EditorPath, ":");
        do {
            EditorArgs = get_args(Editor);
@@ -1031,8 +1039,9 @@ get_editor(char **args)
      * find one that exists, is regular, and is executable.
      */
     if (Editor == NULL || *Editor == '\0') {
-       sudo_efree(EditorPath);
-       EditorPath = sudo_estrdup(def_editor);
+       free(EditorPath);
+       if ((EditorPath = strdup(def_editor)) == NULL)
+           sudo_fatalx(U_("unable to allocate memory"));
        Editor = strtok(EditorPath, ":");
        do {
            EditorArgs = get_args(Editor);
@@ -1080,7 +1089,8 @@ get_hostname(void)
     if ((user_host = sudo_gethostname()) != NULL) {
        if ((p = strchr(user_host, '.'))) {
            *p = '\0';
-           user_shost = sudo_estrdup(user_host);
+           if ((user_shost = strdup(user_host)) == NULL)
+               sudo_fatalx(U_("unable to allocate memory"));
            *p = '.';
        } else {
            user_shost = user_host;