# dkim_set_policy_lookup()

[back to index]

SYNOPSIS

    #include <dkim.h>
    DKIM_STAT dkim_set_policy_lookup(
    	DKIM_LIB *libopendkim,
            DKIM_CBSTAT (*func) (DKIM *dkim,
    	             unsigned char *query,
                         _Bool excheck,
    	             unsigned char *buf,
    	             size_t buflen,
    	             int *qstat)
    );

Defines a function which should do policy lookups rather than implementing the DKIM specification (e.g a DNS lookup).

DESCRIPTION

Called When | `dkim_set_policy_lookup()` can be called at any time.

ARGUMENTS

Argument | Description
--- | ---
libopendkim | Library-specific handle, returned by `dkim_init()`.

func

A pointer to a function which the library should use in place of its own code to do policy lookups. The function will receive six things:

1. a `DKIM` handle referencing the job being processed;
2. a pointer to the string that should be queried
3. a Boolean indicating whether this query should verify domain existence ("true") or retrieve the policy TXT record ("false")
4. a pointer to a buffer that should receive the result of the policy lookup
5. the number of bytes available there
6. a pointer to an integer which should receive the result of the query attempt, and should be one of the known constants used to report the status of a DNS query (e.g. `NXDOMAIN`, `NOERROR`, `SERVFAIL`, etc., typically defined in `<arpa/nameser.h>`)

The function should return a valid `DKIM_CBSTAT` constant; in particular, if no policy is found, the contents of `buf` should be unchanged and `DKIM_CBSTAT_CONTINUE` should be returned. If `func` is NULL, the internal policy lookup implementation will be used.

RETURN VALUES

- DKIM_STAT_OK -- success

NOTES

- None.

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