From: Wouter Wijngaards Date: Fri, 23 Jan 2015 15:23:58 +0000 (+0000) Subject: - windows port fixes, no AF_LOCAL, no chown, no chmod(grp). X-Git-Tag: release-1.5.2rc1~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79044dc6cfba8fd4bde92ef4e2146bdf1c7ea308;p=thirdparty%2Funbound.git - windows port fixes, no AF_LOCAL, no chown, no chmod(grp). git-svn-id: file:///svn/unbound/trunk@3319 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/config.h.in b/config.h.in index 1f06ee81d..c36d4b98b 100644 --- a/config.h.in +++ b/config.h.in @@ -42,7 +42,7 @@ /* Whether the C compiler accepts the "unused" attribute */ #undef HAVE_ATTR_UNUSED -/* Define to 1 if your system has a working `chown' function. */ +/* Define to 1 if you have the `chown' function. */ #undef HAVE_CHOWN /* Define to 1 if you have the `chroot' function. */ @@ -802,6 +802,10 @@ #define ARG_LL "%I64" #endif +#ifndef AF_LOCAL +#define AF_LOCAL AF_UNIX +#endif + #ifdef HAVE_ATTR_FORMAT diff --git a/configure b/configure index 6a9c1e982..26e3e8296 100755 --- a/configure +++ b/configure @@ -17958,7 +17958,7 @@ if test "$ac_res" != no; then : fi -for ac_func in tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent +for ac_func in tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill chown sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/configure.ac b/configure.ac index cc59727e5..8d496ce9b 100644 --- a/configure.ac +++ b/configure.ac @@ -978,7 +978,7 @@ AC_INCLUDES_DEFAULT #endif ]) AC_SEARCH_LIBS([setusercontext], [util]) -AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent]) +AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill chown sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent]) AC_CHECK_FUNCS([setresuid],,[AC_CHECK_FUNCS([setreuid])]) AC_CHECK_FUNCS([setresgid],,[AC_CHECK_FUNCS([setregid])]) @@ -1215,6 +1215,10 @@ dnl includes #else #define ARG_LL "%I64" #endif + +#ifndef AF_LOCAL +#define AF_LOCAL AF_UNIX +#endif ] AHX_CONFIG_FORMAT_ATTRIBUTE diff --git a/daemon/remote.c b/daemon/remote.c index a5be6d68c..7a8fdb75e 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -327,9 +327,13 @@ add_open(const char* ip, int nr, struct listen_port** list, int noproto_is_err, * group as the user we run as. */ if(fd != -1) { +#ifdef HAVE_CHOWN if (cfg->username && cfg->username[0]) chown(ip, cfg->uid, cfg->gid); chmod(ip, (mode_t)(S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP)); +#else + (void)cfg; +#endif } } else { hints.ai_socktype = SOCK_STREAM; diff --git a/daemon/unbound.c b/daemon/unbound.c index a31b0392f..f6bd924a5 100644 --- a/daemon/unbound.c +++ b/daemon/unbound.c @@ -504,16 +504,18 @@ perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode, if(cfg->pidfile && cfg->pidfile[0]) { writepid(daemon->pidfile, getpid()); if(cfg->username && cfg->username[0]) { +# ifdef HAVE_CHOWN if(chown(daemon->pidfile, cfg->uid, cfg->gid) == -1) { log_err("cannot chown %u.%u %s: %s", (unsigned)cfg->uid, (unsigned)cfg->gid, daemon->pidfile, strerror(errno)); } +# endif /* HAVE_CHOWN */ } } #else (void)daemon; -#endif +#endif /* HAVE_KILL */ /* Set user context */ #ifdef HAVE_GETPWNAM diff --git a/doc/Changelog b/doc/Changelog index 80d0f7181..17e97c62c 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +23 January 2015: Wouter + - windows port fixes, no AF_LOCAL, no chown, no chmod(grp). + 16 January 2015: Wouter - unit test for local unix connection. Documentation and log_addr does not inspect port for AF_LOCAL. diff --git a/services/listen_dnsport.c b/services/listen_dnsport.c index fc0085a54..ef9a4acf5 100644 --- a/services/listen_dnsport.c +++ b/services/listen_dnsport.c @@ -641,6 +641,7 @@ create_local_accept_sock(const char *path, int* noproto) (void)noproto; /*unused*/ return s; #else + (void)path; log_err("Local sockets are not supported"); *noproto = 1; return -1; diff --git a/util/config_file.c b/util/config_file.c index 3554e3fa0..f8f803067 100644 --- a/util/config_file.c +++ b/util/config_file.c @@ -1205,6 +1205,8 @@ void config_lookup_uid(struct config_file* cfg) cfg->uid = pwd->pw_uid; cfg->gid = pwd->pw_gid; } +#else + (void)cfg; #endif }