diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-02-04 17:09:24 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-02-04 17:09:24 +0000 |
commit | fd556922919a35d6f292089fe2340ebc16574a2b (patch) | |
tree | 754ce34e8858d0b75067f944d6c394bb10d4554a /src/cmd_oper.cpp | |
parent | ca7d83f7e5427e4b900762a9faa22be7a56fbaef (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
Diffstat (limited to 'src/cmd_oper.cpp')
-rw-r--r-- | src/cmd_oper.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
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++) |