Erik Faye-Lund [off-list ref] writes:
OK, I did another stab at this, and this is the best I could come up
with right now, what do you think?
Getting warmer ;-)
Similarly to drop_privileges() you can create prepare_credential that
takes "struct cred *, const char *username, const char *groupname" as
another helper, and make its implementation on the NO_POSIX side barf/die
when called, saying that switching credentials is not supported in
NO_POSIX implementation. That way, you can keep the main clean without
any conditionals. Command line argument parser can (and probably should)
stay the same between implementations.
Thanks.