This is the result after running 'clang-format -i' on all C++ files and
headers, with the defined formatting rules in .clang-format.
Only the openvpn/common/unicode-impl.hpp has been excluded, as that is
mostly a copy of an external project.
Signed-off-by: David Sommerseth <davids@openvpn.net>
Added SetUserGroupRetainCap, which inherits from SetUserGroup,
and allows a privilege downgrade to retain one or more
Linux Capabilities.
Signed-off-by: James Yonan <james@openvpn.net>
Added LogSetup, an abstract base class with a virtual method
reopen() that accomplishes the log file reopen.
Added RunContext::set_log_reopen() method that accepts
a LogSetup object and calls its reopen() method on
SIGHUP.
daemonize() and log_setup() methods in daemon.hpp
now return a LogSetup object.
Signed-off-by: James Yonan <james@openvpn.net>
std::strerror() doesn't claim to be thread-safe, so
add openvpn::strerror_str() which is thread-safe by
virtue of the fact that it backs to strerror_r().
Signed-off-by: James Yonan <james@openvpn.net>
construction even when user/group lookup fails.
Updated calls to std::strerror() to use a saved version
of errno.
Added chown(), gid(), and additional defined() methods.
Use uid_t as the return type for uid().
* Added uid() method.
* Removed "explicit" qualifier from constructors since it
appears to be superfluous.
* Added "::" prefix to global libc functions.
* Added clarifying comment that SetUserGroup object does not
own passwd and group objects, therefore *pw and *gr can
change under us.