diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/sql/schema.sql | 10 | ||||
-rw-r--r-- | util/updates/update_2.23.sql | 6 |
2 files changed, 15 insertions, 1 deletions
diff --git a/util/sql/schema.sql b/util/sql/schema.sql index 046eccf6..09b334f9 100644 --- a/util/sql/schema.sql +++ b/util/sql/schema.sql @@ -363,13 +363,21 @@ CREATE TABLE users ( username varchar(20) NOT NULL UNIQUE, mail varchar(100) NOT NULL, perm smallint NOT NULL DEFAULT 1+4+16, + -- Interpretation of the passwd column depends on its length: + -- * 29 bytes: Password reset token + -- First 9 bytes: salt (ASCII) + -- Latter 20 bytes: sha1(hex(token) + salt) + -- 'token' is a sha1 digest obtained from random data. + -- * 41 bytes: Hashed/salted password + -- First 9 bytes: salt (ASCII) + -- Latter 32 bytes: sha256(global_salt + password + salt) + -- * Anything else: Invalid, account disabled. passwd bytea NOT NULL DEFAULT '', registered timestamptz NOT NULL DEFAULT NOW(), c_votes integer NOT NULL DEFAULT 0, c_changes integer NOT NULL DEFAULT 0, ip inet NOT NULL DEFAULT '0.0.0.0', c_tags integer NOT NULL DEFAULT 0, - salt character(9) NOT NULL DEFAULT '', ign_votes boolean NOT NULL DEFAULT FALSE, email_confirmed boolean NOT NULL DEFAULT FALSE ); diff --git a/util/updates/update_2.23.sql b/util/updates/update_2.23.sql index f93b1480..28117f4b 100644 --- a/util/updates/update_2.23.sql +++ b/util/updates/update_2.23.sql @@ -92,3 +92,9 @@ ALTER TABLE releases_platforms ALTER COLUMN platform TYPE platform USING platfor ALTER TABLE vn ALTER COLUMN c_platforms DROP DEFAULT; ALTER TABLE vn ALTER COLUMN c_platforms TYPE platform[] USING string_to_array(c_platforms, '/')::platform[]; ALTER TABLE vn ALTER COLUMN c_platforms SET DEFAULT '{}'; + + +-- Merging passwd and salt +--SELECT length(passwd), count(*) from users group by length(passwd); +UPDATE users SET passwd = convert_to(salt, 'UTF-8') || passwd; +ALTER TABLE users DROP COLUMN salt; |