# dkim_policy()

[back to index]

SYNOPSIS

    #include <dkim.h>
    DKIM_STAT dkim_policy(
    	DKIM *dkim,
    	dkim_policy_t *pcode,
    	unsigned int *pflags,
    	DKIM_PSTATE * pstate
    );

Retrieve and evaluate the author domain signing practices (ADSP) for a message.

DESCRIPTION

Called When | `dkim_policy()` is called after `dkim_eom()` when `dkim` is a verifying handle, i.e. one returned by an earlier call to `dkim_verify()`.

ARGUMENTS

Argument | Description
--- | ---
dkim | Message-specific handle, returned by `dkim_verify()`.
pcode | A pointer to a `dkim_policy_t` which is updated to contain the policy type retrieved from the sender. This can be NULL if that information is not of interest to the caller.

pflags

A pointer to an unsigned integer which is updated to contain policy flags retrieved from the sender. This can be NULL if that information is not of interest to the caller. Valid flags are:

- `DKIM_PFLAG_ATSP` -- policy shows ATSP enabled

pstate

A caller may wish to use this function in a re-entrant manner, such as when using a policy lookup callback that may return `DKIM_CBSTAT_TRYAGAIN`. In that case, the caller should allocate a `DKIM_PSTATE` and initialize it using `memset()` to fill it with all-zeroes, then pass a pointer to it to this function. If the callback does return `DKIM_CBSTAT_TRYAGAIN`, `pstate` will be updated to contain internal state information so that subsequent calls to this function will simply re-attempt the lookup that could not be completed on the previous attempt, essentially picking up where it left off (avoiding repeated lookups). Instead, if `pstate` is NULL, the entire policy process will be repeated on each call.

NOTES

- ADSP (Author Domain Signing Practices) is defined in RFC5617.
- ATPS (Authorized Third Party Signers) is an experimental protocol defined in draft-kucherawy-dkim-atps.
- It is an error to call this function with a handle that was created using `dkim_sign()`.
- This function will return `DKIM_STAT_SYNTAX` if the sender's domain could not be determined or if the ADSP record retrieved is not syntactically valid.

Copyright (c) 2005, 2007 Sendmail, Inc. and its suppliers. All rights reserved.
Copyright (c) 2009, 2010, The OpenDKIM Project. All rights reserved.
By using this file, you agree to the terms and conditions set forth in the respective licenses.