s/qmail 4.2.29a
Next generation secure email transport
Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
qmail-send.c File Reference
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <unistd.h>
#include <utime.h>
#include "error.h"
#include "sig.h"
#include "direntry.h"
#include "control.h"
#include "select.h"
#include "open.h"
#include "seek.h"
#include "exit.h"
#include "lock.h"
#include "ndelay.h"
#include "now.h"
#include "getln.h"
#include "buffer.h"
#include "alloc.h"
#include "genalloc.h"
#include "stralloc.h"
#include "logmsg.h"
#include "str.h"
#include "byte.h"
#include "fmt.h"
#include "scan.h"
#include "case.h"
#include "auto_qmail.h"
#include "trigger.h"
#include "newfield.h"
#include "quote.h"
#include "qmail.h"
#include "qsutil.h"
#include "prioq.h"
#include "constmap.h"
#include "fmtqfn.h"
#include "readsubdir.h"
#include "sendtodo.h"
Include dependency graph for qmail-send.c:

Go to the source code of this file.

Data Structures

struct  job
 
struct  del
 

Macros

#define CHANNELS   2
 
#define REPORTMAX   10000
 
#define CHECKSTAT   if (errno != ENOENT) goto FAIL;
 

Functions

void sigterm ()
 
void sigalrm ()
 
void sighup ()
 
void cleandied ()
 
void spawndied (int c)
 
void fnmake_init ()
 
void fnmake_info (unsigned long id)
 
void fnmake_todo (unsigned long id)
 
void fnmake_mess (unsigned long id)
 
void fnmake_foop (unsigned long id)
 
void fnmake_split (unsigned long id)
 
void fnmake2_bounce (unsigned long id)
 
void fnmake_chanaddr (unsigned long id, int c)
 
void senderadd (stralloc *sa, char *sender, char *recip)
 
int getinfo (stralloc *sa, datetime_sec *dt, unsigned long id)
 
void comm_init ()
 
int comm_canwrite (int c)
 
void comm_write (int c, int delnum, unsigned long id, char *sender, char *recip)
 
void comm_selprep (int *nfds, fd_set *wfds)
 
void comm_do (fd_set *wfds)
 
void cleanup_init ()
 
void cleanup_selprep (datetime_sec *wakeup)
 
void cleanup_do ()
 
void pqadd (unsigned long id)
 
void pqstart ()
 
void pqfinish ()
 
void pqrun ()
 
void job_init ()
 
int job_avail ()
 
int job_open (unsigned long id, int channel)
 
void job_close (int j)
 
char * stripvdomprepend (char *recip)
 
void addbounce (unsigned long id, char *recip, char *report)
 
int injectbounce (unsigned long id)
 
void del_status ()
 
void del_init ()
 
int del_canexit ()
 
int del_avail (int c)
 
void del_start (int j, seek_pos mpos, char *recip)
 
void markdone (int c, unsigned long id, seek_pos pos)
 
void del_dochan (int c)
 
void del_selprep (int *nfds, fd_set *rfds)
 
void del_do (fd_set *rfds)
 
void pass_init ()
 
void pass_selprep (datetime_sec *wakeup)
 
datetime_sec nextretry (datetime_sec birth, int c)
 
void pass_dochan (int c)
 
void messdone (unsigned long id)
 
void pass_do ()
 
void tododied ()
 
void todo_init ()
 
void todo_selprep (int *nfds, fd_set *rfds, datetime_sec *wakeup)
 
void todo_del (char *s)
 
void todo_do (fd_set *rfds)
 
int getcontrols ()
 
void regetcontrols ()
 
void reread ()
 
int main ()
 

Variables

int lifetime = 604800
 
int bouncemaxbytes = 0
 
stralloc percenthack = {0}
 
struct constmap mappercenthack
 
stralloc locals = {0}
 
struct constmap maplocals
 
stralloc vdoms = {0}
 
struct constmap mapvdoms
 
stralloc envnoathost = {0}
 
stralloc bouncefrom = {0}
 
stralloc bouncehost = {0}
 
stralloc doublebounceto = {0}
 
stralloc doublebouncehost = {0}
 
char strnum2 [FMT_ULONG]
 
char strnum3 [FMT_ULONG]
 
char * chanaddr [CHANNELS] = { "local/", "remote/" }
 
char * chanstatusmsg [CHANNELS] = { " local ", " remote " }
 
char * tochan [CHANNELS] = { " to local ", " to remote " }
 
int chanfdout [CHANNELS] = { 1, 3 }
 
int chanfdin [CHANNELS] = { 2, 4 }
 
int chanskip [CHANNELS] = { 10, 20 }
 
int flagexitasap = 0
 
int flagrunasap = 0
 
int flagreadasap = 0
 
int flagspawnalive [CHANNELS]
 
datetime_sec recent
 
stralloc fn = {0}
 
stralloc fn2 = {0}
 
char fnmake_strnum [FMT_ULONG]
 
buffer toqc
 
char toqcbuf [1024]
 
buffer fromqc
 
char fromqcbuf [1024]
 
stralloc comm_buf [CHANNELS] = { {0}, {0} }
 
int comm_pos [CHANNELS]
 
int flagcleanup
 
readsubdir cleanupdir
 
datetime_sec cleanuptime
 
prioq pqdone = {0}
 
prioq pqchan [CHANNELS] = { {0}, {0} }
 
prioq pqfail = {0}
 
int numjobs
 
struct jobjo
 
stralloc bouncetext = {0}
 
unsigned long masterdelid = 1
 
unsigned int concurrency [CHANNELS] = { 10, 20 }
 
unsigned int concurrencyused [CHANNELS] = { 0, 0 }
 
struct deld [CHANNELS]
 
stralloc dline [CHANNELS]
 
char delbuf [2048]
 
struct {
   unsigned long   id
 
   int   j
 
   int   fd
 
   seek_pos   mpos
 
   buffer   b
 
   char   buf [128]
 
pass [CHANNELS]
 
stralloc todoline = {0}
 
char todobuf [2048]
 
int todofdin
 
int todofdout
 
int flagtodoalive
 
stralloc newlocals = {0}
 
stralloc newvdoms = {0}
 

Macro Definition Documentation

◆ CHANNELS

#define CHANNELS   2

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

◆ CHECKSTAT

#define CHECKSTAT   if (errno != ENOENT) goto FAIL;

◆ REPORTMAX

#define REPORTMAX   10000

Definition at line 85 of file qmail-send.c.

Function Documentation

◆ addbounce()

void addbounce ( unsigned long  id,
char *  recip,
char *  report 
)

Definition at line 518 of file qmail-send.c.

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

◆ cleandied()

void cleandied ( )

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

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

◆ cleanup_do()

void cleanup_do ( )

Definition at line 269 of file qmail-send.c.

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

◆ cleanup_init()

void cleanup_init ( )

Definition at line 257 of file qmail-send.c.

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

◆ cleanup_selprep()

void cleanup_selprep ( datetime_sec wakeup)

Definition at line 263 of file qmail-send.c.

Here is the caller graph for this function:

◆ comm_canwrite()

int comm_canwrite ( int  c)

Definition at line 186 of file qmail-send.c.

Here is the call graph for this function:

◆ comm_do()

void comm_do ( fd_set *  wfds)

Definition at line 224 of file qmail-send.c.

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

◆ comm_init()

void comm_init ( void  )

Definition at line 174 of file qmail-send.c.

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

◆ comm_selprep()

void comm_selprep ( int nfds,
fd_set *  wfds 
)

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

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

◆ comm_write()

void comm_write ( int  c,
int  delnum,
unsigned long  id,
char *  sender,
char *  recip 
)

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

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

◆ del_avail()

int del_avail ( int  c)

Definition at line 767 of file qmail-send.c.

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

◆ del_canexit()

int del_canexit ( )

Definition at line 757 of file qmail-send.c.

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

◆ del_do()

void del_do ( fd_set *  rfds)

Definition at line 904 of file qmail-send.c.

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

◆ del_dochan()

void del_dochan ( int  c)

Definition at line 823 of file qmail-send.c.

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

◆ del_init()

void del_init ( )

Definition at line 739 of file qmail-send.c.

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

◆ del_selprep()

void del_selprep ( int nfds,
fd_set *  rfds 
)

Definition at line 892 of file qmail-send.c.

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

◆ del_start()

void del_start ( int  j,
seek_pos  mpos,
char *  recip 
)

Definition at line 772 of file qmail-send.c.

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

◆ del_status()

void del_status ( )

Definition at line 724 of file qmail-send.c.

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

◆ fnmake2_bounce()

void fnmake2_bounce ( unsigned long  id)

Definition at line 107 of file qmail-send.c.

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

◆ fnmake_chanaddr()

void fnmake_chanaddr ( unsigned long  id,
int  c 
)

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

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

◆ fnmake_foop()

void fnmake_foop ( unsigned long  id)

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

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

◆ fnmake_info()

void fnmake_info ( unsigned long  id)

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

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

◆ fnmake_init()

void fnmake_init ( void  )

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

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

◆ fnmake_mess()

void fnmake_mess ( unsigned long  id)

Definition at line 104 of file qmail-send.c.

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

◆ fnmake_split()

void fnmake_split ( unsigned long  id)

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

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

◆ fnmake_todo()

void fnmake_todo ( unsigned long  id)

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

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

◆ getcontrols()

int getcontrols ( void  )

Definition at line 1276 of file qmail-send.c.

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

◆ getinfo()

int getinfo ( stralloc *  sa,
datetime_sec dt,
unsigned long  id 
)

Definition at line 141 of file qmail-send.c.

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

◆ injectbounce()

int injectbounce ( unsigned long  id)

Definition at line 567 of file qmail-send.c.

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

◆ job_avail()

int job_avail ( )

Definition at line 430 of file qmail-send.c.

Here is the caller graph for this function:

◆ job_close()

void job_close ( int  j)

Definition at line 454 of file qmail-send.c.

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

◆ job_init()

void job_init ( )

Definition at line 419 of file qmail-send.c.

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

◆ job_open()

int job_open ( unsigned long  id,
int  channel 
)

Definition at line 439 of file qmail-send.c.

Here is the caller graph for this function:

◆ main()

int main ( void  )

Definition at line 1349 of file qmail-send.c.

Here is the call graph for this function:

◆ markdone()

void markdone ( int  c,
unsigned long  id,
seek_pos  pos 
)

Definition at line 803 of file qmail-send.c.

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

◆ messdone()

void messdone ( unsigned long  id)

Definition at line 1058 of file qmail-send.c.

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

◆ nextretry()

datetime_sec nextretry ( datetime_sec  birth,
int  c 
)

Definition at line 975 of file qmail-send.c.

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

◆ pass_do()

void pass_do ( )

Definition at line 1115 of file qmail-send.c.

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

◆ pass_dochan()

void pass_dochan ( int  c)

Definition at line 986 of file qmail-send.c.

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

◆ pass_init()

void pass_init ( )

Definition at line 928 of file qmail-send.c.

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

◆ pass_selprep()

void pass_selprep ( datetime_sec wakeup)

Definition at line 935 of file qmail-send.c.

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

◆ pqadd()

void pqadd ( unsigned long  id)

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

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

◆ pqfinish()

void pqfinish ( )

Definition at line 373 of file qmail-send.c.

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

◆ pqrun()

void pqrun ( )

Definition at line 389 of file qmail-send.c.

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

◆ pqstart()

void pqstart ( )

Definition at line 361 of file qmail-send.c.

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

◆ regetcontrols()

void regetcontrols ( void  )

Definition at line 1309 of file qmail-send.c.

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

◆ reread()

void reread ( void  )

Definition at line 1334 of file qmail-send.c.

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

◆ senderadd()

void senderadd ( stralloc *  sa,
char *  sender,
char *  recip 
)

Definition at line 113 of file qmail-send.c.

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

◆ sigalrm()

void sigalrm ( )

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

Here is the caller graph for this function:

◆ sighup()

void sighup ( void  )

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

Here is the caller graph for this function:

◆ sigterm()

void sigterm ( void  )

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

Here is the caller graph for this function:

◆ spawndied()

void spawndied ( int  c)

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

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

◆ stripvdomprepend()

char * stripvdomprepend ( char *  recip)

Definition at line 491 of file qmail-send.c.

Here is the caller graph for this function:

◆ todo_del()

void todo_del ( char *  s)

Definition at line 1176 of file qmail-send.c.

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

◆ todo_do()

void todo_do ( fd_set *  rfds)

Definition at line 1225 of file qmail-send.c.

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

◆ todo_init()

void todo_init ( void  )

Definition at line 1151 of file qmail-send.c.

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

◆ todo_selprep()

void todo_selprep ( int nfds,
fd_set *  rfds,
datetime_sec wakeup 
)

Definition at line 1162 of file qmail-send.c.

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

◆ tododied()

void tododied ( )

Definition at line 1145 of file qmail-send.c.

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

Variable Documentation

◆ b

buffer b

Definition at line 923 of file qmail-send.c.

◆ bouncefrom

stralloc bouncefrom = {0}

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

◆ bouncehost

stralloc bouncehost = {0}

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

◆ bouncemaxbytes

int bouncemaxbytes = 0

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

◆ bouncetext

stralloc bouncetext = {0}

Definition at line 516 of file qmail-send.c.

◆ buf

char buf[128]

Definition at line 924 of file qmail-send.c.

◆ chanaddr

char* chanaddr[CHANNELS] = { "local/", "remote/" }

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

◆ chanfdin

int chanfdin[CHANNELS] = { 2, 4 }

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

◆ chanfdout

int chanfdout[CHANNELS] = { 1, 3 }

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

◆ chanskip

int chanskip[CHANNELS] = { 10, 20 }

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

◆ chanstatusmsg

char* chanstatusmsg[CHANNELS] = { " local ", " remote " }

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

◆ cleanupdir

readsubdir cleanupdir

Definition at line 254 of file qmail-send.c.

◆ cleanuptime

datetime_sec cleanuptime

Definition at line 255 of file qmail-send.c.

◆ comm_buf

stralloc comm_buf[CHANNELS] = { {0}, {0} }

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

◆ comm_pos

int comm_pos[CHANNELS]

Definition at line 172 of file qmail-send.c.

◆ concurrency

unsigned int concurrency[CHANNELS] = { 10, 20 }

Definition at line 718 of file qmail-send.c.

◆ concurrencyused

unsigned int concurrencyused[CHANNELS] = { 0, 0 }

Definition at line 719 of file qmail-send.c.

◆ d

struct del* d[CHANNELS]

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

◆ delbuf

char delbuf[2048]

Definition at line 722 of file qmail-send.c.

◆ dline

stralloc dline[CHANNELS]

Definition at line 721 of file qmail-send.c.

◆ doublebouncehost

stralloc doublebouncehost = {0}

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

◆ doublebounceto

stralloc doublebounceto = {0}

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

◆ envnoathost

stralloc envnoathost = {0}

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

◆ fd

int fd

Definition at line 921 of file qmail-send.c.

◆ flagcleanup

int flagcleanup

Definition at line 253 of file qmail-send.c.

◆ flagexitasap

int flagexitasap = 0

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

◆ flagreadasap

int flagreadasap = 0

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

◆ flagrunasap

int flagrunasap = 0

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

◆ flagspawnalive

int flagspawnalive[CHANNELS]

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

◆ flagtodoalive

int flagtodoalive

Definition at line 1143 of file qmail-send.c.

◆ fn

stralloc fn = {0}

Definition at line 92 of file qmail-send.c.

◆ fn2

stralloc fn2 = {0}

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

◆ fnmake_strnum

char fnmake_strnum[FMT_ULONG]

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

◆ fromqc

buffer fromqc

Definition at line 170 of file qmail-send.c.

◆ fromqcbuf

char fromqcbuf[1024]

Definition at line 170 of file qmail-send.c.

◆ id

unsigned long id

Definition at line 919 of file qmail-send.c.

◆ j

int j

Definition at line 920 of file qmail-send.c.

◆ jo

struct job* jo

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

◆ lifetime

int lifetime = 604800

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

◆ locals

stralloc locals = {0}

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

◆ maplocals

struct constmap maplocals

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

◆ mappercenthack

struct constmap mappercenthack

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

◆ mapvdoms

struct constmap mapvdoms

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

◆ masterdelid

unsigned long masterdelid = 1

Definition at line 717 of file qmail-send.c.

◆ mpos

seek_pos mpos

Definition at line 922 of file qmail-send.c.

◆ newlocals

stralloc newlocals = {0}

Definition at line 1306 of file qmail-send.c.

◆ newvdoms

stralloc newvdoms = {0}

Definition at line 1307 of file qmail-send.c.

◆ numjobs

int numjobs

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

◆ 

struct { ... } pass[CHANNELS]

◆ percenthack

stralloc percenthack = {0}

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

◆ pqchan

prioq pqchan[CHANNELS] = { {0}, {0} }

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

◆ pqdone

prioq pqdone = {0}

Definition at line 309 of file qmail-send.c.

◆ pqfail

prioq pqfail = {0}

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

◆ recent

datetime_sec recent

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

◆ strnum2

char strnum2[FMT_ULONG]

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

◆ strnum3

char strnum3[FMT_ULONG]

Definition at line 56 of file qmail-send.c.

◆ tochan

char* tochan[CHANNELS] = { " to local ", " to remote " }

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

◆ todobuf

char todobuf[2048]

Definition at line 1140 of file qmail-send.c.

◆ todofdin

int todofdin

Definition at line 1141 of file qmail-send.c.

◆ todofdout

int todofdout

Definition at line 1142 of file qmail-send.c.

◆ todoline

stralloc todoline = {0}

Definition at line 1139 of file qmail-send.c.

◆ toqc

buffer toqc

Definition at line 169 of file qmail-send.c.

◆ toqcbuf

char toqcbuf[1024]

Definition at line 169 of file qmail-send.c.

◆ vdoms

stralloc vdoms = {0}

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