From 7b4c7a681cc4c0a53dc8a8baf4853e921cfbf5de Mon Sep 17 00:00:00 2001 From: bigbiff Date: Thu, 1 Jan 2015 19:44:14 -0500 Subject: Update blkid to 2.25.0 Break libblkid into 4 libraries: libblkid, libuuid, libutil-linux and libfdisk. This should help in later patch updates. Change-Id: I680d9a7feb031e5c29a603e9c58aff4b65826262 --- libblkid/env.c | 110 --------------------------------------------------------- 1 file changed, 110 deletions(-) delete mode 100644 libblkid/env.c (limited to 'libblkid/env.c') diff --git a/libblkid/env.c b/libblkid/env.c deleted file mode 100644 index c79e0e0de..000000000 --- a/libblkid/env.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Security checks of environment - * Added from shadow-utils package - * by Arkadiusz Miƛkiewicz - * - */ - -#include -#include -#include -#ifdef HAVE_SYS_PRCTL_H -#include -#else -#define PR_GET_DUMPABLE 3 -#endif -#if (!defined(HAVE_PRCTL) && defined(linux)) -#include -#endif -#include -#include - -#include "env.h" - -#ifndef HAVE_ENVIRON_DECL -extern char **environ; -#endif - -static char * const forbid[] = { - "_RLD_=", - "BASH_ENV=", /* GNU creeping featurism strikes again... */ - "ENV=", - "HOME=", - "IFS=", - "KRB_CONF=", - "LD_", /* anything with the LD_ prefix */ - "LIBPATH=", - "MAIL=", - "NLSPATH=", - "PATH=", - "SHELL=", - "SHLIB_PATH=", - (char *) 0 -}; - -/* these are allowed, but with no slashes inside - (to work around security problems in GNU gettext) */ -static char * const noslash[] = { - "LANG=", - "LANGUAGE=", - "LC_", /* anything with the LC_ prefix */ - (char *) 0 -}; - -void -sanitize_env(void) -{ - char **envp = environ; - char * const *bad; - char **cur; - char **move; - - for (cur = envp; *cur; cur++) { - for (bad = forbid; *bad; bad++) { - if (strncmp(*cur, *bad, strlen(*bad)) == 0) { - for (move = cur; *move; move++) - *move = *(move + 1); - cur--; - break; - } - } - } - - for (cur = envp; *cur; cur++) { - for (bad = noslash; *bad; bad++) { - if (strncmp(*cur, *bad, strlen(*bad)) != 0) - continue; - if (!strchr(*cur, '/')) - continue; /* OK */ - for (move = cur; *move; move++) - *move = *(move + 1); - cur--; - break; - } - } -} - - -char *safe_getenv(const char *arg) -{ - uid_t ruid = getuid(); - - if (ruid != 0 || (ruid != geteuid()) || (getgid() != getegid())) - return NULL; -#ifdef HAVE_PRCTL - if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0) - return NULL; -#else -#if (defined(linux) && defined(SYS_prctl)) - if (syscall(SYS_prctl, PR_GET_DUMPABLE, 0, 0, 0, 0) == 0) - return NULL; -#endif -#endif -#ifdef HAVE_SECURE_GETENV -return secure_getenv(arg); -#elif HAVE___SECURE_GETENV - return __secure_getenv(arg); -#else - return getenv(arg); -#endif -} -- cgit v1.2.3