提交 756510c1 编写于 作者: P Pauli

Check getauxval on systems that have it when checking for setuid execution.

Reviewed-by: NKurt Roeckx <kurt@roeckx.be>
Reviewed-by: NMatthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/6993)
上级 723bd004
...@@ -31,12 +31,18 @@ int OPENSSL_issetugid(void) ...@@ -31,12 +31,18 @@ int OPENSSL_issetugid(void)
# include OPENSSL_UNISTD # include OPENSSL_UNISTD
# include <sys/types.h> # include <sys/types.h>
# if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
# if __GLIBC_PREREQ(2, 16)
# include <sys/auxv.h>
# endif
# endif
int OPENSSL_issetugid(void) int OPENSSL_issetugid(void)
{ {
if (getuid() != geteuid()) # ifdef AT_SECURE
return 1; return getauxval(AT_SECURE) != 0;
if (getgid() != getegid()) # else
return 1; return getuid() != geteuid() || getgid() != getegid();
return 0; # endif
} }
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册