Commit Graph

253 Commits

Author SHA1 Message Date
Todd C. Miller
5ce50a885c Use non-exiting allocators in libsudo_util. 2015-06-17 17:00:53 -06:00
Todd C. Miller
2c63f1b5b2 regen dependencies 2015-06-16 13:17:46 -06:00
Todd C. Miller
23d72149b0 Add missing dependency info for reallocarray.lo in lib/util/Makefile.in
and regen configure to match last configure.ac change.
2015-06-15 13:45:12 -06:00
Todd C. Miller
f43f530987 Move pattern length check until after we have initialized the glob_t
so we can call globfree() even on error.  From Frank Denis.
2015-06-13 08:13:48 -06:00
Todd C. Miller
c0fa0e248d Add debugging output on memory alloc failure.
Add missing checks in event_select.c for reallocarray() failure.
2015-06-05 13:18:48 -06:00
Todd C. Miller
564eb7e7dd Use non-exiting allocators. 2015-06-05 13:17:56 -06:00
Todd C. Miller
9884df8c9e If asprintf() or vasprintf() fail, set the dest pointer to NULL
like BSD and Solaris do.  This appears to be the direction glibc
is going as well.
2015-06-03 11:07:56 -06:00
Todd C. Miller
1100d91e8f Fix typo/thinko in static buffer conversion; use vsnprintf() not snprintf() 2015-05-27 16:41:46 -06:00
Todd C. Miller
6b7be032af Use non-existing allocators in the passwd/group cache functions. 2015-05-27 10:26:49 -06:00
Todd C. Miller
40d72f26e4 Add standalone reallocarray.c from OpenBSD instead of rolling our own. 2015-05-27 10:04:32 -06:00
Todd C. Miller
8c3fd195d2 Add unit tests for strsplit and parse_gid_list. 2015-05-26 20:25:08 -06:00
Todd C. Miller
8d1708434f Add sudo_strsplit(), similar to strtok_r() but non-destructive and
operates on non-C strings (requires a length parameter).
2015-05-26 15:46:41 -06:00
Todd C. Miller
6741fb5378 Use non-exiting allocators. 2015-05-20 10:39:08 -06:00
Todd C. Miller
f18aa478d3 Use a static buffer for sudo_warn/sudo_fatal messages where possible. 2015-05-26 15:24:54 -06:00
Todd C. Miller
82286d8b7b Add strndup() for those without it. As strndup.c uses strnlen(),
use our own if it is missing.
2015-05-26 14:05:26 -06:00
Todd C. Miller
8437e3606b Add missing sudo_ prefix and include sudo_compat.h. 2015-05-26 14:01:37 -06:00
Todd C. Miller
49d56f323e Add strnlen() replacement needed for glob.c.
Only used if no glob() and no strnlen().
2015-05-26 13:55:18 -06:00
Todd C. Miller
05a01d4c5d Avoid using a leading underbar in defines as they are reserved in
ISO C.
2015-05-21 11:13:20 -06:00
Todd C. Miller
1298ea9107 Add target for "make splint". A few files need extra guards to avoid
errors on systems where they would not otherwise be compiled.
No warnings from splint.
2015-05-21 11:07:13 -06:00
Todd C. Miller
cbcaaa299a No need to cast malloc() return value. 2015-05-14 10:47:09 -06:00
Todd C. Miller
c75eb5bf0d Use reallocarray where possible. 2015-05-14 10:21:58 -06:00
Todd C. Miller
3595807f4e Add reallocarray() for those without it. 2015-05-14 10:13:18 -06:00
Todd C. Miller
80cb630bc0 In sudo_warn_gettext_v1() call dgettext() not gettext() to make
sure the domain is set correctly.  The sudoers plugin uses its own
text domain.
2015-05-12 15:58:05 -06:00
Todd C. Miller
8bc70a635c Instead of trying to make weak functions work on all platforms,
just use a registration function for a plugin-specific setlocale
function.  The sudoers version just wraps sudoers_setlocale().
2015-05-11 14:51:32 -06:00
Todd C. Miller
caf5d45e0f Previously, debug_return_bool was the same as debug_return_int
except that it logged true/false for 1/0.  However, this appears
to trigger a bug in some compilers.  To avoid this, debug_return_bool
now uses bool, not int.  Callers that were passing it an int have
been converted to use debug_return_int instead.
2015-05-07 10:33:23 -06:00
Todd C. Miller
eeca3b0ca4 Include sys/types.h instead of unistd.h to get uid_t and gid_t.
Add missing include of sys/types.h to a few places.
2015-04-09 10:58:04 -06:00
Todd C. Miller
15037d3b7e Make libsudo_util depend on libintl instead of requiring users of
libsudo_util to link with libintl directly.  Bug #690
2015-03-22 08:16:22 -06:00
Todd C. Miller
8088806bd8 Update function names in debug_decl. 2015-03-10 11:09:25 -06:00
Todd C. Miller
ef1b2c3beb Use TCSAFLUSH instead of TCSANOW in sudo_term_copy().
Be consistent with where we put TCSASOFT in the action flags.
2015-03-10 08:55:01 -06:00
Todd C. Miller
9f22416935 Include unistd.h since sudo_compat.h uses gid_t. 2015-03-08 18:53:58 -06:00
Todd C. Miller
a7edf7d984 Remove compat/utime.h, it was only useful for ancient systems that
are no longer capable of compiling sudo.
2015-03-03 16:57:55 -07:00
Todd C. Miller
1592192cef Link libsudo_util with -lrt on systems where clock_gettime is in -lrt. 2015-03-02 16:05:57 -07:00
Todd C. Miller
30adf83b12 Update OpenBSD CVS Ids 2015-03-02 14:43:38 -07:00
Todd C. Miller
5647a1ac46 Make comment match code. 2015-03-02 14:42:17 -07:00
Todd C. Miller
3c79ea75bb Fix compilation error on systems without futimes(). 2015-03-02 14:28:46 -07:00
Todd C. Miller
ee72cba937 Use futimens() and utimensat() instead of futimes() and utimes(). 2015-03-02 13:58:50 -07:00
Todd C. Miller
5d2e9426b2 We cannot (easily) use clock_gettime(CLOCK_MONOTONIC) directly as
it may be present but not implemented.  Add sudo_gettime_real() and
sudo_gettime_mono() functions to get the real and monotonic times
respectively.  Now sudo_gettime_mono() checks the value of
sysconf(_SC_MONOTONIC_CLOCK) before calling clock_gettime(CLOCK_MONOTONIC)
and falls back on sudo_gettime_real() as needed.  The Mach version
of sudo_gettime_mono() uses mach_absolute_time().

This should fix problems with timestamp files on systems where
the CLOCK_MONOTONIC is defined but not actually implemented.
2015-02-24 11:19:21 -07:00
Todd C. Miller
23f4e49f4d Plug memory leak when debug file cannot be opened.
Use %zu printf format now that our snprintf support it.
2015-02-23 15:40:37 -07:00
Todd C. Miller
1ce9dd5e07 Fix cast. 2015-02-23 06:32:43 -07:00
Todd C. Miller
b5831d55d8 Update snprintf.c from OpenBSD. The floating point and wide character
code has been retained but is not compiled by default.
2015-02-21 16:52:14 -07:00
Todd C. Miller
49128a79e3 Add regress for mkdtemp and mkstemps from OpenBSD 2015-02-20 14:37:02 -07:00
Todd C. Miller
be8dbeb22e Avoid using HOST_NAME_MAX directly and use sysconf(_SC_HOST_NAME_MAX)
instead.
2015-02-19 20:28:02 -07:00
Todd C. Miller
8bb5897091 All modern systems should have LINE_MAX. 2015-02-19 09:59:25 -07:00
Todd C. Miller
96eddddc12 Almost no systems actually define OPEN_MAX since it is dynamic on
modern OSes.  If sysconf(_SC_OPEN_MAX) ever fails, fall back on
_POSIX_OPEN_MAX instead.  We can assume modern systems have sysconf().
Also remove checks for strrchr() and strtoll() for which the HAVE_*
defines are no longer used.
2015-02-19 09:59:25 -07:00
Todd C. Miller
1ae2e55141 Fix mkstemps() extension handling. Sudoedit will now preserve the
extension properly when the system libc lacks mkstemps().
2015-02-18 06:24:31 -07:00
Todd C. Miller
166db8eeb4 Use weak symbols for sudo_warn_gettext() and sudo_warn_strerror()
so distros using "-Wl,--no-undefined" in LDFLAGS don't run into
problems.
2015-02-17 06:42:10 -07:00
Todd C. Miller
8cae9876f3 Include unistd.h in siglist.c and signame.c to get gid_t which
is used by sudo_compat.h.  Bug #686
2015-02-17 06:21:06 -07:00
Todd C. Miller
6d71b488b6 Call setprogname("sudo") if getprogname() returns NULL or the empty
string.
2015-02-05 11:17:24 -07:00
Todd C. Miller
a9bf105eda Use stdint.h to get SIZE_MAX as inttypes.h on some pre-C99 HP-UX
systems doesn't include stdint.h itself.
2015-02-03 10:00:30 -07:00
Todd C. Miller
f2a554f297 Add missing prototypes for usrinfo() and setauthdb() for AIX. 2015-02-03 07:33:25 -07:00