s/qmail 4.3.21
Next generation secure email transport
Loading...
Searching...
No Matches
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 "qmail.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 TCP_TIMEOUT   60
#define SMTP_TIMEOUT   1200
#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 ehlo_starttls ()
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 *const *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
unsigned long timeoutconnect = TCP_TIMEOUT
unsigned long timeout = SMTP_TIMEOUT
int smtpfd
char outbuf [BUFSIZE_LINE]
buffer bo = BUFFER_INIT(safewrite,-1,outbuf,sizeof(outbuf))
char frombuf [BUFFER_SMALL]
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 43 of file qmail-smtpam.c.

◆ HUGESMTPTEXT

#define HUGESMTPTEXT   5000

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

◆ MAX_SIZE

#define MAX_SIZE   200000000

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

◆ PORT_SMTP

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

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

◆ PORT_SMTPS

#define PORT_SMTPS   465

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

◆ SMTP_TIMEOUT

#define SMTP_TIMEOUT   1200

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

◆ TCP_TIMEOUT

#define TCP_TIMEOUT   60

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

◆ VERIFYDEPTH

#define VERIFYDEPTH   1

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

◆ WHO

#define WHO   "qmail-smtpam"

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

Function Documentation

◆ dropped()

void dropped ( )

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

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

◆ ehlo_starttls()

int ehlo_starttls ( )

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

Here is the caller graph for this function:

◆ GEN_ALLOC_typedef()

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

◆ get()

void get ( char * ch)

Definition at line 220 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 484 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 *const * argv )

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

Here is the call graph for this function:

◆ out()

void out ( char * s)

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

Here is the call graph for this function:

◆ outhost()

void outhost ( )

Definition at line 167 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 92 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 251 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 160 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 155 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 263 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 197 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 205 of file qmail-smtpam.c.

Here is the call graph for this function:

◆ smtp()

void smtp ( )

Definition at line 442 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 410 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 428 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 228 of file qmail-smtpam.c.

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

◆ temp_chdir()

void temp_chdir ( )

Definition at line 145 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 150 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 138 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 131 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 126 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 104 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 109 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 114 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 119 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 296 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 340 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 398 of file qmail-smtpam.c.

Here is the caller graph for this function:

◆ zero()

void zero ( )

Definition at line 90 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 91 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 216 of file qmail-smtpam.c.

◆ bo

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

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

◆ cadir

stralloc cadir = {0}

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

◆ cafile

stralloc cafile = {0}

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

◆ canonbox

stralloc canonbox = {0}

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

◆ canonhost

stralloc canonhost = {0}

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

◆ certfile

stralloc certfile = {0}

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

◆ ciphers

stralloc ciphers = {0}

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

◆ code

unsigned long code

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

◆ ctx

SSL_CTX* ctx

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

◆ domaincerts

stralloc domaincerts = {0}

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

◆ domainips

stralloc domainips = {0}

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

◆ flagauth

int flagauth = 0

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

◆ flagcritical

int flagcritical = 0

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

◆ flagsmtps

int flagsmtps = 0

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

◆ flagtls

int flagtls = 0

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

◆ flagutf8mail

int flagutf8mail = 0

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

◆ flagverify

int flagverify = 0

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

◆ frombuf

char frombuf[BUFFER_SMALL]

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

◆ host

stralloc host = {0}

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

◆ ifidx

uint32 ifidx = 0

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

◆ ip4

char ip4[4]

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

◆ ip6

char ip6[16]

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

◆ keyfile

stralloc keyfile = {0}

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

◆ keypwd

stralloc keypwd = {0}

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

◆ mapdomaincerts

struct constmap mapdomaincerts

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

◆ mapdomainips

struct constmap mapdomainips

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

◆ maproutes

struct constmap maproutes

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

◆ maptlsdestinations

struct constmap maptlsdestinations

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

◆ outbuf

char outbuf[BUFSIZE_LINE]

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

◆ partner

struct ip_mx partner

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

◆ port

unsigned long port = PORT_SMTP

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

◆ ports

stralloc ports = {0}

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

◆ recip

stralloc recip = {0}

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

◆ recipient

stralloc recipient = {0}

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

◆ remotehost

stralloc remotehost = {0}

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

◆ routes

stralloc routes = {0}

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

◆ sender

stralloc sender = {0}

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

◆ sendip

stralloc sendip = {0}

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

◆ smtpfd

int smtpfd

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

◆ smtptext

stralloc smtptext = {0}

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

◆ ssl

SSL* ssl

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

◆ timeout

unsigned long timeout = SMTP_TIMEOUT

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

◆ timeoutconnect

unsigned long timeoutconnect = TCP_TIMEOUT

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

◆ tlsdest

stralloc tlsdest = {0}

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

◆ tlsdestinations

stralloc tlsdestinations = {0}

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

◆ tlsdestinfo

char* tlsdestinfo = 0

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

◆ tlsdomaininfo

char* tlsdomaininfo = 0

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

◆ up

char up[513]

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

◆ uplen

int uplen

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

◆ verifydepth

unsigned long verifydepth = VERIFYDEPTH

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