summaryrefslogtreecommitdiff
path: root/common
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
commit250513dad1cfc646c382c314b4bbb05fbab7fa3b (patch)
tree6e603ed9cbe2c75719ae9615743226a107033ac1 /common
parent59300e0e984840851014e5056b126161b1d9c7e0 (diff)
Allows listening before dropping priveleges.
Diffstat (limited to 'common')
-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 */