aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/hashcomp.h6
-rw-r--r--include/modules/ssl.h37
2 files changed, 29 insertions, 14 deletions
diff --git a/include/hashcomp.h b/include/hashcomp.h
index ec6cf34f8..f7509a444 100644
--- a/include/hashcomp.h
+++ b/include/hashcomp.h
@@ -156,12 +156,6 @@ namespace irc
* @return True if the end of the stream has been reached, otherwise false
*/
bool StreamEnd();
-
- /** Returns true if the specified value exists in the stream
- * @param value The value to search for
- * @return True if the value was found, False otherwise
- */
- bool Contains(const std::string& value);
};
/** A derived form of sepstream, which separates on commas
diff --git a/include/modules/ssl.h b/include/modules/ssl.h
index 1540f6385..bde05a5b8 100644
--- a/include/modules/ssl.h
+++ b/include/modules/ssl.h
@@ -45,7 +45,7 @@ public:
std::string dn;
std::string issuer;
std::string error;
- std::string fingerprint;
+ std::vector<std::string> fingerprints;
bool trusted = false;
bool invalid = true;
bool unknownsigner = true;
@@ -79,12 +79,20 @@ public:
return error;
}
- /** Get key fingerprint.
- * @return The key fingerprint as a hex string.
+ /** Get primary fingerprint.
+ * @return The primary fingerprint as a hex string.
*/
- const std::string& GetFingerprint() const
+ std::string GetFingerprint() const
{
- return fingerprint;
+ return fingerprints.empty() ? "" : fingerprints.front();
+ }
+
+ /** Get all fingerprints.
+ * @return All fingerprints as a hex string.
+ */
+ const std::vector<std::string>& GetFingerprints() const
+ {
+ return fingerprints;
}
/** Get trust status
@@ -333,9 +341,9 @@ public:
*/
virtual void SetCertificate(User* user, ssl_cert* cert) = 0;
- /** Get the key fingerprint from a user's certificate
- * @param user The user whose key fingerprint to get, user may be remote
- * @return The key fingerprint from the user's TLS certificate or an empty string
+ /** Get the primary fingerprint from a user's certificate
+ * @param user The user whose primary fingerprint to get.
+ * @return The primary fingerprint from the user's TLS certificate or an empty string
* if the user is not using TLS or did not provide a client certificate
*/
std::string GetFingerprint(User* user)
@@ -345,6 +353,19 @@ public:
return cert->GetFingerprint();
return "";
}
+
+ /** Get all fingerprint from a user's certificate
+ * @param user The user whose fingerprint to get.
+ * @return The fingerprint from the user's TLS certificate or an empty string
+ * if the user is not using TLS or did not provide a client certificate
+ */
+ std::vector<std::string> GetFingerprints(User* user)
+ {
+ ssl_cert* cert = GetCertificate(user);
+ if (cert)
+ return cert->GetFingerprints();
+ return {};
+ }
};
/** API implemented by m_sslinfo that allows modules to retrieve the TLS certificate