BUG/MEDIUM: peers: prevent unitialized multiple listeners on peers section
The previous fix: BUG/MEDIUM: peers: fix segfault using multiple bind on peers Prevents to declare multiple listeners on a peers sections but if peers protocol is extended to support this we could raise the bug again. Indeed, after allocating a new listener and adding it to a list the code mistakenly re-configure the first element of the list instead of the new added one, and the last one remains finally uninitialized. The previous fix assure there is no more than one listener in this list but this could be changed in futur. This patch patch assures we configure and initialize the newly added listener instead of the first one in the list. This patch could be backported until version 2.0 to complete BUG/MEDIUM: peers: fix segfault using multiple bind on peers
This commit is contained in:
parent
49f6f4b1a7
commit
ca82578fe8
@ -729,7 +729,10 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
|
|||||||
err_code |= ERR_FATAL;
|
err_code |= ERR_FATAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
l = LIST_ELEM(bind_conf->listeners.n, typeof(l), by_bind);
|
/*
|
||||||
|
* Newly allocated listener is at the end of the list
|
||||||
|
*/
|
||||||
|
l = LIST_ELEM(bind_conf->listeners.p, typeof(l), by_bind);
|
||||||
l->maxaccept = 1;
|
l->maxaccept = 1;
|
||||||
l->accept = session_accept_fd;
|
l->accept = session_accept_fd;
|
||||||
l->analysers |= curpeers->peers_fe->fe_req_ana;
|
l->analysers |= curpeers->peers_fe->fe_req_ana;
|
||||||
@ -933,7 +936,10 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
l = LIST_ELEM(bind_conf->listeners.n, typeof(l), by_bind);
|
/*
|
||||||
|
* Newly allocated listener is at the end of the list
|
||||||
|
*/
|
||||||
|
l = LIST_ELEM(bind_conf->listeners.p, typeof(l), by_bind);
|
||||||
l->maxaccept = 1;
|
l->maxaccept = 1;
|
||||||
l->accept = session_accept_fd;
|
l->accept = session_accept_fd;
|
||||||
l->analysers |= curpeers->peers_fe->fe_req_ana;
|
l->analysers |= curpeers->peers_fe->fe_req_ana;
|
||||||
|
Loading…
Reference in New Issue
Block a user