[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fwd: Obscure problem with Bash when printing]
From: |
Francis Litterio |
Subject: |
Re: [Fwd: Obscure problem with Bash when printing] |
Date: |
Mon, 21 Jul 2003 09:36:46 -0400 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (windows-nt) |
James Richard Tyrer wrote:
>> While this is an obscure problem. It is a very serious bug since Bash does
>> not correctly set HOME to match the user as reported by:
>> id -un
>
> I thought that I should clarify that this ONLY happens when the LPR daemon
> (which is running as root) calls the filter script (as the user that submitted
> the job) that HOME is not correctly set to the: "passwd" file entry for the
> user.
An examination of the source code (file variables.c) shows that Bash
sets HOME only if it's not already in the environment:
/* Set $HOME to the information in the password file if we didn't get
it from the environment. */
...
static void
set_home_var ()
{
SHELL_VAR *temp_var;
temp_var = find_variable ("HOME");
if (temp_var == 0)
temp_var = bind_variable ("HOME", sh_get_home_dir ());
#if 0
VSETATTR (temp_var, att_exported);
#endif
}
Thus, it is the LPR daemon that is not changing HOME before exec'ing the
filter script.