Commit Graph

40 Commits

Author SHA1 Message Date
Todd C. Miller
7aa89c49b5 Emulate pipe2() on systems without it. 2017-03-13 12:11:51 -06:00
Todd C. Miller
2f0295373a When waiting for the parent to grant us the tty, use nanosleep
instead of spinning to avoid hogging the CPU.
2017-01-12 10:44:26 -07:00
Todd C. Miller
6aa43ff1e4 HAVE_DECL_GETGROUPLIST_2 is always defined if HAVE_GETGROUPLIST_2 is,
we need to check its value, not whether it is defined.
2016-12-18 06:50:51 -07:00
Todd C. Miller
ae76e1a229 Use getgrouplist_2() on macOS if available. 2016-12-13 10:39:32 -07:00
Todd C. Miller
8133cdfdf6 Use sys/stat.h defines instead of bare octal values. 2016-11-07 13:36:05 -07:00
Todd C. Miller
19c96da44d add vsyslog() for systems without it. 2016-10-19 11:32:36 -06:00
Todd C. Miller
e147ba1fec Use W_EXITCODE to construct the wait status if sudo could not execute
the command.  Fixes the sudo exit value for exec(3) failure.
2016-08-31 08:39:26 -06:00
Todd C. Miller
f683cbd582 Add definition of nitems for those without it and use it throughout. 2016-06-23 10:58:07 -06:00
Todd C. Miller
f4e5b135bb Update copyright year 2016-01-20 15:40:51 -07:00
Todd C. Miller
4bcef637f8 Work around the buggy pread(2) on 32-bit HP-UX 11.00 by using
pread64() on that platform.
2016-01-13 11:10:33 -07:00
Todd C. Miller
68c1073fe5 Rewritten sudoedit_checkdir support that checks all the dirs in the
path and refuses to follow symlinks in writable directories.
This is a better fix for CVE-2015-5602.
Adapted from a diff by Ben Hutchings.  Bug #707
2016-01-10 18:31:29 -07:00
Todd C. Miller
3354d27a17 Do not follow symbolic links in sudoedit by default. This behavior
can be controlled by the sudoedit_follow Defaults flag as well as
the FOLLOW/NOFOLLOW tags.
2015-08-06 13:20:01 -06:00
Todd C. Miller
540b09b32c Remove some compatibilty defines that should no longer be needed. 2015-07-02 09:07:15 -06:00
Todd C. Miller
8f9aa5af25 Need to include stddef.h to get rsize_t on Mac OS X for sudo_memset_s()
prototype.
2015-06-30 14:11:53 -06:00
Todd C. Miller
a76b93e23a Use our own bitmap macros instead of borrowing the ones from select. 2015-06-23 16:37:00 -06:00
Todd C. Miller
f6627e70b0 No longer need __malloc_like 2015-06-20 16:56:57 -06:00
Todd C. Miller
4a07b472f0 Only include stddef.h where it is needed. 2015-06-20 05:34:35 -06:00
Todd C. Miller
dc883f2454 We require ANSI C so stop using the obsolete STDC_HEADERS. 2015-06-19 14:29:27 -06:00
Todd C. Miller
11840308c4 Fix sudo_strnlen() prototype. 2015-05-26 14:14:06 -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
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
3595807f4e Add reallocarray() for those without it. 2015-05-14 10:13:18 -06:00
Todd C. Miller
6ab5994152 Fix compilation when HAVE_DECL_SIG2STR_MAX is not defined. 2015-05-11 13:26:16 -06:00
Todd C. Miller
4ae1bdf9c3 HAVE_DECL_SIG2STR_MAX is always defined so use a !HAVE_DECL_SIG2STR_MAX
check instead of #ifndef.
2015-05-08 17:31:31 -06:00
Todd C. Miller
5647736ef5 Add configure check for SIG2STR_MAX, which may be missing on UnixWare. 2015-05-07 07:34:50 -06: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
01a4d6ccbf Check clock_gettime() return value and warn if it fails.
Currently, the timestamp will be ignored if clock_gettime() fails.
2015-02-24 09:53:50 -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
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
3eb9a854d8 Add check for getresuid() declaration, which may be missing on HP-UX.
When checking for getdomainname() prototype, look in netdb.h too.
2015-02-06 11:33:30 -07:00
Todd C. Miller
1bb633a210 Check whether getdomainname(), innetgr(), setresuid() and setresgid()
are declared and add prototypes in sudo_compat.h as needed.
2015-02-05 11:08:55 -07:00
Todd C. Miller
55a34e6941 Avoid inadvertantly defining things like PATH_MAX simply because
the source file doesn't include limits.h.
2015-01-15 17:01:30 -07:00
Todd C. Miller
ccc210eddb If a system lacks mkdtemp() or mkstemps(), use our own mkdtemp()
and mkstemps().  Previously we only exposed the missing one but
since the guts are the same we might as well use them.
2014-10-29 13:03:39 -06:00
Todd C. Miller
d0cc4d9e4b Fix inet_ntop() replacement on older systems without it.
We only expose the prototype for net_ifs.c due to the
use of socklen_t.
2014-10-23 15:44:03 -06:00
Todd C. Miller
0f735f6581 Add function arg names to prototypes where missing. 2014-09-08 14:43:01 -06:00
Todd C. Miller
daf634b728 Only include functions in util.exp that are actually in the library.
Fixes a problem on Solaris where undefined functions that are listed
as exported in the map file result in a link error.
Also make sure we use our glob.c if the system is missing glob().
2014-07-29 10:52:43 -06:00
Todd C. Miller
99ae71452a Replace use of HAVE_GETCWD with PREFER_PORTABLE_GETCWD.
It is safe to assume getcwd() exists, we just need to handle broken ones.
2014-07-28 16:36:43 -06:00
Todd C. Miller
47835ff289 Rename missing.h -> sudo_compat.h 2014-07-22 14:25:16 -06:00