s/qmail 4.2.29a
Next generation secure email transport
Loading...
Searching...
No Matches
Macros | Functions | Variables
qmail-remote.c File Reference
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "sig.h"
#include "stralloc.h"
#include "buffer.h"
#include "scan.h"
#include "case.h"
#include "byte.h"
#include "logmsg.h"
#include "auto_qmail.h"
#include "control.h"
#include "dns.h"
#include "alloc.h"
#include "genalloc.h"
#include "quote.h"
#include "fmt.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 "timeout.h"
#include "timeoutconn.h"
#include "base64.h"
#include "socket_if.h"
#include "ucspissl.h"
#include "hmac_md5.h"
#include "tls_remote.h"
#include "tls_errors.h"
#include "tls_timeoutio.h"
#include "uint_t.h"
Include dependency graph for qmail-remote.c:

Go to the source code of this file.

Macros

#define WHO   "qmail-remote"
 
#define MAX_SIZE   200000000
 
#define HUGESMTPTEXT   1000 /* RFC 5322; was 5000 chars/line */
 
#define PORT_SMTP   25 /* silly rabbit, /etc/services is for users */
 
#define PORT_QMTP   209
 
#define PORT_SMTPS   465
 
#define PORT_SUBMISSION   587
 
#define PORT_QMTPS   6209
 
#define VERIFYDEPTH   1
 

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_qmtpnoc ()
 
void temp_read ()
 
void temp_dnscanon ()
 
void temp_dns ()
 
void temp_nomx ()
 
void temp_chdir ()
 
void temp_control ()
 
void perm_partialline ()
 
void temp_proto ()
 
void perm_usage ()
 
void perm_dns ()
 
void perm_nomx ()
 
void perm_ambigmx ()
 
void err_authprot ()
 
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 blast ()
 
void tls_init ()
 
int starttls_peer ()
 
void tls_peercheck ()
 
int utf8string (unsigned char *ch, int len)
 
int utf8received ()
 
int smtp_size ()
 
void smtp_greeting ()
 
void smtp_starttls ()
 
void mailfrom ()
 
int xtext (stralloc *sa, char *s, int len)
 
void mailfrom_xtext ()
 
int mailfrom_plain ()
 
int mailfrom_login ()
 
int mailfrom_cram ()
 
void smtp_auth ()
 
void smtp ()
 
void qmtp ()
 
void addrmangle (stralloc *saout, char *address, int *flagalias, int flagcname)
 
void getcontrols ()
 
int main (int argc, char **argv)
 

Variables

unsigned long port = PORT_SMTP
 
int flagauth = 0
 
int flagsmtps = 0
 
int flagtlsdomain = 0
 
int flagtls = 0
 
int flagverify = 0
 
int flagutf8 = 0
 
stralloc helohost = {0}
 
stralloc eaihost = {0}
 
stralloc host = {0}
 
stralloc idnhost = {0}
 
stralloc sender = {0}
 
stralloc canonhost = {0}
 
stralloc remotehost = {0}
 
stralloc canonbox = {0}
 
stralloc senddomain = {0}
 
stralloc sendip = {0}
 
stralloc domainips = {0}
 
struct constmap mapdomainips
 
char ip4 [4]
 
char ip6 [16]
 
uint32 ifidx = 0
 
char * authsender = 0
 
stralloc smtproutes = {0}
 
struct constmap mapsmtproutes
 
stralloc qmtproutes = {0}
 
struct constmap mapqmtproutes
 
saa reciplist = {0}
 
stralloc recip = {0}
 
char msgsize [FMT_ULONG]
 
unsigned long msize = 0
 
struct ip_mx partner
 
SSL * ssl
 
SSL_CTX * ctx
 
char smallbuf [BUFFER_SMALL]
 
buffer bs = BUFFER_INIT(write,1,smallbuf,sizeof(smallbuf))
 
int flagcritical = 0
 
int timeoutconnect = 60
 
int smtpfd
 
int timeout = 1200
 
char inbuf [BUFFER_MTUSIZE]
 
buffer bi = BUFFER_INIT(read,0,inbuf,sizeof(inbuf))
 
char outbuf [BUFFER_MTUSIZE]
 
buffer bo = BUFFER_INIT(safewrite,-1,outbuf,sizeof(outbuf))
 
char frombuf [BUFFER_SMALL]
 
buffer bf = BUFFER_INIT(saferead,-1,frombuf,sizeof(frombuf))
 
stralloc cafile = {0}
 
stralloc cadir = {0}
 
stralloc certfile = {0}
 
stralloc keyfile = {0}
 
stralloc keypwd = {0}
 
stralloc ciphers = {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
 
int flagsize = 0
 
stralloc authsenders = {0}
 
struct constmap mapauthsenders
 
stralloc user = {0}
 
stralloc pass = {0}
 
stralloc auth = {0}
 
stralloc chal = {0}
 
stralloc slop = {0}
 
stralloc plain = {0}
 
stralloc xuser = {0}
 
int qmtpsend = 0
 

Detailed Description

-- versatile SMTP(S)/QMTP(S) client

Definition in file qmail-remote.c.

Macro Definition Documentation

◆ HUGESMTPTEXT

#define HUGESMTPTEXT   1000 /* RFC 5322; was 5000 chars/line */

Definition at line 46 of file qmail-remote.c.

◆ MAX_SIZE

#define MAX_SIZE   200000000

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

◆ PORT_QMTP

#define PORT_QMTP   209

Definition at line 48 of file qmail-remote.c.

◆ PORT_QMTPS

#define PORT_QMTPS   6209

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

◆ PORT_SMTP

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

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

◆ PORT_SMTPS

#define PORT_SMTPS   465

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

◆ PORT_SUBMISSION

#define PORT_SUBMISSION   587

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

◆ VERIFYDEPTH

#define VERIFYDEPTH   1

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

◆ WHO

#define WHO   "qmail-remote"

Definition at line 43 of file qmail-remote.c.

Function Documentation

◆ addrmangle()

void addrmangle ( stralloc *  saout,
char *  address,
int flagalias,
int  flagcname 
)

Definition at line 1016 of file qmail-remote.c.

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

◆ blast()

void blast ( )

Definition at line 375 of file qmail-remote.c.

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

◆ dropped()

void dropped ( )

Definition at line 270 of file qmail-remote.c.

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

◆ err_authprot()

void err_authprot ( )

Definition at line 249 of file qmail-remote.c.

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 71 of file qmail-remote.c.

◆ get()

void get ( char *  ch)

Definition at line 320 of file qmail-remote.c.

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

◆ getcontrols()

void getcontrols ( void  )

Definition at line 1050 of file qmail-remote.c.

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

◆ mailfrom()

void mailfrom ( )

Definition at line 626 of file qmail-remote.c.

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

◆ mailfrom_cram()

int mailfrom_cram ( )

Definition at line 750 of file qmail-remote.c.

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

◆ mailfrom_login()

int mailfrom_login ( )

Definition at line 720 of file qmail-remote.c.

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

◆ mailfrom_plain()

int mailfrom_plain ( )

Definition at line 694 of file qmail-remote.c.

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

◆ mailfrom_xtext()

void mailfrom_xtext ( )

Definition at line 677 of file qmail-remote.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 1090 of file qmail-remote.c.

Here is the call graph for this function:

◆ out()

void out ( char *  s)

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

Here is the call graph for this function:

◆ outhost()

void outhost ( )

Definition at line 254 of file qmail-remote.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 129 of file qmail-remote.c.

Here is the caller graph for this function:

◆ outsmtptext()

void outsmtptext ( )

Definition at line 351 of file qmail-remote.c.

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

◆ perm_ambigmx()

void perm_ambigmx ( )

Definition at line 243 of file qmail-remote.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 229 of file qmail-remote.c.

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

◆ perm_nomx()

void perm_nomx ( )

Definition at line 236 of file qmail-remote.c.

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

◆ perm_partialline()

void perm_partialline ( )

Definition at line 214 of file qmail-remote.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 224 of file qmail-remote.c.

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

◆ qmtp()

void qmtp ( )

Definition at line 907 of file qmail-remote.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 363 of file qmail-remote.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 284 of file qmail-remote.c.

Here is the call graph for this function:

◆ safewrite()

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

Definition at line 297 of file qmail-remote.c.

Here is the call graph for this function:

◆ smtp()

void smtp ( )

Definition at line 814 of file qmail-remote.c.

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

◆ smtp_auth()

void smtp_auth ( )

Definition at line 795 of file qmail-remote.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 589 of file qmail-remote.c.

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

◆ smtp_size()

int smtp_size ( )

Definition at line 579 of file qmail-remote.c.

Here is the caller graph for this function:

◆ smtp_starttls()

void smtp_starttls ( )

Definition at line 610 of file qmail-remote.c.

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

◆ smtpcode()

unsigned long smtpcode ( )

Definition at line 328 of file qmail-remote.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 459 of file qmail-remote.c.

Here is the caller graph for this function:

◆ temp_chdir()

void temp_chdir ( )

Definition at line 204 of file qmail-remote.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 209 of file qmail-remote.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 190 of file qmail-remote.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 183 of file qmail-remote.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 164 of file qmail-remote.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 142 of file qmail-remote.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 147 of file qmail-remote.c.

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

◆ temp_nomx()

void temp_nomx ( )

Definition at line 197 of file qmail-remote.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 152 of file qmail-remote.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 157 of file qmail-remote.c.

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

◆ temp_proto()

void temp_proto ( )

Definition at line 219 of file qmail-remote.c.

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

◆ temp_qmtpnoc()

void temp_qmtpnoc ( )

Definition at line 171 of file qmail-remote.c.

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

◆ temp_read()

void temp_read ( )

Definition at line 178 of file qmail-remote.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 419 of file qmail-remote.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 470 of file qmail-remote.c.

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

◆ utf8received()

int utf8received ( )

Definition at line 536 of file qmail-remote.c.

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

◆ utf8string()

int utf8string ( unsigned char *  ch,
int  len 
)

Definition at line 528 of file qmail-remote.c.

Here is the caller graph for this function:

◆ xtext()

int xtext ( stralloc *  sa,
char *  s,
int  len 
)

Definition at line 656 of file qmail-remote.c.

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

◆ zero()

void zero ( )

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

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

◆ zerodie()

void zerodie ( void  )

Definition at line 121 of file qmail-remote.c.

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

Variable Documentation

◆ auth

stralloc auth = {0}

Definition at line 648 of file qmail-remote.c.

◆ authsender

char* authsender = 0

Definition at line 91 of file qmail-remote.c.

◆ authsenders

stralloc authsenders = {0}

Definition at line 643 of file qmail-remote.c.

◆ bf

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

Definition at line 315 of file qmail-remote.c.

◆ bi

buffer bi = BUFFER_INIT(read,0,inbuf,sizeof(inbuf))

Definition at line 311 of file qmail-remote.c.

◆ bo

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

Definition at line 313 of file qmail-remote.c.

◆ bs

buffer bs = BUFFER_INIT(write,1,smallbuf,sizeof(smallbuf))

Definition at line 109 of file qmail-remote.c.

◆ cadir

stralloc cadir = {0}

Definition at line 404 of file qmail-remote.c.

◆ cafile

stralloc cafile = {0}

Definition at line 403 of file qmail-remote.c.

◆ canonbox

stralloc canonbox = {0}

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

◆ canonhost

stralloc canonhost = {0}

Definition at line 80 of file qmail-remote.c.

◆ certfile

stralloc certfile = {0}

Definition at line 405 of file qmail-remote.c.

◆ chal

stralloc chal = {0}

Definition at line 649 of file qmail-remote.c.

◆ ciphers

stralloc ciphers = {0}

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

◆ code

unsigned long code

Definition at line 576 of file qmail-remote.c.

◆ ctx

SSL_CTX* ctx

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

◆ domaincerts

stralloc domaincerts = {0}

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

◆ domainips

stralloc domainips = {0}

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

◆ eaihost

stralloc eaihost = {0}

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

◆ flagauth

int flagauth = 0

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

◆ flagcritical

int flagcritical = 0

Definition at line 268 of file qmail-remote.c.

◆ flagsize

int flagsize = 0

Definition at line 577 of file qmail-remote.c.

◆ flagsmtps

int flagsmtps = 0

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

◆ flagtls

int flagtls = 0

Definition at line 61 of file qmail-remote.c.

◆ flagtlsdomain

int flagtlsdomain = 0

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

◆ flagutf8

int flagutf8 = 0

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

◆ flagverify

int flagverify = 0

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

◆ frombuf

char frombuf[BUFFER_SMALL]

Definition at line 314 of file qmail-remote.c.

◆ helohost

stralloc helohost = {0}

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

◆ host

stralloc host = {0}

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

◆ idnhost

stralloc idnhost = {0}

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

◆ ifidx

uint32 ifidx = 0

Definition at line 90 of file qmail-remote.c.

◆ inbuf

char inbuf[BUFFER_MTUSIZE]

Definition at line 310 of file qmail-remote.c.

◆ ip4

char ip4[4]

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

◆ ip6

char ip6[16]

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

◆ keyfile

stralloc keyfile = {0}

Definition at line 406 of file qmail-remote.c.

◆ keypwd

stralloc keypwd = {0}

Definition at line 407 of file qmail-remote.c.

◆ mapauthsenders

struct constmap mapauthsenders

Definition at line 644 of file qmail-remote.c.

◆ mapdomaincerts

struct constmap mapdomaincerts

Definition at line 414 of file qmail-remote.c.

◆ mapdomainips

struct constmap mapdomainips

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

◆ mapqmtproutes

struct constmap mapqmtproutes

Definition at line 96 of file qmail-remote.c.

◆ mapsmtproutes

struct constmap mapsmtproutes

Definition at line 94 of file qmail-remote.c.

◆ maptlsdestinations

struct constmap maptlsdestinations

Definition at line 416 of file qmail-remote.c.

◆ msgsize

char msgsize[FMT_ULONG]

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

◆ msize

unsigned long msize = 0

Definition at line 102 of file qmail-remote.c.

◆ outbuf

char outbuf[BUFFER_MTUSIZE]

Definition at line 312 of file qmail-remote.c.

◆ partner

struct ip_mx partner

Definition at line 103 of file qmail-remote.c.

◆ pass

stralloc pass = {0}

Definition at line 647 of file qmail-remote.c.

◆ plain

stralloc plain = {0}

Definition at line 651 of file qmail-remote.c.

◆ port

unsigned long port = PORT_SMTP

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

◆ qmtproutes

stralloc qmtproutes = {0}

Definition at line 95 of file qmail-remote.c.

◆ qmtpsend

int qmtpsend = 0

Definition at line 905 of file qmail-remote.c.

◆ recip

stralloc recip = {0}

Definition at line 99 of file qmail-remote.c.

◆ reciplist

saa reciplist = {0}

Definition at line 98 of file qmail-remote.c.

◆ remotehost

stralloc remotehost = {0}

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

◆ senddomain

stralloc senddomain = {0}

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

◆ sender

stralloc sender = {0}

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

◆ sendip

stralloc sendip = {0}

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

◆ slop

stralloc slop = {0}

Definition at line 650 of file qmail-remote.c.

◆ smallbuf

char smallbuf[BUFFER_SMALL]

Definition at line 108 of file qmail-remote.c.

◆ smtpfd

int smtpfd

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

◆ smtproutes

stralloc smtproutes = {0}

Definition at line 93 of file qmail-remote.c.

◆ ssl

SSL* ssl

Definition at line 105 of file qmail-remote.c.

◆ timeout

int timeout = 1200

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

◆ timeoutconnect

int timeoutconnect = 60

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

◆ tlsdestinations

stralloc tlsdestinations = {0}

Definition at line 415 of file qmail-remote.c.

◆ tlsdestinfo

char* tlsdestinfo = 0

Definition at line 410 of file qmail-remote.c.

◆ tlsdomaininfo

char* tlsdomaininfo = 0

Definition at line 411 of file qmail-remote.c.

◆ user

stralloc user = {0}

Definition at line 646 of file qmail-remote.c.

◆ verifydepth

unsigned long verifydepth = VERIFYDEPTH

Definition at line 417 of file qmail-remote.c.

◆ xuser

stralloc xuser = {0}

Definition at line 652 of file qmail-remote.c.