Report errors and close the incoming connection if socketpair fails

for ssl connections.
from ircd-ratbox (r26503) (androsyn)
This commit is contained in:
Jilles Tjoelker 2009-05-12 23:18:41 +02:00
parent cef0fc6693
commit 6388eda683

View file

@ -552,7 +552,12 @@ accept_ssld(rb_fde_t *F, struct sockaddr *addr, struct sockaddr *laddr, struct L
{
ssl_ctl_t *ctl;
rb_fde_t *xF[2];
rb_socketpair(AF_UNIX, SOCK_STREAM, 0, &xF[0], &xF[1], "Incoming ssld Connection");
if(rb_socketpair(AF_UNIX, SOCK_STREAM, 0, &xF[0], &xF[1], "Incoming ssld Connection") == -1)
{
ilog_error("creating SSL/TLS socket pairs");
rb_close(F);
return;
}
ctl = start_ssld_accept(F, xF[1], rb_get_fd(xF[0])); /* this will close F for us */
add_connection(listener, xF[0], addr, laddr, ctl);
}