Network Working Group                                           N. Freed
Request for Comments: 5463                              Sun Microsystems
Category: Standards Track                                     March 2009
        
Network Working Group                                           N. Freed
Request for Comments: 5463                              Sun Microsystems
Category: Standards Track                                     March 2009
        

Sieve Email Filtering: Ihave Extension

筛选电子邮件筛选:Ihave扩展名

Status of This Memo

关于下段备忘

This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the "Internet Official Protocol Standards" (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited.

本文件规定了互联网社区的互联网标准跟踪协议,并要求进行讨论和提出改进建议。有关本协议的标准化状态和状态,请参考当前版本的“互联网官方协议标准”(STD 1)。本备忘录的分发不受限制。

Copyright Notice

版权公告

Copyright (c) 2009 IETF Trust and the persons identified as the document authors. All rights reserved.

版权所有(c)2009 IETF信托基金和确定为文件作者的人员。版权所有。

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents in effect on the date of publication of this document (http://trustee.ietf.org/license-info). Please review these documents carefully, as they describe your rights and restrictions with respect to this document.

本文件受BCP 78和IETF信托在本文件出版之日生效的与IETF文件有关的法律规定的约束(http://trustee.ietf.org/license-info). 请仔细阅读这些文件,因为它们描述了您对本文件的权利和限制。

Abstract

摘要

This document describes the "ihave" extension to the Sieve email filtering language. The "ihave" extension provides a means to write scripts that can take advantage of optional Sieve features but can still run when those optional features are not available. The extension also defines a new error control command intended to be used to report situations where no combination of available extensions satisfies the needs of the script.

本文档描述了Sieve电子邮件过滤语言的“ihave”扩展。“ihave”扩展提供了一种编写脚本的方法,该脚本可以利用可选的筛选功能,但在这些可选功能不可用时仍可以运行。扩展还定义了一个新的错误控制命令,用于报告没有可用扩展组合满足脚本需要的情况。

1. Introduction
1. 介绍

Sieve [RFC5228] is a language for filtering email messages at or around the time of final delivery. It is designed to be implementable on either a mail client or mail server. It is suitable for running on a mail server where users may not be allowed to execute arbitrary programs, such as on black-box Internet Message Access Protocol [RFC3501] servers, as it has no user-controlled loops or the ability to run external programs.

Sieve[RFC5228]是一种用于在最终交付时或前后过滤电子邮件的语言。它被设计为可以在邮件客户端或邮件服务器上实现。它适用于在不允许用户执行任意程序的邮件服务器上运行,例如在黑盒Internet消息访问协议[RFC3501]服务器上,因为它没有用户控制的循环或运行外部程序的能力。

Various sieve extensions have already been defined, e.g., [RFC5229], [RFC5230], [RFC5231], [RFC5232], [RFC5233], [RFC5235], and many more are sure to be created over time. Sieve's require clause is used to specify the extensions a particular sieve needs; an error results if the script's require clause calls for an extension that isn't available. This mechanism is sufficient in most situations. However, there can be cases where a script may be able to take advantage of an extension if it is available but can still operate if it is not, possibly with some degradation of functionality. Cases can also arise where a script would prefer one extension but can employ a different one if the first one is not available.

已经定义了各种筛网扩展,例如,[RFC5229]、[RFC5230]、[RFC5231]、[RFC5232]、[RFC5233]、[RFC5235],随着时间的推移,肯定会创建更多的筛网扩展。SIVE的require子句用于指定特定SIVE需要的扩展;如果脚本的require子句调用不可用的扩展,则会导致错误。这种机制在大多数情况下是足够的。但是,在某些情况下,脚本可能能够利用扩展(如果扩展可用),但如果扩展不可用,脚本仍然可以运行,可能会导致功能降级。也可能出现这样的情况:脚本希望使用一个扩展,但如果第一个扩展不可用,则可以使用另一个扩展。

The "ihave" extension provides a means to write scripts that make use of extensions only when they are actually available. It defines a new "ihave" test that takes a list of capability names as an argument and succeeds if and only if all of those capabilities are present. Additionally, specification of the "ihave" extension in the require clause disables parse-time checking of extension use in scripts; run-time checking must be used instead. This makes it possible to write portable scripts that can operate in multiple environments making effective use of whatever extensions are available even though differing sets of extensions are provided in different places.

“ihave”扩展提供了一种编写脚本的方法,该脚本仅在扩展实际可用时才使用扩展。它定义了一个新的“ihave”测试,该测试将一系列功能名称作为参数,并在且仅当所有这些功能都存在时成功。此外,require子句中“ihave”扩展的规范禁用了脚本中扩展使用的解析时间检查;必须改用运行时检查。这使得编写可移植脚本成为可能,这些脚本可以在多个环境中运行,有效地利用任何可用的扩展,即使在不同的地方提供了不同的扩展集。

The "ihave" extension also defines a new error control command. An error causes script execution to terminate with the error message given as the argument to the error control.

“ihave”扩展还定义了一个新的错误控制命令。错误导致脚本执行终止,错误消息作为错误控件的参数提供。

2. Conventions Used in This Document
2. 本文件中使用的公约

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]中所述进行解释。

The terms used to describe the various components of the Sieve language are taken from Section 1.1 of [RFC5228].

用于描述筛子语言各组成部分的术语取自[RFC5228]第1.1节。

3. Capability Identifiers
3. 能力标识符

The capability string associated with the extension defined in this document is "ihave".

与本文档中定义的扩展相关联的功能字符串为“ihave”。

4. Ihave Test
4. 我做了测试
   Usage:   ihave <capabilities: string-list>
        
   Usage:   ihave <capabilities: string-list>
        

The "ihave" test provides a means for Sieve scripts to test for the existence of a given extension prior to actually using it. The capabilities argument to "ihave" is the same as the similarly-named

“ihave”测试为筛选脚本提供了一种方法,可以在实际使用某个给定扩展之前测试该扩展是否存在。“ihave”的capabilities参数与名称类似的参数相同

argument to the require control statement: It specifies the names of one or more Sieve extensions or comparators. The "ihave" test succeeds if all the extensions specified in the capabilities list are available to the script.

require控制语句的参数:它指定一个或多个筛选扩展或比较器的名称。如果脚本可以使用功能列表中指定的所有扩展,“ihave”测试成功。

Unlike most Sieve tests, "ihave" accepts no match or comparator arguments. The type of match for "ihave" is always ":is" and the comparator is always "i;octet".

与大多数筛选测试不同,“ihave”不接受匹配或比较参数。“ihave”的匹配类型始终为“:is”,比较器始终为“i;octet”。

The strings in the capabilities list are constant strings in the context of Sieve variables [RFC5229]. It is an error to pass a non-constant string as an argument to "ihave".

能力列表中的字符串是筛选变量[RFC5229]上下文中的常量字符串。将非常量字符串作为参数传递给“ihave”是错误的。

The Sieve base specification demands that all Sieve extensions used in a given script be specified in the initial require control statement. It is an error for a script to call for extensions the interpreter doesn't support or to attempt to use extensions that have not been listed in the script's require clause. Using "ihave" changes Sieve interpreter behavior and the underlying requirements in the following ways:

筛基规范要求在初始require控制语句中指定给定脚本中使用的所有筛扩展。脚本调用解释器不支持的扩展或尝试使用脚本的require子句中未列出的扩展是错误的。使用“ihave”可以通过以下方式更改解释器行为和基本需求:

1. Use of a given extension is allowed subsequent to the successful evaluation of an "ihave" test on that extension all the way to the end of the script, even outside the block enclosed by the "ihave" test. In other words, subsequent to a successful "ihave", things operate just as if the extension had been specified in the script's require clause. The extension cannot be used prior to the evaluation of such a test and a run-time error MUST be generated if such usage is attempted. However, subsequent use of that extension may still need to be conditionally handled via an "ihave" test to deal with the case where it is not supported.

1. 在成功评估该扩展上的“ihave”测试之后,允许使用给定扩展,直到脚本结束,甚至在“ihave”测试所包含的块之外。换句话说,在成功的“ihave”之后,事情的运行就像脚本的require子句中指定了扩展一样。在评估此类测试之前不能使用扩展,如果尝试使用,则必须生成运行时错误。但是,该扩展的后续使用可能仍然需要通过“ihave”测试有条件地处理,以处理不支持该扩展的情况。

2. Sieve interpreters normally have the option of checking extension use at either parse time or execution time. The specification of "ihave" in a script's require clause changes this behavior: Scripts MUST either defer extension checking to run time or else take the presence of "ihave" tests into account at parse time. Note that since "ihave" can be used inside of "anyof", "allof", and "not" tests, full parse-time checking of "ihave" may be very difficult to implement.

2. 筛解释器通常可以选择在解析时或执行时检查扩展使用情况。脚本的require子句中的“ihave”规范改变了这种行为:脚本必须将扩展检查推迟到运行时,或者在解析时考虑到“ihave”测试的存在。注意,由于“ihave”可以在“anyof”、“allof”和“not”测试中使用,“ihave”的完整解析时间检查可能很难实现。

3. Although it makes little sense to do so, an extension can be specified in both the require control statement and in an "ihave" test. If this is done and the extension has been implemented, the extension can be used anywhere in the script and an "ihave" test of that extension will always return true.

3. 尽管这样做没有什么意义,但是可以在require控制语句和“ihave”测试中指定扩展。如果这样做并且扩展已经实现,那么扩展可以在脚本中的任何地方使用,并且该扩展的“ihave”测试将始终返回true。

4. The "ihave" test accepts a list of capabilities. If any of the specified capabilities are unavailable, the test fails and none of the capabilities are enabled.

4. “ihave”测试接受一系列功能。如果指定的任何功能不可用,则测试将失败,并且所有功能均未启用。

5. The Sieve base specification does not require that interpreters evaluate arguments in any particular order or that test evaluation be short-circuited. If "ihave" is enabled, the interpreter MUST short-circuit tests, i.e., not perform more tests than necessary to find the result. Additionally, evaluation order MUST be left to right if "ihave" is enabled.

5. 筛基规范不要求解释器以任何特定顺序评估参数,也不要求测试评估短路。如果启用了“ihave”,则解释器必须短路测试,即执行的测试不得超过查找结果所需的测试次数。此外,如果启用了“ihave”,则评估顺序必须从左到右。

The "ihave" extension is designed to be used with other extensions that add tests, actions, comparators, or arguments. Implementations MUST NOT allow it to be used with extensions that change the underlying Sieve grammar, or extensions like encoded-character [RFC5228], or variables [RFC5229] that change how the content of Sieve scripts are interpreted. The test MUST fail and the extension MUST NOT be enabled if such usage is attempted.

“ihave”扩展设计用于添加测试、操作、比较器或参数的其他扩展。实现不得允许它与更改基础筛语法的扩展、或更改筛脚本内容解释方式的编码字符[RFC5228]或变量[RFC5229]等扩展一起使用。如果尝试这种使用,测试必须失败,并且扩展不得启用。

5. Error Control
5. 差错控制
   Usage:   error <message: string>
        
   Usage:   error <message: string>
        

The error control causes script execution to terminate with a run-time error. The message argument provides a text description of the error condition that SHOULD be included in any generated report regarding the error. Section 2.10.6 of [RFC5228] describes how run-time errors are handled in Sieve.

错误控制导致脚本执行因运行时错误而终止。message参数提供错误条件的文本描述,该错误条件应包含在任何生成的有关错误的报告中。[RFC5228]的第2.10.6节描述了如何在SIVE中处理运行时错误。

Note that the message argument, like all Sieve strings, employs the UTF-8 charset and can contain non-US-ASCII characters. This must be taken into consideration when reporting script errors.

请注意,与所有筛字符串一样,消息参数使用UTF-8字符集,并且可以包含非US ASCII字符。报告脚本错误时必须考虑这一点。

The error control is included as part of the "ihave" extension so that it is unconditionally available to scripts using ihave.

错误控制作为“ihave”扩展的一部分包括在内,因此它对使用ihave的脚本是无条件可用的。

6. Security Considerations
6. 安全考虑

A potential security issue with Sieve scripts is that when a script fails to run due to the lack of some extension, it may fail to block dangerous email. The "ihave" extension makes it possible to improve script portability and generality, which may improve the overall security provided by Sieve.

Sieve脚本的一个潜在安全问题是,当脚本由于缺少某些扩展而无法运行时,它可能无法阻止危险的电子邮件。“ihave”扩展可以提高脚本的可移植性和通用性,这可以提高Sieve提供的总体安全性。

Script robustness aside, ihave is essentially a more flexible variant of Sieve's existing require mechanism. As such, it does not add any additional capabilities to a Sieve implementation that could create

撇开脚本健壮性不谈,ihave本质上是Sieve现有require机制的一个更灵活的变体。因此,它不会向筛选实现添加任何可能创建

security issues. Of course, all of the security considerations given in the base Sieve specification and in any extensions that are employed are still relevant.

安全问题。当然,基本筛规范和所采用的任何扩展中给出的所有安全注意事项仍然是相关的。

7. IANA Considerations
7. IANA考虑

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: ihave Description: The "ihave" extension provides a means to write scripts that make use of other extensions only when they are actually available. RFC number: RFC 5463 Contact address: Sieve discussion list <ietf-mta-filters@imc.org>

功能名称:ihave描述:“ihave”扩展提供了一种编写脚本的方法,该脚本仅在其他扩展实际可用时才使用这些扩展。RFC编号:RFC 5463联系地址:筛讨论列表<ietf mta-filters@imc.org>

8. References
8. 工具书类
8.1. Normative References
8.1. 规范性引用文件

[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. and T. Showalter, "Sieve: An Email Filtering Language", RFC 5228, January 2008.

[RFC5228]Guenther,P.和T.Showalter,“筛选:电子邮件过滤语言”,RFC 5228,2008年1月。

8.2. Informative References
8.2. 资料性引用

[RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1", RFC 3501, March 2003.

[RFC3501]Crispin,M.,“互联网消息访问协议-版本4rev1”,RFC 35012003年3月。

[RFC5229] Homme, K., "Sieve Email Filtering: Variables Extension", RFC 5229, January 2008.

[RFC5229]Homme,K.,“筛选电子邮件过滤:变量扩展”,RFC5292008年1月。

[RFC5230] Showalter, T. and N. Freed, "Sieve Email Filtering: Vacation Extension", RFC 5230, January 2008.

[RFC5230]Showalter,T.和N.Freed,“筛选电子邮件过滤:假期延长”,RFC 5230,2008年1月。

[RFC5231] Segmuller, W. and B. Leiba, "Sieve Email Filtering: Relational Extension", RFC 5231, January 2008.

[RFC5231]Segmuler,W.和B.Leiba,“筛选电子邮件过滤:关系扩展”,RFC 52312008年1月。

[RFC5232] Melnikov, A., "Sieve Email Filtering: Imap4flags Extension", RFC 5232, January 2008.

[RFC5232]Melnikov,A.,“筛选电子邮件过滤:Imap4flags扩展”,RFC 5232,2008年1月。

[RFC5233] Murchison, K., "Sieve Email Filtering: Subaddress Extension", RFC 5233, January 2008.

[RFC5233]Murchison,K.,“筛选电子邮件过滤:子地址扩展”,RFC 52332008年1月。

[RFC5235] Daboo, C., "Sieve Email Filtering: Spamtest and Virustest Extensions", RFC 5235, January 2008.

[RFC5235]Daboo,C.,“筛选电子邮件过滤:垃圾邮件测试和病毒测试扩展”,RFC5352008年1月。

9. Acknowledgments
9. 致谢

Stephan Bosch, Cyrus Daboo, Arnt Gulbrandsen, Andrew McKeon, and Alexey Melnikov provided helpful suggestions and corrections.

Stephan Bosch、Cyrus Daboo、Arnt Gulbrandsen、Andrew McKeon和Alexey Melnikov提供了有用的建议和更正。

Author's Address

作者地址

Ned Freed Sun Microsystems 800 Royal Oaks Monrovia, CA 91016-6347 USA

Ned Freed Sun Microsystems 800 Royal Oaks Monrovia,加利福尼亚州91016-6347美国

   Phone: +1 909 457 4293
   EMail: ned.freed@mrochek.com
        
   Phone: +1 909 457 4293
   EMail: ned.freed@mrochek.com