From 0f6e6ce1013ff1367738ca388d78baf9436fa002 Mon Sep 17 00:00:00 2001 From: Thomas Ries Date: Wed, 13 Oct 2004 20:43:24 +0000 Subject: [PATCH] - utils.c: preparation for chroot() (consider syslog) --- ChangeLog | 1 + src/siproxd.c | 2 +- src/utils.c | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 951ebe6..bd239d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 0.5.9 ===== + 13-Oct-2004: - utils.c: preparation for chroot() (consider syslog) 09-Oct-2004: - comp_osip.c: libosip2-2.0.9 compatibility (There SEEM to happen some API changes forward and backward: osip_message_to_str, osip_body_to_str, diff --git a/src/siproxd.c b/src/siproxd.c index 9699e13..c94cab6 100644 --- a/src/siproxd.c +++ b/src/siproxd.c @@ -179,6 +179,7 @@ int main (int argc, char *argv[]) /* * Init stuff */ + INFO(PACKAGE"-"VERSION"-"BUILDSTR" started"); /* read the config file */ if (read_config(configfile, config_search) == STS_FAILURE) exit(1); @@ -245,7 +246,6 @@ int main (int argc, char *argv[]) /* initialize the registration facility */ register_init(); - INFO(PACKAGE"-"VERSION"-"BUILDSTR" started"); /* * silence the log - if so required... */ diff --git a/src/utils.c b/src/utils.c index 8984fe5..0db9644 100644 --- a/src/utils.c +++ b/src/utils.c @@ -247,12 +247,12 @@ void secure_enviroment (void) { * as it loads some dynamic libraries. Once chrootet * these libraries will *not* be found and gethostbyname() * calls will simply fail (return NULL pointer and h_errno=0). + * Also (at least for FreeBSD) syslog() needs to be called + * before chroot()ing - this is done in main() by an INFO(). * Took me a while to figure THIS one out */ struct in_addr dummy; - DEBUGC(DBCLASS_DNS, "Initializing DNS, the following DNS " - "failure is normal, don't worry"); - get_ip_by_host("foobar", &dummy); + get_ip_by_host("localhost", &dummy); DEBUGC(DBCLASS_CONFIG,"chrooting to %s", configuration.chrootjail); sts = chroot(configuration.chrootjail);