Fix reload behaviour
Re-read the filter file with the runtime user permissions, create useful log message when the filter cannot be read. Fixes Debian #756040.
This commit is contained in:
parent
b131f45cbb
commit
8ca0fbefc2
14
src/child.c
14
src/child.c
@ -33,6 +33,7 @@
|
||||
#include "conf.h"
|
||||
|
||||
static vector_t listen_fds;
|
||||
volatile int children; /* referenced from main.c */
|
||||
|
||||
/*
|
||||
* Stores the internal data needed for each child (connection)
|
||||
@ -202,6 +203,11 @@ static void child_main (struct child_s *ptr)
|
||||
ptr->connects = 0;
|
||||
srand(time(NULL));
|
||||
|
||||
#ifdef FILTER_ENABLE
|
||||
if (config.filter)
|
||||
filter_init ();
|
||||
#endif /* FILTER_ENABLE */
|
||||
|
||||
/*
|
||||
* We have to wait for connections on multiple fds,
|
||||
* so use select.
|
||||
@ -226,7 +232,6 @@ static void child_main (struct child_s *ptr)
|
||||
FD_SET(*fd, &rfds);
|
||||
maxfd = max(maxfd, *fd);
|
||||
}
|
||||
|
||||
ptr->status = T_WAITING;
|
||||
|
||||
clilen = sizeof(struct sockaddr_storage);
|
||||
@ -358,8 +363,10 @@ static pid_t child_make (struct child_s *ptr)
|
||||
{
|
||||
pid_t pid;
|
||||
|
||||
if ((pid = fork ()) > 0)
|
||||
if ((pid = fork ()) > 0) {
|
||||
++children;
|
||||
return pid; /* parent */
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the SIGNALS so that the child can be reaped.
|
||||
@ -513,10 +520,7 @@ void child_main_loop (void)
|
||||
* This should actually be handled somehow...
|
||||
*/
|
||||
reload_config ();
|
||||
|
||||
#ifdef FILTER_ENABLE
|
||||
filter_reload ();
|
||||
#endif /* FILTER_ENABLE */
|
||||
|
||||
/* propagate filter reload to all children */
|
||||
child_kill_children (SIGHUP);
|
||||
|
@ -61,7 +61,9 @@ void filter_init (void)
|
||||
|
||||
fd = fopen (config.filter, "r");
|
||||
if (!fd) {
|
||||
return;
|
||||
log_message(LOG_ERR, "Can't read the filter from %s: %s",
|
||||
config.filter, strerror(errno));
|
||||
exit(3);
|
||||
}
|
||||
|
||||
p = NULL;
|
||||
|
@ -50,6 +50,7 @@
|
||||
struct config_s config;
|
||||
struct config_s config_defaults;
|
||||
unsigned int received_sighup = FALSE; /* boolean */
|
||||
extern volatile int children; /* defined in child.c */
|
||||
|
||||
/*
|
||||
* Handle a signal
|
||||
@ -374,11 +375,6 @@ main (int argc, char **argv)
|
||||
exit (EX_OSERR);
|
||||
}
|
||||
|
||||
#ifdef FILTER_ENABLE
|
||||
if (config.filter)
|
||||
filter_init ();
|
||||
#endif /* FILTER_ENABLE */
|
||||
|
||||
/* Start listening on the selected port. */
|
||||
if (child_listening_sockets(config.listen_addrs, config.port) < 0) {
|
||||
fprintf (stderr, "%s: Could not create listening sockets.\n",
|
||||
|
Loading…
Reference in New Issue
Block a user