# opendmarc_policy_store_spf()

[back to index]

SYNOPSIS

    #include <dmarc.h>
    DMARC_POLICY_T * opendmarc_policy_store_spf(
    	DMARC_POLICY_T * pctx,
    	u_char *domain, int result, int origin, u_char *human_readable
    );

One you have found the outcome of the SPF check you may call this function to prepare it for a DMARC policy decision.

DESCRIPTION

Called When | `opendmarc_policy_store_spf()` may be called as soon as you have made an SPF decision. If you have no way of validating SPF, you may ignore this function.

ARGUMENTS

Argument | Description
--- | ---
pctx | A pointer to type `DMARC_POLICY_T`.
domain | A pointer to an unsigned string containing the domain used to check `SPF`. This may be the domain from the `SMTP MAIL From:` command or, if that contained no domain, the domain from the `SMTP HELO/EHLO` command.
result | Integer specifying the result of the `SPF` check. Choose from one of: `DMARC_POLICY_SPF_OUTCOME_NONE` if there was no `SPF` record; `DMARC_POLICY_SPF_OUTCOME_PASS` if the `SPF` check passed; `DMARC_POLICY_SPF_OUTCOME_FAIL` if the `SPF` check failed; or `DMARC_POLICY_SPF_OUTCOME_TMPFAIL` if the check returned a temporary failure.
origin | Integer specifying the which part of the `SMTP` session contained the domain to check. Select from one of: `DMARC_POLICY_SPF_ORIGIN_MAILFROM` if the domain came from the `SMTP MAIL From:` command; or `DMARC_POLICY_SPF_ORIGIN_HELO` if the domain came from the `SMTP HELO/EHLO` command.
human_readable | If not NULL, is a string containing an arbitrary, human readable and friendly SPF result.

RETURN VALUES

- `DMARC_PARSE_OKAY` -- On success
- `DMARC_PARSE_ERROR_NULL_CTX` -- If pctx was NULL
- `DMARC_PARSE_ERROR_EMPTY` -- If domain was NULL or zero length
- `DMARC_PARSE_ERROR_NO_DOMAIN` -- If domain did not contain a domain, e.g. "<>"

NOTES

- You may pass the whole `SMTP MAIL From:` command to this function, or the value of the `SMTP MAIL From:` command inside angle braces or just the domain you parsed from that address. This function will correctly handle whatever you feed it.
- If you lack access to an SPF outcome, you may safely omit calling this function, because the library presumes there will be no SPF outcome unless told otherwise.

Copyright (c) 2012, The Trusted Domain Project. All rights reserved.
By using this file, you agree to the terms and conditions set forth in the license.