summaryrefslogtreecommitdiff
path: root/src/modules/extra
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2012-10-06 21:43:20 +0200
committerattilamolnar <attilamolnar@hush.com>2012-11-12 21:48:42 +0100
commita4db7bf9af00b32d4f5c1922997d02b0b8be59e5 (patch)
tree2fd4c4ee2344300285f919968760f27f9ca41df4 /src/modules/extra
parent62149fcd86711d3ca7457a327c4e8fa2e7d85582 (diff)
Remove usage of the deprecated ConfigReader
Diffstat (limited to 'src/modules/extra')
-rw-r--r--src/modules/extra/m_ldapauth.cpp22
-rw-r--r--src/modules/extra/m_ldapoper.cpp12
-rw-r--r--src/modules/extra/m_mssql.cpp34
-rw-r--r--src/modules/extra/m_regex_posix.cpp3
4 files changed, 36 insertions, 35 deletions
diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp
index f51b41e0b..2102b7492 100644
--- a/src/modules/extra/m_ldapauth.cpp
+++ b/src/modules/extra/m_ldapauth.cpp
@@ -76,20 +76,20 @@ public:
void OnRehash(User* user)
{
- ConfigReader Conf;
+ ConfigTag* tag = ServerInstance->Config->ConfValue("ldapauth");
whitelistedcidrs.clear();
requiredattributes.clear();
- base = Conf.ReadValue("ldapauth", "baserdn", 0);
- attribute = Conf.ReadValue("ldapauth", "attribute", 0);
- ldapserver = Conf.ReadValue("ldapauth", "server", 0);
- allowpattern = Conf.ReadValue("ldapauth", "allowpattern", 0);
- killreason = Conf.ReadValue("ldapauth", "killreason", 0);
- std::string scope = Conf.ReadValue("ldapauth", "searchscope", 0);
- username = Conf.ReadValue("ldapauth", "binddn", 0);
- password = Conf.ReadValue("ldapauth", "bindauth", 0);
- verbose = Conf.ReadFlag("ldapauth", "verbose", 0); /* Set to true if failed connects should be reported to operators */
- useusername = Conf.ReadFlag("ldapauth", "userfield", 0);
+ base = tag->getString("baserdn");
+ attribute = tag->getString("attribute");
+ ldapserver = tag->getString("server");
+ allowpattern = tag->getString("allowpattern");
+ killreason = tag->getString("killreason");
+ std::string scope = tag->getString("searchscope");
+ username = tag->getString("binddn");
+ password = tag->getString("bindauth");
+ verbose = tag->getBool("verbose"); /* Set to true if failed connects should be reported to operators */
+ useusername = tag->getBool("userfield");
ConfigTagList whitelisttags = ServerInstance->Config->ConfTags("ldapwhitelist");
diff --git a/src/modules/extra/m_ldapoper.cpp b/src/modules/extra/m_ldapoper.cpp
index 2166b0823..84a3b8729 100644
--- a/src/modules/extra/m_ldapoper.cpp
+++ b/src/modules/extra/m_ldapoper.cpp
@@ -61,13 +61,13 @@ public:
virtual void OnRehash(User* user)
{
- ConfigReader Conf;
+ ConfigTag* tag = ServerInstance->Config->ConfValue("ldapoper");
- base = Conf.ReadValue("ldapoper", "baserdn", 0);
- ldapserver = Conf.ReadValue("ldapoper", "server", 0);
- std::string scope = Conf.ReadValue("ldapoper", "searchscope", 0);
- username = Conf.ReadValue("ldapoper", "binddn", 0);
- password = Conf.ReadValue("ldapoper", "bindauth", 0);
+ base = tag->getString("baserdn");
+ ldapserver = tag->getString("server");
+ std::string scope = tag->getString("searchscope");
+ username = tag->getString("binddn");
+ password = tag->getString("bindaut");
if (scope == "base")
searchscope = LDAP_SCOPE_BASE;
diff --git a/src/modules/extra/m_mssql.cpp b/src/modules/extra/m_mssql.cpp
index eca646fcf..27410e95b 100644
--- a/src/modules/extra/m_mssql.cpp
+++ b/src/modules/extra/m_mssql.cpp
@@ -707,16 +707,17 @@ class ModuleMsSQL : public Module
bool HostInConf(const SQLhost &h)
{
- ConfigReader conf;
- for(int i = 0; i < conf.Enumerate("database"); i++)
+ ConfigTagList tags = ServerInstance->Config->ConfTags("database");
+ for (ConfigIter i = tags.first; i != tags.second; ++i)
{
+ ConfigTag* tag = i->second;
SQLhost host;
- host.id = conf.ReadValue("database", "id", i);
- host.host = conf.ReadValue("database", "hostname", i);
- host.port = conf.ReadInteger("database", "port", "1433", i, true);
- host.name = conf.ReadValue("database", "name", i);
- host.user = conf.ReadValue("database", "username", i);
- host.pass = conf.ReadValue("database", "password", i);
+ host.id = tag->getString("id");
+ host.host = tag->getString("hostname");
+ host.port = tag->getInt("port", 1433);
+ host.name = tag->getString("name");
+ host.user = tag->getString("username");
+ host.pass = tag->getString("password");
if (h == host)
return true;
}
@@ -727,17 +728,18 @@ class ModuleMsSQL : public Module
{
ClearOldConnections();
- ConfigReader conf;
- for(int i = 0; i < conf.Enumerate("database"); i++)
+ ConfigTagList tags = ServerInstance->Config->ConfTags("database");
+ for (ConfigIter i = tags.first; i != tags.second; ++i)
{
+ ConfigTag* tag = i->second;
SQLhost host;
- host.id = conf.ReadValue("database", "id", i);
- host.host = conf.ReadValue("database", "hostname", i);
- host.port = conf.ReadInteger("database", "port", "1433", i, true);
- host.name = conf.ReadValue("database", "name", i);
- host.user = conf.ReadValue("database", "username", i);
- host.pass = conf.ReadValue("database", "password", i);
+ host.id = tag->getString("id");
+ host.host = tag->getString("hostname");
+ host.port = tag->getInt("port", 1433);
+ host.name = tag->getString("name");
+ host.user = tag->getString("username");
+ host.pass = tag->getString("password");
if (HasHost(host))
continue;
diff --git a/src/modules/extra/m_regex_posix.cpp b/src/modules/extra/m_regex_posix.cpp
index 6e837bcb6..e3e436bd6 100644
--- a/src/modules/extra/m_regex_posix.cpp
+++ b/src/modules/extra/m_regex_posix.cpp
@@ -107,8 +107,7 @@ public:
void OnRehash(User* u)
{
- ConfigReader Conf;
- ref.extended = Conf.ReadFlag("posix", "extended", 0);
+ ref.extended = ServerInstance->Config->ConfValue("posix")->getBool("extended");
}
};