masqmail

diff src/masqmail.c @ 192:89f951be358f

REMOVED POP3 SUPPORT masqmail will not include a POP3 client anymore from 0.3.0 on maybe the POP3 code will be reworked into a standalone program some day if you rely on the POP3 client, use fetchmail or something similar instead
author meillo@marmaro.de
date Thu, 15 Jul 2010 14:24:40 +0200
parents 8630e37ae445
children 5745edd5b769
line diff
     1.1 --- a/src/masqmail.c	Thu Jul 15 11:48:33 2010 +0200
     1.2 +++ b/src/masqmail.c	Thu Jul 15 14:24:40 2010 +0200
     1.3 @@ -34,15 +34,13 @@
     1.4  
     1.5  #include "masqmail.h"
     1.6  
     1.7 -/* mutually exclusive modes. Note that there is neither a 'get' mode
     1.8 -   nor a 'queue daemon' mode. These, as well as the distinction beween
     1.9 -   the two (non exclusive) daemon (queue and listen) modes are handled
    1.10 -   by flags.*/
    1.11 +/* mutually exclusive modes. Note that there is no 'queue daemon' mode.
    1.12 +   It, as well as the distinction beween the two (non exclusive) daemon
    1.13 +   (queue and listen) modes, is handled by flags.*/
    1.14  typedef enum _mta_mode {
    1.15  	MODE_ACCEPT = 0,  /* accept message on stdin */
    1.16  	MODE_DAEMON,  /* run as daemon */
    1.17  	MODE_RUNQUEUE,  /* single queue run, online or offline */
    1.18 -	MODE_GET_DAEMON,  /* run as get (retrieve) daemon */
    1.19  	MODE_SMTP,  /* accept SMTP on stdin */
    1.20  	MODE_LIST,  /* list queue */
    1.21  	MODE_MCMD,  /* do queue manipulation */
    1.22 @@ -179,49 +177,6 @@
    1.23  	listen_port(do_listen ? conf.listen_addresses : NULL, queue_interval, argv);
    1.24  }
    1.25  
    1.26 -#ifdef ENABLE_POP3
    1.27 -static void
    1.28 -mode_get_daemon(gint get_interval, char *argv[])
    1.29 -{
    1.30 -	guint pid;
    1.31 -
    1.32 -	/* daemon */
    1.33 -	if (!conf.run_as_user) {
    1.34 -		if ((conf.orig_uid != 0) && (conf.orig_uid != conf.mail_uid)) {
    1.35 -			fprintf(stderr, "must be root or %s for daemon.\n", DEF_MAIL_USER);
    1.36 -			exit(EXIT_FAILURE);
    1.37 -		}
    1.38 -	}
    1.39 -
    1.40 -	/* reparent to init only if init is not already the parent */
    1.41 -	if (getppid() != 1) {
    1.42 -		if ((pid = fork()) > 0) {
    1.43 -			exit(EXIT_SUCCESS);
    1.44 -		} else if (pid < 0) {
    1.45 -			logwrite(LOG_ALERT, "could not fork!");
    1.46 -			exit(EXIT_FAILURE);
    1.47 -		}
    1.48 -	}
    1.49 -
    1.50 -	signal(SIGTERM, sigterm_handler);
    1.51 -	write_pidfile(PIDFILEDIR "/masqmail-get.pid");
    1.52 -
    1.53 -	conf.do_verbose = FALSE;
    1.54 -
    1.55 -	/* closing and reopening the log ensures that it is open afterwards
    1.56 -	   because it is possible that the log is assigned to fd 1 and gets
    1.57 -	   thus closes by fclose(stdout). Similar for the debugfile.
    1.58 -	*/
    1.59 -	logclose();
    1.60 -	fclose(stdin);
    1.61 -	fclose(stdout);
    1.62 -	fclose(stderr);
    1.63 -	logopen();
    1.64 -
    1.65 -	get_daemon(get_interval, argv);
    1.66 -}
    1.67 -#endif
    1.68 -
    1.69  #ifdef ENABLE_SMTP_SERVER
    1.70  static void
    1.71  mode_smtp()
    1.72 @@ -336,8 +291,6 @@
    1.73  	/* cmd line flags */
    1.74  	gchar *conf_file = CONF_FILE;
    1.75  	gint arg = 1;
    1.76 -	gboolean do_get = FALSE;
    1.77 -	gboolean do_get_online = FALSE;
    1.78  
    1.79  	gboolean do_listen = FALSE;
    1.80  	gboolean do_runq = FALSE;
    1.81 @@ -351,7 +304,6 @@
    1.82  	mta_mode mta_mode = MODE_ACCEPT;
    1.83  
    1.84  	gint queue_interval = 0;
    1.85 -	gint get_interval = 0;
    1.86  	gboolean opt_t = FALSE;
    1.87  	gboolean opt_i = FALSE;
    1.88  	gboolean opt_odb = FALSE;
    1.89 @@ -362,7 +314,6 @@
    1.90  
    1.91  	gint exit_code = EXIT_SUCCESS;
    1.92  	gchar *route_name = NULL;
    1.93 -	gchar *get_name = NULL;
    1.94  	gchar *progname;
    1.95  	gchar *f_address = NULL;
    1.96  	gchar *full_sender_name = NULL;
    1.97 @@ -464,30 +415,6 @@
    1.98  					}
    1.99  				}
   1.100  				break;
   1.101 -			case 'g':
   1.102 -				do_get = TRUE;
   1.103 -				if (!mta_mode)
   1.104 -					mta_mode = MODE_NONE;  /* to prevent default MODE_ACCEPT */
   1.105 -				if (argv[arg][pos] == 'o') {
   1.106 -					pos++;
   1.107 -					do_get_online = TRUE;
   1.108 -					/* can be NULL, then we use online detection method */
   1.109 -					route_name = get_optarg(argv, argc, &arg, &pos);
   1.110 -
   1.111 -					if (route_name != NULL) {
   1.112 -						if (isdigit(route_name[0])) {
   1.113 -							get_interval = time_interval(route_name, &pos);
   1.114 -							route_name = get_optarg(argv, argc, &arg, &pos);
   1.115 -							mta_mode = MODE_GET_DAEMON;
   1.116 -							do_get = FALSE;
   1.117 -						}
   1.118 -					}
   1.119 -				} else {
   1.120 -					if ((optarg = get_optarg(argv, argc, &arg, &pos))) {
   1.121 -						get_name = get_optarg(argv, argc, &arg, &pos);
   1.122 -					}
   1.123 -				}
   1.124 -				break;
   1.125  			case 'i':
   1.126  				if (argv[arg][pos] == 0) {
   1.127  					opt_i = TRUE;
   1.128 @@ -574,7 +501,6 @@
   1.129  	if (mta_mode == MODE_VERSION) {
   1.130  		gchar *with_resolver = "";
   1.131  		gchar *with_smtp_server = "";
   1.132 -		gchar *with_pop3 = "";
   1.133  		gchar *with_auth = "";
   1.134  		gchar *with_maildir = "";
   1.135  		gchar *with_ident = "";
   1.136 @@ -585,9 +511,6 @@
   1.137  #ifdef ENABLE_SMTP_SERVER
   1.138  		with_smtp_server = " +smtp-server";
   1.139  #endif
   1.140 -#ifdef ENABLE_POP3
   1.141 -		with_pop3 = " +pop3";
   1.142 -#endif
   1.143  #ifdef ENABLE_AUTH
   1.144  		with_auth = " +auth";
   1.145  #endif
   1.146 @@ -598,8 +521,8 @@
   1.147  		with_ident = " +ident";
   1.148  #endif
   1.149  
   1.150 -		printf("%s %s%s%s%s%s%s%s\n", PACKAGE, VERSION, with_resolver, with_smtp_server,
   1.151 -		       with_pop3, with_auth, with_maildir, with_ident);
   1.152 +		printf("%s %s%s%s%s%s%s\n", PACKAGE, VERSION, with_resolver, with_smtp_server,
   1.153 +		       with_auth, with_maildir, with_ident);
   1.154  
   1.155  		exit(EXIT_SUCCESS);
   1.156  	}
   1.157 @@ -699,30 +622,6 @@
   1.158  		}
   1.159  	}
   1.160  
   1.161 -	if (do_get) {
   1.162 -#ifdef ENABLE_POP3
   1.163 -		if ((mta_mode == MODE_NONE) || (mta_mode == MODE_RUNQUEUE)) {
   1.164 -			set_identity(conf.orig_uid, "getting mail");
   1.165 -			if (do_get_online) {
   1.166 -				if (route_name != NULL) {
   1.167 -					conf.online_detect = g_strdup("argument");
   1.168 -					set_online_name(route_name);
   1.169 -				}
   1.170 -				get_online();
   1.171 -			} else {
   1.172 -				if (get_name)
   1.173 -					get_from_name(get_name);
   1.174 -				else
   1.175 -					get_all();
   1.176 -			}
   1.177 -		} else {
   1.178 -			logwrite(LOG_ALERT, "get (-g) only allowed alone or together with queue run (-q)\n");
   1.179 -		}
   1.180 -#else
   1.181 -		fprintf(stderr, "get (pop) support not compiled in\n");
   1.182 -#endif
   1.183 -	}
   1.184 -
   1.185  	switch (mta_mode) {
   1.186  	case MODE_DAEMON:
   1.187  		mode_daemon(do_listen, queue_interval, argv);
   1.188 @@ -745,15 +644,6 @@
   1.189  			}
   1.190  		}
   1.191  		break;
   1.192 -	case MODE_GET_DAEMON:
   1.193 -#ifdef ENABLE_POP3
   1.194 -		if (route_name != NULL) {
   1.195 -			conf.online_detect = g_strdup("argument");
   1.196 -			set_online_name(route_name);
   1.197 -		}
   1.198 -		mode_get_daemon(get_interval, argv);
   1.199 -#endif
   1.200 -		break;
   1.201  
   1.202  	case MODE_SMTP:
   1.203  #ifdef ENABLE_SMTP_SERVER