From ebd03383f856bfaa72b1700a96561396e6f8f6cc Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 19 Feb 2024 18:46:05 +0000 Subject: Allow using multiple SSL fingerprint algorithms. Closes #1804. --- src/modules/m_spanningtree/compat.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/modules/m_spanningtree') diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index 917b1e480..5d61272ea 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -71,6 +71,35 @@ void TreeSocket::WriteLine(const std::string& original_line) // FRHOST was introduced in PROTO_INSPIRCD_4; drop it. return; } + else if (irc::equals(command, "METADATA")) + { + // : METADATA : + size_t targetend = NextToken(line, cmdend); + size_t nameend = NextToken(line, targetend); + size_t flagend = NextToken(line, nameend); + if (flagend != std::string::npos) + { + std::string extname(line, targetend + 1, nameend - targetend - 1); + if (irc::equals(extname, "ssl_cert")) + { + // Check we have the "e" flag (no error). + if (line.find('e', nameend + 1) < flagend) + { + size_t fpend = NextToken(line, flagend); + if (fpend != std::string::npos) + { + size_t commapos = line.find(',', flagend + 1); + if (commapos < fpend) + { + // Multiple fingerprints in ssl_cert was introduced in PROTO_INSPIRCD_4; drop it. + line.erase(commapos, fpend - commapos); + } + + } + } + } + } + } else if (irc::equals(command, "SQUERY")) { // SQUERY was introduced in PROTO_INSPIRCD_4; convert to PRIVMSG. -- cgit v1.3.1-10-gc9f91