Todd C. Miller
3bb69ffe81
Remove CVS $Sudo$ tags.
2010-01-17 19:51:28 -05:00
Todd C. Miller
0c669eda2e
Adapt to accept pam_env-style /etc/environment which allows shell-style
...
lines such as: export EDITOR="/usr/bin/vi"
2009-06-23 18:24:42 +00:00
Todd C. Miller
44ace77355
Return EINVAL in setenv() if var is NULL or the empty string to match
...
glibc behavior.
2009-06-15 13:10:01 +00:00
Todd C. Miller
62b89f9dfc
Update copyright years.
2009-05-25 12:02:42 +00:00
Todd C. Miller
8d7518a18c
Inline the setting of the environment string.
2009-04-25 16:49:22 +00:00
Todd C. Miller
c0c7180bba
setenv(3) in Linux treats a NUL value as the empty string
...
setenv(3) in BSD doesn't return an error if the name has '=' in it, it
just treats the '=' as end of string.
2009-04-24 18:53:15 +00:00
Todd C. Miller
2012ce9eab
fix K&R compilation
2009-03-11 23:01:10 +00:00
Todd C. Miller
91f04dc3b4
Add --enable-env-debug flag to enable environment sanity checks.
2009-03-08 20:57:01 +00:00
Todd C. Miller
f641253684
Only sync environ for putenv, setenv, and unsetenv. We need to make
...
sure that sudo_putenv and sudo_setenv only modify env.envp, not environ.
2009-03-07 22:10:44 +00:00
Todd C. Miller
0fee90c190
Really fix UNSETENV_VOID
2009-03-02 19:19:35 +00:00
Todd C. Miller
a7a53b5f47
Fix unsetenv when UNSETENV_VOID
2009-03-02 19:18:35 +00:00
Todd C. Miller
3c8acdd649
Add sanity checks for setenv/unsetenv
2009-03-01 13:52:28 +00:00
Todd C. Miller
6fed38f323
Replace sudo_setenv/sudo_unsetenv with calls to setenv/unsetenv and
...
provide our own setenv/unsetenv/putenv that operates on own env pointer.
Make sync_env() inline in setenv/unsetenv/putenv functions.
2009-03-01 00:58:41 +00:00
Todd C. Miller
840acbd3ac
Update copyright years.
2008-11-09 14:13:13 +00:00
Todd C. Miller
50d8974753
Unset AUTHSTATE after calling authenticate() as it may not be correct for
...
the user we are running the command as.
2008-11-06 00:08:24 +00:00
Todd C. Miller
4578548c45
The -i flag should imply env_reset. This got broken in sudo 1.6.9.
2008-06-21 18:59:36 +00:00
Todd C. Miller
b85a28aba9
Add env_file Defaults option that is similar to /etc/environment on some
...
systems.
2008-05-03 00:53:21 +00:00
Todd C. Miller
daba1995fc
Preserve HOME by default too. Matches documentation and previous behavior.
2008-03-13 11:34:31 +00:00
Todd C. Miller
801860b298
Only read /etc/environment on Linux and AIX
2008-01-27 21:31:27 +00:00
Todd C. Miller
cd30e84743
Define LDAPNOINIT before calling ldap_init(), etc. to disable user
...
ldaprc and system defaults that could affect how LDAP works.
2008-01-01 19:01:42 +00:00
Todd C. Miller
926dcd0bcc
Refactor line reading into a separate function, sudo_parseln(),
...
which removes comments, leading/trailing whitespace and newlines.
May want to rethink the use of sudo_parseln() for /etc/ldap.secret
2007-12-31 20:04:46 +00:00
Todd C. Miller
f8c52dc928
Add support for reading and /etc/environment file. Still needs to
...
be documented and should probably only applies to OSes that have
it (AIX and Linux, maybe others).
2007-12-21 21:53:32 +00:00
Todd C. Miller
19fa259480
Remove support for compilers that don't support void *
2007-08-31 23:30:07 +00:00
Todd C. Miller
17c8249fef
Fix typo: PYTHONINSPEC should be PYTHONINSPECT. From David Krause.
2007-07-31 18:04:32 +00:00
Todd C. Miller
4b257e50c1
Add back allocation of the env struct in rebuild_env but save
...
a copy of the old pointer and free it before returning.
2007-07-29 22:32:47 +00:00
Todd C. Miller
2304e1a4a7
Don't init the private environment in rebuild_env() since it may
...
have already been done implicitly sudo_setenv/sudo_unsetenv.
Multiply length by sizeof(char *) in memcpy/memmove when copying
the environment so we copy the full thing.
Add missing set of parens so we deref the right pointer in
sudo_unsetenv when searching for a matching variable.
2007-07-29 20:09:18 +00:00
Todd C. Miller
c94a3d6245
Only need sudo_setenv/sudo_unsetenv if we are going to use
...
ldap_sasl_interactive_bind_s() but don't have gss_krb5_ccache_name().
2007-07-22 19:19:39 +00:00
Todd C. Miller
8f0f4743fd
rebuild_env() and insert_env_vars() no longer return environment pointer,
...
they set environ directly.
No longer need to pass around an envp pointer since we just operate
on environ now.
Add dosync argument to insert_env() that indicates whether it should
reset environ when realloc()ing env.envp.
Use an initial size of 128 for the environment.
2007-07-18 16:57:31 +00:00
Todd C. Miller
8fa2eb187e
Split sudo_setenv() into an external version and a version only for
...
use by rebuild_env().
2007-07-18 16:41:21 +00:00
Todd C. Miller
436e3b631b
Add sudo_unsetenv() and refactor private env syncing code into sync_env().
2007-07-16 22:39:42 +00:00
Todd C. Miller
d1f6bdbcff
Remove format_env()
...
Add sudo_setenv() to replace most format_env() + insert_env() combinations.
insert_env() no longer takes a struct environment *
2007-07-15 19:41:10 +00:00
Todd C. Miller
6462c1edd2
Defer setting user-specified env vars until after authentication.
2007-07-09 19:13:38 +00:00
Todd C. Miller
25b624ce5e
honor def_default_path for PATH set on the command line
2007-07-09 17:25:45 +00:00
Todd C. Miller
87a95bb3a6
Allow user to set environment variables on the command line as long
...
as they are allowed by env_keep and env_check. Ie: apply the same
restrictions as normal environment variables.
TODO: deal with secure_path
2007-07-09 17:22:55 +00:00
Todd C. Miller
879c46e4dd
Add support for setting environment variables on the command line.
...
This is only allowed if the setenv sudoers options is enabled or if
the command is prefixed with the SETENV tag.
2007-06-23 23:58:54 +00:00
Todd C. Miller
363a2f2593
Fix preserving of variables in env_keep.
2007-06-19 16:53:09 +00:00
Todd C. Miller
f670ef29bc
add XAUTHORIZATION
2007-06-19 11:11:42 +00:00
Todd C. Miller
5ac9f1de51
Add LINGUAS to initial_checkenv_table.
...
Add COLORS, HOSTNAME, LS_COLORS, MAIL, PS1, PS2, XAUTHORITY
to intial_keepenv_table.
2007-06-18 21:33:22 +00:00
Todd C. Miller
c225668972
Treat USERNAME environemnt variable like LOGNAME/USER
2007-06-18 21:23:48 +00:00
Todd C. Miller
549c88d513
Don't need to populate keepenv table with the contents of the checkenv table.
2007-06-18 21:21:30 +00:00
Todd C. Miller
e096ae6f13
Make env_check apply when env_reset it true. Environment variables are
...
passed through unless they contain '/' or '%'. There is no need
to have a variable in both env_check and env_keep.
2007-06-18 12:56:11 +00:00
Todd C. Miller
f221ba2300
Check TERM and COLORTERM for '%' and '/' characters. From Debian.
2007-06-09 11:20:59 +00:00
Todd C. Miller
30e57038d4
Remove KRB5_KTNAME from environment. Allow COLORTERM.
2007-06-07 11:52:44 +00:00
Todd C. Miller
bf500a00d6
Add NOEXEC support for AIX 5.3 which supports LDR_PRELOAD and
...
LDR_PRELOAD64. The 64-bit version is not currently supported.
Remove zero_env() prototype as it no longer exists.
2007-01-31 15:00:48 +00:00
Todd C. Miller
be9d490e1a
Add PERL5DB to list of environment variables to remove.
2005-11-15 14:25:03 +00:00
Todd C. Miller
b9f34a5a3f
Add more environment variables to remove; from gentoo linux
...
Add some comments about what bad env variables go to what (more to do)
2005-11-13 19:51:43 +00:00
Todd C. Miller
3c6d0cc871
Add PERLLIB, PERL5LIB and PERL5OPT to the default list of environment
...
variables to remove. From Charles Morris
2005-11-07 16:02:22 +00:00
Todd C. Miller
ce8f2b10e4
add JAVA_TOOL_OPTIONS to initial_badenv_table for java 5
2005-11-01 18:24:47 +00:00
Todd C. Miller
096a289d94
add PS4 and SHELLOPTS to initial_badenv_table for bash
2005-10-28 00:35:33 +00:00
Todd C. Miller
8f90cfbd89
Preserve DISPLAY environment variable by default.
2005-06-25 21:46:16 +00:00