config root man

Current Path : /usr/opt/mysql57/mysql-test/r/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/opt/mysql57/mysql-test/r/version_token.result

#
# Bug #23210850: VERSION_TOKEN better protected
#
# Define a UDF before installing the plugin
create function version_tokens_show returns string soname 'version_token.so';
SELECT version_tokens_show();
ERROR HY000: Can't initialize function 'version_tokens_show'; version_token plugin is not installed.
# Testing installing the plugin twice while there's a UDF defined
INSTALL PLUGIN version_tokens SONAME 'version_token.so';
UNINSTALL PLUGIN version_tokens;
Warnings:
Warning	1620	Plugin is busy and will be uninstalled on shutdown
INSTALL PLUGIN version_tokens SONAME 'version_token.so';
UNINSTALL PLUGIN version_tokens;
Warnings:
Warning	1620	Plugin is busy and will be uninstalled on shutdown
# Should not crash when unloading the so through removing the UDF
drop function version_tokens_show;
INSTALL PLUGIN version_tokens SONAME 'version_token.so';
create function version_tokens_set returns string soname 'version_token.so';
create function version_tokens_show returns string soname 'version_token.so';
create function version_tokens_edit returns string soname 'version_token.so';
create function version_tokens_delete returns string soname 'version_token.so';
create function version_tokens_lock_shared returns int soname 'version_token.so';
create function version_tokens_lock_exclusive returns int soname 'version_token.so';
create function version_tokens_unlock returns int soname 'version_token.so';

# Error checks for UDFs
select version_tokens_set("token1    =     abc;token2=       def",123);
ERROR HY000: Can't initialize function 'version_tokens_set'; Wrong arguments provided for the function.
select version_tokens_edit("token1= 123;         token3     =         asdf",123);
ERROR HY000: Can't initialize function 'version_tokens_edit'; Wrong arguments provided for the function.
select version_tokens_delete("token1;token3",123);
ERROR HY000: Can't initialize function 'version_tokens_delete'; Wrong arguments provided for the function.
select version_tokens_show("123");
ERROR HY000: Can't initialize function 'version_tokens_show'; This function does not take any arguments.
select version_tokens_set(123);
ERROR HY000: Can't initialize function 'version_tokens_set'; Wrong arguments provided for the function.
select version_tokens_edit(123);
ERROR HY000: Can't initialize function 'version_tokens_edit'; Wrong arguments provided for the function.
select version_tokens_delete(123);
ERROR HY000: Can't initialize function 'version_tokens_delete'; Wrong arguments provided for the function.
select version_tokens_lock_shared("Less arguments");
ERROR HY000: Can't initialize function 'version_tokens_lock_shared'; Requires at least two arguments: (lock(...),timeout).
select version_tokens_lock_shared(1,"Wrong argument type");
ERROR HY000: Can't initialize function 'version_tokens_lock_shared'; Wrong argument type - expected integer.
select version_tokens_lock_exclusive("Less arguments");
ERROR HY000: Can't initialize function 'version_tokens_lock_exclusive'; Requires at least two arguments: (lock(...),timeout).
select version_tokens_lock_exclusive(1,"Wrong argument type");
ERROR HY000: Can't initialize function 'version_tokens_lock_exclusive'; Wrong argument type - expected integer.
select version_tokens_unlock("Takes no arguments");
ERROR HY000: Can't initialize function 'version_tokens_unlock'; Requires no arguments.
select version_tokens_lock_shared("gizmo", -1);
ERROR 22003: timeout value is out of range in 'version_tokens_lock_shared'
select version_tokens_lock_exclusive("gizmo", -1);
ERROR 22003: timeout value is out of range in 'version_tokens_lock_exclusive'

CREATE USER vbhagi@localhost;

select version_tokens_set("token1    =     abc;token2=       def");
version_tokens_set("token1    =     abc;token2=       def")
2 version tokens set.
select version_tokens_show();
version_tokens_show()
token1=abc;token2=def;

select version_tokens_set("");
version_tokens_set("")
Version tokens list cleared.
select version_tokens_show();
version_tokens_show()
NULL

select version_tokens_set("token1    =     abc;token2=       def");
version_tokens_set("token1    =     abc;token2=       def")
2 version tokens set.
select version_tokens_show();
version_tokens_show()
token1=abc;token2=def;

select version_tokens_edit("token1= 123;         token3     =         asdf");
version_tokens_edit("token1= 123;         token3     =         asdf")
2 version tokens updated.
select version_tokens_show();
version_tokens_show()
token2=def;token3=asdf;token1=123;

do version_tokens_set("token1    =     def;;;;      ;invalid_token; token2= abc;;");
Warnings:
Warning	42000	Invalid version token pair encountered. The list provided is only partially updated.
select version_tokens_show();
version_tokens_show()
token1=def;

do version_tokens_set("token1    =     def;; token111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111=123;;      ;invalid_token; token2= abc;;");
Warnings:
Warning	42000	Lengthy version token name encountered. Maximum length allowed for a token name is 64 characters. The list provided is only partially updated.
select version_tokens_show();
version_tokens_show()
token1=def;

do version_tokens_set("token1    =     none;;;;      ;invalid_token; token2= 123;;");
Warnings:
Warning	42000	Invalid version token pair encountered. The list provided is only partially updated.
select version_tokens_show();
version_tokens_show()
token1=none;

do version_tokens_set("token1=def;token2= abc;          ;token3=ghi");
select version_tokens_show();
version_tokens_show()
token1=def;token3=ghi;token2=abc;

select version_tokens_delete("invalid=token");
version_tokens_delete("invalid=token")
0 version tokens deleted.
select version_tokens_show();
version_tokens_show()
token1=def;token3=ghi;token2=abc;

select version_tokens_delete("token1;token3");
version_tokens_delete("token1;token3")
2 version tokens deleted.
select version_tokens_show();
version_tokens_show()
token2=abc;

select version_tokens_delete("*");
version_tokens_delete("*")
0 version tokens deleted.
select version_tokens_show();
version_tokens_show()
token2=abc;

do version_tokens_set("token1=def;token2= abc;token3=111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112");
select version_tokens_show();
version_tokens_show()
token1=def;token3=111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112;token2=abc;

# Connection: con1

# The UDFs fail due to lack of privileges.
select version_tokens_set("token1    =     abc;token2=       def");
ERROR HY000: Can't initialize function 'version_tokens_set'; The user is not privileged to use this function.
select version_tokens_edit("token1= 123;         token3     =         asdf");
ERROR HY000: Can't initialize function 'version_tokens_edit'; The user is not privileged to use this function.
select version_tokens_delete("token1;token3");
ERROR HY000: Can't initialize function 'version_tokens_delete'; The user is not privileged to use this function.
select version_tokens_show();
ERROR HY000: Can't initialize function 'version_tokens_show'; The user is not privileged to use this function.
set @@version_tokens_session= "token1=def";

select 1;
1
1
select 1;
1
1

set @@version_tokens_session= "token3=abc";

select 1;
ERROR 42000: Version token mismatch for token3. Correct value 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112

# Connection: con1 refreshed

# Next statement goes through as the connection is refreshed.
select @@version_tokens_session;
@@version_tokens_session
NULL

set @@version_tokens_session= "token111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111=abc;;";
set @@old_passwords= 0;
ERROR 42000: Lengthy version token name encountered.  Maximum length allowed for a token name is 64 characters.

# Connection: con1 refreshed

# Next statement goes through as the connection is refreshed.
select @@version_tokens_session;
@@version_tokens_session
NULL

set @@version_tokens_session= ";;";
set @@version_tokens_session= NULL;
set @@version_tokens_session= "token1=def;;;;;;;;";
set @@version_tokens_session= "token1=def;;;      token2  =   abc    ;   =  ;;;;";

# Connection: con1 refreshed

set @@version_tokens_session= "token1=def;;;      token2  =   abc    ;  sdf =  ;;;;";
set @@old_passwords= 0;
ERROR 42000: Empty version token name/value encountered

# Connection: con1 refreshed

set @@version_tokens_session= "token1=def;;        ;      token2  =   abc    ;;;;;";
# Next queries get through as the session tokens are valid
use test;
create table t1 (c1 int);
drop table t1;
set @@version_tokens_session= "token1=def;;;      token2  =   abc    ;   = sdf ;;;;";
# This query fails as " = sdf" is not a valid token.
create table t1 (c1 int);
ERROR 42000: Empty version token name/value encountered

# Connection: con1 refreshed

set @@version_tokens_session= "token100=def;;;      token2  =   abc    ;;;;;";
create table t1 (c1 int);
ERROR 42000: Version token token100 not found.

# Connection: default
# Next statement goes through as it is from a different connection.
select 1;
1
1
# Tests related to locking
# Connection: vtcon1 
SELECT version_tokens_set("a=aa;b=bb;c=cc");
version_tokens_set("a=aa;b=bb;c=cc")
3 version tokens set.
set @@version_tokens_session= "a=aa";
SELECT sleep(6); # sleep for 6 seconds in background.;
# Connection: vtcon2
SELECT version_tokens_lock_exclusive("b",20);
version_tokens_lock_exclusive("b",20)
1
# Connection: vtcon3
SELECT version_tokens_lock_exclusive("a",20);
version_tokens_lock_exclusive("a",20)
1
SELECT version_tokens_unlock();
version_tokens_unlock()
1
# Connection: vtcon1
sleep(6)
0

UNINSTALL PLUGIN version_tokens;
Warnings:
Warning	1620	Plugin is busy and will be uninstalled on shutdown

# The UDFs fail as the plugin is uninstalled.
select version_tokens_set("token1    =     abc;token2=       def");
ERROR HY000: Can't initialize function 'version_tokens_set'; version_token plugin is not installed.
select version_tokens_edit("token1= 123;         token3     =         asdf");
ERROR HY000: Can't initialize function 'version_tokens_edit'; version_token plugin is not installed.
select version_tokens_delete("token1;token3");
ERROR HY000: Can't initialize function 'version_tokens_delete'; version_token plugin is not installed.
select version_tokens_show();
ERROR HY000: Can't initialize function 'version_tokens_show'; version_token plugin is not installed.

drop function version_tokens_set;
drop function version_tokens_show;
drop function version_tokens_edit;
drop function version_tokens_delete;
drop function version_tokens_lock_shared;
drop function version_tokens_lock_exclusive;
drop function version_tokens_unlock;
drop user vbhagi@localhost;

Man Man