2016-05-17 18:51:26 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
|
2001-02-14 01:35:44 +00:00
|
|
|
*
|
2016-05-17 18:51:26 +00:00
|
|
|
* Licensed under the OpenSSL license (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
2001-02-14 01:35:44 +00:00
|
|
|
*/
|
|
|
|
|
2001-02-19 22:04:02 +00:00
|
|
|
#include <openssl/crypto.h>
|
2001-04-26 08:26:18 +00:00
|
|
|
#include <openssl/opensslconf.h>
|
2001-02-14 01:35:44 +00:00
|
|
|
|
|
|
|
#if defined(__OpenBSD__) || (defined(__FreeBSD__) && __FreeBSD__ > 2)
|
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
# include OPENSSL_UNISTD
|
2001-02-14 01:35:44 +00:00
|
|
|
|
|
|
|
int OPENSSL_issetugid(void)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
|
|
|
return issetugid();
|
|
|
|
}
|
2001-02-14 01:35:44 +00:00
|
|
|
|
2016-03-17 16:53:11 +00:00
|
|
|
#elif defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VXWORKS)
|
2001-02-14 01:35:44 +00:00
|
|
|
|
|
|
|
int OPENSSL_issetugid(void)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2001-02-14 01:35:44 +00:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
# include OPENSSL_UNISTD
|
|
|
|
# include <sys/types.h>
|
2001-02-14 01:35:44 +00:00
|
|
|
|
|
|
|
int OPENSSL_issetugid(void)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
|
|
|
if (getuid() != geteuid())
|
|
|
|
return 1;
|
|
|
|
if (getgid() != getegid())
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
2001-02-14 01:35:44 +00:00
|
|
|
#endif
|