From 250513dad1cfc646c382c314b4bbb05fbab7fa3b Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 12 Jul 2005 15:23:05 +0000 Subject: Allows listening before dropping priveleges. --- common/smtppass.c | 14 +++++++------- 1 file 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 */ -- cgit v1.2.3