summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2005-07-12 15:23:05 +0000
committerStef Walter <stef@memberwebs.com>2005-07-12 15:23:05 +0000
commitda8e9de8e3b73ae0968c66361f285d12a4f9f38f (patch)
tree7df3f0bb02572b1b882bcc9484b9cd30b4cf3554
parent0f3700cb67ae820fcd308222e25f8497f437e475 (diff)
Allows listening before dropping priveleges.
-rw-r--r--common/smtppass.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/common/smtppass.c b/common/smtppass.c
index 550484d..6897aaa 100644
--- a/common/smtppass.c
+++ b/common/smtppass.c
@@ -290,6 +290,13 @@ int sp_run(const char* configfile, const char* pidfile, int dbg_level)
if(bind(sock, &SANY_ADDR(g_state.listenaddr), SANY_LEN(g_state.listenaddr)) != 0)
err(1, "couldn't bind to address: %s", g_state.listenname);
+ /* Let 5 connections queue up */
+ if(listen(sock, 5) != 0)
+ {
+ sp_message(NULL, LOG_CRIT, "couldn't listen on socket");
+ exit(1);
+ }
+
/* Drop privileges before daemonizing */
drop_privileges();
@@ -310,13 +317,6 @@ int sp_run(const char* configfile, const char* pidfile, int dbg_level)
openlog(g_state.name, 0, LOG_MAIL);
}
- /* Let 5 connections queue up */
- if(listen(sock, 5) != 0)
- {
- sp_message(NULL, LOG_CRIT, "couldn't listen on socket");
- exit(1);
- }
-
sp_messagex(NULL, LOG_DEBUG, "created socket: %s", g_state.listenname);
/* Handle some signals */