File: filter_33.html

package info (click to toggle)
exim-html 3.20-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge, woody
  • size: 2,868 kB
  • ctags: 4,188
  • sloc: makefile: 40; sh: 19
file content (310 lines) | stat: -rw-r--r-- 9,039 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.52
     from filter on 25 November 2000 -->

<TITLE>Exim Filter Specification - Expansion conditions</TITLE>
</HEAD>
<body bgcolor="#FFFFFF" text="#00005A" link="#FF6600" alink="#FF9933" vlink="#990000">
Go to the <A HREF="filter_1.html">first</A>, <A HREF="filter_32.html">previous</A>, <A HREF="filter_34.html">next</A>, <A HREF="filter_34.html">last</A> section, <A HREF="filter_toc.html">table of contents</A>.
<P><HR><P>


<H2><A NAME="SEC33" HREF="filter_toc.html#TOC33">Expansion conditions</A></H2>

<P>
<A NAME="IDX29"></A>
The following conditions are available for testing by the <EM>${if</EM> construct
while expanding strings:

</P>


<PRE>
<font color=blue>______________________________________________________________</font>

<b>!&#60;<EM>condition</EM>&#62;</b>
</PRE>

<P>
Preceding any condition with an exclamation mark negates the result of the
condition.

</P>


<PRE>
<b>&#60;<EM>symbolic operator</EM>&#62; {&#60;<EM>string1</EM>&#62;}{&#60;<EM>string2</EM>&#62;}</b>
</PRE>

<P>
<A NAME="IDX30"></A>
<A NAME="IDX31"></A>
There are a number of symbolic operators for doing numeric comparisons. They
are:

<PRE>
=        equal
==       equal
&#62;        greater
&#62;=       greater or equal
&#60;        less
&#60;=       less or equal
</PRE>

<P>
For example,

<PRE>
${if &#62;{$message_size}{10M} ...
</PRE>

<P>
Note that the general negation operator provides for inequality testing.
The two strings must take the form of optionally signed decimal integers,
optionally followed by one of the letters `K' or `M' (in either upper or lower
case), signifying multiplication by 1024 or 1024*1024, respectively.

</P>


<PRE>
<font color=blue>______________________________________________________________</font>

<b>def:&#60;<EM>variable name</EM>&#62;</b>
</PRE>

<P>
The <EM>def</EM> condition must be followed by the name of one of the expansion
variables defined in section 33.
The condition is true if the named expansion variable does not contain the
empty string, for example

<PRE>
${if def:sender_ident {from $sender_ident}}
</PRE>

<P>
Note that the variable name is given without a leading <EM>$</EM> character.
If the variable does not exist, the expansion fails.

</P>


<PRE>
<font color=blue>______________________________________________________________</font>

<b>def:header_&#60;<EM>header name</EM>&#62;:  or  def:h_&#60;<EM>header name</EM>&#62;:</b>
</PRE>

<P>
This condition is true if a message is being processed and the named header
exists in the message. For example,

<PRE>
${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
</PRE>

<P>
Note that no <EM>$</EM> appears before <EM>header_</EM> or <EM>h_</EM> in the condition,
and that header names must be terminated by colons if white space does not
follow.

</P>


<PRE>
<font color=blue>______________________________________________________________</font>

<b>exists {&#60;<EM>file name</EM>&#62;}</b>
</PRE>

<P>
The substring is first expanded and then interpreted as an absolute path.
The condition is true if the named file (or directory) exists. The existence
test is done by calling the <EM>stat()</EM> function.
The use of the <EM>exists</EM> test in users' filter files may be locked out by the
system administrator.

</P>


<PRE>
<b>eq {&#60;<EM>string1</EM>&#62;}{&#60;<EM>string2</EM>&#62;}</b>
</PRE>

<P>
<A NAME="IDX32"></A>
<A NAME="IDX33"></A>
The two substrings are first expanded. The condition is true if the two
resulting strings are identical, including the case of letters.

</P>


<PRE>
<font color=blue>______________________________________________________________</font>

<b>match {&#60;<EM>string1</EM>&#62;}{&#60;<EM>string2</EM>&#62;}</b>
</PRE>

<P>
The two substrings are first expanded. The second is then treated as a regular
expression and applied to the first. Because of the pre-expansion, if the
regular expression contains dollar, or backslash characters, they must be
escaped with backslashes. Care must also be taken if the regular expression
contains braces (curly brackets). A closing brace must be escaped so that it is
not taken as a premature termination of &#60;<EM>string2</EM>&#62;. It does no harm to escape
opening braces, but this is not strictly necessary. For example,

<PRE>
${if match {$local_part}{^\\d\{3\}} ...
</PRE>

<P>
If the whole expansion string is in double quotes, further escaping of
backslashes is also required.

</P>
<P>
The condition is true if the regular expression match succeeds. At the start of
an <EM>if</EM> expansion the values of the numeric variable substitutions $<EM>1</EM> etc.
are remembered. Obeying a <EM>match</EM> condition that succeeds causes them to be
reset to the substrings of that condition and they will have these values
during the expansion of the success string. At the end of the <EM>if</EM> expansion,
the previous values are restored. After testing a combination of conditions
using <EM>or</EM>, the subsequent values of the numeric variables are those of the
condition that succeeded.

</P>


<PRE>
<font color=blue>______________________________________________________________</font>

<b>pam {&#60;<EM>string1</EM>&#62;:&#60;<EM>string2</EM>&#62;:...}</b>
</PRE>

<P>
<EM>Pluggable Authentication Modules</EM>
(<A HREF="http://ftp.at.kernel.org/pub/linux/libs/pam/">http://ftp.at.kernel.org/pub/linux/libs/pam/</A>) are a facility which is
available in the latest releases of Solaris and in some GNU/Linux
distributions. The Exim support, which is intended for use in conjunction with
the SMTP AUTH command, is available only if Exim is compiled with

<PRE>
SUPPORT_PAM=yes
</PRE>

<P>
in <TT>`Local/Makefile'</TT>. You probably need to add -<EM>lpam</EM> to EXTRALIBS, and in
some releases of GNU/Linux -<EM>ldl</EM> is also needed.

</P>
<P>
<font color=green>
The argument string is first expanded, and the result must be a colon-separated
list of strings. The PAM module is initialized with the service name `exim' and
the user name taken from the first item in the colon-separated data string
(i.e. &#60;<EM>string1</EM>&#62;). The remaining items in the data string are passed over in
response to requests from the authentication function. In the simple case there
will only be one request, for a password, so the data will consist of two
strings only.

</P>
<P>
There can be problems if any of the strings are permitted to contain colon
characters. In the usual way, these have to be doubled to avoid being taken as
separators. If the data is being inserted from a variable, the <EM>sg</EM> expansion
item can be used to double any existing colons. For example, the configuration
of a LOGIN authenticator might contain this setting:

<PRE>
server_condition = ${if pam{$1:${sg{$2}{:}{::}}}{yes}{no}}
</PRE>

<P>
</font>

</P>


<PRE>
<font color=blue>______________________________________________________________</font>

<b>first_delivery</b>
</PRE>

<P>
<A NAME="IDX34"></A>
<A NAME="IDX35"></A>
This condition, which has no data, is true during a message's first delivery
attempt. It is false during any subsequent delivery attempts.

</P>


<PRE>
<font color=blue>______________________________________________________________</font>

<b>queue_running</b>
</PRE>

<P>
<A NAME="IDX36"></A>
This condition, which has no data, is true during delivery attempts that are
initiated by queue-runner processes, and false otherwise.

</P>


<PRE>
<font color=blue>______________________________________________________________</font>

<b>or {{&#60;<EM>cond1</EM>&#62;}{&#60;<EM>cond2</EM>&#62;}...}</b>
</PRE>

<P>
The sub-conditions are evaluated from left to right. The condition is true if
any one of the sub-conditions is true.
For example,

<PRE>
${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
</PRE>

<P>
When a true sub-condition is found, the following ones are parsed but not
evaluated. If there are several `match' sub-conditions the values of the
numeric variables afterwards are taken from the first one that succeeds.

</P>


<PRE>
<font color=blue>______________________________________________________________</font>

<b>and {{&#60;<EM>cond1</EM>&#62;}{&#60;<EM>cond2</EM>&#62;}...}</b>
</PRE>

<P>
The sub-conditions are evaluated from left to right. The condition is true if
all of the sub-conditions are true.
If there are several `match' sub-conditions, the values of the numeric
variables afterwards are taken from the last one.
When a false sub-condition is found, the following ones are parsed but not
evaluated.

</P>

<P>
Note that <EM>and</EM> and <EM>or</EM> are complete conditions on their own, and precede
their lists of sub-conditions. Each sub-condition must be enclosed in
braces within the overall braces that contain the list. No repetition of <EM>if</EM>
is used.

</P>
<P><HR><P>
Go to the <A HREF="filter_1.html">first</A>, <A HREF="filter_32.html">previous</A>, <A HREF="filter_34.html">next</A>, <A HREF="filter_34.html">last</A> section, <A HREF="filter_toc.html">table of contents</A>.
</BODY>
</HTML>