Bug 1969 - preexec
Summary: preexec
Status: RESOLVED INVALID
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Config Files (show other bugs)
Version: 3.0.7
Hardware: x86 Windows XP
: P3 normal
Target Milestone: none
Assignee: Samba Bugzilla Account
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-25 09:02 UTC by Tilo Lutz
Modified: 2004-10-26 02:32 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tilo Lutz 2004-10-25 09:02:32 UTC
preexec = echo $HOME > /tmp/homedir
don't work correct.
It always returns root homepath,
not user homepath.
Comment 1 Gerald (Jerry) Carter (dead mail address) 2004-10-25 10:39:53 UTC
syntax should be

    preexec = echo %$(HOME) > /tmp/homedir 

However, samba does not initialize the user's 
logon evironment so I doubt that the $HOME variable 
will work at all.  

For the home directory path, you should be using

    preexec = echo %H > /tmp/homedir 
Comment 2 Tilo Lutz 2004-10-25 10:58:16 UTC
OK.

But than this behavior should be described in the man page.
Comment 3 Gerald (Jerry) Carter (dead mail address) 2004-10-25 11:37:58 UTC
It is documented.  See the section on variables in 
the smb.conf(5) man page.
Comment 4 Tilo Lutz 2004-10-25 12:12:39 UTC
Hm

I took a look at man smb.conf and found
a section VARIABLE SUBSTITUTIONS.
It describes how to use variables in config files.

But I didn't find any comment samba doesn't
set environment variables when using preexec.
Man programs will have a strange behavoir
without them.

Example: I use smbclient and preexec with the netlogon share
sending infos to users.
Although I call smbclient as user sender name will be displayed
as "root"
Comment 5 Björn Jacke 2004-10-26 02:32:15 UTC
isn't it obvious that environment variables of the samba server's environment
are meant? Anything else would be impossible.

About the HOME also see man page:
       %H     the home directory of the user given by %u.