|
Packit Service |
084de1 |
/*
|
|
Packit Service |
084de1 |
* Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
|
|
Packit Service |
084de1 |
*
|
|
Packit Service |
084de1 |
* Licensed under the OpenSSL license (the "License"). You may not use
|
|
Packit Service |
084de1 |
* this file except in compliance with the License. You can obtain a copy
|
|
Packit Service |
084de1 |
* in the file LICENSE in the source distribution or at
|
|
Packit Service |
084de1 |
* https://www.openssl.org/source/license.html
|
|
Packit Service |
084de1 |
*/
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
#ifndef _GNU_SOURCE
|
|
Packit Service |
084de1 |
# define _GNU_SOURCE
|
|
Packit Service |
084de1 |
#endif
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
#include <stdlib.h>
|
|
Packit Service |
084de1 |
#include "internal/cryptlib.h"
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
char *ossl_safe_getenv(const char *name)
|
|
Packit Service |
084de1 |
{
|
|
Packit Service |
084de1 |
#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
|
|
Packit Service |
084de1 |
# if __GLIBC_PREREQ(2, 17)
|
|
Packit Service |
084de1 |
# define SECURE_GETENV
|
|
Packit Service |
084de1 |
return secure_getenv(name);
|
|
Packit Service |
084de1 |
# endif
|
|
Packit Service |
084de1 |
#endif
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
#ifndef SECURE_GETENV
|
|
Packit Service |
084de1 |
if (OPENSSL_issetugid())
|
|
Packit Service |
084de1 |
return NULL;
|
|
Packit Service |
084de1 |
return getenv(name);
|
|
Packit Service |
084de1 |
#endif
|
|
Packit Service |
084de1 |
}
|