Commit Graph

54 Commits

Author SHA1 Message Date
Todd C. Miller
85598f77b2 Use inet_pton() instead of inet_aton() and include a version from
BIND for those without it.
2014-02-05 10:00:07 -07:00
Todd C. Miller
b813c4de48 Use sudo_timeval macros and remove compat macros from missing.h 2014-01-30 15:51:59 -07:00
Todd C. Miller
659b1f0e34 Switch to new time stamp file format. Each user now has a single
file which may contain multiple records when per-tty time stamps
are in use (the default).  The time stamps use a monotonic timer
where available and are once again stored in /var/run/sudo.  The
lecture status is now stored separately from the time stamps in a
different directory.
2014-01-30 15:50:40 -07:00
Todd C. Miller
7e008eb677 Fix typo, ULONG_MAX vs. ULLONG_MAX 2014-01-24 16:08:28 -07:00
Todd C. Miller
f689a86354 Remove _MAX and _MIN defines that any system from the last 20 years
should have.  Add ULLONG_MAX in case it is missing.
2013-12-16 14:52:31 -07:00
Todd C. Miller
3e2d818ed9 Move prototypes for functions provided by libcommon that don't have
their own header files into sudo_util.h.
2013-12-12 18:29:07 -07:00
Todd C. Miller
cbf41b8b96 The OpenBSD strtonum() uses very short error strings that can't
be translated usefully.  Convert them to longer strings on error.
Also use the longer strings for atomode() and atoid().
2013-12-11 13:43:10 -07:00
Todd C. Miller
8f9ce7249a Use strtonum() instead of atoi(), strtol() or strtoul() where possible. 2013-12-10 16:23:21 -07:00
Todd C. Miller
f83eac40eb Add strtonum.c to compat for simpler number parsing. 2013-12-10 14:38:52 -07:00
Todd C. Miller
0d81263e26 Instead of setprogname(), add initprogname() which gets the program
name for getprogname() using /proc or pstat() if possible.
2013-12-01 19:12:21 -07:00
Todd C. Miller
192cbbb490 Rename snprintf replacement rpl_snprintf since we may now replace
the libc version and #define rpl_snprintf snprintf in missing.h so
we get our version when needed.  This is consistent with how we
replace glob and fnmatch.
2013-11-19 16:06:08 -07:00
Todd C. Miller
96eb2c4f8f Add warning_gettext() wrapper function that changes to the user locale,
then calls gettext().
Add U_ macro that calls warning_gettext() instead of gettext().
Rename warning2()/error2() back to warning_nodebug()/error_nodebug().
2013-11-18 08:59:57 -07:00
Todd C. Miller
702ec173de Move va_copy compat macro to missing.h 2013-11-11 14:35:10 -07:00
Todd C. Miller
8861e01d16 Add support for libevent-style timed events. Adding a timed event
is currently O(n).  The only consumer of timed events is sudoreplay
which only used a singled one so O(n) == O(1) for now.  This also
allows us to remove the nanosleep compat function as we now use a
timeout event instead.
2013-10-28 10:00:09 -06:00
Todd C. Miller
923edabe6c Convert sudo to use BSD TAILQ macros instead of home ground tail
queue functions.  This includes a private queue.h header derived
from FreeBSD.  It is simpler to just use our own header rather than
try to deal with macros that may or may not be present in various
queue.h incarnations.
2013-10-22 09:00:37 -06:00
Todd C. Miller
e223df6908 Include stddef.h for rsize_t and errno_t on systems that support
it natively.
2013-09-29 18:35:34 -06:00
Todd C. Miller
5caa61d687 Use __nonnull__ attribute in __printflike. 2013-08-18 14:18:55 -06:00
Todd C. Miller
4928c8c72e Use __printf0like for warning() and fatal() since the fmt string
may be NULL.
2013-08-15 12:58:24 -06:00
Todd C. Miller
1f3ea50afd Implement memset_s() and use it instead of zero_bytes().
A new constant, SUDO_CONV_REPL_MAX, is defined by the plugin
API as the max conversation reply length.  This constant can be
used as a max value for memset_s() when clearing passwords
filled in by the conversation function.
2013-08-03 08:30:06 -06:00
Todd C. Miller
d6282d154a Update copyright years. 2013-04-24 09:35:02 -04:00
Todd C. Miller
414fc377c9 Tru64 5.x does declare innetgr() and getdomainname(). 2013-04-01 16:39:30 -04:00
Todd C. Miller
f7b62e8dc1 Move SET/CLR/ISSET from config.h.in to missing.h 2013-04-01 15:38:09 -04:00
Todd C. Miller
6083947939 Tru64 Unix doesn't prototype innetgr() or getdomainname(). 2013-03-26 13:19:59 -04:00
Todd C. Miller
d710f1b41c Whitespace fixes 2013-03-26 10:27:06 -04:00
Todd C. Miller
4e5baccb9c Add __malloc_like macro to apply __malloc__ attribute to emalloc,
ecalloc and estrdup.  It cannot be applied to realloc since that
may return the same pointer.
2013-03-05 10:18:32 -05:00
Todd C. Miller
a449e8b3e7 Add howmany() macro since some systems have this in sys/param.h
which we no longer include.
2012-12-20 14:46:45 -05:00
Todd C. Miller
1d7072fe09 Don't include <sys/param.h>. We only needed it for MAXPATHLEN,
MAXHOSTNAMELEN and the MIN/MAX macros.  We now use PATH_MAX and
HOST_NAME_MAX throughout without falling back on MAXPATHLEN or
MAXHOSTNAMELEN and define our own MIN/MAX macros as needed.
2012-12-04 10:40:47 -05:00
Todd C. Miller
3c9da162e4 Use MAX_HOST_NAME+1 (limits.h) instead of MAXHOSTNAMELEN (sys/param.h
or netdb.h).
2012-12-04 10:18:41 -05:00
Todd C. Miller
ab7dda035a Replace strsigname() with sig2str(), emulating it as needed. 2012-08-29 14:25:09 -04:00
Todd C. Miller
537dc94b9e Use strsigname() to print signal names in the debug output.
If the system has no strsigname(), use our own.
2012-08-26 20:12:51 -04:00
Todd C. Miller
60a3019483 Add support for controlling symbol visibility using the HP and
Solaris C compilers.
2012-06-15 14:18:23 -04:00
Todd C. Miller
1fe3f9f40f The visibility attribute was actually added in gcc 3.3.x, not 4.0.
Just assume that if -fvisibility=hidden works that the attribute
is usable.
2012-06-13 16:57:49 -04:00
Todd C. Miller
6f6b0dec6c Use gcc's visibility attribute to specify when symbols are visible
or hidden, if available.  If not available, use an ELF version
script if it is supported.  If all else fails, fall back to using
libtool's -export-symbols.
2012-06-13 14:01:16 -04:00
Todd C. Miller
4e0ffceacb Add offsetof macro for those without it. 2012-05-10 10:01:26 -04:00
Todd C. Miller
1e7afbd53f g/c __unused which is no longer used 2012-03-28 17:07:29 -04:00
Todd C. Miller
8c1d8a7b15 Make a copy of the struct passwd in exec_setup() to make sure nothing
in the policy init modifies it.
2012-02-06 10:56:39 -05:00
Todd C. Miller
47af0fc2b8 Add configure test for missing errno declaration and only
declare it ourselves if it is missing.
2011-08-30 10:05:30 -04:00
Todd C. Miller
b124635b04 Instead of keeping separate groups and gids arrays, create struct
group_info and use it to store both, along with a count for each.
Cache group info on a per-user basis using getgrouplist() to get
the groups.  We no longer need special to special case the user or
list user for user_in_group() and thus no longer need to reset the
groups list when listing another user.
2011-07-20 11:58:45 -04:00
Todd C. Miller
5cf56a77ec Provide mkdtemp() for systems without it. 2010-12-27 13:49:49 -05:00
Todd C. Miller
da67324b11 Declare innetgr() for HP-UX which is missing a declaration.
Declare domainname() for HP-UX and Solaris which are missing a declaration.
2010-09-13 11:52:46 -04:00
Todd C. Miller
0d935f8546 Move includes to the top of the file. 2010-09-03 19:28:42 -04:00
Todd C. Miller
f454727bb8 Merge compat.h and missing.h into missing.h 2010-08-16 14:05:44 -04:00
Todd C. Miller
8dd8aa000e Remove some obsolete configure tests, ancient Unix systems are no
longer supported.
2010-08-10 13:44:05 -04:00
Todd C. Miller
684d1fd9f7 Fix mkstemps() prototype 2010-07-09 10:22:20 -04:00
Todd C. Miller
ea4298bb54 Use mkstemps() instead of mkstemp() in sudoedit. This allows sudoedit
to preserve the file extension (if any) which may be used by the editor
(like emacs) to choose the editing mode.
2010-07-09 10:08:05 -04:00
Todd C. Miller
b72a530fd0 Update copyright year 2010-06-14 12:19:49 -04:00
Todd C. Miller
e54cfc9bd4 We don't use getgrouplist() at the moment so there's no need to
provide a compat version.
2010-06-10 15:12:37 -04:00
Todd C. Miller
5770391ec4 No longer check for strdup or strndup for LIBOBJ replacement. 2010-04-05 19:47:49 -04:00
Todd C. Miller
8c91f0a30c Create our own sys_siglist for systems without it for use by strsignal() 2010-04-02 07:47:19 -04:00
Todd C. Miller
8db39a8586 Add checks for getgrset and getgrouplist and use replacement getgrouplist
if the system doesn't support it.
2010-03-22 08:25:30 -04:00