From f0eac3c55243b8c9520a45db3c248638d2bc0f34 Mon Sep 17 00:00:00 2001 From: Alexander Peshkov Date: Tue, 22 Mar 2016 19:32:11 +0300 Subject: [PATCH] Backported fix for CORE-5162: SEC$ tables and tag/attributes --- doc/sql.extensions/README.user_management | 16 +++++++++------- src/include/gen/ids.h | 1 + src/jrd/UserManagement.cpp | 3 +++ src/jrd/relations.h | 1 + 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/doc/sql.extensions/README.user_management b/doc/sql.extensions/README.user_management index a64acbb828..37b8f16389 100644 --- a/doc/sql.extensions/README.user_management +++ b/doc/sql.extensions/README.user_management @@ -9,13 +9,14 @@ Author: Syntax is: - CREATE USER name {PASSWORD 'password'} [ options ] [ TAGS ( tag [, tag [, tag ...]] ) ] - ALTER USER name SET [PASSWORD 'password'] [ options ] [ TAGS ( tag [, tag [, tag ...]] ) ] - ALTER CURRENT USER SET [PASSWORD 'password'] [ options ] [ TAGS ( tag [, tag [, tag ...]] ) ] - CREATE OR ALTER USER name SET [PASSWORD 'password'] [ options ] [ TAGS ( tag [, tag [, tag ...]] ) ] - DROP USER name [USING PLUGIN name]; + CREATE USER name [ options ] [ TAGS ( tag [, tag [, tag ...]] ) ] + ALTER USER name [ SET ] [ options ] [ TAGS ( tag [, tag [, tag ...]] ) ] + ALTER CURRENT USER [ SET ] [ options ] [ TAGS ( tag [, tag [, tag ...]] ) ] + CREATE OR ALTER USER name [ SET ] [ options ] [ TAGS ( tag [, tag [, tag ...]] ) ] + DROP USER name [ USING PLUGIN name ]; where OPTIONS is a (probably empty) list of following options: +- PASSWORD 'password' - FIRSTNAME 'firstname' - MIDDLENAME 'middlename' - LASTNAME 'lastname' @@ -93,9 +94,10 @@ Samples (suppose UserManager=Srp,Legacy_UserManager in firebird.conf): SELECT CAST(U.SEC$USER_NAME AS CHAR(20)) LOGIN, CAST(A.SEC$KEY AS CHAR(10)) TAG, CAST(A.SEC$VALUE AS CHAR(20)) "VALUE", - SEC$PLUGIN "PLUGIN" + U.SEC$PLUGIN "PLUGIN" FROM SEC$USERS U LEFT JOIN SEC$USER_ATTRIBUTES A - ON U.SEC$USER_NAME = A.SEC$USER_NAME; + ON U.SEC$USER_NAME = A.SEC$USER_NAME + AND U.SEC$PLUGIN = A.SEC$PLUGIN; LOGIN TAG VALUE PLUGIN ==================== ========== ==================== =============================== diff --git a/src/include/gen/ids.h b/src/include/gen/ids.h index 9e0a5f6a11..08156f9e53 100644 --- a/src/include/gen/ids.h +++ b/src/include/gen/ids.h @@ -634,6 +634,7 @@ const USHORT f_sec_attr_user = 0; const USHORT f_sec_attr_key = 1; const USHORT f_sec_attr_value = 2; + const USHORT f_sec_attr_plugin = 3; // Relation 45 (RDB$AUTH_MAPPING) diff --git a/src/jrd/UserManagement.cpp b/src/jrd/UserManagement.cpp index 11b758c0b6..1740cfc922 100644 --- a/src/jrd/UserManagement.cpp +++ b/src/jrd/UserManagement.cpp @@ -542,6 +542,9 @@ void UserManagement::list(IUser* u, unsigned cachePosition) putField(threadDbb, record, DumpField(f_sec_attr_value, VALUE_STRING, b->value.length(), b->value.c_str())); + putField(threadDbb, record, + DumpField(f_sec_attr_plugin, VALUE_STRING, static_cast(plugName.length()), plugName.c_str())); + buffer->store(record); } } diff --git a/src/jrd/relations.h b/src/jrd/relations.h index d3e68c2e95..70879d81e8 100644 --- a/src/jrd/relations.h +++ b/src/jrd/relations.h @@ -633,6 +633,7 @@ RELATION(nam_sec_user_attributes, rel_sec_user_attributes, ODS_12_0, rel_virtual FIELD(f_sec_attr_user, nam_user_name, fld_user, 0, ODS_12_0) FIELD(f_sec_attr_key, nam_sec_attr_key, fld_attr_key, 0, ODS_12_0) FIELD(f_sec_attr_value, nam_sec_attr_value, fld_attr_value, 0, ODS_12_0) + FIELD(f_sec_attr_plugin, nam_sec_plugin, fld_plugin_name, 0, ODS_12_0) END_RELATION // Relation 45 (RDB$AUTH_MAPPING)