summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-04 17:09:24 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-04 17:09:24 +0000
commitfd556922919a35d6f292089fe2340ebc16574a2b (patch)
tree754ce34e8858d0b75067f944d6c394bb10d4554a
parentca7d83f7e5427e4b900762a9faa22be7a56fbaef (diff)
Allow space seperated hostlist in <oper:host> e.g. <oper host="foo@bar baz@qux blarp@flerble" name="blah">
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3074 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/cmd_oper.h2
-rw-r--r--src/cmd_oper.cpp17
2 files changed, 18 insertions, 1 deletions
diff --git a/include/cmd_oper.h b/include/cmd_oper.h
index 22bdfda44..879671da6 100644
--- a/include/cmd_oper.h
+++ b/include/cmd_oper.h
@@ -28,6 +28,8 @@
#include "users.h"
#include "channels.h"
+bool OneOfMatches(char* host, char* hostlist);
+
class cmd_oper : public command_t
{
public:
diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp
index a98a778d3..20a4b5ba8 100644
--- a/src/cmd_oper.cpp
+++ b/src/cmd_oper.cpp
@@ -62,6 +62,21 @@ extern std::vector<userrec*> all_opers;
extern std::vector<userrec*> local_users;
extern userrec* fd_ref_table[MAX_DESCRIPTORS];
+bool OneOfMatches(char* host, char* hostlist)
+{
+ std::stringstream hl(hostlist);
+ std::string xhost;
+ while (hl >> xhost)
+ {
+ log(DEBUG,"Oper: Matching host %s",xhost.c_str());
+ if (match(host,xhost.c_str()))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
void cmd_oper::Handle (char **parameters, int pcnt, userrec *user)
{
char LoginName[MAXBUF];
@@ -82,7 +97,7 @@ void cmd_oper::Handle (char **parameters, int pcnt, userrec *user)
Config->ConfValue("oper","password",i,Password,&Config->config_f);
Config->ConfValue("oper","type",i,OperType,&Config->config_f);
Config->ConfValue("oper","host",i,HostName,&Config->config_f);
- if ((!strcmp(LoginName,parameters[0])) && (!operstrcmp(Password,parameters[1])) && (match(TheHost,HostName)))
+ if ((!strcmp(LoginName,parameters[0])) && (!operstrcmp(Password,parameters[1])) && (OneOfMatches(TheHost,HostName)))
{
fail2 = true;
for (j =0; j < Config->ConfValueEnum("type",&Config->config_f); j++)