X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsocket.cpp;h=f19af36bb48a9728d2fd49c372e4cfd8c1129860;hb=2ec7654267f8ad127653839ba9aaf369705e3026;hp=2daa6a8212dd72f108ff192b3deae36159d06348;hpb=33932b95e4b886aec8ac1bf3e3e1665826bcd0ea;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/socket.cpp b/src/socket.cpp index 2daa6a821..f19af36bb 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -98,24 +98,27 @@ int InspIRCd::BindPorts(FailedPortList& failed_ports) const std::string path = tag->getString("path"); if (!path.empty()) { + // Expand the path relative to the config directory. + const std::string fullpath = ServerInstance->Config->Paths.PrependData(path); + // UNIX socket paths are length limited to less than PATH_MAX. irc::sockets::sockaddrs bindspec; - if (path.length() > std::min(ServerInstance->Config->Limits.MaxHost, sizeof(bindspec.un.sun_path) - 1)) + if (fullpath.length() > std::min(ServerInstance->Config->Limits.MaxHost, sizeof(bindspec.un.sun_path) - 1)) { this->Logs->Log("SOCKET", LOG_DEFAULT, "UNIX listener on %s at %s specified a path that is too long!", - path.c_str(), tag->getTagLocation().c_str()); + fullpath.c_str(), tag->getTagLocation().c_str()); continue; } // Check for characters which are problematic in the IRC message format. - if (path.find_first_of("\n\r\t!@: ") != std::string::npos) + if (fullpath.find_first_of("\n\r\t!@: ") != std::string::npos) { this->Logs->Log("SOCKET", LOG_DEFAULT, "UNIX listener on %s at %s specified a path containing invalid characters!", - path.c_str(), tag->getTagLocation().c_str()); + fullpath.c_str(), tag->getTagLocation().c_str()); continue; } - irc::sockets::untosa(path, bindspec); + irc::sockets::untosa(fullpath, bindspec); if (!BindPort(tag, bindspec, old_ports)) failed_ports.push_back(std::make_pair(bindspec, errno)); else