Internet Engineering Task Force (IETF) C. Daboo Request for Comments: 6609 Apple, Inc. Category: Standards Track A. Stone ISSN: 2070-1721 Serendipity May 2012
Internet Engineering Task Force (IETF) C. Daboo Request for Comments: 6609 Apple, Inc. Category: Standards Track A. Stone ISSN: 2070-1721 Serendipity May 2012
Sieve Email Filtering: Include Extension
筛选电子邮件筛选:包括扩展名
Abstract
摘要
The Sieve Email Filtering "include" extension permits users to include one Sieve script inside another. This can make managing 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 to include their own personal scripts or site-wide scripts.
Sieve电子邮件过滤“include”扩展允许用户将一个Sieve脚本包含在另一个脚本中。这可以使管理大型脚本或多组脚本变得更加容易,并允许站点及其用户建立脚本库。用户可以包含自己的个人脚本或站点范围的脚本。
Status of This Memo
关于下段备忘
This is an Internet Standards Track document.
这是一份互联网标准跟踪文件。
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.
本文件是互联网工程任务组(IETF)的产品。它代表了IETF社区的共识。它已经接受了公众审查,并已被互联网工程指导小组(IESG)批准出版。有关互联网标准的更多信息,请参见RFC 5741第2节。
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc6609.
有关本文件当前状态、任何勘误表以及如何提供反馈的信息,请访问http://www.rfc-editor.org/info/rfc6609.
Copyright Notice
版权公告
Copyright (c) 2012 IETF Trust and the persons identified as the document authors. All rights reserved.
版权所有(c)2012 IETF信托基金和确定为文件作者的人员。版权所有。
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
本文件受BCP 78和IETF信托有关IETF文件的法律规定的约束(http://trustee.ietf.org/license-info)自本文件出版之日起生效。请仔细阅读这些文件,因为它们描述了您对本文件的权利和限制。从本文件中提取的代码组件必须包括信托法律条款第4.e节中所述的简化BSD许可证文本,并提供简化BSD许可证中所述的无担保。
Table of Contents
目录
1. Introduction and Overview .......................................2 2. Conventions Used in This Document ...............................2 3. Include Extension ...............................................3 3.1. General Considerations .....................................3 3.2. Control Structure "include" ................................4 3.3. Control Structure "return" .................................7 3.4. Interaction with the "variables" Extension .................8 3.4.1. Control Structure "global" ..........................8 3.4.2. Variables Namespace global .........................10 3.5. Interaction with Other Extensions .........................11 4. Security Considerations ........................................12 5. IANA Considerations ............................................12 6. References .....................................................13 6.1. Normative References ......................................13 6.2. Informative References ....................................13 Appendix A. Acknowledgments .......................................14
1. Introduction and Overview .......................................2 2. Conventions Used in This Document ...............................2 3. Include Extension ...............................................3 3.1. General Considerations .....................................3 3.2. Control Structure "include" ................................4 3.3. Control Structure "return" .................................7 3.4. Interaction with the "variables" Extension .................8 3.4.1. Control Structure "global" ..........................8 3.4.2. Variables Namespace global .........................10 3.5. Interaction with Other Extensions .........................11 4. Security Considerations ........................................12 5. IANA Considerations ............................................12 6. References .....................................................13 6.1. Normative References ......................................13 6.2. Informative References ....................................13 Appendix A. Acknowledgments .......................................14
It's convenient to be able to break Sieve [RFC5228] scripts down into smaller components that can be reused in a variety of different circumstances. For example, users may want to have a default script and a special 'vacation' script, the latter being activated when the user goes on vacation. In that case, the default actions should 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 vacation command as needed. Another is to have a vacation script that simply has a vacation command and then includes the default script.
可以方便地将Sieve[RFC5228]脚本分解为更小的组件,这些组件可以在各种不同的环境中重用。例如,用户可能希望有一个默认脚本和一个特殊的“假期”脚本,后者在用户休假时被激活。在这种情况下,应继续运行默认操作,但应首先执行休假命令。一个选项是编辑默认脚本,根据需要添加或删除休假命令。另一种方法是创建一个假期脚本,该脚本只包含一个假期命令,然后包含默认脚本。
This document defines the Sieve Email Filtering "include" extension, which permits users to include one Sieve script inside another.
本文档定义了Sieve电子邮件过滤“include”扩展,它允许用户将一个Sieve脚本包含在另一个脚本中。
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].
本文件中的关键词“必须”、“不得”、“必需”、“应”、“不应”、“应”、“不应”、“建议”、“可”和“可选”应按照[RFC2119]中所述进行解释。
Conventions for notations are as in Sieve [RFC5228], Section 1.1.
符号惯例见筛[RFC5228]第1.1节。
The following key phrases are used to describe scripts and script execution:
以下关键短语用于描述脚本和脚本执行:
script a valid Sieve script.
为有效的筛选脚本编写脚本。
script execution an instance of a Sieve interpreter invoked for a given message delivery, starting with the user's active script and continuing through any included scripts until the final disposition of the message (e.g., delivered, forwarded, discarded, rejected, etc.).
脚本执行为给定的消息传递调用的筛解释器实例,从用户的活动脚本开始,继续执行任何包含的脚本,直到消息的最终处置(例如,传递、转发、丢弃、拒绝等)。
immediate script the individual Sieve script file being executed.
立即脚本正在执行的单个筛选脚本文件。
including script the individual Sieve script file that had an include statement that included the immediate script.
include script包含包含即时脚本的include语句的单个Sieve脚本文件。
Sieve implementations that implement the "include", "return", and "global" commands described below have an identifier of "include" for use with the capability mechanism. If any of the "include", "return", or "global" commands are used in a script, the "include" capability MUST be listed in the "require" statement in that script.
实现下面描述的“include”、“return”和“global”命令的Sieve实现的标识符为“include”,用于功能机制。如果脚本中使用了任何“include”、“return”或“global”命令,“include”功能必须在该脚本的“require”语句中列出。
Sieve implementations need to track the use of actions in included scripts so that implicit "keep" behavior can be properly determined based on whether any actions have executed in any script.
筛实现需要跟踪所包含脚本中操作的使用情况,以便根据是否在任何脚本中执行了任何操作来正确确定隐式“保留”行为。
Sieve implementations are allowed to limit the total number of nested included scripts, but MUST provide for a total of at least three levels of nested scripts including the top-level script. An error MUST be generated either when the script is uploaded to the Sieve repository, or when the script is executed, if any nesting limit is exceeded. If such an error is detected whilst processing a Sieve script, an implicit "keep" action MUST be executed to prevent loss of any messages.
Sieve实现允许限制嵌套包含脚本的总数,但必须提供至少三个级别的嵌套脚本,包括顶级脚本。将脚本上载到Sieve存储库时,或者如果超过任何嵌套限制,则在执行脚本时,必须生成错误。如果在处理筛选脚本时检测到此类错误,则必须执行隐式“保留”操作以防止丢失任何消息。
Sieve implementations MUST NOT allow recursive script inclusion. Both direct recursion, where script A includes script A (itself), and indirect recursion, where script A includes script B which includes script A once again, are prohibited.
筛实现不能允许包含递归脚本。禁止直接递归(其中脚本A包含脚本A(自身))和间接递归(其中脚本A包含脚本B,脚本B再次包含脚本A)。
Sieve implementations MUST generate an error at execution time if an included script is a recursive inclusion. Implementations MUST NOT generate errors for recursive includes at upload time, as this would force an upload ordering requirement upon script authors and generators.
如果包含的脚本是递归包含,则筛选实现必须在执行时生成错误。实现在上载时不得为递归包含生成错误,因为这将强制脚本作者和生成器执行上载顺序要求。
Sieve implementations MUST generate an error at execution time if an included script does not exist, except when the ":optional" parameter is specified. Implementations MUST NOT generate errors for scripts missing at upload time, as this would force an upload ordering requirement upon script authors and generators.
如果包含的脚本不存在,则筛选实现必须在执行时生成错误,除非指定了“:optional”参数。实现不能为上传时丢失的脚本生成错误,因为这将强制脚本作者和生成器执行上传顺序要求。
If the Sieve "variables" extension [RFC5229] is present, an issue arises with the "scope" of variables defined in scripts that may include each other. For example, if a script defines the variable "${status}" with one particular meaning or usage, and another defines "${status}" with a different meaning, then if one script includes the other there is an issue as to which "${status}" is being referenced. To solve this problem, Sieve implementations MUST follow the scoping rules defined in Section 3.4 and support the "global" command defined there.
如果存在筛选“变量”扩展[RFC5229],则脚本中定义的变量的“范围”可能会出现问题,这些变量可能相互包含。例如,如果一个脚本定义变量“${status}”具有一个特定的含义或用法,而另一个脚本定义“${status}”具有不同的含义,那么如果一个脚本包含另一个脚本,则存在引用“${status}”的问题。为了解决这个问题,Sieve实现必须遵循第3.4节中定义的范围规则,并支持其中定义的“global”命令。
Usage: include [LOCATION] [":once"] [":optional"] <value: string>
Usage: include [LOCATION] [":once"] [":optional"] <value: string>
LOCATION = ":personal" / ":global"
LOCATION = ":personal" / ":global"
The "include" command takes an optional "location" parameter, an optional ":once" parameter, an optional ":optional" parameter, and a single string argument representing the name of the script to include for processing at that point. Implementations MUST restrict script names according to ManageSieve [RFC5804], Section 1.6. The script name argument MUST be a constant string as defined in [RFC5229], Section 3; implementations MUST NOT expand variables in the script name argument.
“include”命令接受一个可选的“location”参数、一个可选的“:once”参数、一个可选的“:optional”参数和一个字符串参数,该参数表示要包含的脚本名称,以便在该点进行处理。实现必须根据ManageSeeve[RFC5804]第1.6节限制脚本名称。脚本名称参数必须是[RFC5229]第3节中定义的常量字符串;实现不能在脚本名称参数中展开变量。
The "location" parameter MUST default to ":personal" if not specified. The "location" parameter MUST NOT be specified more than once. The "location" has the following meanings:
如果未指定,“位置”参数必须默认为:personal。“位置”参数的指定不得超过一次。“位置”具有以下含义:
:personal Indicates that the named script is stored in the user's own personal (private) Sieve repository.
:personal表示命名脚本存储在用户自己的个人(私有)存储库中。
:global Indicates that the named script is stored in a site-wide Sieve repository, accessible to all users of the Sieve system.
:global表示命名脚本存储在站点范围的Sieve存储库中,可供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 execution. If the script has already been included, processing continues immediately following the "include" command. Implementations MUST NOT generate an error if an "include :once" command names a script whose inclusion would be recursive; in this case, the script MUST be considered previously included, and therefore "include :once" will not include it again.
“:once”参数告诉解释器,如果在脚本执行期间的任何其他点尚未包含命名脚本,则仅包含该脚本。如果脚本已经包含,则处理将在“include”命令之后立即继续。如果一个“include:once”命令指定了一个包含将是递归的脚本,则实现不能生成错误;在这种情况下,脚本必须被视为以前包含过,因此“include:once”将不再包含它。
Note: It is RECOMMENDED that script authors and generators use the ":once" parameter only when including a script that performs general duties such as declaring global variables and making sanity checks of the environment.
注意:建议脚本作者和生成器仅在包含执行一般任务(如声明全局变量和对环境进行健全性检查)的脚本时使用“:once”参数。
The ":optional" parameter indicates that the script may be missing. Ordinarily, an implementation MUST generate an error during execution if an "include" command specifies a script that does not exist. When ":optional" is specified, implementations MUST NOT generate an error for a missing script, and MUST continue as if the "include" command had not been present.
“:optional”参数表示可能缺少脚本。通常,如果“include”命令指定的脚本不存在,则实现必须在执行期间生成错误。当指定“:optional”时,实现不得为缺少的脚本生成错误,并且必须像“include”命令不存在一样继续。
The included script MUST be a valid Sieve script. Implementations MUST validate that each script has its own "require" statements for all optional capabilities used by that script. The scope of a "require" statement is the script in which it immediately appears, and neither inherits nor passes on capabilities to other scripts during the course of execution.
包含的脚本必须是有效的筛选脚本。实现必须验证每个脚本对于该脚本使用的所有可选功能都有自己的“require”语句。“require”语句的作用域是它立即出现在其中的脚本,在执行过程中既不继承也不将功能传递给其他脚本。
A "stop" command in an included script MUST stop all script processing, including the processing of the scripts that include the immediate one. The "return" command (described below) stops processing of the immediate script only, and allows the scripts that include it to continue.
包含脚本中的“stop”命令必须停止所有脚本处理,包括对包含即时脚本的脚本的处理。“return”命令(如下所述)仅停止立即脚本的处理,并允许包含它的脚本继续。
The "include" command MAY appear anywhere in a script where a control structure is legal, and MAY be used within another control structure, e.g., an "if" block.
“include”命令可以出现在控制结构合法的脚本中的任何位置,并且可以在另一个控制结构中使用,例如“if”块。
Examples:
示例:
The user has four scripts stored in their personal repository:
用户的个人存储库中存储了四个脚本:
"default"
“默认值”
This is the default active script that includes several others.
这是默认的活动脚本,包括其他几个脚本。
require ["include"];
要求[“包括”];
include :personal "always_allow"; include :global "spam_tests"; include :personal "spam_tests"; include :personal "mailing_lists";
include :personal "always_allow"; include :global "spam_tests"; include :personal "spam_tests"; include :personal "mailing_lists";
Personal script "always_allow"
个人脚本“始终允许”
This script special-cases some correspondent email addresses and makes sure any message containing those addresses is always kept.
此脚本对一些对应的电子邮件地址进行了特殊处理,并确保始终保留包含这些地址的任何邮件。
if address :is "from" "boss@example.com" { keep; } elsif address :is "from" "ceo@example.com" { keep; }
if address :is "from" "boss@example.com" { keep; } elsif address :is "from" "ceo@example.com" { keep; }
Personal script "spam_tests" (uses "reject" [RFC5429])
个人脚本“垃圾邮件测试”(使用“拒绝”[RFC5429])
This script does some user-specific spam tests to catch spam messages not caught by the site-wide spam tests.
此脚本执行一些特定于用户的垃圾邮件测试,以捕获站点范围的垃圾邮件测试未捕获的垃圾邮件。
require ["reject"];
要求[“拒绝”];
if header :contains "Subject" "XXXX" { reject "Subject XXXX is unacceptable."; } elsif address :is "from" "money@example.com" { reject "Mail from this sender is unwelcome."; }
if header :contains "Subject" "XXXX" { reject "Subject XXXX is unacceptable."; } elsif address :is "from" "money@example.com" { reject "Mail from this sender is unwelcome."; }
Personal script "mailing_lists"
个人脚本“邮件列表”
This script looks for messages from different mailing lists and files each into a mailbox specific to the mailing list.
此脚本将从不同的邮件列表和文件中查找邮件,并将每个邮件列表和文件放入特定于该邮件列表的邮箱中。
require ["fileinto"];
要求[“fileinto”];
if header :is "List-ID" "sieve.ietf.org" { fileinto "lists.sieve"; } elsif header :is "List-ID" "ietf-imapext.imc.org" { fileinto "lists.imapext"; }
if header :is "List-ID" "sieve.ietf.org" { fileinto "lists.sieve"; } elsif header :is "List-ID" "ietf-imapext.imc.org" { fileinto "lists.imapext"; }
There is one script stored in the global repository:
全局存储库中存储了一个脚本:
Site script "spam_tests" (uses "reject" [RFC5429])
站点脚本“垃圾邮件测试”(使用“拒绝”[RFC5429])
This script does some site-wide spam tests that any user at the site can include in their own scripts at a suitable point. The script content is kept up to date by the site administrator.
此脚本执行一些站点范围的垃圾邮件测试,站点上的任何用户都可以在适当的时候将这些测试包含在自己的脚本中。站点管理员会更新脚本内容。
require ["reject"];
要求[“拒绝”];
if anyof (header :contains "Subject" "$$", header :contains "Subject" "Make money") { reject "No thank you."; }
if anyof (header :contains "Subject" "$$", header :contains "Subject" "Make money") { reject "No thank you."; }
Usage: return
用法:退货
The "return" command stops processing of the immediately included script only and returns processing control to the script that 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 appropriate "keep" action if no other actions have been executed up to that point.
“return”命令仅停止对立即包含的脚本的处理,并将处理控制权返回给包含它的脚本。如果在主脚本中使用(即,不在包含的脚本中),它与“停止”命令具有相同的效果,包括适当的“保持”操作,前提是在此之前没有执行任何其他操作。
In order to avoid problems of variables in an included script "overwriting" those from the script that includes it, this specification requires that all variables defined in a script MUST be kept "private" to the immediate script by default -- that is, they are not "visible" to other scripts. This ensures that two script authors cannot inadvertently cause problems by choosing the same name for a variable.
为了避免包含的脚本中的变量“覆盖”包含它的脚本中的变量的问题,本规范要求脚本中定义的所有变量在默认情况下必须对直接脚本保持“私有”——也就是说,它们对其他脚本不“可见”。这确保了两个脚本作者不会因为变量选择相同的名称而无意中导致问题。
However, sometimes there is a need to make a variable defined in one script available to others. This specification defines the new command "global" to declare that a variable is shared among scripts. Effectively, two namespaces are defined: one local to the immediate script, and another shared among all scripts. Implementations MUST allow a non-global variable to have the same name as a global variable but have no interaction between them.
但是,有时需要使一个脚本中定义的变量可供其他脚本使用。此规范定义了新命令“global”,以声明在脚本之间共享变量。实际上,定义了两个名称空间:一个是直接脚本的本地名称空间,另一个是在所有脚本之间共享的名称空间。实现必须允许非全局变量与全局变量具有相同的名称,但它们之间没有交互。
Usage: global <value: string-list>
Usage: global <value: string-list>
The "global" command accepts a string list argument that defines one or more names of variables to be stored in the global variable space. Each name MUST be a constant string and conform to the syntax of variable-name as defined in the "variables" extension document [RFC5229], Section 3. Match variables cannot be specified, and namespace prefixes are not allowed. An invalid name MUST be detected as a syntax error.
“global”命令接受一个字符串列表参数,该参数定义要存储在全局变量空间中的一个或多个变量名称。每个名称必须是一个常量字符串,并符合“变量”扩展文档[RFC5229]第3节中定义的变量名称语法。无法指定匹配变量,并且不允许使用命名空间前缀。必须将无效名称检测为语法错误。
The "global" command is only available when the script has both "include" and "variables" in its require line. If the "global" command appears when only "include" or only "variables" has been required, an error MUST be generated when the script is uploaded.
只有当脚本的require行中同时包含“include”和“variables”时,“global”命令才可用。如果在只需要“包含”或“变量”时出现“全局”命令,则在上载脚本时必须生成错误。
If a "global" command is given the name of a variable that has previously been defined in the immediate script with "set", an error MUST be generated either when the script is uploaded or at execution time.
如果为“全局”命令指定了先前在即时脚本中用“set”定义的变量名称,则必须在上载脚本时或在执行时生成错误。
If a "global" command lists a variable that has not been defined in the "global" namespace, the name of the variable is now marked as global, and any subsequent "set" command will set the value of the variable in global scope.
如果“global”命令列出了尚未在“global”命名空间中定义的变量,则该变量的名称现在标记为global,任何后续的“set”命令都将在全局范围内设置该变量的值。
A variable has global scope in all scripts that have declared it with the "global" command. If a script uses that variable name without declaring it global, the name specifies a separate, non-global variable within that script.
变量在使用“global”命令声明它的所有脚本中都具有全局作用域。如果脚本使用该变量名而未将其声明为全局变量,则该名称将在该脚本中指定一个单独的非全局变量。
Interpretation of a string containing a variable marked as global, but without any value set, SHALL behave as any other access to an unknown variable, as specified in the "variables" extension document [RFC5229], Section 3 (i.e., evaluates to an empty string).
根据“变量”扩展文件[RFC5229]第3节的规定,对包含标记为全局变量但未设置任何值的字符串的解释应与对未知变量的任何其他访问行为相同(即,评估为空字符串)。
Example:
例子:
The active script
活动脚本
The included script may contain repetitive code that is effectively a subroutine that can be factored out. In this script, the test that matches last will leave its value in the test_mailbox variable, and the top-level script will file the message into that mailbox. If no tests matched, the message will be implicitly kept in the INBOX.
包含的脚本可能包含重复代码,这些代码实际上是可以分解的子例程。在此脚本中,与last匹配的测试将在test_mailbox变量中保留其值,顶级脚本将消息归档到该邮箱中。如果没有匹配的测试,消息将隐式保留在收件箱中。
require ["fileinto", "include", "variables", "relational"]; global "test"; global "test_mailbox";
require ["fileinto", "include", "variables", "relational"]; global "test"; global "test_mailbox";
set "test" "$$"; include "subject_tests";
set "test" "$$"; include "subject_tests";
set "test" "Make money"; include "subject_tests";
set "test" "Make money"; include "subject_tests";
if string :count "eq" "${test_mailbox}" "1" { fileinto "${test_mailbox}"; stop; }
if string :count "eq" "${test_mailbox}" "1" { fileinto "${test_mailbox}"; stop; }
Personal script "subject_tests"
个人脚本“主题测试”
This script performs a number of tests against the message, sets the global test_mailbox variable with a folder to file the message into, and then falls back to the top-level script.
此脚本对邮件执行许多测试,设置全局test_mailbox变量以及要将邮件归档到的文件夹,然后返回到顶级脚本。
require ["include", "variables"]; global ["test", "test_mailbox"];
require ["include", "variables"]; global ["test", "test_mailbox"];
if header :contains "Subject" "${test}" { set "test_mailbox" "spam-${test}"; }
if header :contains "Subject" "${test}" { set "test_mailbox" "spam-${test}"; }
In addition to the "global" command, this document defines the variables namespace "global", in accordance with the "variables" extension document [RFC5229], Section 3. The "global" namespace has no sub-namespaces (e.g., 'set "global.data.from" "me@example.com";' is not allowed). The variable-name part MUST be a valid identifier (e.g., 'set "global.12" "value";' is not valid because "12" is not a valid identifier).
除“全局”命令外,本文件还根据“变量”扩展文件[RFC5229]第3节定义了变量名称空间“全局”。“全局”命名空间没有子命名空间(例如,“set”global.data.from“”me@example.com“;”是不允许的)。变量名部分必须是有效标识符(例如,“set”global.12“value”;“set”无效,因为“12”不是有效标识符)。
Note that the "variables" extension document [RFC5229], Section 3 suggests that extensions should define a namespace that is the same as its capability string (in this case, "include" rather than "global"). Nevertheless, references to the "global" namespace without a prior require statement for the "include" extension MUST cause an error.
注意,“variables”扩展文档[RFC5229]第3节建议扩展应定义与其功能字符串相同的名称空间(在本例中为“include”而非“global”)。但是,对“全局”命名空间的引用如果没有“include”扩展的previor require语句,则必须导致错误。
Example:
例子:
require ["variables", "include"];
要求[“变量”,“包括”];
set "global.i_am_on_vacation" "1";
设置“全局。我正在度假”“1”;
Variables declared global and variables accessed via the "global" namespace MUST each be one and the same. In the following example script, we see the variable "i_am_on_vacation" used in a "global" command, and again with the "global" namespace. Consider these as two syntaxes with identical meaning.
声明为全局的变量和通过“全局”命名空间访问的变量必须是一个且相同的变量。在下面的示例脚本中,我们看到变量“i_am_on_vacation”在“global”命令中使用,并且再次使用“global”名称空间。把这些看成是两个意义相同的语法。
Example:
例子:
require ["variables", "include", "vacation"]; global "i_am_on_vacation";
require ["variables", "include", "vacation"]; global "i_am_on_vacation";
set "global.i_am_on_vacation" "1";
设置“全局。我正在度假”“1”;
if string :is "${i_am_on_vacation}" "1" { vacation "It's true, I am on vacation."; }
if string :is "${i_am_on_vacation}" "1" { vacation "It's true, I am on vacation."; }
When "include" is used with the "editheader" extension [RFC5293], any changes made to headers in a script MUST be propagated both to and from included scripts. By way of example, if a script deletes one header and adds another, then includes a second script, the included script MUST NOT see the removed header, and MUST see the added header. Likewise, if the included script adds or removes a header, upon returning to the including script, subsequent actions MUST see the added headers and MUST NOT see the removed headers.
当“include”与“editheader”扩展名[RFC5293]一起使用时,对脚本中的头所做的任何更改都必须传播到包含的脚本,也必须从包含的脚本传播。举例来说,如果脚本删除一个头并添加另一个头,然后包含第二个脚本,则包含的脚本不能看到删除的头,而必须看到添加的头。同样,如果包含的脚本添加或删除头,在返回包含脚本时,后续操作必须看到添加的头,而不能看到删除的头。
When "include" is used with the MIME extension [RFC5703] "foreverypart" control structure, the included script MUST be presented with the current MIME part as though it were the entire message. A script SHALL NOT have any special control over the control structure it was included from. The "break" command in an included script is not valid on its own and may not terminate a "foreverypart" iteration in another script. The included script can use "return" to transfer control back to the including script. A global variable can be used to convey results to the including script. A "stop" in an included script, even within a "foreverypart" loop, still halts all script execution, per Section 3.2.
当“include”与MIME扩展[RFC5703]“foreverypart”控制结构一起使用时,包含的脚本必须与当前MIME部分一起呈现,就像它是整个消息一样。脚本不得对其包含的控制结构具有任何特殊控制。包含的脚本中的“break”命令本身无效,并且不能终止另一个脚本中的“foreverypart”迭代。包含的脚本可以使用“return”将控制权转移回包含的脚本。可以使用全局变量将结果传递给包含脚本。根据第3.2节,包含的脚本中的“停止”,即使在“foreverypart”循环中,仍然会停止所有脚本的执行。
When "include" is used with the "reject" extension [RFC5429], calling "reject" or "ereject" at any time sets the reject action on the message, and continues script execution. Apropos of the MIME extension, if an included script sees only a portion of the message and calls a reject, it is the entire message and not the single MIME part that carries the rejection.
当“include”与“reject”扩展名[RFC5429]一起使用时,随时调用“reject”或“ereject”对消息设置拒绝操作,并继续执行脚本。关于MIME扩展,如果包含的脚本只看到消息的一部分并调用拒绝,则是整个消息而不是单个MIME部分承载拒绝。
Sieve implementations MUST ensure adequate security for the global script repository to prevent unauthorized changes to global scripts. For example, a site policy might enable only certain users with administrative privileges to modify the global scripts. Sites are advised against allowing all users to have write access to the sites' global scripts.
Sieve实现必须确保全局脚本存储库具有足够的安全性,以防止对全局脚本进行未经授权的更改。例如,站点策略可能只允许某些具有管理权限的用户修改全局脚本。建议站点不要允许所有用户对站点的全局脚本具有写访问权限。
Sieve implementations MUST ensure that script names are checked for validity and proper permissions prior to inclusion, in order to prevent a malicious user from gaining access to files accessible to the mail server software that should not be accessible to the user.
Sieve实施必须确保在包含脚本名称之前检查脚本名称的有效性和正确权限,以防止恶意用户访问邮件服务器软件可访问但用户不应访问的文件。
Sieve implementations MUST ensure that script names are safe for use with their storage system. An error MUST be generated either when the script is uploaded or at execution time for a script including a name that could be used as a vector to attack the storage system. By way of example, the following include commands should be considered hostile: 'include "./../..//etc/passwd"', 'include "foo$(`rm star`)"'.
Sieve实现必须确保脚本名称可以安全地用于其存储系统。上载脚本时或脚本执行时,必须生成一个错误,该脚本包含一个可能用作攻击存储系统的向量的名称。举例来说,以下include命令应被视为恶意命令:“include”。/../..//etc/passwd“,“include”foo$(`rm star`)“。
Beyond these, the "include" extension does not raise any security considerations that are not discussed in the base Sieve [RFC5228] document and the "variables" extension document [RFC5229].
除此之外,“include”扩展不会引起基本筛选[RFC5228]文档和“variables”扩展文档[RFC5229]中未讨论的任何安全注意事项。
The following template specifies the IANA registration of the Sieve extension specified in this document:
以下模板规定了本文件中规定的筛网扩展的IANA注册:
To: iana@iana.org Subject: Registration of new Sieve extension
致:iana@iana.org主题:新筛网扩展的注册
Capability name: include Description: adds the "include" command to execute other Sieve scripts, the "return" action from an included script, and the "global" command and "global" variables namespace to access variables shared among included scripts. RFC number: this RFC Contact address: the Sieve discussion list <sieve@ietf.org>
功能名称:include Description:添加“include”命令以执行其他筛选脚本,从包含的脚本中添加“return”操作,以及“global”命令和“global”变量名称空间以访问包含的脚本之间共享的变量。RFC编号:此RFC联系人地址:筛讨论列表<sieve@ietf.org>
This information has been added to IANA's "Sieve Extensions" registry (http://www.iana.org).
此信息已添加到IANA的“筛选扩展”注册表中(http://www.iana.org).
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC2119]Bradner,S.,“RFC中用于表示需求水平的关键词”,BCP 14,RFC 2119,1997年3月。
[RFC5228] Guenther, P., Ed., and T. Showalter, Ed., "Sieve: An Email Filtering Language", RFC 5228, January 2008.
[RFC5228]Guenther,P.,Ed.,和T.Showalter,Ed.,“筛选:电子邮件过滤语言”,RFC 5228,2008年1月。
[RFC5229] Homme, K., "Sieve Email Filtering: Variables Extension", RFC 5229, January 2008.
[RFC5229]Homme,K.,“筛选电子邮件过滤:变量扩展”,RFC5292008年1月。
[RFC5804] Melnikov, A., Ed., and T. Martin, "A Protocol for Remotely Managing Sieve Scripts", RFC 5804, July 2010.
[RFC5804]Melnikov,A.,Ed.,和T.Martin,“远程管理筛选脚本的协议”,RFC 58042010年7月。
[RFC5293] Degener, J. and P. Guenther, "Sieve Email Filtering: Editheader Extension", RFC 5293, August 2008.
[RFC5293]Degener,J.和P.Guenther,“筛选电子邮件过滤:Editheader扩展”,RFC 5293,2008年8月。
[RFC5429] Stone, A., Ed., "Sieve Email Filtering: Reject and Extended Reject Extensions", RFC 5429, March 2009.
[RFC5429]Stone,A.,Ed.“筛选电子邮件过滤:拒绝和扩展拒绝扩展”,RFC 54292009年3月。
[RFC5703] Hansen, T. and C. Daboo, "Sieve Email Filtering: MIME Part Tests, Iteration, Extraction, Replacement, and Enclosure", RFC 5703, October 2009.
[RFC5703]Hansen,T.和C.Daboo,“筛选电子邮件过滤:MIME部分测试、迭代、提取、替换和封装”,RFC 57032009年10月。
Thanks to Stephan Bosch, Ned Freed, Arnt Gulbrandsen, Tony Hansen, Kjetil Torgrim Homme, Jeffrey Hutzelman, Barry Leiba, Alexey Melnikov, Ken Murchison, Marc Mutz, and Rob Siemborski, for comments and corrections.
感谢Stephan Bosch、Ned Freed、Arnt Gulbrandsen、Tony Hansen、Kjetil Torgrim Homme、Jeffrey Hutzelman、Barry Leiba、Alexey Melnikov、Ken Murchison、Marc Mutz和Rob Siemborski的评论和更正。
Authors' Addresses
作者地址
Cyrus Daboo Apple Inc. 1 Infinite Loop Cupertino, CA 95014 USA
Cyrus Daboo苹果公司,美国加利福尼亚州库珀蒂诺市无限环路1号,邮编95014
EMail: cyrus@daboo.name URI: http://www.apple.com/
EMail: cyrus@daboo.name URI: http://www.apple.com/
Aaron Stone Serendipity 1817 California St. #104 San Francisco, CA 94109 USA
Aaron Stone Serendipity 1817加利福尼亚圣第104旧金山CA美国94109
EMail: aaron@serendipity.cx
EMail: aaron@serendipity.cx