[dovecot-cvs] dovecot/src/pop3 main.c,1.16,1.17

cras at dovecot.org cras at dovecot.org
Tue Nov 9 18:54:36 EET 2004


Update of /var/lib/cvs/dovecot/src/pop3
In directory talvi:/tmp/cvs-serv29006/pop3

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/pop3/main.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- main.c	10 Oct 2004 14:32:33 -0000	1.16
+++ main.c	9 Nov 2004 16:54:34 -0000	1.17
@@ -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();



More information about the dovecot-cvs mailing list