draft-ietf-sieve-variables-05.txt   draft-ietf-sieve-variables-06.txt 
Network Working Group K. T. Homme Network Working Group K. T. Homme
Updates: 3028 Updates: 3028
Document: draft-ietf-sieve-variables-05.txt University of Oslo Document: draft-ietf-sieve-variables-06.txt University of Oslo
Expires Feb 10, 2006 10 Aug 2005 Expires Feb 16, 2006 16 Aug 2005
Sieve Extension: Variables Sieve Extension: Variables
Status of this Memo Status of this Memo
This document is an Internet-Draft and is subject to all provisions This document is an Internet-Draft and is subject to all provisions
of section 3 of RFC 3978. By submitting this Internet-Draft, each of section 3 of RFC 3978. By submitting this Internet-Draft, each
author represents that any applicable patent or other IPR claims of author represents that any applicable patent or other IPR claims of
which he or she is aware have been or will be disclosed, and any of which he or she is aware have been or will be disclosed, and any of
which he or she becomes aware will be disclosed, in accordance with which he or she becomes aware will be disclosed, in accordance with
skipping to change at page 5, line 40 skipping to change at page 5, line 40
c) changed "Syntax:" into "Usage:" to mirror [SIEVE] convention. c) changed "Syntax:" into "Usage:" to mirror [SIEVE] convention.
d) removed description of regex interaction and :quoteregex d) removed description of regex interaction and :quoteregex
e) added note to clarify that ${0010} is the same as ${10}. e) added note to clarify that ${0010} is the same as ${10}.
f) changed name of document to align better with other extensions f) changed name of document to align better with other extensions
(uses same format at 3431 and 3894) (uses same format at 3431 and 3894)
0.3. Open Issues 0.2.11. Changes since -05
This extension is in conflict with a MUST in [SIEVE] 2.4: "Tests MUST a) removed "open issues" section.
NOT have side effects." This document therefore can't leave draft
status until a revised Sieve specification has been accepted by the b) updated [RELATIONAL] reference
IESG. No significant changes to this draft are foreseen before
submission as a proposed standard.
1. Introduction 1. Introduction
This is an extension to the Sieve language defined by [SIEVE]. It This is an extension to the Sieve language defined by [SIEVE]. It
adds support for storing and referencing named data. The mechanisms adds support for storing and referencing named data. The mechanisms
detailed in this document will only apply to Sieve scripts that detailed in this document will only apply to Sieve scripts that
include a require clause for the "variables" extension. The require include a require clause for the "variables" extension. The require
clauses themselves are not affected by this extension. clauses themselves are not affected by this extension.
Conventions for notations are as in [SIEVE] section 1.1, including Conventions for notations are as in [SIEVE] section 1.1, including
skipping to change at page 8, line 13 skipping to change at page 8, line 8
set "text" "regarding ${dollar}{beep}"; set "text" "regarding ${dollar}{beep}";
3.2. Match variables 3.2. Match variables
A "match variable" has a name consisting only of decimal digits and A "match variable" has a name consisting only of decimal digits and
has no namespace component. has no namespace component.
The decimal value of the match variable name will index the list of The decimal value of the match variable name will index the list of
matching strings from the most recently evaluated successful match of matching strings from the most recently evaluated successful match of
type ":matches". The list is empty if no match has been successful. type ":matches". The list is empty if no match has been successful.
An extension describing a new match type (e.g., [REGEX]) MAY specify
that match variables are set as a side effect when the match type is
used in a script which has enabled the "variables" extension.
Note: Extra leading zeroes are allowed and ignored. Note: Extra leading zeroes are allowed and ignored.
For ":matches", the list will contain one string for each wildcard The list will contain one string for each wildcard ("?" and "*") in
("?" and "*") in the match pattern. Each string holds what the the match pattern. Each string holds what the corresponding wildcard
corresponding wildcard expands to, possibly the empty string. The expands to, possibly the empty string. The wildcards match as little
wildcards match as little as possible (non-greedy matching). as possible (non-greedy matching).
The first string in the list has index 1. If the index is out of The first string in the list has index 1. If the index is out of
range, the empty string will be substituted. Index 0 contains the range, the empty string will be substituted. Index 0 contains the
matched part of the source value. matched part of the source value.
The interpreter MUST short-circuit tests, ie. not perform more tests The interpreter MUST short-circuit tests, ie. not perform more tests
than necessary to find the result. Evaluation order MUST be left to than necessary to find the result. Evaluation order MUST be left to
right. If a test has two or more list arguments, the implementation right. If a test has two or more list arguments, the implementation
is free to choose which to iterate over first. is free to choose which to iterate over first.
An extension describing a new match type (e.g., [REGEX]) MAY specify
that match variables are set as a side effect when the match type is
used in a script which has enabled the "variables" extension.
Example: Example:
require ["fileinto", "variables"]; require ["fileinto", "variables"];
if header :matches "List-ID" "*<*@*" { if header :matches "List-ID" "*<*@*" {
fileinto "lists.${2}"; stop; fileinto "lists.${2}"; stop;
} }
# Imagine the header # Imagine the header
# Subject: [acme-users] [fwd] version 1.0 is out # Subject: [acme-users] [fwd] version 1.0 is out
skipping to change at page 10, line 30 skipping to change at page 10, line 24
+--------------------------------+ +--------------------------------+
| 30 :lowerfirst | | 30 :lowerfirst |
| :upperfirst | | :upperfirst |
+--------------------------------+ +--------------------------------+
| 20 :quotewildcard | | 20 :quotewildcard |
+--------------------------------+ +--------------------------------+
| 10 :length | | 10 :length |
+--------------------------------+ +--------------------------------+
It is an error to use two or more modifiers of the same precedence in It is an error to use two or more modifiers of the same precedence in
a single SET command. a single "set" action.
Examples: Examples:
# The value assigned to the variable is printed after the arrow # The value assigned to the variable is printed after the arrow
set "a" "juMBlEd lETteRS"; => "juMBlEd lETteRS" set "a" "juMBlEd lETteRS"; => "juMBlEd lETteRS"
set :length "b" "${a}"; => "15" set :length "b" "${a}"; => "15"
set :lower "b" "${a}"; => "jumbled letters" set :lower "b" "${a}"; => "jumbled letters"
set :lower :comparator "i;octet" set :lower :comparator "i;octet"
"b" "${a}"; => "juMBlEd lETteRS" "b" "${a}"; => "juMBlEd lETteRS"
set :upperfirst "b" "${a}"; => "JuMBlEd lETteRS" set :upperfirst "b" "${a}"; => "JuMBlEd lETteRS"
set :upperfirst :lower "b" "${a}"; => "Jumbled letters" set :upperfirst :lower "b" "${a}"; => "Jumbled letters"
skipping to change at page 12, line 36 skipping to change at page 12, line 28
Match variables ${1} through ${9} MUST be supported. References to Match variables ${1} through ${9} MUST be supported. References to
higher indices than the implementation supports MUST be treated as a higher indices than the implementation supports MUST be treated as a
syntax error which SHOULD be discovered at compile-time. syntax error which SHOULD be discovered at compile-time.
7. Security Considerations 7. Security Considerations
When match variables are used, and the author of the script isn't When match variables are used, and the author of the script isn't
careful, strings can contain arbitrary values controlled by the careful, strings can contain arbitrary values controlled by the
sender of the mail. sender of the mail.
Since values stored by SET exceeding implementation limits are Since values stored by "set" which exceed implementation limits are
silently truncated, it's not appropriate to store large structures silently truncated, it's not appropriate to store large structures
with security implications in variables. with security implications in variables.
The introduction of variables makes advanced decision making easier The introduction of variables makes advanced decision making easier
to write, but since no looping construct is provided, all Sieve to write, but since no looping construct is provided, all Sieve
scripts will terminate in an orderly manner. scripts will terminate in an orderly manner.
Sieve filtering should not be relied on as a security measure against Sieve filtering should not be relied on as a security measure against
hostile mail messages. Sieve is designed to do simple, mostly static hostile mail messages. Sieve is designed to do simple, mostly static
tests, and is not suitable for use as a spam or virus checker, where tests, and is not suitable for use as a spam or virus checker, where
skipping to change at page 14, line 8 skipping to change at page 13, line 42
11. References 11. References
11.1. Normative references 11.1. Normative references
[ABNF] Crocker, D. and Overell, P., "Augmented BNF for Syntax [ABNF] Crocker, D. and Overell, P., "Augmented BNF for Syntax
Specifications: ABNF", RFC 2234, November 1997. Specifications: ABNF", RFC 2234, November 1997.
[KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate [KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", RFC 2119, March 1997. Requirement Levels", RFC 2119, March 1997.
[RELATIONAL] Segmuller, W., "Sieve Extension: Relational Tests", [RELATIONAL] Leiba, B. and Segmuller, W., "Sieve Extension:
RFC 3431, December 2002. Relational Tests", Work in Progress, draft-ietf-
sieve-3431bis-XX.txt
[SIEVE] Guenther, P. and Showalter, T., "Sieve: An Email [SIEVE] Guenther, P. and Showalter, T., "Sieve: An Email
Filtering Language", Work in Progress, draft-ietf- Filtering Language", Work in Progress, draft-ietf-
sieve-3028bis-XX.txt sieve-3028bis-XX.txt
[UNICODE] The Unicode Consortium, "The Unicode Standard -- [UNICODE] The Unicode Consortium, "The Unicode Standard --
Worldwide Character Encoding -- Version 1.0", Addison- Worldwide Character Encoding -- Version 1.0", Addison-
Wesley, Volume 1, 1991, Volume 2, 1992. Wesley, Volume 1, 1991, Volume 2, 1992.
[UTF-8] Yergeau, F., "UTF-8, a transformation format of [UTF-8] Yergeau, F., "UTF-8, a transformation format of
 End of changes. 

This html diff was produced by rfcdiff 1.25, available from http://www.levkowetz.com/ietf/tools/rfcdiff/