Mercurial > masqmail
changeset 278:c35c59a36a2a
added -bm for mode accept (the other MTAs have it too)
usually one does not need it as it's the default
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Mon, 06 Dec 2010 17:41:50 -0300 (2010-12-06) |
parents | 5f559921391a |
children | 1aa107c6b1e5 |
files | src/masqmail.c |
diffstat | 1 files changed, 14 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/masqmail.c Mon Dec 06 17:34:15 2010 -0300 +++ b/src/masqmail.c Mon Dec 06 17:41:50 2010 -0300 @@ -38,8 +38,7 @@ It, as well as the distinction beween the two (non exclusive) daemon (queue and listen) modes, is handled by flags.*/ typedef enum _mta_mode { - MODE_NONE = 0, /* for being able to check if a mode was defined */ - MODE_ACCEPT, /* accept message on stdin */ + MODE_ACCEPT = 0, /* accept message on stdin (fallback mode) */ MODE_DAEMON, /* run as daemon */ MODE_RUNQUEUE, /* single queue run, online or offline */ MODE_SMTP, /* accept SMTP on stdin */ @@ -422,7 +421,7 @@ char* opt; gint arg; - mta_mode mta_mode = MODE_NONE; + mta_mode mta_mode = MODE_ACCEPT; gboolean do_listen = FALSE; gboolean do_runq = FALSE; gboolean do_runq_online = FALSE; @@ -470,6 +469,9 @@ arg++; break; + } else if (strcmp(opt, "bm") == 0) { + mta_mode = MODE_ACCEPT; + } else if (strcmp(opt, "bd") == 0) { do_listen = TRUE; mta_mode = MODE_DAEMON; @@ -546,6 +548,7 @@ /* ignore all other -oXXX options */ } else if (strncmp(opt, "qo", 2) == 0) { + /* must be before the `q' check */ mta_mode = MODE_RUNQUEUE; do_runq = FALSE; do_runq_online = TRUE; @@ -577,8 +580,14 @@ } } - if (!mta_mode) { - mta_mode = (arg<argc || opt_t) ? MODE_ACCEPT : MODE_VERSION; + if (mta_mode==MODE_ACCEPT && arg==argc && !opt_t) { + /* + In this case no rcpts can be found, thus no mail + can be sent, thus masqmail will always fail. We + rather do something better instead. This covers + also the case of calling masqmail without args. + */ + mta_mode = MODE_VERSION; } if (mta_mode == MODE_VERSION) {