SCCS-vsn: usr.sbin/sendmail/src/conf.c 3.26
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 3.32
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 3.35
SCCS-vsn: usr.sbin/sendmail/src/main.c 3.30
-static char SccsId[] = "@(#)conf.c 3.25 %G%";
+static char SccsId[] = "@(#)conf.c 3.26 %G%";
# include <whoami.h> /* definitions of machine id's at berkeley */
# include <whoami.h> /* definitions of machine id's at berkeley */
char Arpa_Syserr[] = "455"; /* some (transient) system error */
char Arpa_Usrerr[] = "450"; /* some (fatal) user error */
# endif NEWFTP
char Arpa_Syserr[] = "455"; /* some (transient) system error */
char Arpa_Usrerr[] = "450"; /* some (fatal) user error */
# endif NEWFTP
+
+
+
+
+
+/*
+** Location of system files/databases/etc.
+*/
+
+char *AliasFile = "/usr/lib/aliases"; /* alias file */
+char *ConfFile = "/usr/lib/sendmail.cf"; /* runtime configuration */
+char *StatFile = "/usr/eric/mailstats"; /* statistics summary */
# include <syslog.h>
# endif LOG
# include <syslog.h>
# endif LOG
-static char SccsId[] = "@(#)deliver.c 3.31 %G%";
+static char SccsId[] = "@(#)deliver.c 3.32 %G%";
/*
** DELIVER -- Deliver a message to a particular address.
/*
** DELIVER -- Deliver a message to a particular address.
if (bitset(QBADADDR, to->q_flags))
continue;
if (bitset(QBADADDR, to->q_flags))
continue;
+ /* save statistics.... */
+ Stat.stat_nt[to->q_mailer]++;
+ Stat.stat_bt[to->q_mailer] += kbytes(MsgSize);
+
/*
** See if this user name is "special".
** If the user name has a slash in it, assume that this
/*
** See if this user name is "special".
** If the user name has a slash in it, assume that this
extern char *SysExMsg[];
register int i;
extern int N_SysEx;
extern char *SysExMsg[];
register int i;
extern int N_SysEx;
char buf[30];
i = stat - EX__BASE;
char buf[30];
i = stat - EX__BASE;
# include <syslog.h>
# endif LOG
# include <syslog.h>
# endif LOG
-static char SccsId[] = "@(#)main.c 3.29 %G%";
+static char SccsId[] = "@(#)main.c 3.30 %G%";
/*
** SENDMAIL -- Post mail to a set of destinations.
/*
** SENDMAIL -- Post mail to a set of destinations.
char nbuf[MAXLINE]; /* holds full name */
struct passwd *pw;
extern char *arpadate();
char nbuf[MAXLINE]; /* holds full name */
struct passwd *pw;
extern char *arpadate();
- char *cfname;
- char *aliasname;
+ extern char *AliasFile; /* location of alias file */
+ extern char *ConfFile; /* location of configuration file */
+ extern char *StatFile; /* location of statistics summary */
register int i;
bool verifyonly = FALSE; /* only verify names */
bool safecf = TRUE; /* this conf file is sys default */
register int i;
bool verifyonly = FALSE; /* only verify names */
bool safecf = TRUE; /* this conf file is sys default */
- cfname = CONFFILE;
- aliasname = ALIASFILE;
/* process id */
(void) sprintf(pbuf, "%d", getpid());
/* process id */
(void) sprintf(pbuf, "%d", getpid());
case 'C': /* select configuration file */
if (p[2] == '\0')
case 'C': /* select configuration file */
if (p[2] == '\0')
- cfname = "sendmail.cf";
+ ConfFile = "sendmail.cf";
safecf = FALSE;
break;
case 'A': /* select alias file */
if (p[2] == '\0')
safecf = FALSE;
break;
case 'A': /* select alias file */
if (p[2] == '\0')
break;
case 'n': /* don't alias */
break;
case 'n': /* don't alias */
- readcf(cfname, safecf);
+ readcf(ConfFile, safecf);
# ifndef V6
p = getenv("HOME");
# ifndef V6
p = getenv("HOME");
- initaliases(aliasname, aliasinit);
+ initaliases(AliasFile, aliasinit);
# ifdef DBM
if (aliasinit)
exit(EX_OK);
# ifdef DBM
if (aliasinit)
exit(EX_OK);
if (verifyonly && GrabTo)
finis();
if (verifyonly && GrabTo)
finis();
+ /* collect statistics */
+ Stat.stat_nf[From.q_mailer]++;
+ Stat.stat_bf[From.q_mailer] += kbytes(MsgSize);
+
/*
** Arrange that the person who is sending the mail
** will not be expanded (unless explicitly requested).
/*
** Arrange that the person who is sending the mail
** will not be expanded (unless explicitly requested).
/*
** SENDMAIL.H -- Global definitions for sendmail.
**
/*
** SENDMAIL.H -- Global definitions for sendmail.
**
-** @(#)sendmail.h 3.34 %G%
+** @(#)sendmail.h 3.35 %G%
+** Configuration constants.
+** There shouldn't be much need to change these....
*/
# define MAXLINE 256 /* maximum line length */
*/
# define MAXLINE 256 /* maximum line length */
# define MAXHOP 30 /* maximum value of HopCount */
# define MAXATOM 15 /* max atoms per address */
# define MAXMAILERS 10 /* maximum mailers known to system */
# define MAXHOP 30 /* maximum value of HopCount */
# define MAXATOM 15 /* max atoms per address */
# define MAXMAILERS 10 /* maximum mailers known to system */
-# define ALIASFILE "/usr/lib/aliases" /* location of alias file */
-# define CONFFILE "/usr/lib/sendmail.cf" /* configuration file */
/* values for ArpaMode -- these are ordered!! */
# define ARPA_NONE 0 /* not in arpanet mode */
/* values for ArpaMode -- these are ordered!! */
# define ARPA_NONE 0 /* not in arpanet mode */
+/*
+** Statistics structure.
+*/
+
+struct statistics
+{
+ time_t stat_itime; /* file initialization time */
+ short stat_size; /* size of this structure */
+ long stat_nf[MAXMAILERS]; /* # msgs from each mailer */
+ long stat_bf[MAXMAILERS]; /* kbytes from each mailer */
+ long stat_nt[MAXMAILERS]; /* # msgs to each mailer */
+ long stat_bt[MAXMAILERS]; /* kbytes to each mailer */
+};
+
+extern struct statistics Stat;
+extern long kbytes(); /* for _bf, _bt */
+
+
+
+
/*
** Global variables.
*/
/*
** Global variables.
*/
-extern int ArpaMode; /* ARPANET handling mode */
extern bool FromFlag; /* if set, "From" person is explicit */
extern bool MailBack; /* mail back response on error */
extern bool BerkNet; /* called from BerkNet */
extern bool FromFlag; /* if set, "From" person is explicit */
extern bool MailBack; /* mail back response on error */
extern bool BerkNet; /* called from BerkNet */
extern int Debug; /* debugging level */
extern int Errors; /* set if errors */
extern int ExitStat; /* exit status code */
extern int Debug; /* debugging level */
extern int Errors; /* set if errors */
extern int ExitStat; /* exit status code */
+extern int ArpaMode; /* ARPANET handling mode */
+extern long MsgSize; /* size of the message in bytes */
extern char InFileName[]; /* input file name */
extern char Transcript[]; /* the transcript file name */
extern FILE *TempFile; /* mail temp file */
extern char InFileName[]; /* input file name */
extern char Transcript[]; /* the transcript file name */
extern FILE *TempFile; /* mail temp file */