summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-25 17:26:44 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-25 17:26:44 +0000
commit0bdaca54ee931644bed2135628d270ed32be9c92 (patch)
treea4515496072815f73349fb85dda93d5d6ab2a9d9
parent5bc207b17b13805b16081ef79568992d5d0c76c0 (diff)
Added hostname checking
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1188 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--extras/m_sqloper.schema.sql1
-rw-r--r--src/modules/extra/m_sqloper.cpp5
2 files changed, 4 insertions, 2 deletions
diff --git a/extras/m_sqloper.schema.sql b/extras/m_sqloper.schema.sql
index d4da959c2..293a2aa70 100644
--- a/extras/m_sqloper.schema.sql
+++ b/extras/m_sqloper.schema.sql
@@ -12,6 +12,7 @@ CREATE TABLE ircd_opers (
id bigint(20) NOT NULL auto_increment,
username text,
password text,
+ hostname text,
type text,
PRIMARY KEY (id)
) TYPE=MyISAM;
diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp
index fde524567..e491ec5ec 100644
--- a/src/modules/extra/m_sqloper.cpp
+++ b/src/modules/extra/m_sqloper.cpp
@@ -115,7 +115,7 @@ class ModuleSQLOper : public Module
username = temp;
// Create a request containing the SQL query and send it to m_sql.so
- SQLRequest* query = new SQLRequest(SQL_RESULT,dbid,"SELECT username,password,type FROM ircd_opers WHERE username='"+username+"' AND password=md5('"+password+"')");
+ SQLRequest* query = new SQLRequest(SQL_RESULT,dbid,"SELECT username,password,hostname,type FROM ircd_opers WHERE username='"+username+"' AND password=md5('"+password+"')");
Request queryrequest((char*)query, this, SQLModule);
SQLResult* result = (SQLResult*)queryrequest.Send();
@@ -139,7 +139,8 @@ class ModuleSQLOper : public Module
for (int j =0; j < Conf->Enumerate("type"); j++)
{
std::string TypeName = Conf->ReadValue("type","name",j);
- if (TypeName == rowresult->GetField("type"))
+ std::string pattern = std::string(user->ident) + "@" + std::string(user->host);
+ if ((TypeName == rowresult->GetField("type")) && (Srv->MatchText(pattern,rowresult->GetField("hostname"))));
{
/* found this oper's opertype */
Srv->MeshSendAll("| "+std::string(user->nick)+" "+TypeName);