From e386bf6b58876436e8048ab327da883cc3dfb108 Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 29 Mar 2016 12:37:49 +0200 Subject: [PATCH] In SQL files create Users table with SCRAM support by default (#956) --- sql/lite.sql | 3 +++ sql/mssql.sql | 3 +++ sql/mysql.sql | 5 ++++- sql/pg.sql | 5 ++++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/sql/lite.sql b/sql/lite.sql index 0cf7ff414..1741ea950 100644 --- a/sql/lite.sql +++ b/sql/lite.sql @@ -19,6 +19,9 @@ CREATE TABLE users ( username text PRIMARY KEY, password text NOT NULL, + serverkey text NOT NULL DEFAULT '', + salt text NOT NULL DEFAULT '', + iterationcount integer NOT NULL DEFAULT 0, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ); diff --git a/sql/mssql.sql b/sql/mssql.sql index 155ea64a0..675542b68 100644 --- a/sql/mssql.sql +++ b/sql/mssql.sql @@ -362,6 +362,9 @@ WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW CREATE TABLE [dbo].[users] ( [username] [varchar] (250) NOT NULL, [password] [text] NOT NULL, + [serverkey] [text] NOT NULL, + [salt] [text] NOT NULL, + [iterationcount] [smallint] NOT NULL DEFAULT 0, [created_at] [datetime] NOT NULL DEFAULT GETDATE(), CONSTRAINT [users_PRIMARY] PRIMARY KEY CLUSTERED ( diff --git a/sql/mysql.sql b/sql/mysql.sql index cc603c1b1..f08b3a4b9 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -19,10 +19,13 @@ CREATE TABLE users ( username varchar(191) PRIMARY KEY, password text NOT NULL, + serverkey text NOT NULL DEFAULT '', + salt text NOT NULL DEFAULT '', + iterationcount integer NOT NULL DEFAULT 0, created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; --- To support SCRAM auth: +-- Add support for SCRAM auth to a database created before ejabberd 16.03: -- ALTER TABLE users ADD COLUMN serverkey text NOT NULL DEFAULT ''; -- ALTER TABLE users ADD COLUMN salt text NOT NULL DEFAULT ''; -- ALTER TABLE users ADD COLUMN iterationcount integer NOT NULL DEFAULT 0; diff --git a/sql/pg.sql b/sql/pg.sql index 87cccd484..1bc4f397c 100644 --- a/sql/pg.sql +++ b/sql/pg.sql @@ -19,10 +19,13 @@ CREATE TABLE users ( username text PRIMARY KEY, "password" text NOT NULL, + serverkey text NOT NULL DEFAULT '', + salt text NOT NULL DEFAULT '', + iterationcount integer NOT NULL DEFAULT 0, created_at TIMESTAMP NOT NULL DEFAULT now() ); --- To support SCRAM auth: +-- Add support for SCRAM auth to a database created before ejabberd 16.03: -- ALTER TABLE users ADD COLUMN serverkey text NOT NULL DEFAULT ''; -- ALTER TABLE users ADD COLUMN salt text NOT NULL DEFAULT ''; -- ALTER TABLE users ADD COLUMN iterationcount integer NOT NULL DEFAULT 0;