Commit eba9ed78 authored by jan.koester's avatar jan.koester
Browse files

ports fixed

parent 79c4d6c3
Loading
Loading
Loading
Loading
+8 −1
Changes for src/api/JsonApiServer.cpp: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -488,7 +488,14 @@ JsonApiServer::JsonApiServer(config::AppConfig cfg, std::string staticDir, std::
    , _configStore(configStore)
    , _authService(authService)
    , _loadBalancer(loadBalancer)
    , _clusterManager(clusterManager) {}
    , _clusterManager(clusterManager) {
    // See HttpProxyServer::HttpProxyServer -- same lazy-bind hazard applies to the admin
    // listener's socket.
    for (auto *sock : _httpd->getServerSockets()) {
        sock->bind();
        sock->listen();
    }
}

void JsonApiServer::run() {
    JsonApiController controller(_httpd->getServerSockets(), _cfg, _staticDir, _configStore,
+10 −1
Changes for src/http/HttpProxyServer.cpp: 10 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -253,7 +253,16 @@ HttpProxyServer::HttpProxyServer(config::ListenerConfig listener, std::string ce
    , _authService(authService)
    , _pluginManager(pluginManager)
    , _loadBalancer(loadBalancer)
    , _acmeChallenges(acmeChallenges) {}
    , _acmeChallenges(acmeChallenges) {
    // netplus::tcp/ssl/quic only create the socket at construction; bind()/listen() are
    // separate calls the event loop would otherwise defer until run() -- too late, since
    // run() executes on a worker thread after main.cpp has already dropped root (see this
    // class's header comment / "Privilege Dropping nach dem Binden privilegierter Ports").
    for (auto *sock : _httpd->getServerSockets()) {
        sock->bind();
        sock->listen();
    }
}

void HttpProxyServer::run() {
    HttpProxyController controller(_httpd->getServerSockets(),
+8 −1
Changes for src/smtp/SmtpProxyServer.cpp: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -235,7 +235,14 @@ SmtpProxyServer::SmtpProxyServer(config::ListenerConfig listener, std::string ho
    , _configStore(configStore)
    , _authService(authService)
    , _pluginManager(pluginManager)
    , _loadBalancer(loadBalancer) {}
    , _loadBalancer(loadBalancer) {
    // See HttpProxyServer::HttpProxyServer -- bind/listen must happen here, while still
    // root, not inside run() which starts on a worker thread after privileges are dropped.
    for (auto *sock : _smtpd->getServerSockets()) {
        sock->bind();
        sock->listen();
    }
}

void SmtpProxyServer::run() {
    SmtpProxyController controller(_smtpd->getServerSockets(), _hostname,