mirror of
https://github.com/znc/znc.git
synced 2026-08-05 16:33:46 +02:00
Fix calculation of SSL fingerprints
This commit is contained in:
+8
-1
@@ -1146,7 +1146,14 @@ void CIRCSock::SockError(int iErrno, const CString& sDescription) {
|
||||
// It shouldn't contain any bad characters, but let's be safe...
|
||||
m_pNetwork->PutStatus("|" + s.Escape_n(CString::EDEBUG));
|
||||
}
|
||||
m_pNetwork->PutStatus("If you trust this certificate, do /znc AddTrustedServerFingerprint " + GetSSLPeerFingerprint());
|
||||
CString sSHA1;
|
||||
if (GetPeerFingerprint(sSHA1))
|
||||
m_pNetwork->PutStatus("SHA1: " + sSHA1);
|
||||
CString sSHA256 = GetSSLPeerFingerprint();
|
||||
m_pNetwork->PutStatus("SHA-256: " + sSHA256);
|
||||
m_pNetwork->PutStatus("If you trust this certificate, do /znc AddTrustedServerFingerprint " + sSHA256);
|
||||
|
||||
m_pNetwork->PutStatus("Notice for early ZNC git/nightly adopters: if you previously added a fingerprint with lots of :ff: in it, please remove it. It was a bug, sorry. (This message will be removed before release)");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ CString CZNCSock::GetSSLPeerFingerprint() const {
|
||||
}
|
||||
CString sResult;
|
||||
sResult.reserve(3*256/8);
|
||||
for (char c : buf) {
|
||||
for (unsigned char c : buf) {
|
||||
char b[3];
|
||||
snprintf(b, 3, "%02x", c);
|
||||
sResult += b;
|
||||
|
||||
Reference in New Issue
Block a user