1
#ifndef _COMPAT_GETENV_H
2
#define _COMPAT_GETENV_H
5
* Copyright (C) 2015 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; only
10
* version 2.1 of the License.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this library; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24
#include <sys/types.h>
25
#include <usterr-signal-safe.h>
28
int lttng_is_setuid_setgid(void)
30
return geteuid() != getuid() || getegid() != getgid();
34
char *lttng_secure_getenv(const char *name)
36
if (lttng_is_setuid_setgid()) {
37
ERR("Getting environment variable '%s' from setuid/setgid binary refused for security reasons.",
44
#endif /* _COMPAT_GETENV_H */