00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
#ifndef _MAIN_H
00047 #define _MAIN_H 1
00048
00049
#include <stdio.h>
00050
#include <stdlib.h>
00051
#include <string.h>
00052
#include <stdarg.h>
00053
00054
#ifdef _WITH_OPENBSD
00055
#include <inttypes.h>
00056
#endif
00057
00058
#include "../../config.h"
00059
#include "spf.h"
00060
00061
00062
#ifdef HAVE__BEGIN_DECLS
00063
__BEGIN_DECLS
00064
#else
00065
# ifdef __cplusplus
00066
extern "C" {
00067
# endif
00068
#endif
00069
00070 #define FL_A 2
00071 #define FL_B 4
00072 #define FL_C 8
00073 #define FL_D 16
00074 #define FL_E 32
00075 #define FL_F 64
00076 #define FL_G 128
00077
00078
00079 #define SPF_MAX_RECURSE 20
00080
00081
00082 #define RES_PASS "domain of %s designates %s as permitted sender\r\n"
00083 #define RES_NONE "domain of %s does not designate permitted sender " \
00084
"hosts\r\n"
00085 #define RES_S_FAIL "transitioning domain of %s does not designate %s " \
00086
"as permitted sender\r\n"
00087 #define RES_H_FAIL "domain of %s does not designate %s as permitted " \
00088
"sender\r\n"
00089 #define RES_ERROR "encountered temporary error during SPF processing " \
00090
"of %s\r\n"
00091 #define RES_NEUTRAL "%s is neither permitted nor denied by domain of " \
00092
"%s\r\n"
00093 #define RES_UNKNOWN "error in processing during lookup of %s\r\n"
00094 #define RES_UNMECH "encountered unrecognized mechanism during SPF " \
00095
"processing of domain of %s\r\n"
00096
00097
00098 #define HDR_PASS "Received-SPF: pass (%s: domain of %s designates " \
00099
"%s as permitted sender) receiver=%s; client_ip=%s; " \
00100
"envelope-from=%s;"
00101
00102 #define HDR_NONE "Received-SPF: none (%s: domain of %s does not " \
00103
"designate permitted sender hosts)"
00104
00105 #define HDR_S_FAIL "Received-SPF: softfail (%s: domain of " \
00106
"transitioning %s does not designate %s as " \
00107
"permitted sender) receiver=%s; client_ip=%s; " \
00108
"envelope-from=%s;"
00109
00110 #define HDR_H_FAIL "Received-SPF: fail (%s: domain of %s does not " \
00111
"designate %s as permitted sender) receiver=%s; " \
00112
"client_ip=%s; envelope-from=%s;"
00113
00114 #define HDR_ERROR "Received-SPF: error (%s: error in processing " \
00115
"during lookup of %s: %s)"
00116
00117 #define HDR_NEUTRAL "Received-SPF: neutral (%s: domain of %s is " \
00118
"neutral about designating %s as permitted sender)"
00119
00120 #define HDR_UNKNOWN "Received-SPF: unknown (%s: domain of %s " \
00121
"encountered an error while parsing (check SPF " \
00122
"record %s for errors))"
00123
00124 #define HDR_UNMECH "Received-SPF: unknown -extension:%s (%s: domain of " \
00125
"%s uses a mechanism not recognized by this client)"
00126
00127
00128
00129
00130
#ifndef HAVE_U_INT8_T
00131
# ifdef HAVE_UINT8_T
00132
typedef uint8_t u_int8_t;
00133
# else
00134
typedef unsigned char u_int8_t;
00135
# endif
00136
#endif
00137
00138
#ifndef HAVE_U_INT16_T
00139
# ifdef HAVE_UINT16_T
00140
typedef uint16_t u_int16_t;
00141
# else
00142
typedef unsigned int u_int16_t;
00143
# endif
00144
#endif
00145
00146
#ifndef HAVE_U_INT32_T
00147
# ifdef HAVE_UINT32_T
00148
typedef uint32_t u_int32_t;
00149
# else
00150
typedef unsigned int u_int32_t;
00151
# endif
00152
#endif
00153
00154
#ifndef HAVE_UINTPTR_T
00155
typedef unsigned long int uintptr_t;
00156
#endif
00157
00158
00159
00160
peer_info_t *
SPF_init(
const char *,
const char *,
const char *,
const char *,
00161
const char *, u_int32_t, u_int32_t);
00162
peer_info_t *
SPF_close(
peer_info_t *);
00163
SPF_RESULT SPF_policy_main(
peer_info_t *);
00164
SPF_RESULT SPF_policy_main_rec(
peer_info_t *);
00165
SPF_BOOL SPF_parse_policy(
peer_info_t *,
const char *);
00166
char *
SPF_result(
peer_info_t *);
00167
00168
SPF_BOOL SPF_smtp_from(
peer_info_t *,
const char *);
00169
SPF_BOOL SPF_smtp_helo(
peer_info_t *,
const char *);
00170
00171
char *
SPF_build_header(
peer_info_t *);
00172
char *
SPF_get_explain(
peer_info_t *);
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
#ifdef HAVE__BEGIN_DECLS
00186
__END_DECLS
00187
#else
00188
# ifdef __cplusplus
00189
}
00190
# endif
00191
#endif
00192
00193
00194
#endif