[dovecot-cvs] dovecot/src/imap main.c,1.58,1.59
cras at dovecot.org
cras at dovecot.org
Tue Nov 9 18:54:33 EET 2004
Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv29006/imap
Modified Files:
main.c
Log Message:
Make sure imap or pop3 processes cannot be started from inetd.
Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/main.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- main.c 20 Oct 2004 18:09:32 -0000 1.58
+++ main.c 9 Nov 2004 16:54:31 -0000 1.59
@@ -2,6 +2,7 @@
#include "common.h"
#include "ioloop.h"
+#include "network.h"
#include "ostream.h"
#include "str.h"
#include "lib-signals.h"
@@ -14,6 +15,7 @@
#include "commands.h"
#include "namespace.h"
+#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
@@ -203,6 +205,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("* BAD [ALERT] imap binary must not be started from "
+ "inetd, use imap-login instead.\n");
+ return 1;
+ }
+
/* NOTE: we start rooted, so keep the code minimal until
restrict_access_by_env() is called */
lib_init();
More information about the dovecot-cvs
mailing list