From da8e9de8e3b73ae0968c66361f285d12a4f9f38f 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