1
0
mirror of https://github.com/moparisthebest/spdylay synced 2024-12-21 23:28:52 -05:00

Drop priveleges only after listening on possibly priveleged port

This commit is contained in:
moparisthebest 2013-04-19 07:58:58 -04:00
parent 7dfa559bc4
commit aa13b9b980

View File

@ -259,10 +259,6 @@ int event_loop()
} }
} }
// ListenHandler loads private key. After that, we drop the root
// privileges if needed.
drop_privileges();
evconnlistener *evlistener6, *evlistener4; evconnlistener *evlistener6, *evlistener4;
evlistener6 = create_evlistener(listener_handler, AF_INET6); evlistener6 = create_evlistener(listener_handler, AF_INET6);
evlistener4 = create_evlistener(listener_handler, AF_INET); evlistener4 = create_evlistener(listener_handler, AF_INET);
@ -272,6 +268,10 @@ int event_loop()
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
// ListenHandler loads private key, and we listen on a priveleged port.
// After that, we drop the root privileges if needed.
drop_privileges();
if(get_config()->num_worker > 1) { if(get_config()->num_worker > 1) {
listener_handler->create_worker_thread(get_config()->num_worker); listener_handler->create_worker_thread(get_config()->num_worker);
} else if(get_config()->downstream_proto == PROTO_SPDY) { } else if(get_config()->downstream_proto == PROTO_SPDY) {