Commit Graph

57 Commits

Author SHA1 Message Date
Todd C. Miller
ac61b5655d Use EXIT_SUCCESS and EXIT_FAILURE more consistently. 2020-02-08 12:43:00 -07:00
Todd C. Miller
41242e121f FreeBSD is missing SIGLWP (aka SIGTHR) in sys_signame[].
Don't test SIGLWP on FreeBSD where it is reserved for the thread
library and is not listed in sys_signame[].
2020-01-15 10:27:54 -07:00
Todd C. Miller
8aa815643f Remove POD-style C<> markup (typewriter font) from sudo.conf 2020-01-02 13:12:27 -07:00
Robert Manner
c0d53d75eb src/load_plugins, plugins/sudoers: added developer_mode sudo.conf option
It can be used to disable the enforcement that a plugin (shared object or
an imported python module) must be owned by root and not modifiable by
others.
This can make plugin development easier.
2019-12-14 12:55:42 -07:00
Todd C. Miller
98ce89ee80 Add unit test for parse_host_port and make an empty port an error. 2019-11-05 06:04:13 -07:00
Todd C. Miller
40bf4081be Rename sudo_strtoid() to sudo_strtoidx() and add simplified sudo_strtoid() 2019-10-20 10:21:29 -06:00
Todd C. Miller
e339d9950d Fix stronum() regress test and the errno value for out of range numbers. 2019-10-16 09:37:41 -06:00
Todd C. Miller
29afe160a2 Split atofoo.c regress into multiple tests. 2019-10-16 08:45:32 -06:00
Todd C. Miller
396bc57fef Add sudo_strtoid() tests for -1 and range errors.
Also adjust testsudoers/test5 which relied upon gid -1 parsing.
2019-10-10 10:04:13 -06:00
Todd C. Miller
0bbfdc9920 Add regress tests for str2sig() and sig2str(). 2019-08-19 08:37:08 -06:00
Todd C. Miller
9d8f374397 Add ssizeof macro that returns ssize_t.
We can use this instead of casting the result of size_t to int.
Also change checks for snprintf() returning <=0 to <0.
2019-06-25 09:45:10 -06:00
Todd C. Miller
1e1ef61902 Add SPDX-License-Identifier to files. 2019-04-29 07:21:51 -06:00
Todd C. Miller
de65d70929 Add a proper getdelim(3) replacement and use it instead of getline(3). 2019-04-08 10:37:30 -06:00
Todd C. Miller
f17683482b Quiet a warning on gcc 8 2019-02-18 15:56:12 -07:00
Todd C. Miller
985600e7f0 Minor snprintf() usage tweaks:
1) don't assume snprintf() returns -1 on error, check for <0
2) when comparing return value of sizeof(foo), cast the sizeof, not the len
3) cast return value to void in cases where snprintf cannot fail
2019-01-20 07:49:48 -07:00
Todd C. Miller
ffe2041a02 Skip sudo_getgrouplist2() check on systems with getgrouplist_2().
sudo_getgrouplist2() is just a wrapper on such systems and this
avoids a test failure on macOS where a user is automatically a
member of certain groups.
2018-10-26 11:11:58 -06:00
Todd C. Miller
a3cb22b467 Check the user's primary gid from the passwd file too. 2018-10-26 10:24:38 -06:00
Todd C. Miller
6c3d20cb41 Convert PVS-Studio comment to ANSI C. 2018-10-26 08:39:09 -06:00
Todd C. Miller
404524c4ef Add regress test for sudo_getgrouplist2().
This test assumes all the groups in root's group list can
be resolved by group ID.
2018-10-26 06:52:46 -06:00
Todd C. Miller
64e5d34c57 Add comments in .c files so PVS-Studio will check them. 2018-10-21 08:46:05 -06:00
Todd C. Miller
a924b4610b Fix warnings on OpenIndiana (Illumos) 2018-08-30 14:06:18 -06:00
Todd C. Miller
48fba3c2cc update my email to Todd.Miller@sudo.ws 2017-12-03 17:53:40 -07:00
Todd C. Miller
dd47a0a416 Add missing initprogname() calls. 2017-11-28 09:06:44 -07:00
Todd C. Miller
f59327bc5c Fix final test with a format > 2048 bytes.
Keep track of tests run in the syslog() stub so we can
detect if the stub is not being called.
2017-02-13 20:30:45 -07:00
Todd C. Miller
63deb77705 Add regress for vsyslog replacement. 2017-01-15 19:07:59 -07:00
Todd C. Miller
e8f612ead4 Fix a clang warning on macOS 2016-12-02 09:34:08 -07:00
Todd C. Miller
334350af45 id_t is 64-bits on FreeBSD so use strtoll() there.
Fixes the strtoid regress.
2016-11-30 07:32:59 -07:00
Todd C. Miller
e797fc643f Plug memory leak when a particular Path is set more than once. 2016-11-16 13:57:50 -07:00
Todd C. Miller
6dff4ac7fd Always define _PATH_SUDO_NOEXEC, _PATH_SUDO_SESH, _PATH_SUDO_PLUGIN_DIR,
even if only defined to NULL.  This means the accessors can always be
present.

Use RTLD_PRELOAD_VAR instead of _PATH_SUDO_NOEXEC to tell when
noexec is available.

Add ENABLE_SUDO_PLUGIN_API and use it instead of _PATH_SUDO_PLUGIN_DIR
to tell when the plugin API is available.

Add sudo_conf_clear_paths() to clear the path values so the
regress tests are not affected by compile-time settings.
2016-11-16 10:13:26 -07:00
Todd C. Miller
f3c7e0f83b Update error output to match quoting changes. 2016-11-03 11:16:09 -06:00
Todd C. Miller
17ad75d50b Add a flags option to sudo_parseln() and a flag to only mach comments
at the beginning of the line.  Use the flag when parsing ldap.conf.
2016-09-01 09:19:20 -06:00
Todd C. Miller
70f2f4eee9 Better test for negated character classes. 2016-02-26 11:24:25 -07:00
Todd C. Miller
f222a20b13 Add test for negated character class 2016-02-26 11:14:50 -07:00
Todd C. Miller
445e6f2e9a Check sudo_conf_read() return value and exit on fatal error (a
warning was already printed by sudo_conf_read()).
2015-07-07 13:17:50 -06:00
Todd C. Miller
5e695d4cd9 Add missing exit value. 2015-06-30 12:19:24 -06:00
Todd C. Miller
662f9ec562 Add missing fcntl.h include. 2015-06-30 12:19:17 -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
e2328479dd Use strtok_r() instead of strtok() 2015-06-19 12:35:51 -06:00
Todd C. Miller
4f9cabd005 Remove obsolete memory.h include. 2015-06-18 21:02:57 -06:00
Todd C. Miller
db3012645e Test strsplit behavior with an empty string. 2015-06-18 16:14:20 -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
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
49128a79e3 Add regress for mkdtemp and mkstemps from OpenBSD 2015-02-20 14:37:02 -07:00
Todd C. Miller
f730b28ce0 Adjust regress test now that boolean settings display an error for
invalid input.
2014-10-27 16:31:01 -06:00
Todd C. Miller
6b1b734ffa Add a flag argument to sudo_conf_read() so we can decide which
bits get parsed.  This lets us parse Debug statements first and
init the debug subsystem early.
2014-10-26 08:33:08 -06:00
Todd C. Miller
a7e724b75d Change how sudo.conf is parsed. We now do a quick parse and then
set the values after the entire file has been parsed.  This lets
us init the debug system earlier.  Plugin-specific debug flags are
now stored in struct plugin_info and struct plugin_container and
passed to the plugin via one or more debug_flags settings.
2014-10-22 13:20:32 -06:00
Todd C. Miller
cd56a87590 Avoid potential division by zero 2014-07-25 14:07:39 -06:00
Todd C. Miller
f6fec06037 Add test for getprogname() and symbolic links; bug 654 2014-07-25 09:37:58 -06:00
Todd C. Miller
47835ff289 Rename missing.h -> sudo_compat.h 2014-07-22 14:25:16 -06:00