Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 3d4d9cc28af00be9852b4cb3055b122e > files > 129

exim-doc-4.69-4.fc12.noarch.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><style xmlns="" type="text/css">
div.added    { background-color: #ffff99; }
div.deleted  { text-decoration: line-through;
               background-color: #FF7F7F; }
div.changed  { background-color: #99ff99; }
div.off      {  }

span.added   { background-color: #ffff99; }
span.deleted { text-decoration: line-through;
               background-color: #FF7F7F; }
span.changed { background-color: #99ff99; }
span.off     {  }



pre.literallayout {
  background-color: #E8E8D0;
  padding-left: 0.5cm;
  padding-top:  5px;
  padding-bottom: 5px;
}

div[class=changed] pre.literallayout {
  background-color: #99ff99;
  padding-left: 0.5cm;
  padding-top:  5px;
  padding-bottom: 5px;
}

div.literallayout {
  background-color: #E8E8D0;
  padding-left: 0.5cm;
  padding-top:  5px;
  padding-bottom: 5px;
}

div[class=changed] div.literallayout {
  background-color: #99ff99;
  padding-left: 0.5cm;
  padding-top:  5px;
  padding-bottom: 5px;
}

</style><title>23. Environment for running local transports</title><meta name="generator" content="DocBook XSL Stylesheets V1.72.0" /><link rel="start" href="index.html" title="Specification of the Exim Mail Transfer Agent" /><link rel="up" href="index.html" title="Specification of the Exim Mail Transfer Agent" /><link rel="prev" href="ch22.html" title="22. The redirect router" /><link rel="next" href="ch24.html" title="24. Generic options for transports" /></head><body><div class="navheader">
<table width="100%" summary="Navigation header"><tr><td width="20%" align="left"><a accesskey="p" href="ch22.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch24.html">Next</a></td></tr></table></div>
<div class="chapter" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a href="index.html#toc0215" id="CHAPenvironment">23. Environment for running local transports</a></h2></div>
</div>
</div>
<p>
<a id="IIDenvlotra1" class="indexterm"></a>
<a id="IIDenvlotra2" class="indexterm"></a>
<a id="IIDenvlotra3" class="indexterm"></a>
Local transports handle deliveries to files and pipes. (The <span><strong class="command">autoreply</strong></span>
transport can be thought of as similar to a pipe.) Exim always runs transports
in subprocesses, under specified uids and gids. Typical deliveries to local
mailboxes run under the uid and gid of the local user.
</p>
<p>
Exim also sets a specific current directory while running the transport; for
some transports a home directory setting is also relevant. The <span><strong class="command">pipe</strong></span>
transport is the only one that sets up environment variables; see section
<a href="ch29.html#SECTpipeenv" title="29.4 Environment variables">29.4</a> for details.
</p>
<p>
The values used for the uid, gid, and the directories may come from several
different places. In many cases, the router that handles the address associates
settings with that address as a result of its <span><strong class="option">check_local_user</strong></span>, <span><strong class="option">group</strong></span>,
or <span><strong class="option">user</strong></span> options. However, values may also be given in the transport’s own
configuration, and these override anything that comes from the router.
</p>
<div class="section" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="index.html#toc0216" id="SECID131">23.1 Concurrent deliveries</a></h3></div>
</div>
</div>
<p>
<a id="id581338" class="indexterm"></a>
<a id="id581349" class="indexterm"></a>
If two different messages for the same local recipient arrive more or less
simultaneously, the two delivery processes are likely to run concurrently. When
the <span><strong class="command">appendfile</strong></span> transport is used to write to a file, Exim applies locking
rules to stop concurrent processes from writing to the same file at the same
time.
</p>
<p>
However, when you use a <span><strong class="command">pipe</strong></span> transport, it is up to you to arrange any
locking that is needed. Here is a silly example:
</p>
<pre class="literallayout">my_transport:
  driver = pipe
  command = /bin/sh -c 'cat &gt;&gt;/some/file'
</pre><p>
This is supposed to write the message at the end of the file. However, if two
messages arrive at the same time, the file will be scrambled. You can use the
<span><strong class="option">exim_lock</strong></span> utility program (see section <a href="ch50.html#SECTmailboxmaint" title="50.15 Mailbox maintenance (exim_lock)">50.15</a>) to lock a
file using the same algorithm that Exim itself uses.
</p>
</div>
<div class="section" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="index.html#toc0217" id="SECTenvuidgid">23.2 Uids and gids</a></h3></div>
</div>
</div>
<p>
<a id="id581422" class="indexterm"></a>
<a id="id581437" class="indexterm"></a>
All transports have the options <span><strong class="option">group</strong></span> and <span><strong class="option">user</strong></span>. If <span><strong class="option">group</strong></span> is set, it
overrides any group that the router set in the address, even if <span><strong class="option">user</strong></span> is not
set for the transport. This makes it possible, for example, to run local mail
delivery under the uid of the recipient (set by the router), but in a special
group (set by the transport). For example:
</p>
<pre class="literallayout"># Routers ...
# User/group are set by check_local_user in this router
local_users:
  driver = accept
  check_local_user
  transport = group_delivery

# Transports ...
# This transport overrides the group
group_delivery:
  driver = appendfile
  file = /var/spool/mail/$local_part
  group = mail
</pre><p>
If <span><strong class="option">user</strong></span> is set for a transport, its value overrides what is set in the
address by the router. If <span><strong class="option">user</strong></span> is non-numeric and <span><strong class="option">group</strong></span> is not set, the
gid associated with the user is used. If <span><strong class="option">user</strong></span> is numeric, <span><strong class="option">group</strong></span> must be
set.
</p>
<p>
<a id="id581512" class="indexterm"></a>
When the uid is taken from the transport’s configuration, the <em class="function">initgroups()</em>
function is called for the groups associated with that uid if the
<span><strong class="option">initgroups</strong></span> option is set for the transport. When the uid is not specified
by the transport, but is associated with the address by a router, the option
for calling <em class="function">initgroups()</em> is taken from the router configuration.
</p>
<p>
<a id="id581548" class="indexterm"></a>
The <span><strong class="command">pipe</strong></span> transport contains the special option <span><strong class="option">pipe_as_creator</strong></span>. If this
is set and <span><strong class="option">user</strong></span> is not set, the uid of the process that called Exim to
receive the message is used, and if <span><strong class="option">group</strong></span> is not set, the corresponding
original gid is also used.
</p>
<p>
This is the detailed preference order for obtaining a gid; the first of the
following that is set is used:
</p>
<div class="itemizedlist">
<ul type="disc"><li><p>
A <span><strong class="option">group</strong></span> setting of the transport;
</p>
</li><li><p>
A <span><strong class="option">group</strong></span> setting of the router;
</p>
</li><li><p>
A gid associated with a user setting of the router, either as a result of
<span><strong class="option">check_local_user</strong></span> or an explicit non-numeric <span><strong class="option">user</strong></span> setting;
</p>
</li><li><p>
The group associated with a non-numeric <span><strong class="option">user</strong></span> setting of the transport;
</p>
</li><li><p>
In a <span><strong class="command">pipe</strong></span> transport, the creator’s gid if <span><strong class="option">deliver_as_creator</strong></span> is set and
the uid is the creator’s uid;
</p>
</li><li><p>
The Exim gid if the Exim uid is being used as a default.
</p>
</li></ul></div>
<p>
If, for example, the user is specified numerically on the router and there are
no group settings, no gid is available. In this situation, an error occurs.
This is different for the uid, for which there always is an ultimate default.
The first of the following that is set is used:
</p>
<div class="itemizedlist">
<ul type="disc"><li><p>
A <span><strong class="option">user</strong></span> setting of the transport;
</p>
</li><li><p>
In a <span><strong class="command">pipe</strong></span> transport, the creator’s uid if <span><strong class="option">deliver_as_creator</strong></span> is set;
</p>
</li><li><p>
A <span><strong class="option">user</strong></span> setting of the router;
</p>
</li><li><p>
A <span><strong class="option">check_local_user</strong></span> setting of the router;
</p>
</li><li><p>
The Exim uid.
</p>
</li></ul></div>
<p>
Of course, an error will still occur if the uid that is chosen is on the
<span><strong class="option">never_users</strong></span> list.
</p>
</div>
<div class="section" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="index.html#toc0218" id="SECID132">23.3 Current and home directories</a></h3></div>
</div>
</div>
<p>
<a id="id581758" class="indexterm"></a>
<a id="id581769" class="indexterm"></a>
<a id="id581784" class="indexterm"></a>
<a id="id581798" class="indexterm"></a>
Routers may set current and home directories for local transports by means of
the <span><strong class="option">transport_current_directory</strong></span> and <span><strong class="option">transport_home_directory</strong></span> options.
However, if the transport’s <span><strong class="option">current_directory</strong></span> or <span><strong class="option">home_directory</strong></span> options
are set, they override the router’s values. In detail, the home directory
for a local transport is taken from the first of these values that is set:
</p>
<div class="itemizedlist">
<ul type="disc"><li><p>
The <span><strong class="option">home_directory</strong></span> option on the transport;
</p>
</li><li><p>
The <span><strong class="option">transport_home_directory</strong></span> option on the router;
</p>
</li><li><p>
The password data if <span><strong class="option">check_local_user</strong></span> is set on the router;
</p>
</li><li><p>
The <span><strong class="option">router_home_directory</strong></span> option on the router.
</p>
</li></ul></div>
<p>
The current directory is taken from the first of these values that is set:
</p>
<div class="itemizedlist">
<ul type="disc"><li><p>
The <span><strong class="option">current_directory</strong></span> option on the transport;
</p>
</li><li><p>
The <span><strong class="option">transport_current_directory</strong></span> option on the router.
</p>
</li></ul></div>
<p>
If neither the router nor the transport sets a current directory, Exim uses the
value of the home directory, if it is set. Otherwise it sets the current
directory to <em class="filename">/</em> before running a local transport.
</p>
</div>
<div class="section" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 xmlns="" class="title"><a xmlns="http://www.w3.org/1999/xhtml" href="index.html#toc0219" id="SECID133">23.4 Expansion variables derived from the address</a></h3></div>
</div>
</div>
<p>
<a id="id581941" class="indexterm"></a>
<a id="id581952" class="indexterm"></a>
<a id="id581964" class="indexterm"></a>
Normally a local delivery is handling a single address, and in that case the
variables such as <em class="varname">$domain</em> and <em class="varname">$local_part</em> are set during local
deliveries. However, in some circumstances more than one address may be handled
at once (for example, while writing batch SMTP for onward transmission by some
other means). In this case, the variables associated with the local part are
never set, <em class="varname">$domain</em> is set only if all the addresses have the same domain,
and <em class="varname">$original_domain</em> is never set.
<a id="id581999" class="indexterm"></a>
<a id="id582011" class="indexterm"></a>
<a id="id582023" class="indexterm"></a>
</p>
</div>
</div>
<div class="navfooter">
<table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch22.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch24.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div>
</body></html>