- return true;
- }
- }
- return false;
- }
-
- virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> ¶meters, User *user, bool validated, const std::string &original_line)
- {
- irc::string pcmd = command.c_str();
-
- if ((pcmd == "OPER") && (validated))
- {
- ConfigReader cf(ServerInstance);
- char TheHost[MAXBUF];
- char TheIP[MAXBUF];
- std::string LoginName;
- std::string Password;
- std::string OperType;
- std::string HostName;
- std::string HashType;
- std::string FingerPrint;
- bool SSLOnly;
- ssl_cert* cert = cmd.CertExt.get(user);
-
- snprintf(TheHost,MAXBUF,"%s@%s",user->ident.c_str(),user->host.c_str());
- snprintf(TheIP, MAXBUF,"%s@%s",user->ident.c_str(),user->GetIPString());
-
- for (int i = 0; i < cf.Enumerate("oper"); i++)
- {
- LoginName = cf.ReadValue("oper", "name", i);
- Password = cf.ReadValue("oper", "password", i);
- OperType = cf.ReadValue("oper", "type", i);
- HostName = cf.ReadValue("oper", "host", i);
- HashType = cf.ReadValue("oper", "hash", i);
- FingerPrint = cf.ReadValue("oper", "fingerprint", i);
- SSLOnly = cf.ReadFlag("oper", "sslonly", i);
-
- if (FingerPrint.empty() && !SSLOnly)
- continue;
-
- if (LoginName != parameters[0])
- continue;