summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-02-22 17:12:06 +0100
committerAttila Molnar <attilamolnar@hush.com>2015-02-22 17:12:06 +0100
commit21e25f7aa9091821e24447784d08d8fdd905f1c3 (patch)
tree055430ead556f6ec6326543124df87ec79e91dba
parent2d97be1d32cb518b104583239c9483410b268fac (diff)
parent75e7eaceba5031927445d5fc9861c8c107fdaa8f (diff)
Merge pull request #1000 from ShutterQuick/master+281
m_sqloper: Add `active` column
-rw-r--r--extras/m_sqloper.mssql.sql1
-rw-r--r--extras/m_sqloper.mysql.sql19
-rw-r--r--extras/m_sqloper.postgresql.sql8
-rw-r--r--extras/m_sqloper.sqlite3.sql4
-rw-r--r--src/modules/m_sqloper.cpp2
5 files changed, 8 insertions, 26 deletions
diff --git a/extras/m_sqloper.mssql.sql b/extras/m_sqloper.mssql.sql
index 5056e12e9..7580a4391 100644
--- a/extras/m_sqloper.mssql.sql
+++ b/extras/m_sqloper.mssql.sql
@@ -4,5 +4,6 @@ CREATE TABLE [dbo].[ircd_opers] (
[password] varchar(255) NULL,
[hostname] varchar(255) NULL,
[type] varchar(255) NULL,
+ [active] bit NOT NULL DEFAULT 1,
PRIMARY KEY CLUSTERED ([id])
)
diff --git a/extras/m_sqloper.mysql.sql b/extras/m_sqloper.mysql.sql
index 293a2aa70..f43495806 100644
--- a/extras/m_sqloper.mysql.sql
+++ b/extras/m_sqloper.mysql.sql
@@ -1,24 +1,9 @@
--- MySQL dump 9.11
---
--- Host: localhost Database: brain
--- ------------------------------------------------------
--- Server version 4.0.20
-
---
--- Table structure for table `ircd_opers`
---
-
CREATE TABLE ircd_opers (
id bigint(20) NOT NULL auto_increment,
username text,
password text,
hostname text,
type text,
+ active tinyint(1) NOT NULL DEFAULT 1,
PRIMARY KEY (id)
-) TYPE=MyISAM;
-
---
--- Dumping data for table `ircd_opers`
---
-
-
+) ENGINE=MyISAM;
diff --git a/extras/m_sqloper.postgresql.sql b/extras/m_sqloper.postgresql.sql
index fd640949f..4244abc22 100644
--- a/extras/m_sqloper.postgresql.sql
+++ b/extras/m_sqloper.postgresql.sql
@@ -1,14 +1,10 @@
---
--- PostgreSQL database dump
---
-
CREATE TABLE ircd_opers (
id serial NOT NULL,
username text,
"password" text,
hostname text,
- "type" text
+ "type" text,
+ active boolean NOT NULL DEFAULT 1
);
ALTER TABLE ONLY ircd_opers
ADD CONSTRAINT ircd_opers_pkey PRIMARY KEY (id);
-
diff --git a/extras/m_sqloper.sqlite3.sql b/extras/m_sqloper.sqlite3.sql
index 1bb2937b8..1c607e664 100644
--- a/extras/m_sqloper.sqlite3.sql
+++ b/extras/m_sqloper.sqlite3.sql
@@ -3,5 +3,5 @@ id integer primary key,
username text,
password text,
hostname text,
-type text);
-
+type text,
+active integer NOT NULL DEFAULT 1);
diff --git a/src/modules/m_sqloper.cpp b/src/modules/m_sqloper.cpp
index bc46bd7e7..b5f0d6c47 100644
--- a/src/modules/m_sqloper.cpp
+++ b/src/modules/m_sqloper.cpp
@@ -122,7 +122,7 @@ public:
SQL.SetProvider("SQL/" + dbid);
hashtype = tag->getString("hash");
- query = tag->getString("query", "SELECT hostname as host, type FROM ircd_opers WHERE username='$username' AND password='$password'");
+ query = tag->getString("query", "SELECT hostname as host, type FROM ircd_opers WHERE username='$username' AND password='$password' AND active=1;");
}
ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, LocalUser *user, bool validated, const std::string &original_line) CXX11_OVERRIDE