[popt] secure_getenv.c: secure_getenv() wrapper for systems that don't have it. bugfix/popt-1.16-apply-patches github/bugfix/popt-1.16-apply-patches
authorDavid Korth <gerbilsoft@gerbilsoft.com>
Mon, 7 Sep 2015 21:17:40 +0000 (17:17 -0400)
committerDavid Korth <gerbilsoft@gerbilsoft.com>
Mon, 7 Sep 2015 21:17:40 +0000 (17:17 -0400)
commitb895b6ad009a198b0a56a6b013839534bc5d508b
tree518f62bc4b0d9c0a5b653e24ec051f0f73168d2c
parentcadb3760858182897c0d94785d6de7e53b4c984e
[popt] secure_getenv.c: secure_getenv() wrapper for systems that don't have it.

On Windows, this just calls getenv(), since there's no real way to
implement "security" here.

On non-Windows systems, it checks if euid == uid and egid == gid.
If either of them are incorrect, security restrictions will be enabled,
and popt_secure_getenv() will always return NULL. Otherwise, security
restrictions will be disabled, and popt_secure_getenv() will simply
call getenv() with the specified parameter.

system.h: Declare and use popt_secure_getenv() if the system doesn't
have secure_getenv() or __secure_getenv().
extlib/popt/CMakeLists.txt
extlib/popt/secure_getenv.c [new file with mode: 0644]
extlib/popt/system.h