SCCS-vsn: usr.sbin/sendmail/src/main.c 5.63
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)main.c 5.62.1.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 5.63 (Berkeley) %G%";
#endif /* not lint */
#define _DEFINE
#endif /* not lint */
#define _DEFINE
#include <sys/file.h>
#include <sys/stat.h>
#include <signal.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <signal.h>
char *RcptLogFile = NULL; /* file name */
char *RcptLogFile = NULL; /* file name */
+static void obsolete();
+
#ifdef DAEMON
#ifndef SMTP
ERROR %%%% Cannot have daemon mode without SMTP %%%% ERROR
#ifdef DAEMON
#ifndef SMTP
ERROR %%%% Cannot have daemon mode without SMTP %%%% ERROR
#define MAXCONFIGLEVEL 3 /* highest config version level known */
#define MAXCONFIGLEVEL 3 /* highest config version level known */
-static void obsolete();
-
main(argc, argv, envp)
int argc;
char **argv;
main(argc, argv, envp)
int argc;
char **argv;
bool safecf = TRUE;
static bool reenter = FALSE;
char jbuf[MAXHOSTNAMELEN]; /* holds MyHostName */
bool safecf = TRUE;
static bool reenter = FALSE;
char jbuf[MAXHOSTNAMELEN]; /* holds MyHostName */
- extern int DtableSize, optind;
+ extern int DtableSize;
+ extern int optind;
extern bool safefile();
extern time_t convtime();
extern putheader(), putbody();
extern bool safefile();
extern time_t convtime();
extern putheader(), putbody();
extern char **myhostname();
extern char *arpadate();
extern char **environ;
extern char **myhostname();
extern char *arpadate();
extern char **environ;
/*
** Check to see if we reentered.
/*
** Check to see if we reentered.
** the argument processing applies to this run rather than
** to the run that froze the configuration.
*/
** the argument processing applies to this run rather than
** to the run that froze the configuration.
*/
-#ifdef DBM
-#define GETOPTSTR "b:C:c:d:e:F:f:h:I:i:m:no:p:q:R:r:s:T:tv:"
-#else
-#define GETOPTSTR "b:C:c:d:e:F:f:h:i:m:no:p:q:R:r:s:T:tv:"
-#endif
- while ((j = getopt(argc, argv, GETOPTSTR)) != EOF)
- switch(j)
+ while ((j = getopt(argc, argv, "b:C:d:")) != EOF)
+ {
+ switch (j)
{
case 'b':
if (optarg[0] == 'z' && optarg[1] == '\0')
{
case 'b':
if (optarg[0] == 'z' && optarg[1] == '\0')
setbuf(stdout, (char *) NULL);
printf("Version %s\n", Version);
break;
setbuf(stdout, (char *) NULL);
printf("Version %s\n", Version);
break;
- case 'c': case 'e': case 'F': case 'f': case 'h': case 'i':
- case 'm': case 'n': case 'o': case 'p': case 'q': case 'R':
- case 'r': case 's': case 'T': case 't': case 'v':
-#ifdef DBM
- case 'I':
-#endif
- break;
- default:
- ExitStat = EX_USAGE;
- finis();
- break;
InChannel = stdin;
OutChannel = stdout;
InChannel = stdin;
OutChannel = stdout;
if (!nothaw)
readconfig = !thaw(FreezeFile);
if (!nothaw)
readconfig = !thaw(FreezeFile);
- /* reset the environment after the thaw */
-
/* strip out "dangerous" environment variables */
(void) unsetenv("FS");
for (i = 1; (p = envp[i++]) != NULL;)
{
if (strncmp(p, "LD_", 3) == 0)
{
/* strip out "dangerous" environment variables */
(void) unsetenv("FS");
for (i = 1; (p = envp[i++]) != NULL;)
{
if (strncmp(p, "LD_", 3) == 0)
{
+ /* hack: change this name to be non-special */
+ p[0] = '\201';
OpMode = MD_DAEMON;
optind = 1;
OpMode = MD_DAEMON;
optind = 1;
- while ((j = getopt(argc, argv, GETOPTSTR)) != EOF)
- switch(j)
+ while ((j = getopt(argc, argv, "b:C:c:d:e:F:f:h:I:i:m:no:p:q:R:r:s:T:tv:")) != EOF)
+ {
+ switch (j)
{
case 'b': /* operations mode */
{
case 'b': /* operations mode */
{
case MD_DAEMON:
# ifdef DAEMON
{
case MD_DAEMON:
# ifdef DAEMON
av += optind;
#ifdef NAMED_BIND
av += optind;
#ifdef NAMED_BIND
/* If -C doesn't have an argument, use sendmail.cf. */
#define __DEFPATH "sendmail.cf"
/* If -C doesn't have an argument, use sendmail.cf. */
#define __DEFPATH "sendmail.cf"
- if (ap[1] == 'C' &&
- !ap[2] && (argv[0] == NULL || argv[0][0] == '-'))
+ if (ap[1] == 'C' && ap[2] == '\0' &&
+ (argv[1] == NULL || argv[1][0] == '-'))
{
*argv = xalloc(sizeof(__DEFPATH) + 2);
argv[0][0] = '-';
argv[0][1] = 'C';
(void)strcpy(&argv[0][2], __DEFPATH);
}
{
*argv = xalloc(sizeof(__DEFPATH) + 2);
argv[0][0] = '-';
argv[0][1] = 'C';
(void)strcpy(&argv[0][2], __DEFPATH);
}
- if (ap[1] == 'q' &&
- !ap[2] && (argv[0] == NULL || argv[0][0] == '-'))
- {
- *argv = xalloc(4);
- argv[0][0] = '-';
- argv[0][1] = 'C';
- argv[0][2] = '1';
- argv[0][3] = '\0';
- }
+
+ /* If -q doesn't have an argument, run it once. */
+ if (ap[1] == 'q' && ap[2] == '\0' &&
+ (argv[1] == NULL || argv[1][0] == '-'))
+ *argv = "-q0";