Commit Graph

179 Commits

Author SHA1 Message Date
Todd C. Miller
78355e618f Add cppcheck target to run cppcheck on all source files. 2014-01-13 09:50:39 -07:00
Todd C. Miller
a18395a90e Still need limits.h here. 2013-12-17 14:32:24 -07:00
Todd C. Miller
aa849ed945 Go back to using /proc/self/fd instead of /proc/$$/fd as only AIX
lacks /proc/self and it has F_CLOSEM.
2013-12-17 07:38:20 -07:00
Todd C. Miller
1c3f2ac1e7 Use /dev/fd in closefrom() on FreeBSD < 8.0 and Mac OS X. 2013-12-16 16:24:02 -07:00
Todd C. Miller
8c184dcec3 Remove _MAX and _MIN compat; we rely on missing.h for that.
We already require the compiler handle long long so there's
no need to use HAVE_LONG_LONG_INT everywhere.
2013-12-16 14:53:27 -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
e1ac1a2ff3 Use atoid() not atoi() when parsing uids/gids. 2013-12-05 15:51:56 -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
12f3bdf60e Add wrapper functions for dlopen() et al so that we can support
statically compiling in the sudoers plugin but still allow other
plugins to be loaded.  The new --enable-static-sudoers configure
option will cause the sudoers plugin to be compiled statically into
the sudo binary.  This does not prevent other plugins from being
loaded as per sudo.conf.
2013-11-22 16:35:15 -07:00
Todd C. Miller
6270991362 Back out unintended change. 2013-11-20 12:21:34 -07:00
Todd C. Miller
ba40be9dd2 Define RTLD_GLOBAL for older systems without it. Bug #621 2013-11-20 07:22:10 -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
42b1e4a9c4 Add check for C99 compliant (v)snprintf function. 2013-11-19 10:40:25 -07:00
Todd C. Miller
0a47860ef7 Include unistd.h in sig2str.c for Tru64 as it defines SIGRTMIN and
SIGRTMAX in terms of sysconf(), which is prototyped in unistd.h.
Bug #621; from Daniel Richard G.
2013-11-19 09:48:01 -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
bf65cc041e Fixes for building under Tru64; from Daniel Richard G.
Bug #624
2013-11-17 14:16:13 -07:00
Todd C. Miller
9d9d8e852b Include arpa/inet.h for HP-UX; from Daniel Richard G. 2013-11-12 08:53:33 -07:00
Todd C. Miller
87e1ae76af Uniquify header dependencies so we don't end up with duplicates
when a header file includes other headers.  The header dependencies
are sorted so the generated order is stable.
2013-11-11 13:53:06 -07:00
Todd C. Miller
88a57822ea Add getaddrinfo.lo to LTLIBOBJS for systems that need it.
From Daniel Richard G.
2013-11-11 12:53:44 -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
3c2a9b9948 Don't redefine opterr, optind, optopt, optarg in getopt_long.c.
Add a check for optreset which is a BSD extension and provide a
definition in getopt_long.c if it is not present.
2013-08-16 13:50:48 -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
e5f0e1f752 Quiet a gcc "used uninitialized in this function" false positive. 2013-08-15 10:49:06 -06:00
Todd C. Miller
39cbfcd406 Use private version of atoid() to avoid a dependency on libcommon.a
(since that already depends on libreplace.a).
2013-08-07 16:52:50 -06:00
Todd C. Miller
dde7331a0f Use atoid() in more places. 2013-08-07 15:49:03 -06:00
Todd C. Miller
2c6e68df0e Avoid a crash on Mac OS X 10.8 (at least) when we close libdispatch's
fds out from under it before executing the command.  Switch to just
setting the close on exec flag instead.
2013-08-07 15:04:58 -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
deb3844959 Add make rules for building getopt_long.c 2013-07-18 10:07:41 -06:00
Todd C. Miller
9309c9eab7 Use getopt_long() so we can make the -h flag take an optional argument.
Includes a version for those without it.
2013-07-17 17:00:55 -06:00
Todd C. Miller
f9c4fb69de Add missing $(PIE_LDFLAGS) $(SSP_LDFLAGS) for test programs 2013-05-22 17:04:25 -04:00
Todd C. Miller
c5971524f1 Solaris maps negative gids to GID_NOBODY. 2013-04-24 15:24:24 -04:00
Todd C. Miller
d6282d154a Update copyright years. 2013-04-24 09:35:02 -04:00
Todd C. Miller
5d75798165 Fix check for _BIG_ENDIAN and _LITTLE_ENDIAN (Solaris) and
__BIG_ENDIAN__ and __LITTLE_ENDIAN__ (HP-UX)
2013-04-17 16:23:49 -04:00
Todd C. Miller
89759fa36c For big endian architectures just use memcpy() instead of BE macros
in a loop.
2013-04-15 11:05:52 -04:00
Todd C. Miller
e3b61c11f1 Support %lld and %llu 2013-04-10 11:17:41 -04:00
Todd C. Miller
b9bb50ff5b Use free() not efree() since we don't include alloc.h here 2013-04-02 11:23:31 -04:00
Todd C. Miller
afc95dd118 Update guard to take __progname into account 2013-04-01 10:23:36 -04:00
Todd C. Miller
d7ea8fead5 Some older systems have inttypes.h but not stdint.h 2013-04-01 10:23:18 -04:00
Todd C. Miller
98ffa51545 Add guards in compat source files. Not really needed since we only
include them in the Makefile if they are needed but should not hurt
either.
2013-04-01 10:19:26 -04:00
Todd C. Miller
837cda0c54 regen depends 2013-03-25 13:54:25 -04:00
Todd C. Miller
c078614b43 Fix regress tests on non-OpenBSD platforms. 2013-03-19 14:08:11 -04:00
Todd C. Miller
7109e46deb Pass BIND_VERBOSE to shl_load() 2013-03-18 15:15:13 -04:00
Todd C. Miller
a43318959a Update copyright year. 2013-03-02 14:01:30 -05:00
Todd C. Miller
f524c515e5 Use pst_highestfd from pstat_getproc() on HP-UX. 2013-03-01 13:01:37 -05:00
Todd C. Miller
0fdb89e3b3 regen depends for to add compat/nss_dbdefs.h for getgrouplist.lo 2013-01-22 15:48:52 -05:00
Todd C. Miller
e1859cac14 Fix typo that breaks the build on HP-UX. 2013-01-22 15:48:16 -05:00
Todd C. Miller
6bc3d4aed5 Use nss_search() to implement getgrouplist() where available. Tested
on Solaris and HP-UX.  We need to include a compatibility header
for HP-UX which uses the Solaris nsswitch implementation but doesn't
ship nss_dbdefs.h.
2013-01-22 15:41:15 -05:00
Todd C. Miller
a06a14838f Use _getgroupsbymember() on Solaris to get the groups list. Fixes
performance problems with the getgroupslist() compat on Solaris
systems with network-based group databases.
2013-01-18 14:58:12 -05:00