aboutgitcodebugslistschat
path: root/Makefile
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-09-28 14:33:18 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-09-29 12:21:58 +0200
commit68ef4931cb8bcbc53c0d2b6078946d836da7b5d9 (patch)
treea39e9c4ee647df256ef0fe5c15fa2b7e5b8c8fbb /Makefile
parent7d4e50827c0681838793bf2ee81dbb6386c5db69 (diff)
downloadpasst-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 'Makefile')
-rw-r--r--Makefile3
1 files changed, 1 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 59967eb..e0933f3 100644
--- a/Makefile
+++ b/Makefile
@@ -282,12 +282,12 @@ cppcheck: $(SRCS) $(HEADERS)
$(SYSTEM_INCLUDES:%=--config-exclude=%) \
$(SYSTEM_INCLUDES:%=--suppress=*:%/*) \
$(SYSTEM_INCLUDES:%=--suppress=unmatchedSuppression:%/*) \
+ --inline-suppr \
--suppress=objectIndex:tcp.c --suppress=objectIndex:udp.c \
--suppress=va_list_usedBeforeStarted:util.c \
--suppress=unusedFunction \
--suppress=knownConditionTrueFalse:conf.c \
--suppress=strtokCalled:conf.c --suppress=strtokCalled:qrap.c \
- --suppress=getpwnamCalled:passt.c \
--suppress=localtimeCalled:pcap.c \
--suppress=unusedStructMember:pcap.c \
--suppress=funcArgNamesDifferent:util.h \
@@ -295,7 +295,6 @@ cppcheck: $(SRCS) $(HEADERS)
\
--suppress=unmatchedSuppression:conf.c \
--suppress=unmatchedSuppression:dhcp.c \
- --suppress=unmatchedSuppression:passt.c \
--suppress=unmatchedSuppression:pcap.c \
--suppress=unmatchedSuppression:qrap.c \
--suppress=unmatchedSuppression:tcp.c \