fix non-functional max_conns_per_ip
authorPiotr Krysiuk <c7f.m0d3@gmail.com>
Thu, 19 Mar 2020 00:13:28 +0000 (00:13 +0000)
committerPiotr Krysiuk <c7f.m0d3@gmail.com>
Thu, 19 Mar 2020 00:13:28 +0000 (00:13 +0000)
commitb582491e02a92983300cc114a48bdeed7c022621
tree57ce271efbc915d4538671011d15624a35d944d6
parent4c524db8d2a853bdfbff33b5bfa92b4c7bc64491
fix non-functional max_conns_per_ip

Starting with nsjail::listenMode update to pipe socket traffic [commit 273ce6bc846b7325c7f0915067c54bf8cf6f5654], a pipe file descriptor is passed as connsock parameter when calling net::limitConns and also as sock parameter when calling addProc in subproc::runChild.
This breaks net::limitConns because pid.remote_addr and also local variable addr are left uninitialized despite net::connToText calls when counting number of existing network connections from the same peer.

The subsequent correction to fetch remote address [commit 2cf562160d308f9b5cca767a2459332f2041b41c] made the bug even more interesting, since the loop in net::limitConns now compares unsanitized content of stack with network addresses of already connected clients.
subproc.cc