draft-ietf-sieve-include-01.txt   draft-ietf-sieve-include-02.txt 
Network Working Group C. Daboo Network Working Group C. Daboo
Internet-Draft A. Stone Internet-Draft A. Stone
Expires: September 30, 2009 March 29, 2009 Expires: November 5, 2009 May 4, 2009
Sieve Email Filtering: Include Extension Sieve Email Filtering: Include Extension
draft-ietf-sieve-include-01 draft-ietf-sieve-include-02
Status of this Memo Status of this Memo
This Internet-Draft is submitted to IETF in full conformance with the This Internet-Draft is submitted to IETF in full conformance with the
provisions of BCP 78 and BCP 79. This document may contain material provisions of BCP 78 and BCP 79. This document may contain material
from IETF Documents or IETF Contributions published or made publicly from IETF Documents or IETF Contributions published or made publicly
available before November 10, 2008. The person(s) controlling the available before November 10, 2008. The person(s) controlling the
copyright in some of this material may not have granted the IETF copyright in some of this material may not have granted the IETF
Trust the right to allow modifications of such material outside the Trust the right to allow modifications of such material outside the
IETF Standards Process. Without obtaining an adequate license from IETF Standards Process. Without obtaining an adequate license from
skipping to change at page 1, line 41 skipping to change at page 1, line 41
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
The list of current Internet-Drafts can be accessed at The list of current Internet-Drafts can be accessed at
http://www.ietf.org/ietf/1id-abstracts.txt. http://www.ietf.org/ietf/1id-abstracts.txt.
The list of Internet-Draft Shadow Directories can be accessed at The list of Internet-Draft Shadow Directories can be accessed at
http://www.ietf.org/shadow.html. http://www.ietf.org/shadow.html.
This Internet-Draft will expire on September 30, 2009. This Internet-Draft will expire on November 5, 2009.
Copyright Notice Copyright Notice
Copyright (c) 2009 IETF Trust and the persons identified as the Copyright (c) 2009 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents in effect on the date of Provisions Relating to IETF Documents in effect on the date of
publication of this document (http://trustee.ietf.org/license-info). publication of this document (http://trustee.ietf.org/license-info).
Please review these documents carefully, as they describe your rights Please review these documents carefully, as they describe your rights
skipping to change at page 2, line 18 skipping to change at page 2, line 18
Abstract Abstract
The Sieve Email Filtering "include" extension permits users to The Sieve Email Filtering "include" extension permits users to
include one Sieve script inside another. This can make managing include one Sieve script inside another. This can make managing
large scripts or multiple sets of scripts much easier, and allows a large scripts or multiple sets of scripts much easier, and allows a
site and its users to build up libraries of scripts. Users are able site and its users to build up libraries of scripts. Users are able
to include their own personal scripts or site-wide scripts. to include their own personal scripts or site-wide scripts.
Change History (to be removed prior to publication as an RFC) Change History (to be removed prior to publication as an RFC)
Changes from ietf-01 to ietf-02:
a. Require that script names must be constant strings, not subject
to variable expansion.
b. Try the phrase immediate script instead of current script.
c. Clarify that "global 'varname'" and "global.varname" refer to the
same variable.
d. Drop the requirement the global keywords come after require and
before anything else.
Changes from ietf-00 to ietf-01: Changes from ietf-00 to ietf-01:
a. Replaced import/export with global. a. Replaced import/export with global.
b. Added :once modifier to include. b. Added :once modifier to include.
c. Added global namespace to see if it holds water. c. Added global namespace to see if it holds water.
Changes from daboo-06 to ietf-00: Changes from daboo-06 to ietf-00:
a. None a. None
Changes from -05 to -06: Changes from -05 to -06:
a. Aaron Stone joins as author. a. Aaron Stone joins as author.
skipping to change at page 2, line 42 skipping to change at page 3, line 4
a. Fixed examples. a. Fixed examples.
b. Relaxed requirement that imported/exported variables be set b. Relaxed requirement that imported/exported variables be set
before being used. before being used.
Changes from -03 to -04: Changes from -03 to -04:
a. Fixed missing 2119 definitions. a. Fixed missing 2119 definitions.
b. Defined interaction with variables through use of import and b. Defined interaction with variables through use of import and
export commands. export commands.
Changes from -02 to -03: Changes from -02 to -03:
a. Refreshing expired draft (updated for nits). a. Refreshing expired draft (updated for nits).
b. Syntax -> Usage. b. Syntax -> Usage.
c. Updated to 3028bis reference. c. Updated to 3028bis reference.
Changes from -01 to -02: Changes from -01 to -02:
a. Minor formatting changes only - refreshing expired draft. a. Minor formatting changes only - refreshing expired draft.
Changes from -00 to -01: Changes from -00 to -01:
a. Added IPR boiler plate. a. Added IPR boiler plate.
b. Re-ordered sections at start to conform to RFC style. b. Re-ordered sections at start to conform to RFC style.
c. Moved recursion comment into General Considerations section. c. Moved recursion comment into General Considerations section.
d. Switched to using optional parameter to indicate personal vs d. Switched to using optional parameter to indicate personal vs
global. global.
e. Explicitly state that an error occurs when a missing script is e. Explicitly state that an error occurs when a missing script is
included. included.
Open Issues (to be resolved prior to publication as an RFC)
a. Interaction with variables (scoping). Idea 1: use a "global"
command to make a variable shared between scripts. Idea 2: use a
"global" variable namespace and no additional commands.
Table of Contents Table of Contents
1. Introduction and Overview . . . . . . . . . . . . . . . . . . 4 1. Introduction and Overview . . . . . . . . . . . . . . . . . . 4
2. Conventions Used in This Document . . . . . . . . . . . . . . 4 2. Conventions Used in This Document . . . . . . . . . . . . . . 4
3. Include Extension . . . . . . . . . . . . . . . . . . . . . . 4 3. Include Extension . . . . . . . . . . . . . . . . . . . . . . 4
3.1. General Considerations . . . . . . . . . . . . . . . . . . 4 3.1. General Considerations . . . . . . . . . . . . . . . . . . 4
3.2. Control Structure include . . . . . . . . . . . . . . . . 5 3.2. Control Structure include . . . . . . . . . . . . . . . . 5
3.3. Control Structure return . . . . . . . . . . . . . . . . . 8 3.3. Control Structure return . . . . . . . . . . . . . . . . . 8
3.4. Interaction with Variables . . . . . . . . . . . . . . . . 8 3.4. Interaction with Variables . . . . . . . . . . . . . . . . 8
3.4.1. Control Structure global . . . . . . . . . . . . . . . 9 3.4.1. Control Structure global . . . . . . . . . . . . . . . 9
3.4.2. Variables Namespace global . . . . . . . . . . . . . . 10 3.4.2. Variables Namespace global . . . . . . . . . . . . . . 10
4. Security Considerations . . . . . . . . . . . . . . . . . . . 10 4. Security Considerations . . . . . . . . . . . . . . . . . . . 11
5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11
5.1. "include" Extension Registration . . . . . . . . . . . . . 11 5.1. "include" Extension Registration . . . . . . . . . . . . . 11
6. Normative References . . . . . . . . . . . . . . . . . . . . . 11 6. References . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Appendix A. Acknowledgments . . . . . . . . . . . . . . . . . . . 11 6.1. Normative References . . . . . . . . . . . . . . . . . . . 12
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 11 6.2. Informative References . . . . . . . . . . . . . . . . . . 12
Appendix A. Acknowledgments . . . . . . . . . . . . . . . . . . . 12
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 12
1. Introduction and Overview 1. Introduction and Overview
It's convenient to be able to break SIEVE [RFC5228] scripts down into It's convenient to be able to break SIEVE [RFC5228] scripts down into
smaller components which can be reused in a variety of different smaller components which can be reused in a variety of different
circumstances. For example, users may want to have a default script circumstances. For example, users may want to have a default script
and a special 'vacation' script, the latter being activated when the and a special 'vacation' script, the latter being activated when the
user goes on vacation. In that case the default actions should user goes on vacation. In that case the default actions should
continue to be run, but a vacation command should be executed first. continue to be run, but a vacation command should be executed first.
One option is to edit the default script to add or remove the One option is to edit the default script to add or remove the
skipping to change at page 5, line 36 skipping to change at page 5, line 36
3.2. Control Structure include 3.2. Control Structure include
Usage: include [LOCATION] [ONCE] <value: string> Usage: include [LOCATION] [ONCE] <value: string>
LOCATION = ":personal" / ":global" LOCATION = ":personal" / ":global"
ONCE = ":once" ONCE = ":once"
The "include" command takes an optional "location" parameter, an The "include" command takes an optional "location" parameter, an
optional ":once" parameter, and a single string argument representing optional ":once" parameter, and a single string argument representing
the name of the script to include for processing at that point. the name of the script to include for processing at that point. It
is RECOMMENDED that implementations restrict script names according
to [I-D.ietf-sieve-managesieve] Section 1.7. Implementations MUST
NOT allow variables to be expanded into the names of Sieve scripts;
in other words, the value MUST be a constant string as defined in by
VARIABLES [RFC5229] Section 3.
The "location" parameter MUST default to ":personal" if not The "location" parameter MUST default to ":personal" if not
specified. The "location" has the following meanings: specified. The "location" has the following meanings:
:personal :personal
Indicates that the named script is stored in the user's own Indicates that the named script is stored in the user's own
personal (private) Sieve repository. personal (private) Sieve repository.
:global :global
Indicates that the named script is stored in a site-wide Sieve Indicates that the named script is stored in a site-wide Sieve
repository, accessible to all users of the Sieve system. repository, accessible to all users of the Sieve system.
The ":once" parameter tells the interpreter only to include the Sieve The ":once" parameter tells the interpreter only to include the named
script if it has not already been included at any other point during script if it has not already been included at any other point during
the script execution. If the script has already been included, script execution. If the script has already been included,
processing continues immediately following the include command. processing continues immediately following the include command.
Implementations MUST NOT generate an error if an "include :once" Implementations MUST NOT generate an error if an "include :once"
command names a script whose inclusion would be recursive; in this command names a script whose inclusion would be recursive; in this
case, the script MUST be considered previously included and therefore case, the script MUST be considered previously included and therefore
"include :once" will not include it again. "include :once" will not include it again.
Note: It is RECOMMENDED that script authors / generators use this Note: It is RECOMMENDED that script authors / generators use this
parameter only when including a script that performs general duties parameter only when including a script that performs general duties
such as declaring global variables and making sanity checks of the such as declaring global variables and making sanity checks of the
environment. environment.
skipping to change at page 6, line 18 skipping to change at page 6, line 26
"include :once" will not include it again. "include :once" will not include it again.
Note: It is RECOMMENDED that script authors / generators use this Note: It is RECOMMENDED that script authors / generators use this
parameter only when including a script that performs general duties parameter only when including a script that performs general duties
such as declaring global variables and making sanity checks of the such as declaring global variables and making sanity checks of the
environment. environment.
The included script MUST be a valid Sieve script, including having The included script MUST be a valid Sieve script, including having
necessary "require" statements for all optional capabilities used by necessary "require" statements for all optional capabilities used by
the script. The scope of a "require" statement in an included script the script. The scope of a "require" statement in an included script
is for that script only, not the including script. For example, if is for the immediate script only, not the including script. For
script "A" includes script "B", and script "B" uses the "fileinto" example, if script "A" includes script "B", and script "B" uses the
extension, script "B" must have a "require" statement for "fileinto", "fileinto" extension, script "B" must have a "require" statement for
irrespective of whether script "A" has one. In addition, if script "fileinto", irrespective of whether script "A" has one. In addition,
"A" does not have a "require" statement for "fileinto", "fileinto" if script "A" does not have a "require" statement for "fileinto",
cannot be used anywhere in script "A", even after inclusion of script "fileinto" cannot be used anywhere in script "A", even after
"B". inclusion of script "B".
A "stop" command in an included script MUST stop all script A "stop" command in an included script MUST stop all script
processing, including the processing of the scripts that include the processing, including the processing of the scripts that include the
current one. The "return" command (described below) stops processing immediate one. The "return" command (described below) stops
of the current script only, and allows the scripts that include it to processing of the immediate script only, and allows the scripts that
continue. include it to continue.
Examples: Examples:
The user has four scripts stored in their personal repository: The user has four scripts stored in their personal repository:
"default" "default"
This is the default active script that includes several others. This is the default active script that includes several others.
require ["include"]; require ["include"];
skipping to change at page 8, line 30 skipping to change at page 8, line 37
if anyof (header :contains "Subject" "$$", if anyof (header :contains "Subject" "$$",
header :contains "Subject" "Make money") header :contains "Subject" "Make money")
{ {
include "my_reject_script"; include "my_reject_script";
} }
3.3. Control Structure return 3.3. Control Structure return
Usage: return Usage: return
The "return" command stops processing of the currently included The "return" command stops processing of the immediately included
script only and returns processing control to the script which script only and returns processing control to the script which
includes it. If used in the main script (i.e. not in an included includes it. If used in the main script (i.e. not in an included
script), it has the same effect as the "stop" command, including the script), it has the same effect as the "stop" command, including the
appropriate "keep" action if no other actions have been executed up appropriate "keep" action if no other actions have been executed up
to that point. to that point.
3.4. Interaction with Variables 3.4. Interaction with Variables
In order to avoid problems of variables in an included script In order to avoid problems of variables in an included script
"overwriting" those from the script that includes it, this "overwriting" those from the script that includes it, this
specification requires that all variables defined in a script MUST be specification requires that all variables defined in a script MUST be
kept "private" to that script by default - i.e. they are not kept "private" to the immediate script by default - i.e. they are not
"visible" to other scripts. This ensures that two script authors "visible" to other scripts. This ensures that two script authors
cannot inadvertently cause problems by choosing the same name for a cannot inadvertently cause problems by choosing the same name for a
variable. variable.
However, sometimes there is a need to make a variable defined in one However, sometimes there is a need to make a variable defined in one
script available to others. This specification defines the new script available to others. This specification defines the new
command "global" to declare that a variable is shared among scripts. command "global" to declare that a variable is shared among scripts.
Effectively, two namespaces are defined: one local to the current Effectively, two namespaces are defined: one local to the immediate
script, and another shared among all scripts. Implementations MUST script, and another shared among all scripts. Implementations MUST
allow a non-global variable to have the same name as a global allow a non-global variable to have the same name as a global
variable but have no interaction between them. variable but have no interaction between them.
3.4.1. Control Structure global 3.4.1. Control Structure global
Usage: global <value: string-list> Usage: global <value: string-list>
The "global" command contains a string list argument that defines one The "global" command contains a string list argument that defines one
or more names of variables to be stored in the global variable space. or more names of variables to be stored in the global variable space.
The "global" command, if present, MUST be used immediately after any If a "global" command is given the name of a variable that has been
"require" commands (at least one of which will be present listing the defined in the immediate script, any value stored in the global space
"include" extension). Multiple "global" commands are allowed. An is overwritten with the value of the variable in the script.
error occurs if an "global" command appears after a command other
than "require" or "global". Use of the "global" command makes the
listed variables immediately available for use in the body of the
script that uses it.
If a "global" command lists a variable that has not been defined in If a "global" command lists a variable that has not been defined in
the global namespace, the name of the variable is nonetheless marked the global namespace, the name of the variable is nonetheless marked
as global, and any subsequent "set" command will set the value of the as global, and any subsequent "set" command will set the value of the
variable in global scope. variable in global scope.
Interpretation of a string containing a variable marked as global, Interpretation of a string containing a variable marked as global,
but without any value set, SHALL behave as any other access to an but without any value set, SHALL behave as any other access to an
unknown variable, as specified in Section 3 of [RFC5229] (that is, unknown variable, as specified in Section 3 of [RFC5229] (that is,
the unknown variable reference evaltuates to an empty string). the unknown variable reference evaltuates to an empty string).
skipping to change at page 10, line 29 skipping to change at page 10, line 49
In addition to the "global" command, this document defines the In addition to the "global" command, this document defines the
variables namespace "global", per [RFC5229], Section 3. variables namespace "global", per [RFC5229], Section 3.
Example: Example:
require ["variables", "include"]; require ["variables", "include"];
set "global.i_am_on_vacation" "1"; set "global.i_am_on_vacation" "1";
[[[ Does it make sense to have this form instead of the "global" Variables declared global and variables accessed via the global
command? Does it make sense to have both? If both, it would make namespace MUST be one and the same. In the following example script,
sense that the two syntaxes reference the same set of variables. By we see the variable "i_am_on_vacation" used in a "global" command,
way of example: and again with the "global." namespace. Consider these as two
syntaxes with identical meaning.
Example:
require ["variables", "include"]; require ["variables", "include"];
global "i_am_on_vacation"; global "i_am_on_vacation";
set "global.i_am_on_vacation" "1"; set "global.i_am_on_vacation" "1";
if string :is "${i_am_on_vacation}" "1" if string :is "${i_am_on_vacation}" "1"
{ {
vacation "It's true, I am on vacation." vacation "It's true, I am on vacation."
} }
]]]
4. Security Considerations 4. Security Considerations
Sieve implementations MUST ensure adequate security for the global Sieve implementations MUST ensure adequate security for the global
script repository to prevent unauthorized changes to global scripts. script repository to prevent unauthorized changes to global scripts.
Beyond that, the "include" extension does not raise any security Sieve implementations MUST ensure that script names are checked for
considerations that are not present in the base Sieve protocol, and validity and proper permissions prior to inclusion, in order to
these issues are discussed in Sieve. prevent a malicious user from gaining acess to files accessible to
the mail server software that should not be accessible to the user.
Beyond these, the "include" extension does not raise any security
considerations that are not present in the base SIEVE [RFC5228]
document.
5. IANA Considerations 5. IANA Considerations
The following template specifies the IANA registration of the Sieve The following template specifies the IANA registration of the Sieve
extension specified in this document: extension specified in this document:
5.1. "include" Extension Registration 5.1. "include" Extension Registration
Capability name: include Capability name: include
Description: add the "include" command to execute other Sieve Description: add the "include" command to execute other Sieve
scripts. scripts.
RFC number: this RFC RFC number: this RFC
Contact address: the Sieve discussion list <ietf-mta-filters@imc.org> Contact address: the Sieve discussion list <ietf-mta-filters@imc.org>
6. Normative References 6. References
6.1. Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997. Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC5228] Guenther, P. and T. Showalter, "Sieve: An Email Filtering [RFC5228] Guenther, P. and T. Showalter, "Sieve: An Email Filtering
Language", RFC 5228, January 2008. Language", RFC 5228, January 2008.
[RFC5229] Homme, K., "Sieve Email Filtering: Variables Extension", [RFC5229] Homme, K., "Sieve Email Filtering: Variables Extension",
RFC 5229, January 2008. RFC 5229, January 2008.
6.2. Informative References
[I-D.ietf-sieve-managesieve]
Martin, T. and A. Melnikov, "A Protocol for Remotely
Managing Sieve Scripts", draft-ietf-sieve-managesieve-09
(work in progress), January 2009.
Appendix A. Acknowledgments Appendix A. Acknowledgments
Thanks to Ken Murchison, Rob Siemborski, Alexey Melnikov, Marc Mutz Thanks to Ken Murchison, Rob Siemborski, Alexey Melnikov, Marc Mutz,
and Kjetil Torgrim Homme for comments and corrections. Kjetil Torgrim Homme, Stephan Bosch, and Arnt Gulbrandsen for
comments and corrections.
Authors' Addresses Authors' Addresses
Cyrus Daboo Cyrus Daboo
Email: cyrus@daboo.name Email: cyrus@daboo.name
Aaron Stone Aaron Stone
Email: aaron@serendipity.palo-alto.ca.us Email: aaron@serendipity.palo-alto.ca.us
 End of changes. 26 change blocks. 
50 lines changed or deleted 72 lines changed or added

This html diff was produced by rfcdiff 1.35. The latest version is available from http://tools.ietf.org/tools/rfcdiff/