summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/anope.example.conf8
-rw-r--r--data/modules.example.conf14
-rw-r--r--data/stats.standalone.example.conf8
-rw-r--r--modules/extra/ssl_gnutls.cpp6
-rw-r--r--modules/extra/ssl_openssl.cpp4
-rw-r--r--src/init.cpp5
-rw-r--r--src/messages.cpp5
-rw-r--r--src/misc.cpp5
8 files changed, 32 insertions, 23 deletions
diff --git a/data/anope.example.conf b/data/anope.example.conf
index 7e2536663..acabf8c14 100644
--- a/data/anope.example.conf
+++ b/data/anope.example.conf
@@ -238,15 +238,15 @@ serverinfo
/*
* The filename containing the Anope process ID. The path is relative to the
- * services root directory.
+ * data directory.
*/
- pid = "data/anope.pid"
+ pid = "anope.pid"
/*
* The filename containing the Message of the Day. The path is relative to the
- * services root directory.
+ * config directory.
*/
- motd = "conf/motd.txt"
+ motd = "motd.txt"
}
/*
diff --git a/data/modules.example.conf b/data/modules.example.conf
index 4089e9ea2..f1818e0e2 100644
--- a/data/modules.example.conf
+++ b/data/modules.example.conf
@@ -580,7 +580,8 @@ module { name = "sasl" }
name = "ssl_gnutls"
/*
- * An optional certificate and key for ssl_gnutls to give to the uplink.
+ * An optional certificate and key for ssl_gnutls to give to the uplink. All
+ * paths are relative to the config directory.
*
* You can generate your own certificate and key pair by using:
*
@@ -588,8 +589,8 @@ module { name = "sasl" }
* certtool --generate-self-signed --load-privkey privkey.pem --outfile fullchain.pem
*
*/
- cert = "data/fullchain.pem"
- key = "data/privkey.pem"
+ cert = "fullchain.pem"
+ key = "privkey.pem"
/*
* Diffie-Hellman parameters to use when acting as a server. This is only
@@ -602,7 +603,7 @@ module { name = "sasl" }
* certtool --generate-dh-params --bits 2048 --outfile dhparams.pem
*
*/
-# dhparams = "data/dhparams.pem"
+ #dhparams = "dhparams.pem"
}
/*
@@ -620,14 +621,15 @@ module { name = "sasl" }
/*
* An optional certificate and key for ssl_openssl to give to the uplink.
+ * All paths are relative to the config directory.
*
* You can generate your own certificate and key pair by using:
*
* openssl genrsa -out privkey.pem 2048
* openssl req -new -x509 -key privkey.pem -out fullchain.pem -days 1095
*/
- cert = "data/fullchain.pem"
- key = "data/privkey.pem"
+ cert = "fullchain.pem"
+ key = "privkey.pem"
/*
* If you wish to increase security you can disable support for older
diff --git a/data/stats.standalone.example.conf b/data/stats.standalone.example.conf
index cf443a36f..4a1c6f644 100644
--- a/data/stats.standalone.example.conf
+++ b/data/stats.standalone.example.conf
@@ -235,15 +235,15 @@ serverinfo
/*
* The filename containing the Anope process ID. The path is relative to the
- * services root directory.
+ * data directory.
*/
- pid = "data/anope.pid"
+ pid = "anope.pid"
/*
* The filename containing the Message of the Day. The path is relative to the
- * services root directory.
+ * config directory.
*/
- motd = "conf/motd.txt"
+ motd = "motd.txt"
}
/*
diff --git a/modules/extra/ssl_gnutls.cpp b/modules/extra/ssl_gnutls.cpp
index 520f877c0..4d399feb9 100644
--- a/modules/extra/ssl_gnutls.cpp
+++ b/modules/extra/ssl_gnutls.cpp
@@ -329,9 +329,9 @@ public:
{
Configuration::Block *config = conf->GetModule(this);
- const Anope::string certfile = config->Get<const Anope::string>("cert", "data/fullchain.pem");
- const Anope::string keyfile = config->Get<const Anope::string>("key", "data/privkey.pem");
- const Anope::string dhfile = config->Get<const Anope::string>("dh", "data/dhparams.pem");
+ const Anope::string certfile = Anope::ExpandConfig(config->Get<const Anope::string>("cert", "fullchain.pem"));
+ const Anope::string keyfile = Anope::ExpandConfig(config->Get<const Anope::string>("key", "privkey.pem"));
+ const Anope::string dhfile = Anope::ExpandConfig(config->Get<const Anope::string>("dh", "dhparams.pem"));
CheckFile(certfile);
CheckFile(keyfile);
diff --git a/modules/extra/ssl_openssl.cpp b/modules/extra/ssl_openssl.cpp
index a052752ae..ec81e6ccb 100644
--- a/modules/extra/ssl_openssl.cpp
+++ b/modules/extra/ssl_openssl.cpp
@@ -146,8 +146,8 @@ public:
{
Configuration::Block *config = conf->GetModule(this);
- this->certfile = config->Get<const Anope::string>("cert", "data/fullchain.pem");
- this->keyfile = config->Get<const Anope::string>("key", "data/privkey.pem");
+ 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()))
{
diff --git a/src/init.cpp b/src/init.cpp
index 7cb136844..3881d92e8 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -218,7 +218,10 @@ static void remove_pidfile()
static void write_pidfile()
{
- const auto pidfile = Config->GetBlock("serverinfo")->Get<const Anope::string>("pid");
+ auto pidfile = Anope::ExpandData(Config->GetBlock("serverinfo")->Get<const Anope::string>("pid"));
+ if (pidfile.empty())
+ return;
+
std::ofstream stream(pidfile.str());
if (!stream.is_open())
throw CoreException("Can not write to PID file " + pidfile);
diff --git a/src/messages.cpp b/src/messages.cpp
index 4b2e134ff..9a0a7a539 100644
--- a/src/messages.cpp
+++ b/src/messages.cpp
@@ -241,10 +241,11 @@ void MOTD::Run(MessageSource &source, const std::vector<Anope::string> &params,
if (s != Me)
return;
- std::ifstream stream(Config->GetBlock("serverinfo")->Get<const Anope::string>("motd").str());
+ auto motdfile = Anope::ExpandConfig(Config->GetBlock("serverinfo")->Get<const Anope::string>("motd"));
+ std::ifstream stream(motdfile.str());
if (!stream.is_open())
{
- IRCD->SendNumeric(ERR_NOSUCHNICK, source.GetSource(), "- MOTD file not found! Please contact your IRC administrator.");
+ IRCD->SendNumeric(ERR_NOSUCHNICK, source.GetSource(), "- MOTD file not readable! Please contact your IRC administrator.");
return;
}
diff --git a/src/misc.cpp b/src/misc.cpp
index 861e6ee20..8a0920fc1 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -810,8 +810,11 @@ void Anope::UpdateTime()
#endif
}
-Anope::string Anope::Expand(const Anope::string& base, const Anope::string& fragment)
+Anope::string Anope::Expand(const Anope::string &base, const Anope::string &fragment)
{
+ if (fragment.empty())
+ return ""; // We can't expand an empty fragment.
+
// The fragment is an absolute path, don't modify it.
if (std::filesystem::path(fragment.str()).is_absolute())
return fragment;