From 345e5e82d3f8d6f30298f04f18e1f3cdb96f046b Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Fri, 7 Nov 2008 09:24:39 +0000 Subject: [PATCH] Fix bug #217 git-svn-id: file:///svn/unbound/trunk@1336 be551aaa-1e26-0410-a405-d3ace91eadb9 --- config.h.in | 4 ++++ configure | 9 +++++++++ configure.ac | 5 +++++ daemon/unbound.c | 4 ++-- doc/Changelog | 3 +++ 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/config.h.in b/config.h.in index 35ad34434..308718c00 100644 --- a/config.h.in +++ b/config.h.in @@ -6,6 +6,10 @@ /* Pathname to the Unbound configuration file */ #undef CONFIGFILE +/* Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work + */ +#undef DARWIN_BROKEN_SETREUID + /* Define if you want to use debug lock checking (slow). */ #undef ENABLE_LOCK_CHECKS diff --git a/configure b/configure index 3c2d89a36..5dcea7ea9 100755 --- a/configure +++ b/configure @@ -25003,6 +25003,15 @@ fi done +# check if setreuid en setregid fail, on MacOSX10.4(darwin8). +if echo $build_os | grep darwin8 > /dev/null; then + +cat >>confdefs.h <<\_ACEOF +#define DARWIN_BROKEN_SETREUID 1 +_ACEOF + +fi + # check mkdir { echo "$as_me:$LINENO: checking whether mkdir has one arg" >&5 echo $ECHO_N "checking whether mkdir has one arg... $ECHO_C" >&6; } diff --git a/configure.ac b/configure.ac index 61b5b2e67..a0c0ff8a5 100644 --- a/configure.ac +++ b/configure.ac @@ -797,6 +797,11 @@ AC_LIBOBJ([fake-rfc2553]) fi AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev setresuid setreuid setresgid setregid]) +# check if setreuid en setregid fail, on MacOSX10.4(darwin8). +if echo $build_os | grep darwin8 > /dev/null; then + AC_DEFINE(DARWIN_BROKEN_SETREUID, 1, [Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work]) +fi + # check mkdir AC_MSG_CHECKING([whether mkdir has one arg]) AC_TRY_COMPILE([ diff --git a/daemon/unbound.c b/daemon/unbound.c index 2a53ca0b5..0fcd52c20 100644 --- a/daemon/unbound.c +++ b/daemon/unbound.c @@ -443,7 +443,7 @@ perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode, if(cfg->username && cfg->username[0]) { #ifdef HAVE_SETRESGID if(setresgid(gid,gid,gid) != 0) -#elif defined(HAVE_SETREGID) +#elif defined(HAVE_SETREGID) && !defined(DARWIN_BROKEN_SETREUID) if(setregid(gid,gid) != 0) #else /* use setgid */ if(setgid(gid) != 0) @@ -452,7 +452,7 @@ perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode, cfg->username, strerror(errno)); #ifdef HAVE_SETRESUID if(setresuid(uid,uid,uid) != 0) -#elif defined(HAVE_SETREUID) +#elif defined(HAVE_SETREUID) && !defined(DARWIN_BROKEN_SETREUID) if(setreuid(uid,uid) != 0) #else /* use setuid */ if(setuid(uid) != 0) diff --git a/doc/Changelog b/doc/Changelog index 43fcefe9a..894bcc6a8 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +7 November 2008: Wouter + - fix bug 217: fixed, setreuid and setregid do not work on MacOSX10.4. + 6 November 2008: Wouter - dname_priv must decompress the name before comparison. - iana portlist updated.