@@ -23,11 +23,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include #include #include -#include #include #include #include #include #include @@ -605,11 +604,11 @@ filed_log_msg("START"); return(0); } -#endif +#endif /* FILED_DONT_LOG */ #ifdef FILED_DONT_TIMEOUT #define filed_sockettimeout_thread_init() 0 #define filed_sockettimeout_init() 0 #define filed_sockettimeout_accept(x) /**/ @@ -726,10 +725,12 @@ int count; int valid; int time_interval = 30; int check_period = 90; + filed_sockettimeout_time = time(NULL); + while (1) { for (count = 0; count < (check_period / time_interval); count++) { sleep_time.tv_sec = time_interval; sleep_time.tv_nsec = 0; nanosleep(&sleep_time, NULL); @@ -754,11 +755,11 @@ expiration_time = filed_sockettimeout_sockstatus[idx].expiration_time; thread_id = filed_sockettimeout_sockstatus[idx].thread_id; - if (expiration_time > now) { + if (expiration_time > filed_sockettimeout_time) { continue; } filed_sockettimeout_close(idx, 1); @@ -807,16 +808,20 @@ return(-1); } return(0); } -#endif +#endif /* FILED_DONT_TIMEOUT */ +#ifndef FILED_DO_SECCOMP +#define filed_init_seccomp() 0 +#else #include #include #include #include +#include #include static int filed_init_seccomp(void) { struct sock_fprog filter; struct sock_filter rules[] = { @@ -838,10 +843,11 @@ return(-1); } return(0); } +#endif /* FILED_DO_SECCOMP */ /* Format time per RFC2616 */ static char *filed_format_time(char *buffer, size_t buffer_len, const time_t timeinfo) { struct tm timeinfo_tm, *timeinfo_tm_p; @@ -1704,11 +1710,11 @@ return; } /* Add a getopt option */ static void filed_getopt_long_setopt(struct option *opt, const char *name, int has_arg, int val) { - opt->name = name; + opt->name = (const char *) name; opt->has_arg = has_arg; opt->flag = NULL; opt->val = val; return; @@ -1817,10 +1823,13 @@ int init_ret, chroot_ret, setuid_ret, lookup_ret, chdir_ret; int setuid_enabled = 0, daemon_enabled = 0; int ch; int fd; + /* Set default value */ + thread_options.fake_newroot = NULL; + /* Process arguments */ filed_getopt_long_setopt(&options[0], "port", required_argument, 'p'); filed_getopt_long_setopt(&options[1], "threads", required_argument, 't'); filed_getopt_long_setopt(&options[2], "cache", required_argument, 'c'); filed_getopt_long_setopt(&options[3], "bind", required_argument, 'b');