| 
									
										
										
										
											2016-05-18 02:51:26 +08:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2018-09-11 20:22:14 +08:00
										 |  |  |  * Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2001-02-14 09:35:44 +08:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-05-18 02:51:26 +08: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 09:35:44 +08:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-02-20 06:04:02 +08:00
										 |  |  | #include <openssl/crypto.h>
 | 
					
						
							| 
									
										
										
										
											2001-04-26 16:26:18 +08:00
										 |  |  | #include <openssl/opensslconf.h>
 | 
					
						
							| 
									
										
										
										
											2001-02-14 09:35:44 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-21 21:48:31 +08:00
										 |  |  | #if defined(__OpenBSD__) || (defined(__FreeBSD__) && __FreeBSD__ > 2) || defined(__DragonFly__)
 | 
					
						
							| 
									
										
										
										
											2001-02-14 09:35:44 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | # include OPENSSL_UNISTD
 | 
					
						
							| 
									
										
										
										
											2001-02-14 09:35:44 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | int OPENSSL_issetugid(void) | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | { | 
					
						
							|  |  |  |     return issetugid(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2001-02-14 09:35:44 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-15 23:33:57 +08:00
										 |  |  | #elif defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_UEFI)
 | 
					
						
							| 
									
										
										
										
											2001-02-14 09:35:44 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | int OPENSSL_issetugid(void) | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | { | 
					
						
							|  |  |  |     return 0; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2001-02-14 09:35:44 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | # include OPENSSL_UNISTD
 | 
					
						
							|  |  |  | # include <sys/types.h>
 | 
					
						
							| 
									
										
										
										
											2001-02-14 09:35:44 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-17 12:35:37 +08:00
										 |  |  | # if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
 | 
					
						
							|  |  |  | #  if __GLIBC_PREREQ(2, 16)
 | 
					
						
							|  |  |  | #   include <sys/auxv.h>
 | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | # endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-02-14 09:35:44 +08:00
										 |  |  | int OPENSSL_issetugid(void) | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-08-17 12:35:37 +08:00
										 |  |  | # ifdef AT_SECURE
 | 
					
						
							|  |  |  |     return getauxval(AT_SECURE) != 0; | 
					
						
							|  |  |  | # else
 | 
					
						
							|  |  |  |     return getuid() != geteuid() || getgid() != getegid(); | 
					
						
							|  |  |  | # endif
 | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2001-02-14 09:35:44 +08:00
										 |  |  | #endif
 |