summaryrefslogtreecommitdiff
path: root/modules/extra
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-11-08 00:26:51 +0000
committerSadie Powell <sadie@witchery.services>2024-11-08 00:26:51 +0000
commit59647baff923d18ae5b104276bef360b900371f1 (patch)
tree48f230e7199c95cc3ee1aa690854c9a2e8d3af9a /modules/extra
parent1393518555769efebf39ffaa56508ac767dff703 (diff)
Avoid unnecessary string copies when calling IsFile.
Diffstat (limited to 'modules/extra')
-rw-r--r--modules/extra/ssl_gnutls.cpp4
-rw-r--r--modules/extra/ssl_openssl.cpp6
2 files changed, 5 insertions, 5 deletions
diff --git a/modules/extra/ssl_gnutls.cpp b/modules/extra/ssl_gnutls.cpp
index 4d399feb9..e2c9aa23c 100644
--- a/modules/extra/ssl_gnutls.cpp
+++ b/modules/extra/ssl_gnutls.cpp
@@ -318,7 +318,7 @@ public:
static void CheckFile(const Anope::string &filename)
{
- if (!Anope::IsFile(filename.c_str()))
+ if (!Anope::IsFile(filename))
{
Log() << "File does not exist: " << filename;
throw ConfigException("Error loading certificate/private key");
@@ -339,7 +339,7 @@ public:
GnuTLS::X509CertCredentials *newcred = new GnuTLS::X509CertCredentials(certfile, keyfile);
// DH params is not mandatory
- if (Anope::IsFile(dhfile.c_str()))
+ if (Anope::IsFile(dhfile))
{
try
{
diff --git a/modules/extra/ssl_openssl.cpp b/modules/extra/ssl_openssl.cpp
index ec81e6ccb..0e6ad2abc 100644
--- a/modules/extra/ssl_openssl.cpp
+++ b/modules/extra/ssl_openssl.cpp
@@ -149,7 +149,7 @@ public:
this->certfile = Anope::ExpandConfig(config->Get<const Anope::string>("cert", "fullchain.pem"));
this->keyfile = Anope::ExpandConfig(config->Get<const Anope::string>("key", "privkey.pem"));
- if (Anope::IsFile(this->certfile.c_str()))
+ if (Anope::IsFile(this->certfile))
{
if (!SSL_CTX_use_certificate_chain_file(client_ctx, this->certfile.c_str()) || !SSL_CTX_use_certificate_chain_file(server_ctx, this->certfile.c_str()))
throw ConfigException("Error loading certificate");
@@ -159,7 +159,7 @@ public:
else
Log() << "Unable to open certificate " << this->certfile;
- if (Anope::IsFile(this->keyfile.c_str()))
+ if (Anope::IsFile(this->keyfile))
{
if (!SSL_CTX_use_PrivateKey_file(client_ctx, this->keyfile.c_str(), SSL_FILETYPE_PEM) || !SSL_CTX_use_PrivateKey_file(server_ctx, this->keyfile.c_str(), SSL_FILETYPE_PEM))
throw ConfigException("Error loading private key");
@@ -168,7 +168,7 @@ public:
}
else
{
- if (Anope::IsFile(this->certfile.c_str()))
+ if (Anope::IsFile(this->certfile))
throw ConfigException("Error loading private key " + this->keyfile + " - file not found");
else
Log() << "Unable to open private key " << this->keyfile;