| 
      
      
      From: <ta...@us...> - 2015-03-19 18:58:37
      
     | 
| Revision: 61025
          http://sourceforge.net/p/firebird/code/61025
Author:   tabloid
Date:     2015-03-19 18:58:34 +0000 (Thu, 19 Mar 2015)
Log Message:
-----------
See added / modified .fbt file(s)
Added Paths:
-----------
    qa/fbt-repository/trunk/tests/bugs/core_3736.fbt
    qa/fbt-repository/trunk/tests/functional/tabloid/batches/svn-get-local-updated.bat.txt
Added: qa/fbt-repository/trunk/tests/bugs/core_3736.fbt
===================================================================
--- qa/fbt-repository/trunk/tests/bugs/core_3736.fbt	                        (rev 0)
+++ qa/fbt-repository/trunk/tests/bugs/core_3736.fbt	2015-03-19 18:58:34 UTC (rev 61025)
@@ -0,0 +1,148 @@
+{
+'id': 'bugs.core_3736',
+'qmid': '',
+'tracker_id': 'CORE-3736',
+'title': 'WITH LOCK clause is allowed for users with read-only rights on some table, thus blocking others from updating this table',
+'description': '',
+'versions': [
+{
+ 'firebird_version': '3.0',
+ 'platform': 'All',
+ 'test_type': 'ISQL',
+ 'init_script': 
+  """
+  """,
+ 'test_script': 
+  """
+    drop user tmp$c3736_ro; -- read-only access to the table
+    drop user tmp$c3736_ud; -- access for UPDATE and DELETE on the table
+    commit;
+    
+    create user tmp$c3736_ro password 'tmp$c3736_ro';
+    create user tmp$c3736_ud password 'tmp$c3736_ud';
+    commit;
+    
+    revoke all on all from tmp$c3736_ro;
+    revoke all on all from tmp$c3736_ud;
+    commit;
+    
+    recreate table t_read_only_for_non_sys(id int);
+    commit;
+    insert into t_read_only_for_non_sys values(1);
+    insert into t_read_only_for_non_sys values(2);
+    insert into t_read_only_for_non_sys values(3);
+    insert into t_read_only_for_non_sys values(4);
+    insert into t_read_only_for_non_sys values(5);
+    commit;
+    
+    grant select on t_read_only_for_non_sys to tmp$c3736_ro;
+    commit;
+    grant update,delete,select on t_read_only_for_non_sys to tmp$c3736_ud;
+    commit;
+    
+    set transaction no wait;
+    
+    update t_read_only_for_non_sys set id = id where id >= 4;
+    
+    set term ^;
+    execute block returns( who_am_i type of column sec$users.sec$user_name, my_action varchar(20), what_i_see int )
+    as
+      declare v_dbname type of column mon$database.mon$database_name;
+      declare v_usr_ro type of column sec$users.sec$user_name = 'tmp$c3736_ro';
+      declare v_pwd_ro varchar(20) = 'tmp$c3736_ro';
+      declare v_connect varchar(255);
+    begin
+      select 'localhost:' || d.mon$database_name
+      from mon$database d
+      into v_dbname;
+    
+      for
+        execute statement 'select current_user, ''select_read_only'', id from t_read_only_for_non_sys' --  for update with lock'
+        on external (v_dbname)
+        as user (v_usr_ro) password (v_pwd_ro)
+        into who_am_i, my_action, what_i_see
+      do 
+        suspend;
+    
+      for
+        execute statement 'select current_user, ''select_with_lock'', id from t_read_only_for_non_sys for update with lock'
+        on external (v_dbname)
+        as user (v_usr_ro) password (v_pwd_ro)
+        into who_am_i, my_action, what_i_see
+      do 
+        suspend;
+    
+    
+    end
+    ^
+    set term ;^
+    rollback;
+    
+    set transaction no wait;
+    
+    update t_read_only_for_non_sys set id = id where id >= 4;
+    
+    set term ^;
+    execute block returns( who_am_i type of column sec$users.sec$user_name, my_action varchar(20), what_i_see int )
+    as
+      declare v_dbname type of column mon$database.mon$database_name;
+      declare v_usr_ud type of column sec$users.sec$user_name = 'tmp$c3736_ud';
+      declare v_pwd_ud varchar(20) = 'tmp$c3736_ud';
+      declare v_connect varchar(255);
+    begin
+      select 'localhost:' || d.mon$database_name
+      from mon$database d
+      into v_dbname;
+    
+      for
+        execute statement 'select current_user, ''select_with_lock'', id from t_read_only_for_non_sys for update with lock'
+        on external (v_dbname)
+        as user (v_usr_ud) password (v_pwd_ud)
+        into who_am_i, my_action, what_i_see
+      do 
+        suspend;
+    
+    end
+    ^
+    set term ;^
+    rollback;
+  """,
+ 'expected_stdout': 
+  """
+    WHO_AM_I                        MY_ACTION              WHAT_I_SEE 
+    =============================== ==================== ============ 
+    TMP$C3736_RO                    select_read_only                1 
+    TMP$C3736_RO                    select_read_only                2 
+    TMP$C3736_RO                    select_read_only                3 
+    TMP$C3736_RO                    select_read_only                4 
+    TMP$C3736_RO                    select_read_only                5 
+    
+    
+    WHO_AM_I                        MY_ACTION              WHAT_I_SEE 
+    =============================== ==================== ============ 
+    TMP$C3736_UD                    select_with_lock                1 
+    TMP$C3736_UD                    select_with_lock                2 
+    TMP$C3736_UD                    select_with_lock                3 
+  """,
+ 'expected_stderr': 
+  """
+    Execute statement error at isc_dsql_prepare :
+    335544352 : no permission for UPDATE access to TABLE T_READ_ONLY_FOR_NON_SYS
+    Statement : select current_user, 'select_with_lock', id from t_read_only_for_non_sys for update with lock
+    Execute statement error at isc_dsql_fetch :
+    335544878 : concurrent transaction number is 806
+    Statement : select current_user, 'select_with_lock', id from t_read_only_for_non_sys for update with lock
+  """,
+  'substitutions': [
+    ('=.*',''),
+    ('Statement failed, SQLSTATE.*',''),
+    ('record not found for user:.*',''),
+    ('unknown ISC error.*', ''),
+    ('Warning: ALL on ALL is not granted to.*', ''),
+    ('Data source.*',''),
+    ('TABLE T_READ_ONLY_FOR_NON_SYS',''),
+    ('concurrent transaction number is.*','')
+  ]
+}
+]
+}
Property changes on: qa/fbt-repository/trunk/tests/bugs/core_3736.fbt
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: qa/fbt-repository/trunk/tests/functional/tabloid/batches/svn-get-local-updated.bat.txt
===================================================================
--- qa/fbt-repository/trunk/tests/functional/tabloid/batches/svn-get-local-updated.bat.txt	                        (rev 0)
+++ qa/fbt-repository/trunk/tests/functional/tabloid/batches/svn-get-local-updated.bat.txt	2015-03-19 18:58:34 UTC (rev 61025)
@@ -0,0 +1 @@
+svn st | findstr /r /v /b /c:"?"
\ No newline at end of file
Property changes on: qa/fbt-repository/trunk/tests/functional/tabloid/batches/svn-get-local-updated.bat.txt
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |