Qsmtp  0.30dev
Functions
addrparse.c File Reference

validate email addresses More...

#include <qsmtpd/addrparse.h>
#include <control.h>
#include <netio.h>
#include <qsmtpd/antispam.h>
#include <qsmtpd/qsmtpd.h>

Functions

int addrparse (char *in, const int flags, string *addr, char **more, struct userconf *ds, const char *rcpthosts, const off_t rcpthsize)
 check an email address for syntax errors and/or existence More...
 

Detailed Description

validate email addresses

Function Documentation

int addrparse ( char *  in,
const int  flags,
string addr,
char **  more,
struct userconf ds,
const char *  rcpthosts,
const off_t  rcpthsize 
)

check an email address for syntax errors and/or existence

Parameters
ininput to parse
flags
  • 0: mail from checks
  • 1: rcpt to checks (e.g. source route is allowed)
addrstruct string to contain the address (memory will be malloced, is set if 0 or -1 is returned)
morehere starts the data behind the first '>' behind the first '<' (or NULL if line ends after the '>')
dsstore the userconf of the user here
rcpthostsarray of the valid rcpthosts
rcpthsizesize of rcpthosts array
Returns
if address was validated
Return values
0address exists locally
>0on error (e.g. ENOMEM, return code is error code)
-2if address not local (this is of course no error condition for MAIL FROM)
-1if address local but nonexistent (expired or most probably faked) OR if domain of address does not exist (in both cases error is sent to network before leaving)

ds may be NULL in case the result is not interesting (e.g. if only checking MAIL FROM).