return false;
}
- virtual void OnLoadModule(Module* mod, const std::string& name)
+ virtual void OnLoadModule(Module* mod)
{
if (ServerInstance->Modules->ModuleHasInterface(mod, "HashRequest"))
{
- ServerInstance->Logs->Log("m_sqloper",DEBUG, "Post-load registering hasher: %s", name.c_str());
std::string sname = HashNameRequest(this, mod).response;
hashers[sname.c_str()] = mod;
names.push_back(sname);
return false;
/* Make an MD5 hash of the password for using in the query */
- std::string md5_pass_hash = HashRequest(this, x->second, password).result;
+ std::string md5_pass_hash = HashRequest(this, x->second, password).hex();
/* We generate our own sum here because some database providers (e.g. SQLite) dont have a builtin md5/sha256 function,
* also hashing it in the module and only passing a remote query containing a hash is more secure.
bool OperUser(User* user, const std::string &pattern, const std::string &type)
{
- ConfigReader Conf;
-
- for (int j = 0; j < Conf.Enumerate("type"); j++)
- {
- std::string tname = Conf.ReadValue("type","name",j);
- std::string hostname(user->ident);
+ OperIndex::iterator iter = ServerInstance->Config->oper_blocks.find(" " + type);
+ if (iter == ServerInstance->Config->oper_blocks.end())
+ return false;
+ OperInfo* ifo = iter->second;
- hostname.append("@").append(user->host);
+ std::string hostname(user->ident);
- if ((tname == type) && OneOfMatches(hostname.c_str(), user->GetIPString(), pattern.c_str()))
- {
- /* Opertype and host match, looks like this is it. */
- std::string operhost = Conf.ReadValue("type", "host", j);
+ hostname.append("@").append(user->host);
- if (operhost.size())
- user->ChangeDisplayedHost(operhost.c_str());
+ if (OneOfMatches(hostname.c_str(), user->GetIPString(), pattern.c_str()))
+ {
+ /* Opertype and host match, looks like this is it. */
- user->Oper(type, tname);
- return true;
- }
+ user->Oper(ifo);
+ return true;
}
return false;
Version GetVersion()
{
- return Version("Allows storage of oper credentials in an SQL table", VF_VENDOR, API_VERSION);
+ return Version("Allows storage of oper credentials in an SQL table", VF_VENDOR);
}
};