Commit Graph

109 Commits

Author SHA1 Message Date
Todd C. Miller
088edcb6f5 Add exported libsudo_util functions to util.exp and mark in headers
using __dso_public.
2014-06-26 15:51:15 -06:00
Todd C. Miller
134b2a4228 Rename emalloc2() -> emallocarray() and erealloc3() -> ereallocarray(). 2014-04-22 16:02:28 -06:00
Todd C. Miller
12a1b672c0 We must include gettext.h before missing.h as it includes system
headers.  Also add missing DEFAULT_TEXT_DOMAIN defines in sudoers
audit code that does not include sudoers.h.
2014-02-11 09:40:59 -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
ae6fb933f0 Do not assume localtime(), gmtime() and ctime() always return non-NULL. 2014-01-21 16:32:00 -07:00
Todd C. Miller
aa93ef78a7 Quiet a few innocuous cppcheck warnings. 2014-01-08 17:01:03 -07:00
Todd C. Miller
a6e1766dd6 Fix typo; we want setlocale(LC_ALL, "") since we are setting the
locale for the first time.
2013-12-28 07:59:45 -07:00
Todd C. Miller
91db1efe91 Use sudoers_initlocale() in main() startup, not sudoers_setlocal()
as the latter assumes we are already in the user's locale which may
not be the case.  For sudoreplay, we can just use setlocale()
directly as there is no sudoers locale.
2013-12-27 06:50:06 -07:00
Todd C. Miller
cf47b156fc Warn if the time stamp in the I/O log file does not fit in time_t.
Warn if the info line is not well-formed instead of silently ignoring
it.
2013-12-14 08:30:37 -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
e964aa4d8c Correctly parse 64-bit times in I/O log files. 2013-12-05 16:19:50 -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
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
99b7351de0 Fix some #if vs. #ifdef and remove an extraneous semicolon.
Bug #624; from Daniel Richard G.
2013-11-17 16:15:36 -07:00
Todd C. Miller
8e503a229f Fix warnings from -Wold-style-definition 2013-11-04 06:26:37 -07:00
Todd C. Miller
9f761dc44c Fix potential NULL dereference in non-interactive mode. 2013-10-30 10:21:02 -06:00
Todd C. Miller
abe0314e01 SIGKILL is not catchable 2013-10-29 14:20:43 -06:00
Todd C. Miller
449c4a290a Add sudo_ev_get_timeleft() to get the amount of time left before
an event times out and use it in sudoreplay.
2013-10-29 08:16:42 -06:00
Todd C. Miller
f4cd08ef63 If the user presses <return> or <enter> in sudoreplay, skip to the
next event.  Useful for skipping past long pauses in the data.
2013-10-28 17:01:23 -06:00
Todd C. Miller
b8f5d3edf7 Move session replay into its own function. 2013-10-28 14:44:50 -06: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
07a804caf3 Quiet sign comparision warnings. 2013-10-23 15:03:31 -06:00
Todd C. Miller
f85106ea67 Use SLIST and STAILQ macros instead of doing headless singly linked
lists manually.  As a bonus we now use a tail queue for ldap.c and
sudoreplay.c.
2013-10-22 09:08:09 -06:00
Todd C. Miller
fe0e953e9b Fix AND operator broken by changes to fix OR. 2013-10-21 16:00:29 -06:00
Todd C. Miller
2c8d5add86 Fix OR operator. 2013-10-19 16:59:08 -06:00
Todd C. Miller
b2d0bdee20 Work around a bug in sudo 1.8.7 timing files where the indexes are
off by two.
2013-09-03 09:39:35 -06:00
Todd C. Miller
422115d728 Repair writing of the I/O log file indices broken in sudo 1.8.7. 2013-09-03 09:22:44 -06:00
Todd C. Miller
acac6ae2a8 Use lower case for the long option arguments to match the manual.
This is inconsistent with GNU but it is better to match the sudo
documentation.
2013-08-16 10:17:47 -06:00
Todd C. Miller
99352d6738 Rename error.h -> fatal.h now that there is no error() function. 2013-08-15 14:24:29 -06:00
Todd C. Miller
8b1d645534 Simplify usage messages a bit and make --help output more closely
resemble GNU usage wrt long options.  Sync usage and man page
SYNOPSYS sections and improve long options in the manual pages.
Now that we have long options we don't need to give the mnemonic
for the single-character options in the description.
2013-08-14 10:30:51 -06:00
Todd C. Miller
39575aecf2 Long option support for visudo and sudoreplay. 2013-07-19 09:42:25 -06:00
Todd C. Miller
368a6558ca Change some error/errorx -> fatal/fatalx in comments and xgettext
flags.
2013-04-26 16:06:05 -04:00
Todd C. Miller
8ca50e13b7 No need to translate this error message. 2013-04-24 11:11:21 -04:00
Todd C. Miller
95b50f84af Use time(&now) instead of now = time(NULL) when storing the current
time in a time_t (better compiler error checking).
Better parsing and printing of 64-bit time_t on 32-bit platforms.
2013-04-23 13:15:22 -04:00
Todd C. Miller
39acd2fcba Rename error/errorx -> fatal/fatalx and remove the exit value as
it was always 1.
2013-04-18 14:07:59 -04:00
Todd C. Miller
b6d644b300 Be consistent with error message when regcomp() fails. 2013-04-08 15:41:09 -04:00
Todd C. Miller
0c40e82c16 Add simple regress tests for sudo.conf parsing. 2013-02-15 14:42:10 -05:00
Todd C. Miller
11e04d30dd Remove useless store detected by llvm checker. 2013-02-06 16:35:19 -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
2632ec7e69 Move warn/error into common and make static builds work. 2012-11-25 09:34:40 -05:00
Todd C. Miller
c2c6616a0c Move _sudo_printf from src/conversation.c to common/sudo_printf.c.
Add sudo_printf function pointer that is initialized to _sudo_printf()
instead of requiring a sudo_conv function pointer everywhere.  The
plugin will reset sudo_printf to point to the version passed in via
the plugin open function.  Now plugin_error.c can just call sudo_printf
in all cases.  The sudoers binaries no longer need their own version
of sudo_printf.
2012-11-25 09:34:33 -05:00
Todd C. Miller
4bde57b8b2 Rename warning2()/error2() -> warning_nodebug()/error_nodebug(). 2012-11-25 09:34:10 -05:00
Todd C. Miller
7b3d268687 Call gettext() on parameters for warning()/warningx() instead of
having warning() do it for us.
2012-11-25 09:34:04 -05:00
Todd C. Miller
90147bb605 Allow sudoers programs (visudo, sudoreplay, visudo) to use
plugin_error.c instead of the error.c from the front-end.  This
means sudoers_setlocale() needs to be independent of the sudo_user
struct and the defaults table.  The sudoers locale is now updated
via a callback.
2012-11-25 09:33:52 -05:00
Todd C. Miller
acf8af9aac #unifdef HAVE_SETLOCALE, it is C89 so no need to check for it. 2012-11-12 08:51:58 -05:00
Todd C. Miller
c1db4b1546 Always include locale.h from gettext.h so we no longer need to
include locale.h from the .c files.
2012-11-11 20:23:53 -05:00
Todd C. Miller
595d3b2651 Display warning/error messages in the user's locale. 2012-11-08 15:37:44 -05:00
Todd C. Miller
a3a1574cdf Explicitly mark main() as public in executables to avoid an HP-UX
ld warning.
2012-10-02 15:08:02 -04:00