Todd C. Miller
39db44b041
Support passing sudo_make_gidlist_item() an array of gids.
...
The gids are formatted as strings, not gid_t.
2021-02-22 12:33:21 -07:00
Todd C. Miller
41eae91206
If sudo_getgrouplist2() returns -1, clamp ngroups based on max_groups.
...
The ngroups parameter is an out parameter that is filled in with
the actual number of groups, which may be less than the static
number allocated when max_groups is set in sudo.conf.
Fixes a potential out of bounds read found by LLVM libFuzzer.
2021-02-13 11:54:21 -07:00
Todd C. Miller
fa5d44b8b5
Quiet some clang 10 analyzer warnings.
2020-08-07 14:22:56 -06:00
Todd C. Miller
446ae3f507
Include string.h unconditionally and only use strings.h for strn?casecmp()
...
In the pre-POSIX days BSD had strings.h, not string.h.
Now strings.h is only used for non-ANSI string functions.
2020-05-18 07:59:24 -06:00
Todd C. Miller
dd88460800
We no longer need to include headers we don't use for sudo*.h files.
...
Previously we needed to include headers required by the various
sudo*h files. Now those files are more self-sufficient and we
should only include headers needed by code in the various .c files.
2020-05-18 06:47:04 -06:00
Todd C. Miller
486ee2b71f
debug_decl and debug_decl_vars now require a semicolon at the end.
2019-12-22 08:48:16 -07:00
Todd C. Miller
1e1ef61902
Add SPDX-License-Identifier to files.
2019-04-29 07:21:51 -06:00
Todd C. Miller
c92f80b79e
In sudo_make_grlist_item() the calculation of total did not include
...
space for pointers to the group names.
2019-02-05 16:46:30 -07:00
Todd C. Miller
6c3d20cb41
Convert PVS-Studio comment to ANSI C.
2018-10-26 08:39:09 -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
aaefdd7575
Include stddef.h for offsetof() definition.
2018-08-22 10:27:33 -06:00
Todd C. Miller
c57ca74405
Use new sudo_getgrouplist2() function instead of getgrouplist().
2018-06-15 14:05:14 -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
250209d7a8
When running a command as the invoking user we cannot use the gid
...
list from the front-end since it may not correspond to the user's
aux group vector as defined by the group database.
2017-11-28 09:48:43 -07:00
Todd C. Miller
ae76e1a229
Use getgrouplist_2() on macOS if available.
2016-12-13 10:39:32 -07:00
Todd C. Miller
985ab1dd3e
Cache the user's group IDs and group names separately and only
...
resolve group IDs -> names when needed. If the sudoers file doesn't
contain groups we will no longer try to resolve all the user's group
IDs to names, which can be expensive on some systems.
2016-08-13 16:27:44 -06:00
Todd C. Miller
6cbba7d665
Add an administrative domain to the passwd/group cache key for
...
AIX which can have different name <-> ID mappings depending
on whether the database is local, LDAP, etc.
2016-02-01 11:08:58 -07:00
Todd C. Miller
d4211081c0
Add some debugging printfs when malloc fails and we don't have an
...
explicit call to sudo_warnx().
2015-07-14 15:28:01 -06:00
Todd C. Miller
0b241088b3
There's no need to conditionalize the #include <unistd.h>, we require
...
a POSIX system.
2015-07-02 09:08:28 -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
4f9cabd005
Remove obsolete memory.h include.
2015-06-18 21:02:57 -06:00
Todd C. Miller
6b7be032af
Use non-existing allocators in the passwd/group cache functions.
2015-05-27 10:26:49 -06: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
59ab26dbcc
Go back to a 2 args debug_decl and just use the "default" instance,
...
now renamed "active".
2015-02-01 08:24:49 -07:00
Todd C. Miller
e9914a91b1
The sudoers plugin now defines its own list of debugging subsystem names
...
and defines.
2014-10-22 13:30:52 -06:00
Todd C. Miller
866cfc4fc3
Add support for multiple Debug lines per program. Callers may
...
register arbitrary debug facilities or use built-in defaults. We
now use separate Debug statements for plugins and programs.
2014-10-22 13:23:05 -06:00
Todd C. Miller
36a5767e3e
efree -> sudo_efree for consistency
2014-07-10 15:35:04 -06:00
Todd C. Miller
2d61d38c23
Add sudo_ prefix to alloc.c functions and rename alloc.h -> sudo_alloc.h
2014-06-27 10:48:31 -06:00
Todd C. Miller
134b2a4228
Rename emalloc2() -> emallocarray() and erealloc3() -> ereallocarray().
2014-04-22 16:02:28 -06:00
Todd C. Miller
2508da6f68
Better match debugging.
...
Sprinkle const in match functions.
2013-12-05 14:34:56 -07:00
Todd C. Miller
07a804caf3
Quiet sign comparision warnings.
2013-10-23 15:03:31 -06:00
Todd C. Miller
9b2fb418ca
Don't allow max_groups to be set to zero, it just complicates things
...
needlessly. Fixes an assertion in visudo when there is a group-based
Defaults entry.
2013-08-12 09:14:38 -06:00
Todd C. Miller
6e50087010
Add sudo_set_grlist(), currently unused by the back end.
2013-03-26 13:27:51 -04:00
Todd C. Miller
593832152f
Make sure groupname_len is at least 32 just to be on the safe side.
...
It is better to allocate a little extra and not need it than to
have to reallocate and start over.
2013-03-05 14:06:51 -05:00
Todd C. Miller
791b751425
Use sysconf(_SC_LOGIN_NAME_MAX) to find max username length instead
...
of poking around in struct utmpx.
2013-02-15 10:20:21 -05:00
Todd C. Miller
2d9da65881
#include "sudo_usage.h" not <sudo_usage.h> so we get the one in the
...
build directory and not the src dir when using a separate build
directory.
2013-02-15 08:57:21 -05:00
Todd C. Miller
d837700341
Use max_groups in front-end and plugin.
2013-02-14 15:52:27 -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
883e0ec3cc
Split out implementation-specific back end code out of pwutil.c
...
into pwutil_impl.c. This will allow the main pwutil code to be
used for lookup methods other than getpw* and getgr*.
2012-09-21 16:25:01 -04:00