Qsmtp  0.23svn
Defines | Functions
include/antispam.h File Reference

headers of antispam helper functions More...

#include <sys/types.h>

Go to the source code of this file.

Defines

#define SPF_NONE   0
#define SPF_PASS   1
#define SPF_NEUTRAL   2
#define SPF_SOFTFAIL   3
#define SPF_FAIL_PERM   4
#define SPF_FAIL_MALF   5
#define SPF_TEMP_ERROR   7
#define SPF_HARD_ERROR   8
#define SPF_IGNORE   15
#define SPF_FAIL(x)   (((x) == SPF_FAIL_PERM) || ((x) == SPF_FAIL_MALF))

Functions

void dotip6 (char *)
int check_rbl (char *const *, char **)
void tarpit (void)
int domainmatch (const char *fqdn, const size_t len, const char **list)
int lookupipbl (int)
int check_host (const char *)
int spfreceived (int, const int)

Detailed Description

headers of antispam helper functions


Define Documentation

#define SPF_FAIL (   x)    (((x) == SPF_FAIL_PERM) || ((x) == SPF_FAIL_MALF))

check if one of the conditions is given to fail SPF policy

#define SPF_FAIL_MALF   5

SPF entry is malformed

#define SPF_FAIL_PERM   4

host is denied by SPF policy

#define SPF_HARD_ERROR   8

permanent DNS error while SPF testing

#define SPF_IGNORE   15

SPF policy for this host will not be tested

#define SPF_NEUTRAL   2

host has neutral match in SPF policy

#define SPF_NONE   0

no SPF policy given

#define SPF_PASS   1

host matches SPF policy

#define SPF_SOFTFAIL   3

host has softfail match in SPF policy

#define SPF_TEMP_ERROR   7

temporary DNS error while SPF testing


Function Documentation

int check_host ( const char *  domain)

look up SPF records for domain

This works a like the check_host in the SPF draft but takes two arguments less. The remote ip and the full sender address can be taken directly from xmitstat.

Parameters:
domainno idea what this might be for ;)
Returns:
one of the SPF_* constants defined in include/antispam.h
int check_rbl ( char *const *  rbls,
char **  txt 
)

do a rbl lookup for remoteip

Parameters:
rblsa NULL terminated array of rbls
txtpointer to "char *" where the TXT record of the listing will be stored if existent
Returns:
index of first match
Return values:
-1if not listed or error (if not listed errno is set to 0)

If no match was found but temporary DNS errors were encountered errno is set to EAGAIN.

int domainmatch ( const char *  fqdn,
const size_t  len,
const char **  list 
)

check if a given host name matches against domain list

Parameters:
fqdnhostname to check
lenlength of fqdn
listlist of domains and hosts to check against, NULL terminated
Returns:
1 on match, 0 otherwise

-if list is NULL terminated and every list[x] and fqdn are 0-terminated there can't be any errors

void dotip6 ( char *  buffer)

print IPv6 address of remote host in dotted form in buffer

Parameters:
bufferbuffer to store result
int lookupipbl ( int  fd)

check if the remote host is listed in local IP map file given by fd

Parameters:
fdfile descriptor to file
Returns:
  • <0 on error
  • >0 on match
  • 0 otherwise
int spfreceived ( int  fd,
const int  spf 
)

print "Received-SPF:" to message header

Parameters:
fdfile descriptor of message body
spfSPF status of mail transaction
Returns:
0 if everything goes right, -1 on write error
void tarpit ( void  )

delay the next reply to the client

This should be used in all places where the client seems to be a spammer. This will delay him so he can't send so much spams.

tarpit does not sleep if there is input pending. If the client is using pipelining or (more likely) a worm or spambot ignoring our replies we kick him earlier and save some traffic.