/*
* InspIRCd -- Internet Relay Chat Daemon
*
- * Copyright (C) 2013 Adam <Adam@anope.org>
- * Copyright (C) 2009 Robin Burchell <robin+git@viroteck.net>
- * Copyright (C) 2008 Pippijn van Steenhoven <pip88nl@gmail.com>
- * Copyright (C) 2008 Craig Edwards <craigedwards@brainbox.cc>
- * Copyright (C) 2007 Carsten Valdemar Munk <carsten.munk+inspircd@gmail.com>
+ * Copyright (C) 2017-2020 Sadie Powell <sadie@witchery.services>
+ * Copyright (C) 2014, 2018 Attila Molnar <attilamolnar@hush.com>
+ * Copyright (C) 2013-2014 Adam <Adam@anope.org>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public
if (!oper_command)
return;
- std::vector<std::string> params;
+ CommandBase::Params params;
params.push_back(opername);
params.push_back(password);
- oper_command->Handle(params, user);
+ ClientProtocol::TagMap tags;
+ oper_command->Handle(user, CommandBase::Params(params, tags));
}
void Fallback()
public:
AdminBindInterface(Module* c, const std::string& p, const std::string& u, const std::string& o, const std::string& pa, const std::string& b, const std::string& w)
- : LDAPInterface(c), provider(p), user(u), opername(p), password(pa), base(b), what(w)
+ : LDAPInterface(c)
+ , provider(p)
+ , user(u)
+ , opername(o)
+ , password(pa)
+ , base(b)
+ , what(w)
{
}
}
};
-class ModuleLDAPAuth : public Module
+class ModuleLDAPOper : public Module
{
dynamic_reference<LDAPProvider> LDAP;
std::string base;
std::string attribute;
public:
- ModuleLDAPAuth()
+ ModuleLDAPOper()
: LDAP(this, "LDAP")
{
me = this;
attribute = tag->getString("attribute");
}
- ModResult OnPreCommand(std::string& command, std::vector<std::string>& parameters, LocalUser* user, bool validated, const std::string& original_line) CXX11_OVERRIDE
+ ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) CXX11_OVERRIDE
{
if (validated && command == "OPER" && parameters.size() >= 2)
{
return MOD_RES_PASSTHRU;
std::string acceptedhosts = tag->getString("host");
- std::string hostname = user->ident + "@" + user->host;
+ std::string hostname = user->ident + "@" + user->GetRealHost();
if (!InspIRCd::MatchMask(acceptedhosts, hostname, user->GetIPString()))
return MOD_RES_PASSTHRU;
Version GetVersion() CXX11_OVERRIDE
{
- return Version("Adds the ability to authenticate opers via LDAP", VF_VENDOR);
+ return Version("Allows server operators to be authenticated against an LDAP database.", VF_VENDOR);
}
};
-MODULE_INIT(ModuleLDAPAuth)
+MODULE_INIT(ModuleLDAPOper)