From fd556922919a35d6f292089fe2340ebc16574a2b Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 4 Feb 2006 17:09:24 +0000 Subject: Allow space seperated hostlist in e.g. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3074 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/cmd_oper.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src') 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 all_opers; extern std::vector 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++) -- cgit v1.2.3