This document provide note and summary of RFC 7208, Sender Policy Framework (SPF) for Authorizing Use of Domains in Email, Version 1. The content of this document are merged with errata that are reported before 2019-04-04.
1. Introduction
This document defines a protocol by which ADministrative Management Domains (ADMD) can authorize hosts to use their domain names in the "MAIL FROM" or "HELO" identities. Compliant ADMDs publish Sender Policy Framework (SPF) records in the DNS specifying which hosts are permitted to use their names, and compliant mail receivers use the published SPF records to test the authorization of sending Mail Transfer Agents (MTAs) using a given "HELO" or "MAIL FROM" identity during a mail transaction.
2. Operational Overview
2.1. Publishing Authorization
An SPF-compliant domain publishes valid SPF records to authorize the use of the relevant domain names in the "HELO" and "MAIL FROM" identities by the MTAs specified therein.
SPF results can be used to make both positive (source is authorized) and negative (source is not authorized) determinations. If ADMDs choose to publish SPF records and want to support receivers making negative authorization determinations, it is necessary for them to publish records that end in "-all", or redirect to other records that do; otherwise, no definitive determination of authorization can be made.
When changing SPF records, care has to be taken to ensure that there is a transition period so that the old policy remains valid until all legitimate email can reasonably expect to have been checked.
2.2. Checking Authorization
A mail receiver can perform a set of SPF checks for each mail message it receives. Typically, such checks are done by a receiving MTA, but can be performed elsewhere in the mail processing chain so long as the required information is available and reliable.
Without explicit approval of the publishing ADMD, checking other identities against SPF version 1 records is NOT RECOMMENDED because there are cases that are known to give incorrect results. For example, almost all mailing lists rewrite the "MAIL FROM" identity, but some do not change any other identities in the message. Documents that define other identities will have to define the method for explicit approval.
To make the test, the mail receiver MUST evaluate the check_host() function.
Although invalid, malformed, or non-existent domains cause SPF checks to return "none" because no SPF record can be found, it has long been the policy of many MTAs to reject email from such domains, especially in the case of invalid "MAIL FROM". Rejecting email will prevent one method of circumventing of SPF records.
Implementations have to take care to correctly extract the <domain> from the data given with the SMTP MAIL FROM command as many MTAs will still accept such things as source routes, the %-hack (see [RFC1123]), and bang paths (see [RFC1983]). These archaic features have been maliciously used to bypass security systems.
2.3. The "HELO" Identity
It is RECOMMENDED that SPF verifiers not only check the "MAIL FROM" identity but also separately check the "HELO" identity by applying the check_host() function (Section 4) to the "HELO" identity as the <sender>. If a conclusive determination about the message can be made based on a check of "HELO", then the use of DNS resources to process the typically more complex "MAIL FROM" can be avoided. Additionally, since SPF records published for "HELO" identities refer to a single host, when available, they are a very reliable source of host authorization status. Checking "HELO" before "MAIL FROM" is the RECOMMENDED sequence if both are checked.
This SPF check can only be performed when the "HELO" string is a valid, multi-label domain name.
2.4. The "MAIL FROM" Identity
SPF verifiers MUST check the "MAIL FROM" identity if a "HELO" check either has not been performed or has not reached a definitive policy result by applying the check_host() function to the "MAIL FROM" identity as the <sender>.
If the reverse-path is null, this document defines the "MAIL FROM" identity to be the mailbox composed of the local-part "postmaster" and the "HELO" identity (which might or might not have been checked separately before).
2.5. Location of Checks
The authorization check is performed during the SMTP transaction at the time of the MAIL command, and uses the MAIL FROM value and the client IP address. Performing the check at later times or with other input can cause problems such as the following:
-
It might be difficult to accurately extract the required information from potentially deceptive headers.
-
Legitimate email might fail the authorization check because the sender’s policy has since changed.
2.6. Results of Evaluation
Moved to <<#_results,section 4.2>>.
3. SPF Records
The SPF record is expressed as a single string of text found in the RDATA of a single DNS TXT resource record; multiple SPF records are not permitted for the same owner name.
3.1. DNS Resource Record
SPF records MUST be published as a DNS TXT (type 16) Resource Record (RR) only. The character content of the record is encoded as [US-ASCII].
3.2. Multiple DNS Records
A domain name MUST NOT have multiple records that would cause an authorization check to select more than one record.
3.3. Multiple Strings in a Single DNS Record
If a published record contains multiple character-strings, then the record MUST be treated as if those strings are concatenated together without adding spaces. For example:
IN TXT "v=spf1 .... first" "second string..."
is equivalent to:
IN TXT "v=spf1 .... firstsecond string..."
3.4. Record Size
If the size of the DNS message, the combined length of the DNS name and the text of all the records of a given type is under 450 octets, then DNS answers ought to fit in UDP packets. Records that are too long to fit in a single UDP packet could be silently ignored by SPF verifiers due to firewall and other issues that interfere with the operation of DNS over TCP or using EDNS0.
Note that when computing the sizes for replies to queries of the TXT format, one has to take into account any other TXT records published at the domain name. Similarly, the sizes for replies to all queries related to SPF have to be evaluated to fit in a single 512-octet UDP packet.
3.5. Wildcard Records
Use of wildcard records for publishing is discouraged, and care has to be taken if they are used.
SPF records have to be listed twice for every name within the zone: once for the name, and once with a wildcard to cover the tree under the name, in order to cover all domains in use in outgoing mail.
4. The check_host() Function
The check_host()
function fetches SPF records, parses them, and
evaluates them to determine whether a particular host is or is not
permitted to send mail with a given identity.
Receiving ADMDs that perform this check MUST correctly evaluate the
check_host()
function as described here.
4.1. Arguments
The check_host()
function takes these arguments:
-
<ip>
: the IP address of the SMTP client that is emitting the mail, either IPv4 or IPv6. -
<domain>
: the domain that provides the sought-after authorization information; initially, the domain portion of the "MAIL FROM" or "HELO" identity. -
<sender>
: the "MAIL FROM" or "HELO" identity.
4.2. Results
This section enumerates and briefly defines the possible outputs of
check_host()
function.
-
"none": means either,
-
no syntactically valid DNS domain name was extracted from the SMTP session that could be used as the one to be authorized, or
-
no SPF records were retrieved from the DNS.
-
-
"neutral": means the ADMD has explicitly stated that it is not asserting whether the IP address is authorized.
-
"pass": an explicit statement that the client is authorized to inject mail with the given identity.
-
"fail": an explicit statement that the client is not authorized to use the domain in the given identity.
-
"softfail": a weak statement by the publishing ADMD that the host is probably not authorized. It has not published a stronger, more definitive policy that results in a "fail".
-
"temperror": the SPF verifier encountered a transient (generally DNS) error while performing the check. A later retry may succeed without further DNS operator action.
-
"permerror": the domain’s published records could not be correctly interpreted. This signals an error condition that definitely requires DNS operator intervention to be resolved.
4.3. Initial Processing
If the <domain> is malformed (e.g., label longer than 63 characters, zero-length label not at the end, etc.) or is not a multi-label domain name, or if the DNS lookup returns "Name Error" (RCODE 3, also known as "NXDOMAIN" [RFC2308]), check_host() immediately returns the result "none".
If the <sender> has no local-part, substitute the string "postmaster" for the local-part.
4.4. Record Lookup
A DNS query needs to be made for the <domain> name, querying for type TXT only.
If the DNS lookup returns a server failure (RCODE 2) or some other error
(RCODE other than 0 or 3), or if the lookup times out, then check_host()
terminates immediately with the result "temperror".
4.5. Selecting Records
Records begin with a version section:
record = version terms *SP version = "v=spf1"
If the resultant record set includes no records, check_host()
produces the
"none" result.
If the resultant record set includes more than one record, check_host()
produces the "permerror" result.
4.6. Record Evaluation
The check_host()
function parses and interprets the SPF record to find a
result for the current test.
if there are any syntax errors anywhere in the record, check_host()
returns
immediately with the result "permerror", without further interpretation or
evaluation.
4.6.1. Term Evaluation
There are two types of terms: mechanisms and modifiers.
terms = *( 1*SP ( directive / modifier ) ) directive = [ qualifier ] mechanism qualifier = "+" / "-" / "?" / "~" mechanism = ( all / include / a / mx / ptr / ip4 / ip6 / exists ) modifier = redirect / explanation / unknown-modifier unknown-modifier = name "=" macro-string ; where name is not any known modifier name = ALPHA *( ALPHA / DIGIT / "-" / "_" / "." )
Most mechanisms allow a ":" or "/" character after the name.
Modifiers always contain an equals ('=') character immediately after the name, and before any ":" or "/" characters that might be part of the macro-string.
Terms that do not contain any of "=", ":", or "/" are mechanisms.
Mechanism and modifier names are case-insensitive.
4.6.2. Mechanisms
Each mechanism is considered in turn from left to right. If there are no more mechanisms, the result is the default result.
When a mechanism is evaluated, one of three things can happen: it can match, not match, or return an exception.
If it matches, processing ends and the qualifier value is returned as the result of that record. If it does not match, processing continues with the next mechanism. If it returns an exception, mechanism processing ends and the exception value is returned.
The possible qualifiers, and the results they cause check_host()
to return,
are as follows:
"+" pass "-" fail "~" softfail "?" neutral
The qualifier is optional and defaults to "+".
When a mechanism matches and the qualifier is "-", then a "fail" result is returned.
4.6.3. Modifiers
Modifiers are not mechanisms. They do not return match or not-match. Instead, they provide additional information. Although modifiers do not directly affect the evaluation of the record, the "redirect" modifier has an effect after all the mechanisms have been evaluated.
4.6.4. DNS Lookup Limits
The following terms cause DNS queries: the "include", "a", "mx", "ptr", and "exists" mechanisms, and the "redirect" modifier.
SPF implementations MUST limit the total number of those terms to 10 during SPF evaluation, to avoid unreasonable load on the DNS. If this limit is exceeded, the implementation MUST return "permerror".
The other terms — the "all", "ip4", and "ip6" mechanisms, and the "exp" modifier — do not cause DNS queries at the time of SPF evaluation (the "exp" modifier only causes a lookup at a later time), and their use is not subject to this limit.
When evaluating the "mx" mechanism, the number of "MX" resource records queried is included in the overall limit of 10 mechanisms/modifiers that cause DNS lookups as described above. In addition to that limit, the evaluation of each "MX" record MUST NOT result in querying more than 10 address records — either "A" or "AAAA" resource records. If this limit is exceeded, the "mx" mechanism MUST produce a "permerror" result.
When evaluating the "ptr" mechanism or the %{p} macro, the number of "PTR" resource records queried is included in the overall limit of 10 mechanisms/modifiers that cause DNS lookups as described above. In addition to that limit, the evaluation of each "PTR" record MUST NOT result in querying more than 10 address records — either "A" or "AAAA" resource records. If this limit is exceeded, all records other than the first 10 MUST be ignored.
The check_host()
elapsed time SHOULD have limited to least 20 seconds.
If such a limit is exceeded, the result of authorization SHOULD be
"temperror".
There may be cases where it is useful to limit the number of "terms" for which DNS queries return either a positive answer (RCODE 0) with an answer count of 0, or a "Name Error" (RCODE 3) answer. These are sometimes collectively referred to as "void lookups". SPF implementations SHOULD limit "void lookups" to two. An implementation MAY choose to make such a limit configurable. In this case, a default of two is RECOMMENDED. Exceeding the limit produces a "permerror" result.
4.7. Default Result
If none of the mechanisms match and there is no "redirect" modifier, then the check_host() returns a result of "neutral", just as if "?all" were specified as the last directive.
If there is a "redirect" modifier, check_host() proceeds as defined in Section 6.1.
It is better to use either a "redirect" modifier or an "all" mechanism to explicitly terminate processing. For example:
v=spf1 +mx -all
or
v=spf1 +mx redirect=_spf.example.com
4.8. Domain Specification
The <domain-spec> string is subject to macro expansion (see Section 7). The resulting string is the common presentation form of a fully qualified DNS name: a series of labels separated by periods. This domain is called the <target-name> in the rest of this document.
For several mechanisms, the <domain-spec> is optional. If it is not provided, the <domain> from the check_host() arguments (see Section 4.1) is used as the <target-name>. "domain" and <domain-spec> are syntactically identical after macro expansion. "domain" is an input value for check_host(), while <domain-spec> is computed by check_host().
The result of evaluating check_host() with a syntactically invalid domain is undefined. Examples include names with empty labels, such as "foo..example.com", and labels that are longer than 63 characters. Some implementations choose to treat such errors as not-match and therefore ignore such names, while others return a "permerror" exception.
5. Mechanism Definitions
This section defines two types of mechanisms: basic language framework mechanisms and designated sender mechanisms.
Basic mechanisms contribute to the language framework. They do not specify a particular type of authorization scheme. The basic mechanisms are as follows:
all include
Designated sender mechanisms are used to identify a set of <ip> addresses as being permitted or not permitted to use the <domain> for sending mail. The designated sender mechanisms are as follows:
a mx ptr (do not use) ip4 ip6 exists
The following conventions apply to all mechanisms that perform a comparison between <ip> and an IP address at any point:
If no CIDR prefix length is given in the directive, then <ip> and the IP address are compared for equality.
If a CIDR prefix length is specified, then only the specified number of high-order bits of <ip> and the IP address are compared for equality.
When any mechanism fetches host addresses to compare with <ip>, when <ip> is an IPv4, "A" records are fetched; when <ip> is an IPv6 address, "AAAA" records are fetched. SPF implementations on IPv6 servers need to handle both "AAAA" and "A" records, for clients on IPv4-mapped IPv6 addresses [RFC4291]. IPv4 <ip> addresses are only listed in an SPF record using the "ip4" mechanism.
Several mechanisms rely on information fetched from the DNS. For these DNS queries, except where noted, if the DNS server returns an error (RCODE other than 0 or 3) or the query times out, the mechanism stops and the topmost check_host() returns "temperror". If the server returns "Name Error" (RCODE 3), then evaluation of the mechanism continues as if the server returned no error (RCODE 0) and zero answer records.
5.1. "all"
all = "all"
The "all" mechanism is a test that always matches. It is used as the rightmost mechanism in a record to provide an explicit default. For example:
v=spf1 a mx -all
Mechanisms after "all" will never be tested and MUST be ignored.
Any "redirect" modifier MUST be ignored when there is an "all" mechanism in the record, regardless of the relative ordering of the terms.
5.2. "include"
include = "include" ":" domain-spec
The "include" mechanism triggers a recursive evaluation of check_host()
.
-
The
<domain-spec>
is expanded as per section 7. -
check_host()
is evaluated with the resulting string as the<domain>
. The<ip>
and<sender>
arguments remain the same as in the current evaluation ofcheck_host()
. -
The recursive evaluation returns match, not-match, or an error.
-
If it returns match, then the appropriate result for the "include" mechanism is used (e.g., "include" or "+include" produces a "pass" result and "-include" produces "fail").
-
If it returns not-match or an error, the parent
check_host()
resumes processing as per the table below, with the previous value of<domain>
restored.
The "include" mechanism makes it possible for one domain to designate multiple administratively independent domains. For example, a vanity domain "example.net" might send mail using the servers of administratively independent domains "example.com" and "example.org".
Example.net could say
IN TXT "v=spf1 include:example.com include:example.org -all"
This would direct check_host()
to, in effect, check the records of
"example.com" and "example.org" for a "pass" result.
Only if the host were not permitted for either of those domains would the
result be "fail".
Whether this mechanism matches, does not match, or returns an exception
depends on the result of the recursive evaluation of check_host()
:
+-------------------------------------+------------------------------------+ | A recursive check_host() result of: | Causes the "include" mechanism to: | +-------------------------------------+------------------------------------+ | pass | match | | fail | not match | | softfail | not match | | neutral | not match | | temperror | return temperror | | permerror | return permerror | | none | return permerror | +-------------------------------------+------------------------------------+
The "include" mechanism is intended for crossing administrative boundaries.
When remaining within one administrative authority, "include" is usually not the best choice. For example, if example.com and example.org were managed by the same entity, and if the permitted set of hosts for both domains was "mx:example.com", it would be possible for example.org to specify "include:example.com", but it would be preferable to specify "redirect=example.com" or even "mx:example.com".
The "redirect" modifier is more suitable for consolidating both authorizations and policy into a common set to be shared within an ADMD. Redirect is much more like a common code element to be shared among records in a single ADMD. It is possible to control both authorized hosts and policy for an arbitrary number of domains from a single record.
5.3. "a"
a = "a" [ ":" domain-spec ] [ dual-cidr-length ]
This mechanism matches if <ip> is one of the <target-name>'s IP addresses. For clarity, this means the "a" mechanism also matches AAAA records.
An address lookup is done on the <target-name> using the type of lookup (A or AAAA) appropriate for the connection type (IPv4 or IPv6). The <ip> is compared to the returned address(es). If any address matches, the mechanism matches.
5.4. "mx"
This mechanism matches if <ip> is one of the MX hosts for a domain name.
mx = "mx" [ ":" domain-spec ] [ dual-cidr-length ]
-
check_host() first performs an MX lookup on the <target-name>.
-
To prevent denial-of-service (DoS) attacks, the processing limits defined in Section 4.6.4 MUST be followed.
-
If the MX lookup limit is exceeded, then "permerror" is returned and the evaluation is terminated.
-
-
Then it performs an address lookup on each MX name returned.
-
The <ip> is compared to each returned IP address.
-
If any address matches, the mechanism matches.
-
If the <target-name> has no MX record, check_host() MUST NOT apply the implicit MX rules of [RFC5321] by querying for an A or AAAA record for the same name.
5.5. "ptr" (do not use)
This mechanism tests whether the DNS reverse-mapping for <ip> exists and correctly points to a domain name within a particular domain. This mechanism SHOULD NOT be published.
The <ip>'s name is looked up using this procedure:
-
Perform a DNS reverse-mapping for <ip>: Look up the corresponding PTR record in "in-addr.arpa." if the address is an IPv4 address and in "ip6.arpa." if it is an IPv6 address.
-
Check all domain names to see if they either match the <target-name> domain or are a subdomain of the <target-name> domain.
-
If any do, this domain name can be validated.
-
If no domain name can be found, or if none of the domain names match or are a subdomain of the <target-name>, this mechanism fails to match.
-
If a DNS error occurs while doing the PTR RR lookup, then this mechanism fails to match.
This mechanism may match if
-
a validated domain name is a subdomain of the <target-name>, or
-
the <target-name> and a domain name are the same.
For example, "mail.example.com" is within the domain "example.com", but "mail.bad-example.com" is not.
The domain names received must also be validated for the mechanism to match.
-
For each matched record, validate the domain name by looking up its IP addresses. To prevent DoS attacks, the PTR processing limits defined in Section 4.6.4 MUST be applied. If they are exceeded, processing is terminated and the mechanism does not match.
-
If <ip> is among the returned IP addresses, then that domain name is validated.
If a DNS error occurs while doing an A RR lookup, then that domain name is skipped and the search continues.
The mechanism matches if a domain name is found that properly matches the target name and can be properly validated. While these tests can be done in either order, performing the match before validating prevents needless DNS queries being performed.
Note: This mechanism is not as reliable as other mechanisms in cases of DNS errors. If used, proper PTR records have to be in place for the domain’s hosts and the "ptr" mechanism SHOULD be one of the last mechanisms checked. After many years of SPF deployment experience, it has been concluded that it is unnecessary and more reliable alternatives should be used instead. It is, however, still in use as part of the SPF protocol, so compliant check_host() implementations MUST support it.
5.6. "ip4" and "ip6"
These mechanisms test whether <ip> is contained within a given IP network.
ip4 = "ip4" ":" ip4-network [ ip4-cidr-length ] ip6 = "ip6" ":" ip6-network [ ip6-cidr-length ] ip4-cidr-length = "/" ("0" / %x31-39 0*1DIGIT) ; value range 0-32 ip6-cidr-length = "/" ("0" / %x31-39 0*2DIGIT) ; value range 0-128 dual-cidr-length = [ ip4-cidr-length ] [ "/" ip6-cidr-length ] ip4-network = qnum "." qnum "." qnum "." qnum qnum = DIGIT ; 0-9 / %x31-39 DIGIT ; 10-99 / "1" 2DIGIT ; 100-199 / "2" %x30-34 DIGIT ; 200-249 / "25" %x30-35 ; 250-255 ; as per conventional dotted-quad notation, e.g., <IP_ADDRESS> ip6-network = <as per Section 2.2 of [RFC4291]> ; e.g., 2001:db8::cd30
The <ip> is compared to the given network.
-
If CIDR prefix length high-order bits match, the mechanism matches.
-
If ip4-cidr-length is omitted, it is taken to be "/32".
-
If ip6-cidr-length is omitted, it is taken to be "/128".
-
It is not permitted to omit parts of the IP address instead of using CIDR notations. That is, use <IP_ADDRESS>/24 instead of 192.0.2.
5.7. "exist"
This mechanism is used to construct an arbitrary domain name that is used for a DNS A record query. It allows for complicated schemes involving arbitrary parts of the mail envelope to determine what is permitted.
exists = "exists" ":" domain-spec
-
The resulting domain name is used for a DNS A RR lookup (even when the connection type is IPv6).
-
If any A record is returned, this mechanism matches.
-
Domains can use this mechanism to specify arbitrarily complex queries. For example, suppose example.com publishes the record: …. v=spf1 exists:%{ir}.%{l1r+-}._spf.%{d} -all ….
The <target-name> might expand to "<IP_ADDRESS>.someuser._spf.example.com". This makes fine-grained decisions possible at the level of the user and client IP address.
6. Modifier Definitions
Modifiers are name/value pairs that provide additional information.
-
Modifiers always have an "=" separating the name and the value.
-
The modifiers defined in this document ("redirect" and "exp") SHOULD appear at the end of the record, after all mechanisms, though syntactically they can appear anywhere in the record.
-
Ordering of these two modifiers does not matter.
-
These two modifiers MUST NOT appear in a record more than once each. If they do, then check_host() exits with a result of "permerror".
-
Unrecognized modifiers MUST be ignored no matter where, or how often, they appear in a record. This allows implementations conforming to this document to gracefully handle records with modifiers that are defined in other specifications.
6.1. redirect: Redirected Query
The "redirect" modifier is intended for consolidating both authorizations and policy into a common set to be shared within a single ADMD.
redirect = "redirect" "=" domain-spec
-
For clarity, any "redirect" modifier SHOULD appear as the very last term in a record.
-
Any "redirect" modifier MUST be ignored if there is an "all" mechanism anywhere in the record.
If all mechanisms fail to match, and a "redirect" modifier is present, then processing proceeds as follows:
-
The <domain-spec> portion of the redirect section is expanded as per the macro rules in Section 7.
-
Then check_host() is evaluated with the resulting string as the <domain>.
-
The <ip> and <sender> arguments remain the same as in the current evaluation of check_host().
-
-
The result of this new evaluation of check_host() is then considered the result of the current evaluation with the exception that if no SPF record is found, or if the <target-name> is malformed, the result is a "permerror" rather than "none".
-
Note that the newly queried domain can itself specify redirect processing.
This facility is intended for use by organizations that wish to apply the same record to multiple domains. For example:
la.example.com. TXT "v=spf1 redirect=_spf.example.com" ny.example.com. TXT "v=spf1 redirect=_spf.example.com" sf.example.com. TXT "v=spf1 redirect=_spf.example.com" _spf.example.com. TXT "v=spf1 mx:example.com -all"
In this example, mail from any of the three domains is described by the same record. This can be an administrative advantage.
Note: In general, the domain "A" cannot reliably use a redirect to another domain "B" not under the same administrative control. Since the <sender> stays the same, there is no guarantee that the record at domain "B" will correctly work for mailboxes in domain "A", especially if domain "B" uses mechanisms involving local-parts. An "include" directive will generally be more appropriate.
6.2. exp: Explanation
explanation = "exp" "=" domain-spec
If check_host() results in a "fail" due to a mechanism match (such as "-all"), and the "exp" modifier is present, then the explanation string returned is computed as described below.
If no "exp" modifier is present, then either a default explanation string or an empty explanation string MUST be returned to the calling application.
-
The <domain-spec> is macro expanded (see Section 7) and becomes the <target-name>.
-
The DNS TXT RRset for the <target-name> is fetched.
-
If there are any DNS processing errors (any RCODE other than 0), or if no records are returned, or if more than one record is returned, or if there are syntax errors in the explanation string, then proceed as if no "exp" modifier was given.
-
The fetched TXT record’s strings are concatenated with no spaces, and then treated as an explain-string, which is macro-expanded. This final result is the explanation string.
-
Implementations MAY limit the length of the resulting explanation string to allow for other protocol constraints and/or reasonable processing limits.
-
Since the explanation string is intended for an SMTP response and Section 2.4 of [RFC5321] says that responses are in [US-ASCII], the explanation string MUST be limited to [US-ASCII].
-
Software evaluating check_host() can use this string to communicate information from the publishing domain in the form of a short message or URL.
-
Software SHOULD make it clear that the explanation string comes from a third party. For example, it can prepend the macro string "%{o} explains: " to the explanation.
-
During recursion into an "include" mechanism, an "exp" modifier from the <target-name> MUST NOT be used. This is because "include" is meant to cross administrative boundaries and the explanation provided should be the one from the receiving ADMD.
-
In contrast, when executing a "redirect" modifier, an "exp" modifier from the original domain MUST NOT be used. "redirect" is meant to operate as a tool to consolidate policy records within an ADMD so the redirected explanation is the one that ought to have priority.
Here are some examples of possible explanation TXT records at explain._spf.example.com:
"Mail from example.com should only be sent by its own servers."
— a simple, constant message
"%{i} is not one of %{d}'s designated mail servers."
— a message with a little more information, including the IP address that failed the check
"See http://%{d}/why.html?s=%{S}&i=%{I}"
— a complicated example that constructs a URL with the arguments to check_host() so that a web page can be generated with detailed, custom instructions
7. Macros
7.1. Formal Specification
domain-spec = macro-string domain-end domain-end = ( "." toplabel [ "." ] ) / macro-expand toplabel = ( *alphanum ALPHA *alphanum ) / ( 1*alphanum "-" *( alphanum / "-" ) alphanum ) alphanum = ALPHA / DIGIT explain-string = *( macro-string / SP ) macro-string = *( macro-expand / macro-literal ) macro-expand = ( "%{" macro-letter transformers *delimiter "}" ) / "%%" / "%_" / "%-" macro-literal = %x21-24 / %x26-7E ; visible characters except "%" macro-letter = "s" / "l" / "o" / "d" / "i" / "p" / "h" / "c" / "r" / "t" / "v" transformers = *DIGIT [ "r" ] delimiter = "." / "-" / "+" / "," / "/" / "_" / "="
Some special cases:
-
A literal "%" is expressed by "%%".
-
"%_" expands to a single " " space.
-
"%-" expands to a URL-encoded space, viz., "%20".
7.2. Macro Definitions
The following macro letters are expanded in term arguments:
s = <sender> l = local-part of <sender> o = domain of <sender> d = <domain> i = <ip> p = the validated domain name of <ip> (do not use) v = the string "in-addr" if <ip> is ipv4, or "ip6" if <ip> is ipv6 h = HELO/EHLO domain
The following macro letters are allowed only in "exp" text:
c = SMTP client IP (easily readable format) r = domain name of host performing the check t = current timestamp
7.3. Macro Processing Details
A '%' character not followed by a '{', '%', '-', or '_' character is a syntax error. So:
-exists:%(ir).sbl.example.org
is incorrect and will cause check_host() to yield a "permerror". Instead, the following is legal:
-exists:%{ir}.sbl.example.org
Optional transformers are the following:
*DIGIT = zero or more digits
'r' = reverse value, splitting on dots by default
If transformers or delimiters are provided, the replacement value for a macro letter is split into parts separated by one or more of the specified delimiter characters. After performing any reversal operation and/or removal of left-hand parts, the parts are rejoined using "." and not the original splitting characters.
-
By default, strings are split on "." (dots).
-
Note that no special treatment is given to leading, trailing, or consecutive delimiters in input strings, and so the list of parts might contain empty strings.
-
Some older implementations of SPF prohibit trailing dots in domain names, so trailing dots SHOULD NOT be published, although they MUST be accepted by implementations conforming to this document.
-
Macros can specify delimiter characters that are used instead of ".".
-
The "r" transformer indicates a reversal operation: if the client IP address were <IP_ADDRESS>, the macro %{i} would expand to "<IP_ADDRESS>" and the macro %{ir} would expand to "<IP_ADDRESS>".
-
The DIGIT transformer indicates the number of right-hand parts to use, after optional reversal.
-
If a DIGIT is specified, the value MUST be nonzero.
-
If no DIGITs are specified, or if the value specifies more parts than are available, all the available parts are used.
-
If the DIGIT was 5, and only 3 parts were available, the macro interpreter would pretend the DIGIT was 3.
-
Implementations MUST support at least a value of 127, as that is the maximum number of labels in a domain name (less the zero-length label at the end).
-
-
The "s" macro expands to the <sender> argument. It is an email address with a local-part, an "@" character, and a domain.
-
The "l" macro expands to just the local-part.
-
The "o" macro expands to just the domain part.
-
Note that "s", "l", and "o" values remain the same during recursive and chained evaluations due to "include" and/or "redirect".
-
If the original <sender> had no local-part, the local-part was set to "postmaster" in initial processing (see Section 4.3).
-
For IPv4 addresses, both the "i" and "c" macros expand to the standard dotted-quad format.
-
For IPv6 addresses, the "i" macro expands to a dot-format address; it is intended for use in %{ir}.
-
The "c" macro can expand to any of the hexadecimal colon-format addresses specified in Section 2.2 of [RFC4291]. It is intended for humans to read.
-
The "p" macro expands to the validated domain name of <ip>. The procedure for finding the validated domain name is defined in Section 5.5.
-
If the <domain> is present in the list of validated domains, it SHOULD be used.
-
Otherwise, if a subdomain of the <domain> is present, it SHOULD be used.
-
Otherwise, any name from the list can be used.
-
If there are no validated domain names or if a DNS error occurs, the string "unknown" is used.
-
This macro SHOULD NOT be published (see Section 5.5 for the discussion).
-
-
The "h" macro expands to the parameter that was provided to the SMTP server via the HELO or EHLO SMTP verb. For sessions where that verb was provided more than once, the most recent instance is used.
-
The "r" macro expands to the name of the receiving MTA. This SHOULD be a fully qualified domain name, but if one does not exist (as when the checking is done by a Mail User Agent (MUA)) or if policy restrictions dictate otherwise, the word "unknown" SHOULD be substituted. The domain name can be different from the name found in the MX record that the client MTA used to locate the receiving MTA.
-
The "t" macro expands to the decimal representation of the approximate number of seconds since the Epoch (Midnight, January 1, 1970, UTC) at the time of the evaluation. This is the same value as the value that is returned by the Portable Operating System Interface (POSIX) time() function in most standards-compliant libraries.
-
When the result of macro expansion is used in a domain name query, if the expanded domain name exceeds 253 characters (the maximum length of a domain name in this format), the left side is truncated to fit, by removing successive domain labels (and their following dots) until the total length does not exceed 253 characters.
-
Uppercase macros expand exactly as their lowercase equivalents, and are then URL escaped. URL escaping MUST be performed for characters not in the "unreserved" set, which is defined in [RFC3986].
-
Care has to be taken by the sending ADMD so that macro expansion for legitimate email does not exceed the 63-character limit on DNS labels. The local-part of email addresses, in particular, can have more than 63 characters between dots.
-
To minimize DNS lookup resource requirements, it is better if sending ADMDs avoid using the "s", "l", "o", or "h" macros in conjunction with any mechanism directive. Although these macros are powerful and allow per-user records to be published, they severely limit the ability of implementations to cache results of check_host() and they reduce the effectiveness of DNS caches.
-
If no directive processed during the evaluation of check_host() contains an "s", "l", "o", or "h" macro, then the results of the evaluation can be cached on the basis of <domain> and <ip> alone for as long as the DNS record involved with the shortest Time to Live (TTL) has not expired.
7.4. Expansion Examples
The <sender> is<EMAIL_ADDRESS>The IPv4 SMTP client IP is <IP_ADDRESS>. The IPv6 SMTP client IP is 2001:db8::cb01. The PTR domain name of the client IP is mx.example.org.
Example of macro expansion,
-
%{s}
<EMAIL_ADDRESS>-
%{o}
: email.example.com -
%{d}
: email.example.com -
%{d4}
: email.example.com -
%{d3}
: email.example.com -
%{d2}
: example.com -
%{d1}
: com -
%{dr}
: com.example.email -
%{d2r}
: example.email -
%{l}
: strong-bad -
%{l-}
: strong.bad -
%{lr}
: strong-bad -
%{lr-}
: bad.strong -
%{l1r-}
: strong -
%{ir}.%{v}._spf.%{d2}: `<IP_ADDRESS>.in-addr._spf.example.com
-
%{lr-}.lp._spf.%{d2}
:bad.strong.lp._spf.example.com
-
%{lr-}.lp.%{ir}.%{v}._spf.%{d2}
: bad.strong.lp.<IP_ADDRESS>.in-addr._spf.example.com -
%{ir}.%{v}.%{l1r-}.lp._spf.%{d2}
: <IP_ADDRESS>.in-addr.strong.lp._spf.example.com -
%{d2}.trusted-domains.example.net
: example.com.trusted-domains.example.net -
%{ir}.%{v}._spf.%{d2}
:1.0.b.c.<IP_ADDRESS>.<IP_ADDRESS>.<IP_ADDRESS>.<IP_ADDRESS>.<IP_ADDRESS>.8.b.d.<IP_ADDRESS>.2.ip6._spf.example.com
8. Result Handling
There are essentially two classes of handling choices:
- Handling within the SMTP session that attempted to deliver the message, such as by returning a permanent SMTP error (rejection) or temporary SMTP error ("try again later");
- Permitting the message to pass (a successful SMTP reply code) and adding an additional header field that indicates the result returned by check_host() and other salient details; this is discussed in more detail in Section 9.
8.1. None
The SPF verifier has no information at all about the authorization or lack thereof of the client to use the checked identity or identities. The check_host() function completed without errors but was not able to reach any conclusion.
8.2. Neutral
A policy for the identity was discovered, there is no definite assertion (positive or negative) about the client.
A "neutral" result MUST be treated exactly like the "none" result; the distinction exists only for informational purposes. Treating "neutral" more harshly than "none" would discourage ADMDs from testing the use of SPF records (see Section 10.1).
8.3. Pass
The client is authorized to inject mail with the given identity. The domain can now, in the sense of reputation, be considered responsible for sending the message. Further policy checks can now proceed with confidence in the legitimate use of the identity. This is further discussed in Appendix G.1.
8.4. Fail
The client is not authorized to use the domain in the given identity. Disposition of SPF fail messages is a matter of local policy. See Appendix G.2 for considerations on developing local policy.
-
If the checking software chooses to reject the mail during the SMTP transaction, then it SHOULD use an SMTP reply code of 550 (see [RFC5321]) and, if supported, the 5.7.1 enhanced status code (see [RFC3463], Section 3.8), in addition to an appropriate reply text.
-
The check_host() function will return either a default explanation string or one from the domain that published the SPF records (see Section 6.2).
-
If the information does not originate with the checking software, it is good to make it clear that the text is provided by the sender’s domain. For example:
550 5.7.1 SPF MAIL FROM check failed: 550 5.7.1 The domain example.com explains: 550 5.7.1 Please see http://www.example.com/mailpolicy.html
-
If the checking software chooses not to reject the mail during the SMTP transaction, then it SHOULD add a Received-SPF or Authentication-Results header field (see Section 9) to communicate this result to downstream message processors. While this is true for all SPF results, it is of particular importance for "fail" results since the message is explicitly not authorized by the ADMD.
8.5. Softfail
A "softfail" result ought to be treated as somewhere between "fail" and "neutral"/"none". The ADMD believes the host is not authorized but is not willing to make a strong policy statement.
-
Receiving software SHOULD NOT reject the message based solely on this result, but MAY subject the message to closer scrutiny than normal.
-
The ADMD wants to discourage the use of this host and thus desires limited feedback when a "softfail" result occurs. For example, the recipient’s MUA could highlight the "softfail" status, or the receiving MTA could give the sender a message using greylisting [RFC6647], with a note the first time the message is received, but accept it on a later attempt based on receiver policy.
8.6. Temperror
The SPF verifier encountered a transient (generally DNS) error while performing the check.
-
Checking software can choose to accept or temporarily reject the message.
-
If the message is rejected during the SMTP transaction for this reason, the software SHOULD use an SMTP reply code of 451 and, if supported, the 4.4.3 enhanced status code (see Section 3.5 of [RFC3463]).
-
These errors can be caused by problems in either the sender’s or receiver’s DNS software. See Appendix G.4 for considerations on developing local policy.
8.7. Permerror
The domain’s published records could not be correctly interpreted.
-
This signals an error condition that definitely requires DNS operator intervention to be resolved.
-
If the message is rejected during the SMTP transaction for this reason, the software SHOULD use an SMTP reply code of 550 and, if supported, the 5.5.2 enhanced status code (see [RFC3463], Section 3.6).
-
Be aware that if the ADMD uses macros (Section 7), it is possible that this result is due to the checked identities having an unexpected format.
-
It is also possible that this result is generated by certain SPF verifiers due to the input arguments having an unexpected format; see Section 4.8.
-
See Appendix G.3 for considerations on developing local policy.
9. Recording the Result
It is RECOMMENDED that SMTP receivers record the result of SPF processing in the message header.
Two methods are presented:
-
Section 9.1 defines the Received-SPF field, which is the results field originally defined for SPF use.
-
Received-SPF is intended to include enough information to enable reconstruction of the SPF evaluation of the message.
-
Received-SPF relies on compliance of agents within the receiving ADMD to adhere to the header field ordering rules of [RFC5321] and [RFC5322]
-
-
Section 9.2 discusses the Authentication-Results header field [RFC7001], which was specified more recently and is designed for use by SPF and other authentication methods.
-
Authentication-Results is designed only to relay the result itself and related output details of likely use to end users (e.g., what property of the message was actually authenticated and what it contained), leaving reconstructive work to the purview of system logs and the Received field contents.
-
Authentication-Results includes some provisions to protect against non-compliant implementations.
-
-
An SPF verifier operator could choose to use both to serve different downstream agents. In such cases, care needs to be taken to ensure that both fields are conveying the same details, or unexpected results can occur.
9.1. The Received-SPF Header Field
-
The Received-SPF header field is a trace field (see [RFC5322], Section 3.6.7) and SHOULD be prepended to the existing header, above the Received: field that is generated by the SMTP receiver.
-
It MUST appear above all other Received-SPF fields in the message.
The header field has the following format:
header-field = "Received-SPF:" [CFWS] result FWS [comment FWS] [ key-value-list ] CRLF
result = "pass" / "fail" / "softfail" / "neutral" / "none" / "temperror" / "permerror"
key-value-list = key-value-pair *( ";" [CFWS] key-value-pair ) [";"]
key-value-pair = key [CFWS] "=" ( dot-atom / quoted-string )
key = "client-ip" / "envelope-from" / "helo" / "problem" / "receiver" / "identity" / "mechanism" / name
identity = "mailfrom" ; for the "MAIL FROM" identity / "helo" ; for the "HELO" identity / name ; other identities
dot-atom = <unquoted word as per [RFC5322]> quoted-string = <quoted string as per [RFC5322]> comment = <comment string as per [RFC5322]> CFWS = <comment or folding white space as per [RFC5322]> FWS = <folding white space as per [RFC5322]> CRLF = <standard end-of-line token as per [RFC5322]>
-
The header field SHOULD include a "(…)" style comment after the result, conveying supporting information for the result, such as <ip>, <sender>, and <domain>.
-
SPF verifiers SHOULD give enough information so that the SPF results can be verified — that is, at least "client-ip", "helo", and, if the "MAIL FROM" identity was checked, "envelope-from".
The following key-value pairs are designed for later machine parsing,
-
client-ip: the IP address of the SMTP client
-
envelope-from: the envelope sender mailbox
-
helo: the host name given in the HELO or EHLO command
-
mechanism: the mechanism that matched (if no mechanisms matched, substitute the word "default")
-
problem: if an error was returned, details about the error
-
receiver: the host name of the SPF verifier
-
identity: the identity that was checked; see the <identity> ABNF rule
Other keys MAY be defined by SPF verifiers.
SPF verifiers MUST make sure that the Received-SPF header field does not contain invalid characters, is not excessively long (see [RFC5322], Section 2.1.1), and does not contain malicious data that has been provided by the sender.
Examples of various header field styles that could be generated are the following:
Received-SPF: pass (mybox.example.org: domain of<EMAIL_ADDRESS>designates <IP_ADDRESS> as permitted sender) receiver=mybox.example.org; client-ip=<IP_ADDRESS><EMAIL_ADDRESS>helo=foo.example.com; Received-SPF: fail (mybox.example.org: domain of<EMAIL_ADDRESS>does not designate <IP_ADDRESS> as permitted sender) identity=mailfrom; client-ip=<IP_ADDRESS><EMAIL_ADDRESS>Received-SPF: pass (mybox.example.org: domain of<EMAIL_ADDRESS>designates <IP_ADDRESS> as permitted sender) receiver=mybox.example.org; client-ip=<IP_ADDRESS>; mechanism=ip4:<IP_ADDRESS><EMAIL_ADDRESS>helo=foo.example.com;
9.2. SPF Results in the Authentication-Results Header Field
The Authentication-Results header field is designed to communicate lists of tests a border MTA did and their results. The specified elements of the field provide less information than the Received-SPF field:
Authentication-Results: myhost.example.org; spf=pass smtp.mailfrom=example.net Received-SPF: pass (myhost.example.org: domain of<EMAIL_ADDRESS>designates <IP_ADDRESS> as permitted sender) receiver=mybox.example.org; client-ip=<IP_ADDRESS><EMAIL_ADDRESS>helo=foo.example.com;
It is, however, possible to add CFWS in the "reason" part of an Authentication-Results header field and provide the equivalent information, if desired.
As an example, an expanded Authentication-Results header field might look like (for a "MAIL FROM" check in this example):
Authentication-Results: myhost.example.org; spf=pass reason="client-ip=<IP_ADDRESS>; smtp.helo=foo.example.com"<EMAIL_ADDRESS>10. Effects on Infrastructure
This section provides operational advice and instruction only. It is non-normative.
10.1. Sending Domains
Originating ADMDs that wish to be compliant with this specification will need to determine the list of relays ([RFC5598], Section 2.2.2) that they allow to use their domain name in the "HELO" and "MAIL FROM" identities when relaying to other ADMDs. It is recognized that forming such a list is not just a simple technical exercise, but involves policy decisions with both technical and administrative considerations.
10.1.1. DNS Resource Considerations
For example, consider a domain set up as follows:
example.com. IN MX 10 mx.example.com. IN MX 20 mx2.example.com. mx.example.com. IN A <IP_ADDRESS> mx2.example.com. IN A <IP_ADDRESS>
Assume the administrative point is to authorize (pass) mx and mx2 while failing every other host. Compare the following solutions:
Best record:
example.com. IN TXT "v=spf1 ip4:<IP_ADDRESS> ip4:<IP_ADDRESS> -all"
Good record:
$ORIGIN example.com. @ IN TXT "v=spf1 a:authorized-spf.example.com -all" authorized-spf IN A <IP_ADDRESS> IN A <IP_ADDRESS>
Expensive record:
example.com. IN TXT "v=spf1 mx:example.com -all"
Wasteful, bad record:
example.com. IN TXT "v=spf1 ip4:<IP_ADDRESS>/24 mx -all"
10.1.2. Administrator’s Considerations
There might be administrative considerations: using "a" over "ip4" or "ip6" allows hosts to be renumbered easily at the cost of a DNS query per receiver. Using "mx" over "a" allows the set of mail hosts to be changed easily. Unless such changes are common, it is better to use the less resource-intensive mechanisms like "ip4" and "ip6" over "a" or "a" over "mx".
Publishing SPF records for domains that send no mail is a well-established best practice. The record for a domain that sends no mail is:
www.example.com. IN TXT "v=spf1 -all"
Publishing SPF records for individual hosts is also best practice. The host name is generally the identity used in the 5321.HELO/.EHLO command. In the case of messages with a null 5321.MailFrom, this is used as the domain for 5321.MailFrom SPF checks, in addition to being used in 5321.HELO/.EHLO-based SPF checks. The standard SPF record for an individual host that is involved in mail processing is:
relay.example.com. IN TXT "v=spf1 a -all"
Validating correct deployment is difficult. [RFC6652] describes one mechanism for soliciting feedback on SPF failures. Another suggestion can be found in Appendix C.
Regardless of the method used, understanding the ADMD’s outbound mail architecture is essential to effective deployment.
10.1.3. Bounces
In this case, the only entity available for performing an SPF check is the "HELO" identity defined in Section 1.1.4. SPF functionality is enhanced by administrators ensuring this identity is set correctly and has an appropriate SPF record. It is normal to have the "HELO" identity set to the host name instead of the domain. Zone file generation for significant numbers of hosts can be consolidated using the "redirect" modifier and scripted for initial deployment.
10.2. Receivers
There is no comprehensive normative requirement for specific handling of a message based on SPF results. The information presented in Section 8 and in Appendix G is offered for receiver consideration when forming local handling policies.
The primary considerations are that SPF might return "pass" for mail that is ultimately harmful (e.g., spammers that arrange for SPF to pass using disposable domain names, or virus or spam outbreaks from within trusted sources), and might also return "fail" for mail that is ultimately legitimate (e.g., legitimate mail that has traversed a mail alias). It is important to take both of these cases under consideration when establishing local handling policy.
10.3. Mediator
A mediator takes 'delivery’ of a message and posts a 'submission’ of a new message. The mediator can make the newly posted message be as similar to or as different from the original message as they wish. Examples include mailing lists (see Section 5.3 of [RFC5598]) and ReSenders (Section 5.2 of [RFC5598]). This is discussed in [RFC5321], Section 3.9. For the operation of SPF, the essential concern is the email address in the 5321.MailFrom command for the new message.
Because SPF evaluation is based on the IP address of the "last" sending SMTP server, the address of the mediator will be used, rather than the address of the SMTP server that sent the message to the mediator. Some mediators retain the email address from the original message, while some use a new address.
If the address is the same as for the original message, and the original message had an associated SPF record, then the SPF evaluation will fail unless mitigations such as those described in Appendix D are used.
11. Security Considerations
11.1. Processing Limits
The processing limits outlined in Section 4.6.4 are designed to prevent attacks such as the following:
-
A malicious party could create an SPF record with many references to a victim’s domain and send many emails to different SPF verifiers; those SPF verifiers would then create a DoS attack. In effect, the SPF verifiers are being used to amplify the attacker’s bandwidth by using fewer octets in the SMTP session than are used by the DNS queries. Using SPF verifiers also allows the attacker to hide the true source of the attack. This potential attack is based on large volumes of mail being transmitted.
-
Whereas implementations of check_host() are supposed to limit the number of DNS lookups, malicious domains could publish records that exceed these limits in an attempt to waste computation effort at their targets when they send them mail. Malicious domains could also design SPF records that cause particular implementations to use excessive memory or CPU or to trigger bugs. If a receiver is configured to accept mail with an SPF result of "temperror", such an attack might result in mail that would otherwise have been rejected due to an SPF "fail" result being accepted. This potential attack is based on specially crafted SPF records being used to exhaust DNS resources of the victim.
-
Malicious parties could send a large volume of mail purporting to come from the intended target to a wide variety of legitimate mail hosts.
-
Malicious parties could, in theory, use SPF records as a vehicle for DNS lookup amplification for a DoS attack. In this scenario, the attacker publishes an SPF record in its own DNS that uses "a" and "mx" mechanisms directed toward the intended victim, e.g., "a:example.com a:foo.example.com a:bar.example.com
-
and then distributes mail with a MAIL FROM value including its own domain in large volume to a wide variety of destinations. Any such destination operating an SPF verifier will begin querying all of the names associated with the "a" mechanisms in that record. The names used in the record needn’t exist for the attack to be effective. Operational experience since the publication of [RFC4408] suggests that mitigation of this class of attack can be accomplished with minimal impact on the deployed base by having the verifier abort processing and return "permerror" (Section 2.6.7) as soon as more than two "void lookups" have been encountered (defined in Section 4.6.4).
-
Of these, the case of a third party referenced in the SPF record is the easiest for a DoS attack to effectively exploit. As a result, limits that might seem reasonable for an individual mail server can still allow an unreasonable amount of bandwidth amplification. Therefore, the processing limits need to be quite low.
11.2. SPF-Authorized Email May Contain Other False Identities
The "MAIL FROM" and "HELO" identity authorizations do not provide assurance about the authorization/authenticity of other identities used in the message. It is entirely possible for a malicious sender to inject a message using his own domain in the identities used by SPF and have that domain’s SPF record authorize the sending host, and yet the message can easily list other identities in its header. Unless the user or the MUA takes care to note that the authorized identity does not match the other more commonly presented identities (such as the From: header field), the user might be lulled into a false sense of security.
11.3. Spoofed DNS and IP Data
There are two aspects of this protocol that malicious parties could exploit to undermine the validity of the check_host() function:
-
The evaluation of check_host() relies heavily on DNS. A malicious attacker could attack the DNS infrastructure and cause check_host() to see spoofed DNS data, and then return incorrect results. This could include returning "pass" for an <ip> value where the actual domain’s record would evaluate to "fail". See [RFC3833] for a description of DNS weaknesses, and see [RFC4033] for a countermeasure.
-
The client IP address, <ip>, is assumed to be correct. In a modern, correctly configured system, the risk of this not being true is nil.
11.4. Cross-User Forgery
By definition, SPF policies just map domain names to sets of authorized MTAs, not whole email addresses to sets of authorized users. Although the "l" macro (Section 7) provides a limited way to define individual sets of authorized MTAs for specific email addresses, it is generally impossible to verify, through SPF, the use of specific email addresses by individual users of the same MTA.
It is up to mail services and their MTAs to directly prevent cross-user forgery: based on SMTP AUTH ([RFC4954]), users have to be restricted to using only those email addresses that are actually under their control (see Section 6.1 of [RFC6409]). Another means to verify the identity of individual users is message cryptography, such as Pretty Good Privacy (PGP) ([RFC4880]) or S/MIME ([RFC5751]).
11.5. Untrusted Information Sources
An SPF-compliant receiver gathers information from the SMTP commands it receives and from the published DNS records of the sending domain holder (e.g., "HELO" domain name, the "MAIL FROM" address from the envelope, and SPF DNS records published by the domain holder). These parameters are not validated in the SMTP process.
All of these pieces of information are generated by actors outside of the authority of the receiver, and thus are not guaranteed to be accurate or legitimate.
11.5.1. Recorded Results
This information, passed to the receiver in the Received-SPF: or Authentication-Results: trace fields, can be returned to the client MTA as an SMTP rejection message. If such an SMTP rejection message is generated, the information from the trace fields has to be checked for such problems as invalid characters and excessively long lines.
11.5.2. External Explanations
When the authorization check fails, an explanation string could be included in the reject response. Both the sender and the rejecting receiver need to be aware that the explanation was determined by the publisher of the SPF record checked and, in general, not the receiver. The explanation can contain malicious URLs, or it might be offensive or misleading.
Explanations returned to sender domains due to "exp" modifiers (Section 6.2) were generated by the sender policy published by the domain holders themselves. As long as messages are only returned with non-delivery notifications ([RFC3464]) to domains publishing the explanation strings from their own DNS SPF records, the only affected parties are the original publishers of the domain’s SPF records.
In practice, such non-delivery notifications can be misdirected, such as when an MTA accepts an email and only later generates the notification to a forged address, or when an email forwarder does not direct the bounce back to the original sender.
11.5.3. Macro Expansion
Macros (Section 7) allow senders to inject arbitrary text (any non-null [US-ASCII] character) into receiver DNS queries. It is necessary to be prepared for hostile or unexpected content.
11.6. Privacy Exposure
Checking SPF records causes DNS queries to be sent to the domain owner. These DNS queries, especially if they are caused by the "exists" mechanism, can contain information about who is sending email and likely to which MTA the email is being sent. This can introduce some privacy concerns, which are more or less of an issue depending on local laws and the relationship between the ADMD and the person sending the email.
11.7. Delivering Mail Producing a "Fail" Result
Operators that choose to deliver mail for which SPF produces a "fail" result need to understand that they are admitting content that is explicitly not authorized by the purported sender. While there are known failure modes that can be considered "false negatives", the distinct choice to admit those messages increases end-user exposure to likely harm. This is especially true for domains belonging to known good actors that are typically well-behaved; unauthorized mail from those sources might well be subjected to much higher skepticism and content analysis.
SPF does not, however, include the capacity to distinguish good actors from bad ones, nor does it handle the concept of known actors versus unknown ones. Those notions are out of scope for this specification.


I've tried to make this quick and dirty. You can find the usage for Scotch in the source of this page.


Analyzing Login/Logout Records
问题描述 :
The following are example login/logout records.
* The student 1 logged in to the PC 1 at 12:55
* The student 2 logged in to the PC 4 at 13:00
* The student 1 logged in to the PC 2 at 13:10
* The student 1 logged out of the PC 2 at 13:20
* The student 1 logged in to the PC 3 at 13:30
* The student 1 logged out of the PC 1 at 13:40
* The student 1 logged out of the PC 3 at 13:45
* The student 1 logged in to the PC 1 at 14:20
* The student 2 logged out of the PC 4 at 14:30
* The student 1 logged out of the PC 1 at 14:40
For a query such as “Give usage of the student 1 between 13:00 and 14:30″, your program should answer “55 minutes”, that is, the sum of 45 minutes from 13:00 to 13:45 and 10 minutes from 14:20 to 14:30, as depicted in the following figure.
输入:
N M
r
record1
…
recordr
q
query1
…
queryq
The numbers N and M in the first line are the numbers of PCs and the students, respectively. r is the number of records. q is the number of queries. These four are integers satisfying the following.
1 ≤ N ≤ 1000, 1 ≤ M ≤ 10000, 2 ≤ r ≤ 1000, 1 ≤ q ≤ 50
Each record consists of four integers, delimited by a space, as follows.
t n m s
s is 0 or 1. If s is 1, this line means that the student m logged in to the PC n at time t . If s is 0, it means that the student m logged out of the PC n at time t . The time is expressed as elapsed minutes from 0:00 of the day. t , n and m satisfy the following.
540 ≤ t ≤ 1260, 1 ≤ n ≤ N , 1 ≤ m ≤ M
You may assume the following about the records.
# Records are stored in ascending order of time t.
# No two records for the same PC has the same time t.
# No PCs are being logged in before the time of the first record nor after that of the last record in the file.
# Login and logout records for one PC appear alternatingly, and each of the login-logout record pairs is for the same student.
Each query consists of three integers delimited by a space, as follows.
ts te m
It represents “Usage of the student m between ts and te “. ts , te and m satisfy the following.
540 ≤ ts < te ≤ 1260, 1 ≤ m ≤ M
输出:
N M
r
record1
…
recordr
q
query1
…
queryq
The numbers N and M in the first line are the numbers of PCs and the students, respectively. r is the number of records. q is the number of queries. These four are integers satisfying the following.
1 ≤ N ≤ 1000, 1 ≤ M ≤ 10000, 2 ≤ r ≤ 1000, 1 ≤ q ≤ 50
Each record consists of four integers, delimited by a space, as follows.
t n m s
s is 0 or 1. If s is 1, this line means that the student m logged in to the PC n at time t . If s is 0, it means that the student m logged out of the PC n at time t . The time is expressed as elapsed minutes from 0:00 of the day. t , n and m satisfy the following.
540 ≤ t ≤ 1260, 1 ≤ n ≤ N , 1 ≤ m ≤ M
You may assume the following about the records.
# Records are stored in ascending order of time t.
# No two records for the same PC has the same time t.
# No PCs are being logged in before the time of the first record nor after that of the last record in the file.
# Login and logout records for one PC appear alternatingly, and each of the login-logout record pairs is for the same student.
Each query consists of three integers delimited by a space, as follows.
ts te m
It represents “Usage of the student m between ts and te “. ts , te and m satisfy the following.
540 ≤ ts < te ≤ 1260, 1 ≤ m ≤ M
样例输入:
4 2 10 775 1 1 1 780 4 2 1 790 2 1 1 800 2 1 0 810 3 1 1 820 1 1 0 825 3 1 0 860 1 1 1 870 4 2 0 880 1 1 0 1 780 870 1 13 15 12 540 12 13 1 600 12 13 0 650 13 15 1 660 12 15 1 665 11 13 1 670 13 15 0 675 11 13 0 680 12 15 0 1000 11 14 1 1060 12 14 1 1060 11 14 0 1080 12 14 0 3 540 700 13 600 1000 15 1000 1200 11 1 1 2 600 1 1 1 700 1 1 0 5 540 600 1 550 650 1 610 620 1 650 750 1 700 800 1 0 0
样例输出:
55 70 30 0 0 50 10 50 0
题意：给出每个人在某台电脑的登录时间与下线时间，求在某个时间段某个人的上线时间。
题解：大模拟~可以先记录每个人的上下线时间点，看做一个区间的左右界限，然后记录区间深度，如果到某个时间点时，区间深度大于0，就说明这个人在线，否则，就不在。
#include<cstdio> #include<cstring> #include<algorithm> #include<vector> using namespace std; struct data { int p,t; bool lg; data(){} data(int _p,int _t,bool _lg){p=_p;t=_t;lg=_lg;} }; vector<data> po[10005]; int main() { int n,m; //freopen("data.txt","r",stdin); while(scanf("%d%d",&n,&m),n||m) { for(int i=1;i<=m;i++) po[i].clear(); int r,q,t,nn,mm,s; scanf("%d",&r); for(int i=0;i<r;i++) { scanf("%d%d%d%d",&t,&nn,&mm,&s); po[mm].push_back(data(nn,t,s)); } scanf("%d",&q); for(int i=0;i<q;i++) { int x,y,len,ans=0,lx; scanf("%d%d%d",&x,&y,&mm); lx=x; len=po[mm].size(); int cnt=0; for(int j=0;j<len;j++) { if(po[mm][j].t>y) { if(cnt>0) ans+=y-lx; break; } else if(po[mm][j].t>=x) { if(cnt>0) ans+=po[mm][j].t-lx; lx=po[mm][j].t; } if(po[mm][j].lg) cnt++; else cnt--; } printf("%d\n",ans); } } return 0; }
其实国内大部分公司对算法都不够重视。特别是中小型公司老板根本都不懂技术，也不懂什么是算法，从而也不要求程序员懂什么算法，做程序从来不考虑性能问题，只要页面能显示出来就是好程序，这是国内的现状，很无奈。
顶一个 赞一个
这道题目重复了，删掉一个吧
第二个方法很不错啊
程序员会算法，等于一个古惑仔带了zhi抢啊
辛苦了，顶
int L[m+1][n+1];这样定义出错，这个在gcc上可以编译通过 在VS上不行 应该改为new 或者vector
Thanks for using the time to examine this, I truly feel strongly about it and enjoy finding out far more on this subject matter. If achievable, as you achieve knowledge
学算法中的数据结构学到一定程度会乐此不疲的，比如其中的2－3树，类似的红黑树，我甚至可以自己写个逻辑文件系统结构来。
神奇的网站
DFS方法的原理还是不太清楚啊
int L[m+1][n+1];这样定义出错，这个在gcc上可以编译通过 在VS上不行 应该改为new 或者vector
顶一个 赞一个


Tag Archives: VPS
-
The Big Data Migration Affair
Migrating from a VPS to Google Apps for Business and Google App Engine.
-
Out of date instructions = ARGH
When instructions are out of date, more work is involved.
Migrating from a VPS to Google Apps for Business and Google App Engine.
When instructions are out of date, more work is involved.


8.1 The locale Module
The locale module, as shown in Example 8-1, provides an interface to C's localization functions. It
also provides functions to convert between numbers and strings based
on the current locale. (Functions like int and
float, as well as the numeric conversion
functions in string, are not affected by the
current locale.)
Example 8-1. Using the locale Module for Data Formatting
File: locale-example-1.py
import locale
print "locale", "=>", locale.setlocale(locale.LC_ALL, "")
# integer formatting
value = 4711
print locale.format("%d", value, 1), "==",
print locale.atoi(locale.format("%d", value, 1))
# floating point
value = 47.11
print locale.format("%f", value, 1), "==",
print locale.atof(locale.format("%f", value, 1))
info = locale.localeconv()
print info["int_curr_symbol"]
locale => Swedish_Sweden.1252
4,711 == 4711
47,110000 == 47.11
SEK
Example 8-2 shows how you can use the locale module to get the platform locale.
Example 8-2. Using the locale Module to Get the Platform Locale
File: locale-example-2.py
import locale
language, encoding = locale.getdefaultlocale()
print "language", language
print "encoding", encoding
language sv_SE
encoding cp1252
|


DevReach 2019 Day 2 Morning Keynote: Technical Leadership: Lessons Learned at NASA with Jody Davis
A luxurious two-bedroom apartment with the best views over Santorini


Before Change
def run_experiment(variant):
universe = variant["universe"]
task = variant["task"]
domain = variant["domain"]
env = get_environment(universe, domain, task, env_params={})
env = DelayedEnv(env, delay=0.01)
pool = SimpleReplayPool(
observation_shape=env.active_observation_shape,
After Change
def run_experiment(variant):
env = get_environment_from_variant(variant)
env = DelayedEnv(env, delay=0.01)
pool = SimpleReplayPool(
observation_shape=env.active_observation_shape,


Town Library
**Recommendations come in no particular order**
Books to read next:
- "The Poisonwood Bible" by Barbara Kingsolver Check it out on Goodreads
- "We Were Eight Years in Power" by Ta-Nehisi Coates Check it out on Goodreads
- "The Three-Body Problem" by Cixin Liu Check it out on Goodreads
- "White Teeth" by Zadie Smith Check it out on Goodreads
- "Autumn" by Karl Ove Knausgaard Check it out on Goodreads
Movies to watch next:
- "Your Name" directed by Makoto Shinkai Check it out on Rotten Tomatoes
- "Raw" directed by Julia Ducournau Check it out on Rotten Tomatoes
- "Mimosas" directed by Oliver Laxe Check it out on Rotten Tomatoes
- "Good Time" directed by Benny & Joshua Safdie Check it out on Rotten Tomatoes
- "A Girl Walks Home Alone at Night" directed by Ana Lily Amirpour Check it out on Rotten Tomatoes
Albums to listen to next:
- "Drunk" by Thundercat Check it out on Amazon
- "Is the Is Are" by DIIV Check it out on Amazon
- "Sex & Food" by Unknown Mortal Orchestra Check it out on Amazon
- "KOD" by J. Cole Check it out on Amazon
- "The Universe Smiles Upon You" by Khruangbin Check it out on Amazon


Before Change
// gh-5604
assert raw.info["meas_date"] == DATE_NONE
with pytest.warns(RuntimeWarning, match="Overlapping events"):
_test_raw_reader(read_raw_edf, input_fname=gdf1_path + ".gdf",
eog=None, misc=None, stim_channel="auto")
@testing.requires_testing_data
def test_gdf2_data():
Test reading raw GDF 2.x files.
raw = read_raw_edf(gdf2_path + ".gdf", eog=None, misc=None, preload=True,
After Change
data, _ = raw[picks]
// Test Status is added as event
EXPECTED_EVS_ONSETS = raw._raw_extras[0]["events"][1][::2]
evs = raw.find_edf_events()
assert_array_equal(evs[1][::2], EXPECTED_EVS_ONSETS)
// this .npy was generated using the official biosig python package


@* * Copyright 2010-2017 Artima, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *@ @import controllers.Application.scaladocsPageUrl @userGuidePage("Using Private Method Tester") {
PrivateMethodTester
ScalaTest's PrivateMethodTester
trait facilitates the testing of private methods.
To test a private method, mix in trait PrivateMethodTester
and
create a PrivateMethod
object, like this:
val decorateToStringValue = PrivateMethod[String]('decorateToStringValue)
The type parameter on PrivateMethod
, in this case String
, is the result type of the private method
you wish to invoke. The symbol passed to the PrivateMethod.apply
factory method, in this
case 'decorateToStringValue
, is the name of the private method to invoke. To test
the private method, use the invokePrivate
operator, like this:
targetObject invokePrivate decorateToStringValue(1)
Here, targetObject
is a variable or singleton object name referring to the object whose
private method you want to test. You pass the arguments to the private method in the parentheses after
the PrivateMethod
object.
The result type of an invokePrivate
operation will be the type parameter of the PrivateMethod
object, thus you need not cast the result to use it. In other words, after creating a PrivateMethod
object, the
syntax to invoke the private method
looks like a regular method invocation, but with the dot (.
) replaced by invokePrivate
.
The private method is invoked dynamically via reflection, so if you have a typo in the method name symbol, specify the wrong result type,
or pass invalid parameters, the invokePrivate
operation will compile, but throw an exception at runtime.
One limitation to be aware of is that you can't use PrivateMethodTester
to test a private method
declared in a trait because the class the trait gets mixed into will not declare that private method. Only the
class generated to hold method implementations for the trait will have that private method. If you want to
test a private method declared in a trait, and that method does not use any state of that trait, you can move
the private method to a companion object for the trait and test it using PrivateMethodTester
that
way. If the private trait method you want to test uses the trait's state, your best options are to test it
indirectly via a non-private trait method that calls the private method, or make the private method package access
and test it directly via regular static method invocations.
Also, if you want to use PrivateMethodTester
to invoke a parameterless private method, you'll need to use empty parens. Instead of:
targetObject invokePrivate privateParameterlessMethod
You'll need to write:
targetObject invokePrivate privateParameterlessMethod()
Next we'll look at one last goodie, using WrapWith.


We are grateful to our sponsors, whose generous support helps ensure the sustainability of the Bokeh project.
If your company uses Bokeh and is able to sponsor the project, please contact<EMAIL_ADDRESS>If you are a user who appreciates Bokeh and wants to support our mission, please consider making a donation to assist our efforts.
Bokeh was initially developed with funding from the DARPA XDATA Program, and subsequently with support from Anaconda, Inc.
Today, Bokeh is a Sponsored Project of NumFOCUS, a 501(c)(3) nonprofit charity in the United States. NumFOCUS provides Bokeh with fiscal, legal, and administrative support to help ensure the health and sustainability of the project. Visit numfocus.org for more information.
Donations to Bokeh are managed by NumFOCUS. For donors in the United States, your gift is tax-deductible to the extent provided by law. As with any donation, you should consult with your tax adviser about your particular tax situation.


Public Member Functions | |
| startup (Controller $controller) | |
| emailNewPatientAssociate ($patientAssociate) | |
| emailSurveyLink ($clinician, $site, $url) | |
Public Attributes | |
| const | ESRAC_HELP =<EMAIL_ADDRESS>|
| const | SURVEY_SUBJECT = 'ESRA-C II clinician demographic survey' |
| const | SURVEY_BODY1 |
| const | SURVEY_BODY2 |
Copyright 2013 University of Washington, School of Nursing. http://opensource.org/licenses/BSD-3-Clause
| EsracEmailComponent::startup | ( | Controller $ | controller | ) |
startup: called by cakePHP automatically when included into a controller @ param AppController: current controller
| EsracEmailComponent::emailNewPatientAssociate | ( | $ | patientAssociate | ) |
Send email inviting a new patient associate
| patientAssociate | The patient associate |
| EsracEmailComponent::emailSurveyLink | ( | $ | clinician, | |
| $ | site, | |||
| $ | url | |||
| ) |
Email a clinician their demographic survey link
| clinician | The clinician | |
| site | Clinician's site | |
| url | URL for the survey |
| const EsracEmailComponent::ESRAC_HELP =<EMAIL_ADDRESS>|
Email address for ESRA-C help
| const EsracEmailComponent::SURVEY_SUBJECT = 'ESRA-C II clinician demographic survey' |
Subject for a demographic survey link email
Initial value:
"Thank you for choosing to participate in the research study, \"Computerized Assessment for Patients with Cancer (ESRA-C II)\". As part of the study we are collecting demographic data from clinicians. Please follow the secure link below to submit your data confidentially. It should not take long -- there are only six questions."
Initial value:
"If you prefer not to complete the form online, please reply to this email and indicate your preference (over the phone, via paper and campus mail, etc). \r\n\r\n Thank you"


Default Settings
Manage Profile
Themes
Passwords
Payment methods
Other Settings
Projects
Active
Marketing
Users
Development
Settings
Madeleine Scott
sent you friend request
Conform
Delete
rebica
sent you friend request
Conform
Delete
Devid robott
sent you friend request
Conform
Delete
View all Requestes
12 New Messages
Madeleine
Hey! there I' am available....
3 hours ago
Anthony
New product Launching...
5 hour ago
See all Messages
Someone likes our posts.
3 hours ago
3 New Comments
5 hour ago
Server Rebooted.
45 mintues ago
View all Notification
Cori Stover
Welcome!


Toggle navigation
Fun Planners
Home
(current)
Contact
About
Services
Your Details to get registered
Name:*
Phone Number:*
Type of party:*
Select one
birthday
wedding anniversery
party
No.of people:
0-100
100-300
300-500
500-1000
Price:
Address
309 N Dunn
Maryville
Missouri, MO 64468
S528133@mail.nwmissouri.edu


I am the very model of a modern Major-General, I've information vegetable, animal, and mineral, I know the kings of England, and I quote the fights historical, From Marathon to Waterloo, in order categorical.

Run Diff Semantic
Run Diff Efficiency


@* * Copyright 2017 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *@ @import controllers.agent.RepresentationController.ManagePropertiesVM @import actions.AuthenticatedRequest @(model: ManagePropertiesVM)(implicit request: AuthenticatedRequest[_], messages: Messages) @main_template( Messages("agent.dashboard.manageClients.title"), topNavigation = false ) { @* @partials.dashboardTabs() *@
@Messages("agent.dashboard.manageClients.noClients")
} }


cma.constraints_handler2
module documentationcma
2019: constraints handling classes based on ranks
TODO: rename to constraints_by_rank
| Function | nbfeas | return number of g_values that are <= 0 |
| Class | Glinear | a linear bound constraint function on variable i. |
| Class | RankWeight | A weight that adapts depending on observed values. |
| Class | FSumRanks | Testing rank-based optimization of individual functions, for example the sphere function formulated in each coordinate as f_i(x) = x_i^2. |
| Class | GSumRanks | Compute a rank-based penalty from constraints functions. |
| Class | FGSumRanks | TODO: prevent negative f-values but how? |
| Class | SignTracker | count the number of times g changes to the more extreme and reset when crossing zero. |
| Function | _progressive_ranks | return progressive rank values as int((r**2 + r) / 2) = 0, 1, 3, 6, 10, 15, 21,... |
| Function | _new_rank_correlation | compute correlation between ranks and <x_best-x_worst, x>-ranking |


?New
York
BotanicaH3ard¨n
TbSM'lOM
Herbarium:
op
the
University
of
California,
Berkeley
Nymphoid.es
grayana
(Griseb.)
0.
Kuntze
Det.
Robert
Ornduff
Date
IU?
THE
NEW
YORK
BOTANICAL
GARDEN
EXPLORATION
OF
CUBA
Province
of
Pinar
del
Rio
Vicinity
of
Los
Palacios
noM.?.??
:di
/
x
...................
J.
A.
Shafer,
Collector
January
15,1912
1624904
Legend -
Level of confidence that token is an accurately-transcribed word
extremely low
very low
low
undetermined
medium
high
very high


Each pattern in a rule has a corresponding action, which can be any arbitrary Ocaml expression. For example, here is the specification for a program which deletes all occurrences of "zap me" from its input:
{} rule token = parse | "zap me" { token lexbuf } (* ignore this token: no processing and continue *) | _ as c { print_char c; token lexbuf }
Here is a program which compresses multiple blanks and tabs down to a single blank, and throws away whitespace found at the end of a line:
{} rule token = parse | [' ' '\t']+ { print_char ' '; token lexbuf } | [' ' '\t']+ '\n' { token lexbuf } (* ignore this token *)
Actions can include arbitrary Ocaml code which returns a value. Each time the lexical analyzer function is called it continues processing tokens from where it last left off until it either reaches the end of the file.
Actions are evaluated after the lexbuf is bound to the current lexer buffer and the identifer following the keyword as to the matched string. The usage of lexbuf is provided by the Lexing standard library module;
Lexing.lexeme lexbuf
Return the matched string.
Lexing.lexeme_char lexbuf n
Return the nth character in the matched string. The index number of the first character starts from 0.
Lexing.lexeme_start lexbuf
Lexing.lexeme_end lexbuf
Return the absolute position in the input text of the beginning/end of the matched string. The position of the first character is 0.
Lexing.lexeme_start_p lexbuf
Lexing.lexeme_end_p lexbuf
(Since Ocaml 3.08) Return the position of type position (See Position).
entrypoint [exp1... expn] lexbuf
Call the other lexer on the given entry point. Notice that lexbuf is the last argument.
The position information on scanning the input text is recorded in the lexbuf which has a field lex_curr_p of the type position:
type position = { pos_fname : string; (* file name *) pos_lnum : int; (* line number *) pos_bol : int; (* the offset of the beginning of the line *) pos_cnum : int; (* the offset of the position *) }
The value of pos_bol field is the number of characters between the beginning of the file and the beginning of the line while the value of pos_cnum field is the number of characters between the beginning of the file and the position.
The lexing engine manages only the pos_cnum field of lexbuf.lex_curr_p with the number of characters read from the start of lexbuf. So you are reponsible for the other fields to be accurate. Typically, whenever the lexer meets a newline character, the action contains a call to the following function:
let incr_linenum lexbuf = let pos = lexbuf.Lexing.lex_curr_p in lexbuf.Lexing.lex_curr_p <- { pos with Lexing.pos_lnum = pos.Lexing.pos_lnum + 1; Lexing.pos_bol = pos.Lexing.pos_cnum; } ;;


fun build(): Flow<PagedList<Value>>
Constructs the Flow<PagedList>.
Flow<PagedList>
No work (such as loading) is done immediately, the creation of the first PagedList is is deferred until the Flow is collected.
Return The Flow of PagedLists


--- layout: api title: "v3.3.0 JavaScript Library: L.GeoJson" categories: api version: v3.3.0 permalink: /api/v3.3.0/l-geojson/ ---
Represents a GeoJSON layer. Allows you to parse GeoJSON data and display it on the map. Extends FeatureGroup.
L.geoJson(data, {
style: function (feature) {
return {color: feature.properties.color};
},
onEachFeature: function (feature, layer) {
layer.bindPopup(feature.properties.description);
}
}).addTo(map);
Each feature layer created by it gets a feature
property that links to the GeoJSON feature data the layer was created from (so that you can access its properties later).
| Factory | Description |
|---|---|
L.geoJson(
|
Creates a GeoJSON layer. Optionally accepts an object in GeoJSON format to display on the map (you can alternatively add it later with addData method) and an options object. |
| Option | Description |
|---|---|
pointToLayer(
|
Function that will be used for creating layers for GeoJSON points (if not specified, simple markers will be created). |
style(
|
Function that will be used to get style options for vector layers created for GeoJSON features. |
onEachFeature(
|
Function that will be called on each created feature layer. Useful for attaching events and popups to features. |
filter(
|
Function that will be used to decide whether to show a feature or not. |
coordsToLatLng(
|
Function that will be used for converting GeoJSON coordinates to LatLng points (if not specified, coords will be assumed to be WGS84 — standard [longitude, latitude] values in degrees). |
Additionally accepts all Path options for polylines and polygons.
| Method | Returns | Description |
|---|---|---|
addData(
|
this |
Adds a GeoJSON object to the layer. |
setStyle(
|
this |
Changes styles of GeoJSON vector layers with the given style function. |
resetStyle(
|
this |
Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events. |
| Method | Returns | Description |
|---|---|---|
geometryToLayer(
|
ILayer |
Creates a layer from a given GeoJSON feature. |
coordsToLatLng(
|
LatLng |
Creates a LatLng object from an array of 2 numbers (latitude, longitude) used in GeoJSON for points. If reverse is set to true , the numbers will be interpreted as (longitude, latitude). |
coordsToLatLngs(
|
Array |
Creates a multidimensional array of LatLng objects from a GeoJSON coordinates array. levelsDeep specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default). If reverse is set to true , the numbers will be interpreted as (longitude, latitude). |


2000
Salesforce launches an API. XML (eXtensible Markup Language) APIs were part of Salesforce from day one.
Salesforce launches an API. XML (eXtensible Markup Language) APIs were part of Salesforce from day one.
Amazon launched Amazon.com Web Services allowing developers to incorporate Amazon.com content in their own websites
Flickr launches an API so that users can easily share photos on their blogs and social networks
Facebook launches their API
Twitter launches their API (due in large part to people creating rogue APIs)
Google launches their map API
AWS launches solely via APIs. Amazon did not launch a web interface for three more years.
Apple launched the iPhone 3G, opening up entirely new world of mobile applications, one that APIs would be the driving force.
Foursquare launched
APIs run a lot of the world around us.
Many companies offer APIs which allow you to use their data and integrate with their services


My name is Micah Harrison and I am a 18 year old intended Computer Science major at the University of California, Berkeley. I grew up in the beautiful Pomona, California where I graduated from Garey High School in 2016. While in high school, I was always interested the hardware of gaming consoles and, after learning the functions of each part of a console, I actually got paid by some of my friends to repair their systems. Not knowing anything about the software side of Computer Science, I took a small web development course during my senior year of high school and the idea of being able to create incredible projects at the tip of your fingers led me to choose Computer Science as my major. A year and a half later and I am now a sophomore at Berkeley.
In my free time I enjoy hiking with my golden labrador, Ellie, or playing video games with friends. I also enjoy coding for fun and being a nerd.
CS ExperienceI currently do not have much "in the field" CS experience, and I am hoping that is where you come in, but since starting my education at Berkeley, I have become proficient in coding in Python and Scheme and I am currently learning Java. I am comfortable working with various data types and I am eager to learn as much as I can to become a useful asset in the world of CS. In my spare time, I do try to work on little projects such as this very website.
Summer of 2015: Superior: Electrical Mechanical and Plumbing: At this company, I work as a Jr. Project manager. My responsibilities included organizing time and material sheets for proper billing, acting as a head of a diverse group of electricians, and completing and presenting bills of sales to customers in order to finalize transactions.
Summer of 2016 and 2017: Raging Waters At Raging Waters I operated in the Admissions department as a Cashier/ Guest Services. As a Cashier, I would handle large amounts of money while selling tickets to be admitted into the water park. Guest Services allowed me to help and handle customers that have any comments, complaints, or concerns. Whether they just needed a map of the park or they were unhappy with their visit, I would work to the best of my ability to fulfill their requests.(Picture on the left is Admissions department moments away from victory in volleyball)
August 2016 - Present: Clark Kerr Housing Assistant While working at Clark Kerr Unit for UC Berkeley, I managed the mailroom, front office, and Assistant Student Learning Center. I utilized organizational skills in the mailroom sorting mail appropriately so that it ran smoothly and my customer service background helped me to handle students with any issues they may have with their living quarters at the front desk. In the ASC, I helped students with any issues using University computers or printers.


-- .. title: Datathon Logistics .. slug: logistics .. date: 2020-12-10 .. type: text -->
NYU Data Services and the e-board members of the Data Science Club will be here to support you every step of the way throughout the datathon. See the support schedule to see who is available to help you!
The Data Science Club will open their Slack to be the chat platform for all datathon participants, to coordinate our communucation. You can join by clicking this link: https://join.slack.com/t/datascienceclubnyu/shared_invite/zt-ksbn1uzb-zSpMy5ozzmWqDvhc9~6tGQ.
You will have access to Jupyter Notebooks in the cloud hosted by NYU's High Performance Computing unit if your personal machine can't be used. The organizers will add your netIDs, for those who need it.


BABY GENIUSES A film review by Steve Rhodes Copyright 1999 Steve Rhodes RATING (0 TO ****): 0
Some comedies are not funny no matter how hard they try, but BABY GENIUSES, easily one of the worst films in years, doesn't even try that often. Directed by Bob Clark (PORKY'S and PORKY'S 2), the film is a flat as the flat line on a heart monitor when the patient has died, something this comatose picture does in the very beginning.
The plot revolves around a secret experimental lab for toddlers run by Elena Kinder. I regret to inform you that a woman who has taken the name of the once talented Kathleen Turner plays Elena Kinder. This would-be Kathleen Turner overacts with such abandon that her performance could only work in a parody, which this movie isn't. She is aided by a overly serious guy named Heep, who is played by someone having the same name as Christopher Lloyd from the BACK TO THE FUTURE series.
Although the movie is shot in ugly, dark and sinister tones that would befit a horror movie about demonic babies, the movie does not intentionally try to scare us. The actors, who drone with all the emotive power of someone reading the phonebook, do get to participate in a few comic sketches, with repetitive injuries of the gonads being the most common.
The moronic script by the writing committee of Steven Paul, Francisca Matos, Robert Grasmere, Bob Clark and Greg Michael is an insult to human intelligence. The on-going joke in the movie is that the viewers get to understand baby talk. And what do these almost 2-year-old "babies" actually say to each other? Well, they discuss the "Jerry Springer Show" and theories for reducing a family's disposable income. These toddlers are among the most unfunny in the history of cinema.
 You imbeciles! You morons!" Kinder screams at her employees. You may feel like yelling those exact words at the screen.
BABY GENIUSES runs 1:34. It is rated PG for some profanity, sexual innuendo and comic fist fighting violence and would be acceptable for most ages.
My son Jeffrey, almost 10, liked the characters and gave the movie ***. His friend Jessica, almost 10, thought the movie was really cute and gave it ***. Her brother George, age 7, especially liked the baby karate part and gave the movie ***.
Email<EMAIL_ADDRESS>Web: www.InternetReviews.com
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


templateclass vector : protected _Vector_base<_Tp, _Alloc> { private: typedef _Vector_base<_Tp, _Alloc> _Base; public: typedef _Tp value_type; typedef value_type* pointer; typedef const value_type* const_pointer; typedef value_type* iterator; typedef const value_type* const_iterator; typedef value_type& reference; typedef const value_type& const_reference; typedef size_t size_type; typedef ptrdiff_t difference_type; ... int main() { vector ::iterator it; cout << "iterator type check 1 " << (typeid(it) == typeid(string *)) << endl; cout << "iterator type check 2" << (typeid(vector ::iterator) == typeid(vector ::value_type *)) << endl; cout << "iterator type check 3" << (typeid(vector ::pointer) == typeid(vector ::value_type *)) << endl; cout << "iterator type check 4" << (typeid(string *) == typeid(vector ::value_type *)) << endl; } }
/* Note; The STL is not the C++ standard library. The C++ standard allows an implementation to use a pointer for random access iterators, but does not dictate it. Both clang and gcc use user-defined types for these iterators, rather than pointers. Neither is GCC. You need to look at the implementation of the code you are actually trying to compile. And that is not the STL. For example, on gcc 4.8 std::vector::iterator is typedef __gnu_cxx::__normal_iteratoriterator;where __normal_iterator is a class template. */


This page should scroll on the impl thread, but first touch events must go to the main thread.
one
two
three
four
five
six
seven
eight
nine
ten
one
two
three
four
five
six
seven
eight
nine
ten
one
two
three
four
five
six
seven
eight
nine
ten
one
two
three
four
five
six
seven
eight
nine
ten
one
two
three
four
five
six
seven
eight
nine
ten
one
two
three
four
five
six
seven
eight
nine
ten
one
two
three
four
five
six
seven
eight
nine
ten
one
two
three
four
five
six
seven
eight
nine
ten
one
two
three
four
five
six
seven
eight
nine
ten
one
two
three
four
five
six
seven
eight
nine
ten
one
two
three
four
five
six
seven
eight
nine
ten
one
two
three
four
five
six
seven
eight
nine
ten
one
two
three
four
five
six
seven
eight
nine
ten
one
two
three
four
five
six
seven
eight
nine
ten
one
two
three
four
five
six
seven
eight
nine
ten
one
two
three
four
five
six
seven
eight
nine
ten
one
two
three
four
five
six
seven
eight
nine
ten


close
status :
off
Hello World
Bootstrap 4.5.2
is installed by default
The path of this file is
files/views/index.html


Experiments test the extent to which behavioral science theories translate to upstream, multi-stakeholder decisions, in particular whether choice defaults influence such decisions, and through which of three channels: the cognitive energy required to make a decision; perceptions that the default is the recommended or social norm option; and by framing the outcome as a loss or gain. Experiments also explore whether disclosing interventions diminishes their effect.
Engineers are an essential part of solving the effects of climate change and must not only be aware of the issues but empowered to make change to reduce and shift the impact of humans on the planet. This research investigates engineering students’ experiences during undergraduate programs that predict their beliefs about climate change and empowerment to address its related implications for sustainability in their careers. This study is the first of its kind to explore how experiences in college impact students’ climate change beliefs and interest to address related implications for sustainability. To advance understanding, undergraduate engineering seniors’ attitudes, empowerment, career goals, and experiences are measured using a nationally representative survey just prior to students entering the workforce.
The aim of this research project is to understand the effects of contextual complexity on design processes and problem solving of undergraduate engineering students and impacts of the undergraduate experience on engineering student ability to treat contextual complexity in engineering design and ill-structured problems. Our specific research questions are: (Q1) How do students cognitively manage contextual complexity in engineering design and problem-solving tasks? And (Q2) are cognitive loads and activity in brain regions significantly different based on years of educational training?
Tripp Shealy • Department of Civil and Environmental Engineering • Virginia Tech
© 2016