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
parents 5f559921391a
children 1aa107c6b1e5
files src/masqmail.c
diffstat 1 files changed, 14 insertions(+), 5 deletions(-) [+]
line diff
     1.1 --- a/src/masqmail.c	Mon Dec 06 17:34:15 2010 -0300
     1.2 +++ b/src/masqmail.c	Mon Dec 06 17:41:50 2010 -0300
     1.3 @@ -38,8 +38,7 @@
     1.4     It, as well as the distinction beween the two (non exclusive) daemon
     1.5     (queue and listen) modes, is handled by flags.*/
     1.6  typedef enum _mta_mode {
     1.7 -	MODE_NONE = 0,  /* for being able to check if a mode was defined */
     1.8 -	MODE_ACCEPT,  /* accept message on stdin */
     1.9 +	MODE_ACCEPT = 0,  /* accept message on stdin (fallback mode) */
    1.10  	MODE_DAEMON,  /* run as daemon */
    1.11  	MODE_RUNQUEUE,  /* single queue run, online or offline */
    1.12  	MODE_SMTP,  /* accept SMTP on stdin */
    1.13 @@ -422,7 +421,7 @@
    1.14  	char* opt;
    1.15  	gint arg;
    1.16  
    1.17 -	mta_mode mta_mode = MODE_NONE;
    1.18 +	mta_mode mta_mode = MODE_ACCEPT;
    1.19  	gboolean do_listen = FALSE;
    1.20  	gboolean do_runq = FALSE;
    1.21  	gboolean do_runq_online = FALSE;
    1.22 @@ -470,6 +469,9 @@
    1.23  			arg++;
    1.24  			break;
    1.25  
    1.26 +		} else if (strcmp(opt, "bm") == 0) {
    1.27 +			mta_mode = MODE_ACCEPT;
    1.28 +
    1.29  		} else if (strcmp(opt, "bd") == 0) {
    1.30  			do_listen = TRUE;
    1.31  			mta_mode = MODE_DAEMON;
    1.32 @@ -546,6 +548,7 @@
    1.33  			/* ignore all other -oXXX options */
    1.34  
    1.35  		} else if (strncmp(opt, "qo", 2) == 0) {
    1.36 +			/* must be before the `q' check */
    1.37  			mta_mode = MODE_RUNQUEUE;
    1.38  			do_runq = FALSE;
    1.39  			do_runq_online = TRUE;
    1.40 @@ -577,8 +580,14 @@
    1.41  		}
    1.42  	}
    1.43  
    1.44 -	if (!mta_mode) {
    1.45 -		mta_mode = (arg<argc || opt_t) ? MODE_ACCEPT : MODE_VERSION;
    1.46 +	if (mta_mode==MODE_ACCEPT && arg==argc && !opt_t) {
    1.47 +		/*
    1.48 +		In this case no rcpts can be found, thus no mail
    1.49 +		can be sent, thus masqmail will always fail. We
    1.50 +		rather do something better instead. This covers
    1.51 +		also the case of calling masqmail without args.
    1.52 +		*/
    1.53 +		mta_mode =  MODE_VERSION;
    1.54  	}
    1.55  
    1.56  	if (mta_mode == MODE_VERSION) {