Add support to connect to server via unix socket

The syntax for AddServer command and config is chosen to be unix:/path or unix:ssl:/path

For security reasons, only admins can add such servers, to prevent users from poking around the file system.
This commit is contained in:
Alexey Sokolov
2025-04-20 22:20:52 +01:00
parent 66b17926cc
commit 63d10ccb17
10 changed files with 212 additions and 81 deletions
+2
View File
@@ -114,6 +114,8 @@ class CIRCNetwork : private CCoreTranslationMixin {
CServer* FindServer(const CString& sName) const;
bool DelServer(const CString& sName, unsigned short uPort,
const CString& sPass);
bool DelServer(const CServer& Server);
bool AddServer(CServer Server);
bool AddServer(const CString& sName);
bool AddServer(const CString& sName, unsigned short uPort,
const CString& sPass = "", bool bSSL = false);
+10 -1
View File
@@ -23,13 +23,21 @@
class CServer {
public:
CServer(const CString& sName, unsigned short uPort = 6667,
const CString& sPass = "", bool bSSL = false);
const CString& sPass = "", bool bSSL = false,
bool bUnixSocket = false);
~CServer();
// TODO: use C++20's =default and <=>
bool operator==(const CServer&) const;
bool operator<(const CServer&) const;
static CServer Parse(CString sLine);
const CString& GetName() const;
unsigned short GetPort() const;
const CString& GetPass() const;
bool IsSSL() const;
bool IsUnixSocket() const;
CString GetString(bool bIncludePassword = true) const;
static bool IsValidHostName(const CString& sHostName);
@@ -39,6 +47,7 @@ class CServer {
unsigned short m_uPort;
CString m_sPass;
bool m_bSSL;
bool m_bUnixSocket;
};
#endif // !ZNC_SERVER_H