1 #ifndef _COMPAT_GETENV_H
2 #define _COMPAT_GETENV_H
5 * Copyright (C) 2015 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License, version 2 only,
9 * as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include <sys/types.h>
24 #include <common/error.h>
27 int lttng_is_setuid_setgid(void)
29 return geteuid() != getuid() || getegid() != getgid();
33 char *lttng_secure_getenv(const char *name
)
35 if (lttng_is_setuid_setgid()) {
36 WARN("Getting environment variable '%s' from setuid/setgid binary refused for security reasons.",
43 #endif /* _COMPAT_GETENV_H */
This page took 0.029456 seconds and 4 git commands to generate.