diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2022-09-28 14:33:18 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-09-29 12:21:58 +0200 |
commit | 68ef4931cb8bcbc53c0d2b6078946d836da7b5d9 (patch) | |
tree | a39e9c4ee647df256ef0fe5c15fa2b7e5b8c8fbb /qrap.c | |
parent | 7d4e50827c0681838793bf2ee81dbb6386c5db69 (diff) | |
download | passt-68ef4931cb8bcbc53c0d2b6078946d836da7b5d9.tar passt-68ef4931cb8bcbc53c0d2b6078946d836da7b5d9.tar.gz passt-68ef4931cb8bcbc53c0d2b6078946d836da7b5d9.tar.bz2 passt-68ef4931cb8bcbc53c0d2b6078946d836da7b5d9.tar.lz passt-68ef4931cb8bcbc53c0d2b6078946d836da7b5d9.tar.xz passt-68ef4931cb8bcbc53c0d2b6078946d836da7b5d9.tar.zst passt-68ef4931cb8bcbc53c0d2b6078946d836da7b5d9.zip |
Clean up parsing in conf_runas()
conf_runas() handles several of the different possible cases for the
--runas argument in a slightly odd order. Although it can parse both
numeric UIDs/GIDs and user/group names, it can't parse a numeric UID
combined with a group name or vice versa. That's not obviously useful, but
it's slightly surprising gap to have.
Rework the parsing to be more systematic: first split the option into
user and (optional) group parts, then separately parse each part as either
numeric or a name. As a bonus this removes some clang-tidy warnings.
While we're there also add cppcheck suppressions for getpwnam() and
getgrnam(). It complains about those because they're not reentrant.
passt is single threaded though, and is always likely to be during
this initialization code, even if we multithread later.
There were some existing suppressions for these in the cppcheck
invocation but they're no longer up to date. Replace them with inline
suppressions which, being next to the code, are more likely to stay
correct.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'qrap.c')
0 files changed, 0 insertions, 0 deletions