Back to index

courier  0.68.2
Classes | Defines | Functions
cmlm.h File Reference
#include "config.h"
#include "afx/afx.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cctype>
#include "datadir.h"
#include "bindir.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ExclusiveLock
class  SharedLock
class  SubSharedLock
class  SubExclusiveLock
class  CommandLock

Defines

#define TMP   "tmp"
#define TMPLOCK   "tmp.lock"
#define OPTIONS   "options"
#define DOMAINS   "sublist"
#define ARCHIVE   "archive"
#define UNSUBLIST   "unsublist"
#define COMMANDS   "commands"
#define COMMANDSDAT   "commands.dat"
#define BOUNCES   "bounces"
#define BOUNCESDAT   "bounces.dat"
#define BOUNCESLOCK   "bounces.lock"
#define HOURLYLOCKFILE   "hourly.lock"
#define DAILYLOCKFILE   "daily.lock"
#define DIGESTLOCKFILE   "digest.lock"
#define MODQUEUE   "modqueue"
#define MODQUEUELOCKFILE   "modqueue.lock"
#define HEADERADD   "headeradd"
#define HEADERDEL   "headerdel"
#define TEMPLATEDIR   DATADIR "/couriermlm"
#define MSGSEPARATOR   "===="
#define SENDMAIL   BINDIR "/sendmail"
#define REFORMIME   BINDIR "/reformime"
#define MAXRCPTS   20
#define MSGLOCKFILE   ARCHIVE "/.lock"
#define SEQNO   ARCHIVE "/.seqno"
#define NEXTSEQNO   ARCHIVE "/.nextseqno"
#define MISC   DOMAINS "/misc"
#define MISCSIZE   2
#define ALIASES   DOMAINS "/aliases"
#define SUBLOCKFILE   "sublist.lock"
#define CMDLOCKFILE   "commands.lock"
#define SUBLOGFILE   "sublist.log"

Functions

void trapsigs (const char *)
void clearsigs (int)
std::string cmdget_s (const char *)
template<typename iterator_t , typename comp_t >
iterator_t find_last_if (iterator_t b, iterator_t e, comp_t c)
void TrimLeft (std::string &s)
void TrimRight (std::string &s)
std::string get_verp_return (std::string addr)
std::string toverp (std::string)
std::string fromverp (std::string)
std::string readmsg ()
std::string header_s (std::string a, const char *b)
std::string returnaddr (std::string, const char *)
std::string mkboundary_msg_s (afxipipestream &)
std::string mkfilename ()
std::string mktmpfilename ()
void post (std::istream &, const char *)
int is_subscriber (std::string)
int getinfo (std::string, int(*)(std::string))
std::string myname ()
void addrlower (char *)
void addrlower (std::string &)
int isfound (std::string)
int sendmail (const char **, pid_t &)
int wait4sendmail (pid_t)
int sendmail_bcc (pid_t &, std::string, int nodsn=0)
bool checkconfirm (std::string)
void ack_template (std::ostream &, const char *, std::string, std::string)
void simple_template (std::ostream &, const char *, std::string)
void copy_template (std::ostream &, const char *, std::string)
void copy_report (const char *, afxopipestream &)
int copyio (afxipipestream &, afxopipestream &)
int copyio_noseek (afxipipestream &, afxopipestream &)
int copyio_noseek_cnt (afxipipestream &, afxopipestream &, unsigned long *)
int cmddigest (const std::vector< std::string > &)

Define Documentation

#define ALIASES   DOMAINS "/aliases"

Definition at line 75 of file cmlm.h.

#define ARCHIVE   "archive"

Definition at line 29 of file cmlm.h.

#define BOUNCES   "bounces"

Definition at line 34 of file cmlm.h.

#define BOUNCESDAT   "bounces.dat"

Definition at line 35 of file cmlm.h.

#define BOUNCESLOCK   "bounces.lock"

Definition at line 36 of file cmlm.h.

#define CMDLOCKFILE   "commands.lock"

Definition at line 78 of file cmlm.h.

#define COMMANDS   "commands"

Definition at line 31 of file cmlm.h.

#define COMMANDSDAT   "commands.dat"

Definition at line 32 of file cmlm.h.

#define DAILYLOCKFILE   "daily.lock"

Definition at line 40 of file cmlm.h.

#define DIGESTLOCKFILE   "digest.lock"

Definition at line 42 of file cmlm.h.

#define DOMAINS   "sublist"

Definition at line 28 of file cmlm.h.

#define HEADERADD   "headeradd"

Definition at line 47 of file cmlm.h.

#define HEADERDEL   "headerdel"

Definition at line 48 of file cmlm.h.

#define HOURLYLOCKFILE   "hourly.lock"

Definition at line 39 of file cmlm.h.

#define MAXRCPTS   20

Definition at line 60 of file cmlm.h.

#define MISC   DOMAINS "/misc"

Definition at line 72 of file cmlm.h.

#define MISCSIZE   2

Definition at line 73 of file cmlm.h.

#define MODQUEUE   "modqueue"

Definition at line 44 of file cmlm.h.

#define MODQUEUELOCKFILE   "modqueue.lock"

Definition at line 45 of file cmlm.h.

#define MSGLOCKFILE   ARCHIVE "/.lock"

Definition at line 62 of file cmlm.h.

#define MSGSEPARATOR   "===="

Definition at line 54 of file cmlm.h.

#define NEXTSEQNO   ARCHIVE "/.nextseqno"

Definition at line 64 of file cmlm.h.

#define OPTIONS   "options"

Definition at line 27 of file cmlm.h.

#define REFORMIME   BINDIR "/reformime"

Definition at line 59 of file cmlm.h.

#define SENDMAIL   BINDIR "/sendmail"

Definition at line 58 of file cmlm.h.

#define SEQNO   ARCHIVE "/.seqno"

Definition at line 63 of file cmlm.h.

#define SUBLOCKFILE   "sublist.lock"

Definition at line 77 of file cmlm.h.

#define SUBLOGFILE   "sublist.log"

Definition at line 80 of file cmlm.h.

#define TEMPLATEDIR   DATADIR "/couriermlm"

Definition at line 52 of file cmlm.h.

#define TMP   "tmp"

Definition at line 24 of file cmlm.h.

#define TMPLOCK   "tmp.lock"

Definition at line 25 of file cmlm.h.

#define UNSUBLIST   "unsublist"

Definition at line 30 of file cmlm.h.


Function Documentation

void ack_template ( std::ostream &  ,
const char *  ,
std::string  ,
std::string   
)
void addrlower ( char *  )
void addrlower ( std::string &  )
bool checkconfirm ( std::string  )
void clearsigs ( int  )
int cmddigest ( const std::vector< std::string > &  )
std::string cmdget_s ( const char *  )
void copy_report ( const char *  ,
afxopipestream  
)
void copy_template ( std::ostream &  ,
const char *  ,
std::string   
)
int copyio ( afxipipestream ,
afxopipestream  
)
int copyio_noseek_cnt ( afxipipestream ,
afxopipestream ,
unsigned long *   
)
template<typename iterator_t , typename comp_t >
iterator_t find_last_if ( iterator_t  b,
iterator_t  e,
comp_t  c 
)

Definition at line 120 of file cmlm.h.

{
       iterator_t r=e;

       while (b != e)
              if (c(*b++))
                     r=b;
       return r;
}

Here is the caller graph for this function:

std::string fromverp ( std::string  )
std::string get_verp_return ( std::string  addr)
int getinfo ( std::string  ,
int(*)(std::string)   
)
std::string header_s ( std::string  a,
const char *  b 
)
int is_subscriber ( std::string  )
int isfound ( std::string  )
std::string mkboundary_msg_s ( afxipipestream )
std::string mkfilename ( )
std::string mktmpfilename ( )

Definition at line 34 of file comtmpfile2.c.

{
       unsigned long seed;
       int i;
       int fd;
       char filename_buf[64];

#if HAVE_GETTIMEOFDAY
       struct timeval tv;

       gettimeofday(&tv, NULL);

       seed=tv.tv_sec;
       seed ^= tv.tv_usec << 16;
#else
       time_t t;

       time(&t);
       seed=t;
#endif
       seed ^= getpid();

       for (i=0; i<1000; i++, seed += 5000)
       {
              char *p;
              unsigned long n;

              strcpy(filename_buf, "/tmp/courier.");

              p=filename_buf + strlen(filename_buf);

              n=seed;
              *p++=base64[ n % 64 ]; n /= 64;
              *p++=base64[ n % 64 ]; n /= 64;
              *p++=base64[ n % 64 ]; n /= 64;
              *p++=base64[ n % 64 ]; n /= 64;
              *p++=base64[ n % 64 ]; n /= 64;
              *p++=base64[ n % 64 ];
              *p=0;

              if ((fd=open(filename_buf, O_RDWR | O_CREAT | O_EXCL, 0600))
                  >= 0)
              {
                     char *p;

                     close(fd);

                     p=strdup(filename_buf);
                     if (!p)
                            unlink(filename_buf);
                     return (p);
              }

              if (errno != EEXIST)
                     break;
       }
       return (NULL);
}

Here is the call graph for this function:

std::string myname ( )
void post ( std::istream &  ,
const char *   
)
std::string readmsg ( )
std::string returnaddr ( std::string  ,
const char *   
)

Here is the caller graph for this function:

int sendmail ( const char **  ,
pid_t &   
)
int sendmail_bcc ( pid_t &  ,
std::string  ,
int  nodsn = 0 
)
void simple_template ( std::ostream &  ,
const char *  ,
std::string   
)
std::string toverp ( std::string  )
void trapsigs ( const char *  )
void TrimLeft ( std::string &  s) [inline]

Definition at line 132 of file cmlm.h.

{
       s=std::string(std::find_if(s.begin(), s.end(),
                               std::not1(std::ptr_fun(::isspace))), s.end());
}
void TrimRight ( std::string &  s) [inline]

Definition at line 138 of file cmlm.h.

{
       s=std::string(s.begin(), find_last_if(s.begin(), s.end(),
                                    std::not1(std::ptr_fun(::isspace)))
                    );
}

Here is the call graph for this function:

int wait4sendmail ( pid_t  )