diff options
author | Luke Bratch <luke@bratch.co.uk> | 2019-05-27 12:46:22 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2019-05-27 12:46:22 +0100 |
commit | 0b1417faa0820847d4674d496dfeb069787c3ab2 (patch) | |
tree | 9258fc30925344f844b6d7218679e0876c711eec /blabouncer.c | |
parent | f0936ca1b231df3c5cb7cf80a1d6a88d7ea980af (diff) |
Change default certfile and keyfile to be <basedir>/ instead of $HOME/.blabouncer/.
Diffstat (limited to 'blabouncer.c')
-rw-r--r-- | blabouncer.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/blabouncer.c b/blabouncer.c index efb2474..e5637cf 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -2212,6 +2212,11 @@ int main(int argc, char *argv[]) { exit(1); } + // Is the base directory set? If not, use the default. + if (!getconfstr("basedir", settings.conffile, settings.basedir)) { + snprintf(settings.basedir, PATH_MAX, "%s/.blabouncer/", getenv("HOME")); + } + // Should the bouncer use TLS for the IRC server? settings.servertls = getconfint("servertls", settings.conffile); @@ -2223,21 +2228,22 @@ int main(int argc, char *argv[]) { // What is the certificate file path? if (!getconfstr("certfile", settings.conffile, settings.certfile)) { // If none provided, set to default - snprintf(settings.certfile, PATH_MAX, "%s/.blabouncer/cert.pem", getenv("HOME")); + if (!snprintf(settings.certfile, PATH_MAX, "%s/cert.pem", settings.basedir)) { + fprintf(stderr, "Error while preparing default certfile location!\n"); + exit(1); + } } // What is the certificate key file path? if (!getconfstr("keyfile", settings.conffile, settings.keyfile)) { // If none provided, set to default - snprintf(settings.keyfile, PATH_MAX, "%s/.blabouncer/key.pem", getenv("HOME")); + if (!snprintf(settings.keyfile, PATH_MAX, "%s/key.pem", settings.basedir)) { + fprintf(stderr, "Error while preparing default certfile location!\n"); + exit(1); + } } } - // Is the base directory set? If not, use the default. - if (!getconfstr("basedir", settings.conffile, settings.basedir)) { - snprintf(settings.basedir, PATH_MAX, "%s/.blabouncer/", getenv("HOME")); - } - // Make sure the base directory exists struct stat st = {0}; if (stat(settings.basedir, &st) == -1) { |