environ - user environment (variable)

SYNOPSIS Overview

extern char ** environ;

DESCRIPTION Description

Environ points to a variable called 'environment' (environment) of the array of strings (the variables must be declared in the user program, but in the case of using libc4 or libc5 and glibc and defining _GNU_SOURCE, which is in the file header unistd.h declared). For a process, this is an array of strings to get through the beginning of the process exec (3) call, it is customary, the format of these strings is

USER
Login name of the user (used by some BSD derived from the program).
LOGNAME
Login name of the user (used by some System-V derived from the program).
HOME
The user's login directory, by login (1) according to the password file passwd (5) setting.
JUST
When not being ignored LC_ALL or more specific environment variables, is the domain name for geographical categories.
PATH
Pre-set sequence of directory prefixes, sh (1) and can take many programs the pathname lookup incomplete files. The prefix ':' separator. (Similarly, there are some shell commands located in different directories with CDPATH search, find and use MANPATH manual pages and so on.)
PWD
The current working directory. It is set some shell.
SHELL
The file name of the user's login shell.
TERM
For preparation of the output terminal type.
PAGER
Tool user-specified text file.
EDITOR/VISUAL
Tools specified by the user to edit text files.

More names can be in the setenv sh (1) the export command and 'name = value', or csh (1) command set. Parameters may also be performed when exec (2) is placed in the environment. C program can use a function getenv (. 3) , the putenv (. 3) , setenv (. 3) and unsetenv (3) to manipulate the environment itself.

Note that the behavior of many programs and library routines is influenced by the existence and value of specific environment variables. Casual gathering will have a look:

Environment variables LANG, LANGUAGE, NLSPATH, LOCPATH, LC_ALL, LC_MESSAGES etc. influence the treatment area.

TMPDIR influence tmpnam (3) the name of the generated path name prefix and a number of other routines, sort (1) and other programs use temporary files directory, and so on.

LD_LIBRARY_PATH, LD_PRELOAD and other variables affect the dynamic LD_ * (loader / linker) behavior.

POSIXLY_CORRECT the specific programs and library routines follow the POSIX requirements.

MALLOC_ * variables influence the behavior of malloc (3) of.

HOSTALIASES given variable containing gethostbyname (3) with an alias file name.

TZ and TZDIR given time zone information.

TERMCAP given to the window size of a given terminal (or a given file including the file name of this information).

And so on, there are many.

There is an obvious security risk. More than once a command system that uses an unusual IFS or LD_LIBRARY_PATH user variable value lured into the scam. 

Guess you like

Origin www.cnblogs.com/fanweisheng/p/11081655.html