Fix host name retrieval during TLS certificate generation (#1935)

Use HOSTNAME if defined, otherwise invoke gethostname(3) if possible,
fallback to uname(2)
This commit is contained in:
Giovanni
2025-03-16 15:43:39 +00:00
committed by GitHub
parent 9ec6ce833e
commit 30fbf1172c
5 changed files with 43 additions and 12 deletions

View File

@@ -44,6 +44,7 @@ class CUtils {
static CString GetIP(unsigned long addr);
static unsigned long GetLongIP(const CString& sIP);
static CString GetHostName();
static void PrintError(const CString& sMessage);
static void PrintMessage(const CString& sMessage, bool bStrong = false);
@@ -74,7 +75,7 @@ class CUtils {
static timeval GetTime();
static unsigned long long GetMillTime();
#ifdef HAVE_LIBSSL
static void GenerateCert(FILE* pOut, const CString& sHost = "");
static void GenerateCert(FILE* pOut);
#endif /* HAVE_LIBSSL */
static CString CTime(time_t t, const CString& sTZ);

View File

@@ -43,6 +43,8 @@
#cmakedefine HAVE_TCSETATTR 1
#cmakedefine HAVE_GETPASSPHRASE 1
#cmakedefine HAVE_CLOCK_GETTIME 1
#cmakedefine ZNC_HAVE_GETHOSTNAME 1
#cmakedefine ZNC_HAVE_UNAME 1
#cmakedefine HAVE_ICU 1
#define U_USING_ICU_NAMESPACE 1