s/qmail 4.2.29a
Next generation secure email transport
Loading...
Searching...
No Matches
Macros | Functions | Variables
qmail-smtpam.c File Reference
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "sig.h"
#include "genalloc.h"
#include "stralloc.h"
#include "buffer.h"
#include "scan.h"
#include "case.h"
#include "byte.h"
#include "error.h"
#include "auto_qmail.h"
#include "control.h"
#include "dns.h"
#include "alloc.h"
#include "quote.h"
#include "ip.h"
#include "ipalloc.h"
#include "ipme.h"
#include "str.h"
#include "now.h"
#include "exit.h"
#include "constmap.h"
#include "tcpto.h"
#include "socket_if.h"
#include "ucspissl.h"
#include "timeout.h"
#include "timeoutconn.h"
#include "tls_remote.h"
#include "tls_errors.h"
#include "tls_timeoutio.h"
#include "uint_t.h"
Include dependency graph for qmail-smtpam.c:

Go to the source code of this file.

Macros

#define MAX_SIZE   200000000
 
#define HUGESMTPTEXT   5000
 
#define PORT_SMTP   25 /* silly rabbit, /etc/services is for users */
 
#define PORT_SMTPS   465
 
#define VERIFYDEPTH   1
 
#define FDPAM   3
 
#define WHO   "qmail-smtpam"
 

Functions

 GEN_ALLOC_typedef (GEN_ALLOC_readyplus(saa, GEN_ALLOC_readyplus(stralloc, GEN_ALLOC_readyplus(sa, GEN_ALLOC_readyplus(len, GEN_ALLOC_readyplus(a)
 
void out (char *s)
 
void zero ()
 
void zerodie ()
 
void outsafe (stralloc *sa)
 
void temp_noip ()
 
void temp_nomem ()
 
void temp_oserr ()
 
void temp_osip ()
 
void temp_noconn ()
 
void temp_dnscanon ()
 
void temp_dns ()
 
void temp_chdir ()
 
void temp_control ()
 
void perm_usage ()
 
void perm_dns ()
 
void outhost ()
 
void dropped ()
 
ssize_t saferead (int fd, char *buf, int len)
 
ssize_t safewrite (int fd, char *buf, int len)
 
void get (char *ch)
 
unsigned long smtpcode ()
 
void outsmtptext ()
 
void quit (char *prepend, char *append)
 
void tls_init ()
 
int starttls_peer ()
 
void tls_peercheck ()
 
int utf8flag (unsigned char *ch, int len)
 
void smtp_greeting ()
 
void smtp_starttls ()
 
void smtp ()
 
void getcontrols ()
 
int main (int argc, char **argv)
 

Variables

int flagauth = 0
 
int flagsmtps = 0
 
int flagtls = 0
 
int flagverify = 0
 
int flagutf8mail = 0
 
unsigned long port = PORT_SMTP
 
stralloc host = {0}
 
stralloc ports = {0}
 
stralloc remotehost = {0}
 
stralloc sender = {0}
 
stralloc canonhost = {0}
 
stralloc canonbox = {0}
 
stralloc sendip = {0}
 
stralloc recipient = {0}
 
stralloc domainips = {0}
 
struct constmap mapdomainips
 
char ip4 [4]
 
char ip6 [16]
 
uint32 ifidx = 0
 
stralloc routes = {0}
 
struct constmap maproutes
 
struct ip_mx partner
 
SSL * ssl
 
SSL_CTX * ctx
 
int flagcritical = 0
 
int timeoutconnect = 60
 
int smtpfd
 
int timeout = 1200
 
char outbuf [1450]
 
buffer bo = BUFFER_INIT(safewrite,-1,outbuf,sizeof(outbuf))
 
char frombuf [128]
 
buffer bi = BUFFER_INIT(saferead,-1,frombuf,sizeof(frombuf))
 
stralloc smtptext = {0}
 
stralloc recip = {0}
 
stralloc cafile = {0}
 
stralloc cadir = {0}
 
stralloc certfile = {0}
 
stralloc keyfile = {0}
 
stralloc keypwd = {0}
 
stralloc ciphers = {0}
 
stralloc tlsdest = {0}
 
char * tlsdestinfo = 0
 
char * tlsdomaininfo = 0
 
stralloc domaincerts = {0}
 
struct constmap mapdomaincerts
 
stralloc tlsdestinations = {0}
 
struct constmap maptlsdestinations
 
unsigned long verifydepth = VERIFYDEPTH
 
unsigned long code
 
char up [513]
 
int uplen
 

Detailed Description

-- TLS enabled SMTP PAM to check mailbox at remote MX

Definition in file qmail-smtpam.c.

Macro Definition Documentation

◆ FDPAM

#define FDPAM   3

Definition at line 42 of file qmail-smtpam.c.

◆ HUGESMTPTEXT

#define HUGESMTPTEXT   5000

Definition at line 38 of file qmail-smtpam.c.

◆ MAX_SIZE

#define MAX_SIZE   200000000

Definition at line 37 of file qmail-smtpam.c.

◆ PORT_SMTP

#define PORT_SMTP   25 /* silly rabbit, /etc/services is for users */

Definition at line 39 of file qmail-smtpam.c.

◆ PORT_SMTPS

#define PORT_SMTPS   465

Definition at line 40 of file qmail-smtpam.c.

◆ VERIFYDEPTH

#define VERIFYDEPTH   1

Definition at line 41 of file qmail-smtpam.c.

◆ WHO

#define WHO   "qmail-smtpam"

Definition at line 44 of file qmail-smtpam.c.

Function Documentation

◆ dropped()

void dropped ( )

Definition at line 180 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GEN_ALLOC_typedef()

GEN_ALLOC_typedef ( GEN_ALLOC_readyplus saa,
GEN_ALLOC_readyplus stralloc,
GEN_ALLOC_readyplus sa,
GEN_ALLOC_readyplus len,
GEN_ALLOC_readyplus a 
)

Definition at line 59 of file qmail-smtpam.c.

◆ get()

void get ( char *  ch)

Definition at line 217 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getcontrols()

void getcontrols ( void  )

Definition at line 455 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 479 of file qmail-smtpam.c.

Here is the call graph for this function:

◆ out()

void out ( char *  s)

Definition at line 86 of file qmail-smtpam.c.

Here is the call graph for this function:

◆ outhost()

void outhost ( )

Definition at line 164 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ outsafe()

void outsafe ( stralloc *  sa)

Definition at line 89 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ outsmtptext()

void outsmtptext ( )

Definition at line 248 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ perm_dns()

void perm_dns ( )

Definition at line 157 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ perm_usage()

void perm_usage ( )

Definition at line 152 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ quit()

void quit ( char *  prepend,
char *  append 
)

Definition at line 260 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ saferead()

ssize_t saferead ( int  fd,
char *  buf,
int  len 
)

Definition at line 194 of file qmail-smtpam.c.

Here is the call graph for this function:

◆ safewrite()

ssize_t safewrite ( int  fd,
char *  buf,
int  len 
)

Definition at line 202 of file qmail-smtpam.c.

Here is the call graph for this function:

◆ smtp()

void smtp ( )

Definition at line 413 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ smtp_greeting()

void smtp_greeting ( )

Definition at line 381 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ smtp_starttls()

void smtp_starttls ( )

Definition at line 399 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ smtpcode()

unsigned long smtpcode ( )

Definition at line 225 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ starttls_peer()

int starttls_peer ( )

Definition at line 325 of file qmail-smtpam.c.

Here is the caller graph for this function:

◆ temp_chdir()

void temp_chdir ( )

Definition at line 142 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ temp_control()

void temp_control ( )

Definition at line 147 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ temp_dns()

void temp_dns ( )

Definition at line 135 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ temp_dnscanon()

void temp_dnscanon ( )

Definition at line 128 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ temp_noconn()

void temp_noconn ( )

Definition at line 123 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ temp_noip()

void temp_noip ( )

Definition at line 101 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ temp_nomem()

void temp_nomem ( void  )

Definition at line 106 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ temp_oserr()

void temp_oserr ( )

Definition at line 111 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ temp_osip()

void temp_osip ( )

Definition at line 116 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tls_init()

void tls_init ( )

Definition at line 293 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tls_peercheck()

void tls_peercheck ( )

Definition at line 336 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ utf8flag()

int utf8flag ( unsigned char *  ch,
int  len 
)

Definition at line 369 of file qmail-smtpam.c.

Here is the caller graph for this function:

◆ zero()

void zero ( )

Definition at line 87 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ zerodie()

void zerodie ( void  )

Definition at line 88 of file qmail-smtpam.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ bi

buffer bi = BUFFER_INIT(saferead,-1,frombuf,sizeof(frombuf))

Definition at line 213 of file qmail-smtpam.c.

◆ bo

buffer bo = BUFFER_INIT(safewrite,-1,outbuf,sizeof(outbuf))

Definition at line 211 of file qmail-smtpam.c.

◆ cadir

stralloc cadir = {0}

Definition at line 277 of file qmail-smtpam.c.

◆ cafile

stralloc cafile = {0}

Definition at line 276 of file qmail-smtpam.c.

◆ canonbox

stralloc canonbox = {0}

Definition at line 68 of file qmail-smtpam.c.

◆ canonhost

stralloc canonhost = {0}

Definition at line 67 of file qmail-smtpam.c.

◆ certfile

stralloc certfile = {0}

Definition at line 278 of file qmail-smtpam.c.

◆ ciphers

stralloc ciphers = {0}

Definition at line 281 of file qmail-smtpam.c.

◆ code

unsigned long code

Definition at line 379 of file qmail-smtpam.c.

◆ ctx

SSL_CTX* ctx

Definition at line 84 of file qmail-smtpam.c.

◆ domaincerts

stralloc domaincerts = {0}

Definition at line 287 of file qmail-smtpam.c.

◆ domainips

stralloc domainips = {0}

Definition at line 72 of file qmail-smtpam.c.

◆ flagauth

int flagauth = 0

Definition at line 49 of file qmail-smtpam.c.

◆ flagcritical

int flagcritical = 0

Definition at line 178 of file qmail-smtpam.c.

◆ flagsmtps

int flagsmtps = 0

Definition at line 50 of file qmail-smtpam.c.

◆ flagtls

int flagtls = 0

Definition at line 51 of file qmail-smtpam.c.

◆ flagutf8mail

int flagutf8mail = 0

Definition at line 55 of file qmail-smtpam.c.

◆ flagverify

int flagverify = 0

Definition at line 54 of file qmail-smtpam.c.

◆ frombuf

char frombuf[128]

Definition at line 212 of file qmail-smtpam.c.

◆ host

stralloc host = {0}

Definition at line 63 of file qmail-smtpam.c.

◆ ifidx

uint32 ifidx = 0

Definition at line 76 of file qmail-smtpam.c.

◆ ip4

char ip4[4]

Definition at line 74 of file qmail-smtpam.c.

◆ ip6

char ip6[16]

Definition at line 75 of file qmail-smtpam.c.

◆ keyfile

stralloc keyfile = {0}

Definition at line 279 of file qmail-smtpam.c.

◆ keypwd

stralloc keypwd = {0}

Definition at line 280 of file qmail-smtpam.c.

◆ mapdomaincerts

struct constmap mapdomaincerts

Definition at line 288 of file qmail-smtpam.c.

◆ mapdomainips

struct constmap mapdomainips

Definition at line 73 of file qmail-smtpam.c.

◆ maproutes

struct constmap maproutes

Definition at line 79 of file qmail-smtpam.c.

◆ maptlsdestinations

struct constmap maptlsdestinations

Definition at line 290 of file qmail-smtpam.c.

◆ outbuf

char outbuf[1450]

Definition at line 210 of file qmail-smtpam.c.

◆ partner

struct ip_mx partner

Definition at line 81 of file qmail-smtpam.c.

◆ port

unsigned long port = PORT_SMTP

Definition at line 57 of file qmail-smtpam.c.

◆ ports

stralloc ports = {0}

Definition at line 64 of file qmail-smtpam.c.

◆ recip

stralloc recip = {0}

Definition at line 272 of file qmail-smtpam.c.

◆ recipient

stralloc recipient = {0}

Definition at line 70 of file qmail-smtpam.c.

◆ remotehost

stralloc remotehost = {0}

Definition at line 65 of file qmail-smtpam.c.

◆ routes

stralloc routes = {0}

Definition at line 78 of file qmail-smtpam.c.

◆ sender

stralloc sender = {0}

Definition at line 66 of file qmail-smtpam.c.

◆ sendip

stralloc sendip = {0}

Definition at line 69 of file qmail-smtpam.c.

◆ smtpfd

int smtpfd

Definition at line 191 of file qmail-smtpam.c.

◆ smtptext

stralloc smtptext = {0}

Definition at line 215 of file qmail-smtpam.c.

◆ ssl

SSL* ssl

Definition at line 83 of file qmail-smtpam.c.

◆ timeout

int timeout = 1200

Definition at line 192 of file qmail-smtpam.c.

◆ timeoutconnect

int timeoutconnect = 60

Definition at line 190 of file qmail-smtpam.c.

◆ tlsdest

stralloc tlsdest = {0}

Definition at line 282 of file qmail-smtpam.c.

◆ tlsdestinations

stralloc tlsdestinations = {0}

Definition at line 289 of file qmail-smtpam.c.

◆ tlsdestinfo

char* tlsdestinfo = 0

Definition at line 284 of file qmail-smtpam.c.

◆ tlsdomaininfo

char* tlsdomaininfo = 0

Definition at line 285 of file qmail-smtpam.c.

◆ up

char up[513]

Definition at line 476 of file qmail-smtpam.c.

◆ uplen

int uplen

Definition at line 477 of file qmail-smtpam.c.

◆ verifydepth

unsigned long verifydepth = VERIFYDEPTH

Definition at line 291 of file qmail-smtpam.c.