commit - 891dbd2acc59a6d9ff6dd8a5b12e91f5a8fa20ed
commit + 7ea3864a9369086024a2d541b053963958b19899
blob - c08183de9c1c94861b6f646bdbf341615391a652
blob + aad64b3e380444dff3e7769feef02cff684f33c2
--- src/ngircd/conf.c
+++ src/ngircd/conf.c
fclose(fd);
if (Conf_IncludeDir[0]) {
- /* Include further configuration files, if any */
dh = opendir(Conf_IncludeDir);
- if (dh) {
- while ((entry = readdir(dh)) != NULL) {
- ptr = strrchr(entry->d_name, '.');
- if (!ptr || strcasecmp(ptr, ".conf") != 0)
- continue;
- snprintf(file, sizeof(file), "%s/%s",
- Conf_IncludeDir, entry->d_name);
- if (TestOnly)
- Config_Error(LOG_INFO,
- "Reading configuration from \"%s\" ...",
- file);
- fd = fopen(file, "r");
- if (fd) {
- Read_Config_File(file, fd);
- fclose(fd);
- } else
- Config_Error(LOG_ALERT,
- "Can't read configuration \"%s\": %s",
- file, strerror(errno));
- }
- closedir(dh);
- } else
+ if (!dh)
Config_Error(LOG_ALERT,
"Can't open include directory \"%s\": %s",
Conf_IncludeDir, strerror(errno));
+ } else {
+ strlcpy(Conf_IncludeDir, SYSCONFDIR, sizeof(Conf_IncludeDir));
+ strlcat(Conf_IncludeDir, CONFIG_DIR, sizeof(Conf_IncludeDir));
+ dh = opendir(Conf_IncludeDir);
}
+ /* Include further configuration files, if IncludeDir is available */
+ if (dh) {
+ while ((entry = readdir(dh)) != NULL) {
+ ptr = strrchr(entry->d_name, '.');
+ if (!ptr || strcasecmp(ptr, ".conf") != 0)
+ continue;
+ snprintf(file, sizeof(file), "%s/%s",
+ Conf_IncludeDir, entry->d_name);
+ if (TestOnly)
+ Config_Error(LOG_INFO,
+ "Reading configuration from \"%s\" ...",
+ file);
+ fd = fopen(file, "r");
+ if (fd) {
+ Read_Config_File(file, fd);
+ fclose(fd);
+ } else
+ Config_Error(LOG_ALERT,
+ "Can't read configuration \"%s\": %s",
+ file, strerror(errno));
+ }
+ closedir(dh);
+ }
+
/* Check if there is still a server to add */
if( New_Server.name[0] ) {
/* Copy data to "real" server structure */
blob - cffbfadfa10cdb8ecca525c8d1c787bd650ee71c
blob + 7784c17470434ee7d3997767239c1b2bfe6c8d6c
--- src/ngircd/defines.h
+++ src/ngircd/defines.h
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/** Configuration file name. */
#define CONFIG_FILE "/ngircd.conf"
+/** Directory containing optional configuration snippets. */
+#define CONFIG_DIR "/ngircd.conf.d"
+
/** Name of the MOTD file. */
#define MOTD_FILE "/ngircd.motd"
blob - 1e40fd3cb63c45ebaef003f4248618bee344b088
blob + 0d0cccc9ce3b669b280cb0a26dd9f1d78df6d72e
--- src/testsuite/ngircd-test1.conf
+++ src/testsuite/ngircd-test1.conf
[Options]
OperCanUseMode = yes
Ident = no
+ IncludeDir = /var/empty
PAM = no
[Operator]
blob - e3f88672c39bd5f71091e79236d89e93fab4ad3a
blob + c9d7f6c5b4b02f44144318b8e4f67cc2790e874b
--- src/testsuite/ngircd-test2.conf
+++ src/testsuite/ngircd-test2.conf
[Options]
OperCanUseMode = yes
Ident = no
+ IncludeDir = /var/empty
PAM = no
[Operator]