diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-06-16 18:30:23 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-06-19 16:52:33 +0300 |
commit | 969da31894394db4f64c4a0e96ec2252fb13142b (patch) | |
tree | 80870112dc39cdead601b85ffce548ed8d742e20 /src | |
parent | 73b823b22009b87fc1d33a8000a870fe9223e7bb (diff) |
libcamera: utils: Support systems that lack secure_getenv and issetugid
Android provides neither secure_getenv() nor issetugid(). Enable
compilation on that platform by using a plain getenv(), as that seems to
be the best we can do.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/utils.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp index 2e7d35fb..49b8fc9e 100644 --- a/src/libcamera/utils.cpp +++ b/src/libcamera/utils.cpp @@ -59,6 +59,10 @@ const char *basename(const char *path) * avoid vulnerabilities that could occur if set-user-ID or set-group-ID * programs accidentally trust the environment. * + * \note Not all platforms may support the features required to implement the + * secure execution check, in which case this function behaves as getenv(). A + * notable example of this is Android. + * * \return A pointer to the value in the environment or NULL if the requested * environment variable doesn't exist or if secure execution is required. */ @@ -67,9 +71,10 @@ char *secure_getenv(const char *name) #if HAVE_SECURE_GETENV return ::secure_getenv(name); #else +#if HAVE_ISSETUGID if (issetugid()) return NULL; - +#endif return getenv(name); #endif } |