diff options
author | Matt Schatz <genius3000@g3k.solutions> | 2020-04-09 06:47:53 -0600 |
---|---|---|
committer | Matt Schatz <genius3000@g3k.solutions> | 2020-04-09 06:57:09 -0600 |
commit | 160649b7673392a9084be0492ac65a332d42cbd0 (patch) | |
tree | a6c24aed01ddc3b0f3a2ff6c9b658c7c9b668bf1 | |
parent | ab564db05edb1c736657c0087bfb167889ba0341 (diff) |
Set Unix socket permissions after binding.
-rw-r--r-- | src/listensocket.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/listensocket.cpp b/src/listensocket.cpp index 8c5fda59a..d7217650e 100644 --- a/src/listensocket.cpp +++ b/src/listensocket.cpp @@ -83,6 +83,11 @@ ListenSocket::ListenSocket(ConfigTag* tag, const irc::sockets::sockaddrs& bind_t #endif } + SocketEngine::SetReuse(fd); + int rv = SocketEngine::Bind(this->fd, bind_to); + if (rv >= 0) + rv = SocketEngine::Listen(this->fd, ServerInstance->Config->MaxConn); + if (bind_to.family() == AF_UNIX) { const std::string permissionstr = tag->getString("permissions"); @@ -91,11 +96,6 @@ ListenSocket::ListenSocket(ConfigTag* tag, const irc::sockets::sockaddrs& bind_t chmod(bind_to.str().c_str(), permissions); } - SocketEngine::SetReuse(fd); - int rv = SocketEngine::Bind(this->fd, bind_to); - if (rv >= 0) - rv = SocketEngine::Listen(this->fd, ServerInstance->Config->MaxConn); - // Default defer to on for TLS listeners because in TLS the client always speaks first int timeout = tag->getDuration("defer", (tag->getString("ssl").empty() ? 0 : 3)); if (timeout && !rv) |