Mercurial > dovecot > core-2.2
diff src/pop3/main.c @ 2873:72f28a4b964d HEAD
Make sure imap or pop3 processes cannot be started from inetd.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 09 Nov 2004 18:54:31 +0200 |
parents | f8adc5cb2508 |
children | 546214c0e6e9 |
line wrap: on
line diff
--- a/src/pop3/main.c Mon Nov 08 04:45:59 2004 +0200 +++ b/src/pop3/main.c Tue Nov 09 18:54:31 2004 +0200 @@ -2,6 +2,7 @@ #include "common.h" #include "ioloop.h" +#include "network.h" #include "lib-signals.h" #include "restrict-access.h" #include "fd-close-on-exec.h" @@ -10,7 +11,9 @@ #include "module-dir.h" #include "mail-storage.h" +#include <stdio.h> #include <stdlib.h> +#include <unistd.h> #include <syslog.h> #define IS_STANDALONE() \ @@ -179,6 +182,13 @@ if (getenv("LOGGED_IN") != NULL && getenv("GDB") == NULL) fd_debug_verify_leaks(3, 1024); #endif + if (IS_STANDALONE() && getuid() == 0 && + net_getpeername(1, NULL, NULL) == 0) { + printf("-ERR pop3 binary must not be started from " + "inetd, use pop3-login instead.\n"); + return 1; + } + /* NOTE: we start rooted, so keep the code minimal until restrict_access_by_env() is called */ lib_init();