List:Commits« Previous MessageNext Message »
From:Horst.Hunger Date:June 24 2010 8:55am
Subject:bzr commit into mysql-next-mr-wl1054 branch (horst.hunger:2965) WL#1054
View as plain text  
#At file:///home/horst/bzr/next-1054/ based on revid:georgi.kodinov@stripped

 2965 Horst.Hunger	2010-06-24
      QA for WL#1054 (second edition).

    added:
      mysql-test/r/plugin_auth_qa.result
      mysql-test/r/plugin_auth_qa_1.result
      mysql-test/r/plugin_auth_qa_2.result
      mysql-test/r/plugin_auth_qa_3.result
      mysql-test/r/plugin_auth_qa_4.result
      mysql-test/r/plugin_auth_qa_5.result
      mysql-test/t/plugin_auth_qa-master.opt
      mysql-test/t/plugin_auth_qa.test
      mysql-test/t/plugin_auth_qa_1-master.opt
      mysql-test/t/plugin_auth_qa_1.test
      mysql-test/t/plugin_auth_qa_2-master.opt
      mysql-test/t/plugin_auth_qa_2.test
      mysql-test/t/plugin_auth_qa_3-master.opt
      mysql-test/t/plugin_auth_qa_3.test
      mysql-test/t/plugin_auth_qa_4-master.opt
      mysql-test/t/plugin_auth_qa_4.test
      mysql-test/t/plugin_auth_qa_5-master.opt
      mysql-test/t/plugin_auth_qa_5.test
      plugin/auth/qa_test_2.c
      plugin/auth/qa_test_3.c
      plugin/auth/qa_test_4.c
      plugin/auth/qa_test_5.c
      plugin/auth/qa_test_6.c
      plugin/auth/qa_test_7.c
    modified:
      plugin/auth/CMakeLists.txt
      plugin/auth/Makefile.am
=== added file 'mysql-test/r/plugin_auth_qa.result'
--- a/mysql-test/r/plugin_auth_qa.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/plugin_auth_qa.result	2010-06-24 08:55:18 +0000
@@ -0,0 +1,329 @@
+INSTALL PLUGIN test_plugin_server SONAME 'auth_test_plugin.so';
+CREATE DATABASE test_user_db;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+========== test 1.1 ======================================================
+CREATE USER plug IDENTIFIED WITH test_plugin_server;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
+DROP USER plug;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
+DROP USER plug;
+CREATE USER plug IDENTIFIED WITH test_plugin_server AS '';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS '';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
+DROP USER plug;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+CREATE USER plug IDENTIFIED WITH test_plugin_server AS plug_dest;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'plug_dest' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS plug_dest;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'plug_dest' at line 1
+========== test 1.1 syntax errors ========================================
+CREATE USER plug IDENTIFIED WITH AS plug_dest;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS plug_dest' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH AS plug_dest;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS plug_dest' at line 1
+CREATE USER plug IDENTIFIED WITH;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+CREATE USER plug IDENTIFIED AS '';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS ''' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED AS '';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS ''' at line 1
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' IDENTIFIED WITH 'test_plugin_server';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED WITH 'test_plugin_server'' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug 
+IDENTIFIED WITH 'test_plugin_server' IDENTIFIED WITH 'test_plugin_server';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED WITH 'test_plugin_server'' at line 2
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS '' AS 'plug_dest';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS 'plug_dest'' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug AS '' AS 'plug_dest';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS '' AS 'plug_dest'' at line 1
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS '' 
+IDENTIFIED WITH test_plugin_server   AS 'plug_dest';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED WITH test_plugin_server   AS 'plug_dest'' at line 2
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS ''
+                 IDENTIFIED WITH test_plugin_server   AS 'plug_dest';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED WITH test_plugin_server   AS 'plug_dest'' at line 2
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd' 
+IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'' at line 2
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd'
+                      IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'' at line 2
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest' 
+USER plug_dest IDENTIFIED by 'plug_dest_pwd';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USER plug_dest IDENTIFIED by 'plug_dest_pwd'' at line 2
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+       USER plug_dest IDENTIFIED by 'plug_dest_pwd';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USER plug_dest IDENTIFIED by 'plug_dest_pwd'' at line 2
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest' 
+plug_dest IDENTIFIED by 'plug_dest_pwd';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'plug_dest IDENTIFIED by 'plug_dest_pwd'' at line 2
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+       plug_dest IDENTIFIED by 'plug_dest_pwd';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'plug_dest IDENTIFIED by 'plug_dest_pwd'' at line 2
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest' 
+IDENTIFIED by 'plug_dest_pwd';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED by 'plug_dest_pwd'' at line 2
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+       IDENTIFIED by 'plug_dest_pwd';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED by 'plug_dest_pwd'' at line 2
+========== test 1.1  combinations ==========================
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+========== test 1.1.1.6/1.1.2.5 ============================
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	plug_dest
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	plug_dest
+plug_dest		
+DROP USER plug, plug_dest;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	plug_dest
+DROP USER plug;
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug_dest		
+DROP USER plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	plug_dest
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	plug_dest
+plug_dest		
+DROP USER plug, plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	plug_dest
+DROP USER plug;
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug_dest		
+DROP USER plug_dest;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	plug_dest
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	plug_dest
+plug_dest		
+DROP USER plug, plug_dest;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	plug_dest
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug_dest		
+DROP USER plug_dest;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+ERROR HY000: GRANT with IDENTIFIED WITH is illegal because the user plug already exists
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server';
+ERROR HY000: GRANT with IDENTIFIED WITH is illegal because the user plug already exists
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+ERROR HY000: Operation CREATE USER failed for 'plug'@'%'
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server';
+ERROR HY000: Operation CREATE USER failed for 'plug'@'%'
+DROP USER plug;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string	password
+plug	test_plugin_server	plug_dest	
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string	password
+plug	test_plugin_server	plug_dest	*939AEE68989794C0F408277411C26055CDF41119
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug IDENTIFIED BY 'plug_dest_passwd';
+ERROR HY000: Operation CREATE USER failed for 'plug'@'%'
+DROP USER plug;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string	password
+plug	test_plugin_server	plug_dest	
+plug_dest	test_plugin_server	plug_dest	
+DROP USER plug,plug_dest;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string	password
+plug	test_plugin_server	plug_dest	
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest 
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string	password
+plug	test_plugin_server	plug_dest	
+plug_dest	test_plugin_server	plug_dest	
+DROP USER plug,plug_dest;
+========== test 1.1.1.1/1.1.2.1/1.1.1.5 ====================
+SET NAMES utf8;
+CREATE USER plüg IDENTIFIED WITH 'test_plugin_server' AS 'plmysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plüg	test_plugin_server	plüg_dest
+DROP USER plüg;
+CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plüg_dest		
+DROP USER plüg_dest;
+SET NAMES ascii;
+CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+pl??g	test_plugin_server	pl??g_dest
+DROP USER 'plüg';
+CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+pl??g_dest		
+DROP USER 'plüg_dest';
+SET NAMES latin1;
+========== test 1.1.1.5 ====================================
+CREATE USER 'plüg' IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
+ERROR HY000: Plugin 'test_plügin_server' is not loaded
+CREATE USER 'plug' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	plüg_dest
+DROP USER 'plug';
+CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plüg_dest		
+DROP USER 'plüg_dest';
+SET NAMES utf8;
+CREATE USER plüg IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
+ERROR HY000: Plugin 'test_plügin_server' is not loaded
+CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plüg	test_plugin_server	plüg_dest
+DROP USER 'plüg';
+CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plüg_dest		
+DROP USER 'plüg_dest';
+CREATE USER plELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plüg	test_plugin_server	plüg_dest
+DROP USER plüg;
+CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plüg_dest		
+DROP USER plüg_dest;
+========== test 1.1.1.2/1.1.2.2=============================
+SET @auth_name= 'test_plugin_server';
+CREATE USER plug IDENTIFIED WITH @auth_name AS 'plug_dest';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@auth_name AS 'plug_dest'' at line 1
+SET @auth_string= 'plug_dest';
+CREATE USER plug IDENTIFIED WITH test_plugin_server AS @auth_string;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@auth_string' at line 1
+========== test 1.1.1.3/1.1.2.3=============================
+CREATE USER plug IDENTIFIED WITH 'hh''s_test_plugin_server' AS 'plug_dest';
+ERROR HY000: Plugin 'hh's_test_plugin_server' is not loaded
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'hh''s_plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug	test_plugin_server	hh's_plug_dest
+DROP USER plug;
+CREATE USER 'hh''s_plug_dest' IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+hh's_plug_dest		
+DROP USER 'hh''s_plug_dest';
+========== test 1.1.1.4 ====================================
+CREATE USER plug IDENTIFIED WITH hh''s_test_plugin_server AS 'plug_dest';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''s_test_plugin_server AS 'plug_dest'' at line 1
+========== test 1.1.3.1 ====================================
+GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+grant_user	test_plugin_server	plug_dest
+CREATE USER plug_dest;
+DROP USER plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+grant_user	test_plugin_server	plug_dest
+plug_dest		
+DROP USER grant_user,plug_dest;
+set @save_sql_mode= @@sql_mode;
+SET @@sql_mode=no_auto_create_user;
+GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+grant_user	test_plugin_server	plug_dest
+CREATE USER plug_dest;
+DROP USER plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest;
+ERROR 42000: Can't find any matching row in the user table
+DROP USER grant_user;
+GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+grant_user	test_plugin_server	plug_dest
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string	password
+grant_user	test_plugin_server	plug_dest	
+plug_dest			*939AEE68989794C0F408277411C26055CDF41119
+DROP USER plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_user_passwd';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string	password
+grant_user	test_plugin_server	plug_dest	
+plug_dest			*560881EB651416CEF77314D07D55EDCD5FC1BD6D
+DROP USER grant_user,plug_dest;
+set @@sql_mode= @save_sql_mode;
+DROP DATABASE test_user_db;
+UNINSTALL PLUGIN test_plugin_server;

=== added file 'mysql-test/r/plugin_auth_qa_1.result'
--- a/mysql-test/r/plugin_auth_qa_1.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/plugin_auth_qa_1.result	2010-06-24 08:55:18 +0000
@@ -0,0 +1,328 @@
+INSTALL PLUGIN test_plugin_server SONAME 'auth_test_plugin.so';
+CREATE DATABASE test_user_db;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+========== test 1.1.3.2 ====================================
+CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+Tables_in_test_user_db
+t1
+REVOKE PROXY ON plug_dest FROM plug_user;
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+DROP USER plug_user,plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+GRANT PROXY ON plug_dest TO plug_user IDENTIFIED BY 'plug_dest_passwd';
+1)
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+Tables_in_test_user_db
+t1
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user'
+                         IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+2)
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+Tables_in_test_user_db
+t1
+REVOKE PROXY ON plug_dest FROM plug_user;
+3)
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+DROP USER plug_user;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+1)
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+GRANT PROXY ON plug_dest TO plug_user;
+2)
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+Tables_in_test_user_db
+t1
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user'
+                         IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+DROP USER plug_user,plug_dest;
+========== test 1.2 ========================================
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+RENAME USER plug_dest TO new_dest;
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+GRANT PROXY ON new_dest TO plug_user;
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+new_dest		
+plug_user	test_plugin_server	plug_dest
+DROP USER plug_user,new_dest;
+CREATE USER plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+GRANT PROXY ON plug_dest TO plug_user;
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+RENAME USER plug_dest TO new_dest;
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+GRANT PROXY ON new_dest TO plug_user;
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+new_dest		
+plug_user	test_plugin_server	plug_dest
+DROP USER plug_user,new_dest;
+CREATE USER plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+GRANT PROXY ON plug_dest TO plug_user;
+connect(plug_user,localhost,plug_user,plug_dest);
+select USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+plug_user@localhost	plug_dest@%
+connection default;
+disconnect plug_user;
+RENAME USER plug_user TO new_user;
+connect(plug_user,localhost,new_user,plug_dest);
+select USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+new_user@localhost	plug_dest@%
+connection default;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+new_user	test_plugin_server	plug_dest
+disconnect plug_user;
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+new_user	test_plugin_server	plug_dest
+plug_dest		
+UPDATE mysql.user SET user='plug_user' WHERE user='new_user';
+FLUSH PRIVILEGES;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug_dest		
+plug_user	test_plugin_server	plug_dest
+DROP USER plug_dest,plug_user;
+========== test 1.3 ========================================
+CREATE USER plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+GRANT PROXY ON plug_dest TO plug_user;
+connect(plug_user,localhost,plug_user,plug_dest);
+select USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+plug_user@localhost	plug_dest@%
+connection default;
+disconnect plug_user;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug_user	test_plugin_server	plug_dest
+UPDATE mysql.user SET user='new_user' WHERE user='plug_user';
+FLUSH PRIVILEGES;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+new_user	test_plugin_server	plug_dest
+UPDATE mysql.user SET authentication_string='new_dest' WHERE user='new_user';
+FLUSH PRIVILEGES;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+new_user	test_plugin_server	new_dest
+UPDATE mysql.user SET plugin='new_plugin_server' WHERE user='new_user';
+FLUSH PRIVILEGES;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+new_user	new_plugin_server	new_dest
+connect(plug_user,localhost,new_user,new_dest);
+ERROR HY000: Plugin 'new_plugin_server' is not loaded
+UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user';
+FLUSH PRIVILEGES;
+GRANT PROXY ON new_dest TO new_user;
+connect(plug_user,localhost,new_user,new_dest);
+select USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+new_user@localhost	new_dest@%
+connection default;
+disconnect plug_user;
+CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+new_dest		
+new_user	test_plugin_server	new_dest
+GRANT ALL PRIVILEGES ON test.* TO new_user;
+connect(plug_user,localhost,new_dest,new_dest_passwd);
+select USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+new_dest@localhost	new_dest@%
+connection default;
+disconnect plug_user;
+DROP USER new_user,new_dest;
+========== test 2, 2.1, 2.2 ================================
+CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
+CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+	test_plugin_server	proxied_user
+proxied_user		
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+proxied_user@localhost	proxied_user@%
+========== test 2.2.1 ======================================
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection default;
+disconnect proxy_con;
+connect(proxy_con,localhost,proxy_user,proxied_user);
+ERROR 28000: Access denied for user 'proxy_user'@'localhost' (using password: YES)
+GRANT PROXY ON proxied_user TO ''@'';
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+proxied_user@localhost	proxied_user@%
+connection default;
+disconnect proxy_con;
+connect(proxy_con,localhost,proxy_user,proxied_user);
+SELECT USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+proxy_user@localhost	proxied_user@
+========== test 2.2.1 ======================================
+SELECT @@proxy_user;
+@@proxy_user
+''@''
+connection default;
+disconnect proxy_con;
+DROP USER ''@'',proxied_user;
+GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'' 
+IDENTIFIED WITH test_plugin_server AS 'proxied_user';
+CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+	test_plugin_server	proxied_user
+proxied_user		
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+proxied_user@localhost	proxied_user@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection default;
+disconnect proxy_con;
+connect(proxy_con,localhost,proxy_user,proxied_user);
+ERROR 28000: Access denied for user 'proxy_user'@'localhost' (using password: YES)
+GRANT PROXY ON proxied_user TO ''@'';
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+proxied_user@localhost	proxied_user@%
+connection default;
+disconnect proxy_con;
+connect(proxy_con,localhost,proxy_user,proxied_user);
+SELECT USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+proxy_user@localhost	proxied_user@
+SELECT @@proxy_user;
+@@proxy_user
+''@''
+connection default;
+disconnect proxy_con;
+DROP USER ''@'',proxied_user;
+CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
+CREATE USER proxied_user_1 IDENTIFIED BY 'proxied_user_1_pwd';
+CREATE USER proxied_user_2 IDENTIFIED BY 'proxied_user_2_pwd';
+CREATE USER proxied_user_3 IDENTIFIED BY 'proxied_user_3_pwd';
+CREATE USER proxied_user_4 IDENTIFIED BY 'proxied_user_4_pwd';
+CREATE USER proxied_user_5 IDENTIFIED BY 'proxied_user_5_pwd';
+GRANT PROXY ON proxied_user_1 TO ''@'';
+GRANT PROXY ON proxied_user_2 TO ''@'';
+GRANT PROXY ON proxied_user_3 TO ''@'';
+GRANT PROXY ON proxied_user_4 TO ''@'';
+GRANT PROXY ON proxied_user_5 TO ''@'';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+	test_plugin_server	proxied_user
+proxied_user_1		
+proxied_user_2		
+proxied_user_3		
+proxied_user_4		
+proxied_user_5		
+connect(proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd');
+connect(proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd);
+connect(proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd);
+connect(proxy_con_4,localhost,proxied_user_4,proxied_user_4_pwd);
+connect(proxy_con_5,localhost,proxied_user_5,proxied_user_5_pwd);
+connection proxy_con_1;
+SELECT USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+proxied_user_1@localhost	proxied_user_1@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection proxy_con_2;
+SELECT USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+proxied_user_2@localhost	proxied_user_2@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection proxy_con_3;
+SELECT USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+proxied_user_3@localhost	proxied_user_3@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection proxy_con_4;
+SELECT USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+proxied_user_4@localhost	proxied_user_4@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection proxy_con_5;
+SELECT USER(),CURRENT_USER();
+USER()	CURRENT_USER()
+proxied_user_5@localhost	proxied_user_5@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection default;
+disconnect proxy_con_1;
+disconnect proxy_con_2;
+disconnect proxy_con_3;
+disconnect proxy_con_4;
+disconnect proxy_con_5;
+DROP USER ''@'',proxied_user_1,proxied_user_2,proxied_user_3,proxied_user_4,proxied_user_5;
+========== test 3 ==========================================
+GRANT ALL PRIVILEGES ON *.* TO plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+FLUSH PRIVILEGES;
+DROP USER plug_user, plug_dest;
+DROP DATABASE test_user_db;
+UNINSTALL PLUGIN test_plugin_server;

=== added file 'mysql-test/r/plugin_auth_qa_2.result'
--- a/mysql-test/r/plugin_auth_qa_2.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/plugin_auth_qa_2.result	2010-06-24 08:55:18 +0000
@@ -0,0 +1,23 @@
+INSTALL PLUGIN qa_test_null SONAME 'qa_test_2.so';
+CREATE DATABASE test_user_db;
+========== test 1.1.3.2 ====================================
+CREATE USER plug_user IDENTIFIED WITH qa_test_null AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest identified by 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug_dest		
+plug_user	qa_test_null	plug_dest
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+SELECT @@external_user;
+@@external_user
+NULL
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+current_user()	user()	@@local.proxy_user	@@local.external_user
+plug_dest@%	plug_dest@localhost	NULL	NULL
+DROP USER plug_user, plug_dest;
+DROP DATABASE test_user_db;
+UNINSTALL PLUGIN qa_test_null;

=== added file 'mysql-test/r/plugin_auth_qa_3.result'
--- a/mysql-test/r/plugin_auth_qa_3.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/plugin_auth_qa_3.result	2010-06-24 08:55:18 +0000
@@ -0,0 +1,24 @@
+INSTALL PLUGIN qa_test_null SONAME 'qa_test_3.so';
+CREATE DATABASE test_user_db;
+========== test 1.1.3.2 ====================================
+CREATE USER plug_user IDENTIFIED WITH qa_test_null AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest identified by 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug_dest		
+plug_user	qa_test_null	plug_dest
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+SELECT @@external_user;
+@@external_user
+NULL
+current_user()	user()	@@local.proxy_user	@@local.external_user
+plug_dest@%	plug_user@localhost	'plug_user'@'%'	'plug_user'@'%'
+current_user()	user()	@@local.proxy_user	@@local.external_user
+plug_dest@%	plug_dest@localhost	NULL	NULL
+DROP USER plug_user, plug_dest;
+DROP DATABASE test_user_db;
+UNINSTALL PLUGIN qa_test_null;

=== added file 'mysql-test/r/plugin_auth_qa_4.result'
--- a/mysql-test/r/plugin_auth_qa_4.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/plugin_auth_qa_4.result	2010-06-24 08:55:18 +0000
@@ -0,0 +1,23 @@
+INSTALL PLUGIN qa_test_null SONAME 'qa_test_4.so';
+CREATE DATABASE test_user_db;
+========== test 1.1.3.2 ====================================
+CREATE USER plug_user IDENTIFIED WITH qa_test_null AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest identified by 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug_user	qa_test_null	plug_dest
+plug_dest		
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+SELECT @@external_user;
+@@external_user
+NULL
+ERROR 1045 (28000): Access denied for user ''@'localhost' (using password: YES)
+current_user()	user()	@@local.proxy_user	@@local.external_user
+plug_dest@%	plug_dest@localhost	NULL	NULL
+DROP USER plug_user, plug_dest;
+DROP DATABASE test_user_db;
+UNINSTALL PLUGIN qa_test_null;

=== added file 'mysql-test/r/plugin_auth_qa_5.result'
--- a/mysql-test/r/plugin_auth_qa_5.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/plugin_auth_qa_5.result	2010-06-24 08:55:18 +0000
@@ -0,0 +1,24 @@
+INSTALL PLUGIN qa_test_null SONAME 'qa_test_5.so';
+CREATE DATABASE test_user_db;
+========== test 1.1.3.2 ====================================
+CREATE USER plug_user IDENTIFIED WITH qa_test_null AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest identified by 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user	plugin	authentication_string
+plug_dest		
+plug_user	qa_test_null	plug_dest
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+SELECT @@external_user;
+@@external_user
+NULL
+current_user()	user()	@@local.proxy_user	@@local.external_user
+plug_dest@%	@localhost	'plug_user'@'%'	'plug_user'@'%'
+current_user()	user()	@@local.proxy_user	@@local.external_user
+plug_dest@%	plug_dest@localhost	NULL	NULL
+DROP USER plug_user, plug_dest;
+DROP DATABASE test_user_db;
+UNINSTALL PLUGIN qa_test_null;

=== added file 'mysql-test/t/plugin_auth_qa-master.opt'
--- a/mysql-test/t/plugin_auth_qa-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/plugin_auth_qa-master.opt	2010-06-24 08:55:18 +0000
@@ -0,0 +1 @@
+--plugin_dir=../plugin/auth/.libs

=== added file 'mysql-test/t/plugin_auth_qa.test'
--- a/mysql-test/t/plugin_auth_qa.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/plugin_auth_qa.test	2010-06-24 08:55:18 +0000
@@ -0,0 +1,340 @@
+# The numbers represent test cases of the test plan.
+
+#--source include/have_plugin_auth.inc
+--source include/not_embedded.inc
+
+INSTALL PLUGIN test_plugin_server SONAME 'auth_test_plugin.so';
+CREATE DATABASE test_user_db;
+
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+--echo ========== test 1.1 ======================================================
+# without '', without AS part
+CREATE USER plug IDENTIFIED WITH test_plugin_server;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
+DROP USER plug;
+# with '', without AS part
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
+DROP USER plug;
+# without '', AS part empty
+CREATE USER plug IDENTIFIED WITH test_plugin_server AS '';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS '';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
+DROP USER plug;
+# with '', AS part empty without ''
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS ;
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS;
+# without '', AS part without ''
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH test_plugin_server AS plug_dest;
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS plug_dest;
+--echo ========== test 1.1 syntax errors ========================================
+# without auth_name
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH AS plug_dest;
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH AS plug_dest;
+# without auth_name and AS part
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH;
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH;
+# without auth_name but AS part
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED AS '';
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED AS '';
+# with 2 auth_name parts
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' IDENTIFIED WITH 'test_plugin_server';
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug 
+                 IDENTIFIED WITH 'test_plugin_server' IDENTIFIED WITH 'test_plugin_server';
+# with 2 AS parts
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS '' AS 'plug_dest';
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug AS '' AS 'plug_dest';
+# with 2 complete WITH parts
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS '' 
+                 IDENTIFIED WITH test_plugin_server   AS 'plug_dest';
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS ''
+                 IDENTIFIED WITH test_plugin_server   AS 'plug_dest';
+# with BY and WITH part
+--error ER_PARSE_ERROR
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd' 
+                      IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; 
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd'
+                      IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+# with WITH part and BY part
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest' 
+       USER plug_dest IDENTIFIED by 'plug_dest_pwd';
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+       USER plug_dest IDENTIFIED by 'plug_dest_pwd';
+# with WITH part and BY part
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest' 
+       plug_dest IDENTIFIED by 'plug_dest_pwd';
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+       plug_dest IDENTIFIED by 'plug_dest_pwd';
+# with WITH part and BY part
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest' 
+       IDENTIFIED by 'plug_dest_pwd';
+--error ER_PARSE_ERROR
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+       IDENTIFIED by 'plug_dest_pwd';
+
+--echo ========== test 1.1  combinations ==========================
+# CREATE...WITH/CREATE...BY
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--echo ========== test 1.1.1.6/1.1.2.5 ============================
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug, plug_dest;
+# 
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug;
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug_dest;
+#  GRANT...WITH/CREATE...BY
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug, plug_dest;
+# 
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug;
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug_dest;
+# CREATE...WITH/GRANT...BY
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug, plug_dest;
+# 
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug_dest;
+# 
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--error 1701
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--error 1701
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server';
+DROP USER plug;
+#
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--error ER_CANNOT_USER
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--error ER_CANNOT_USER
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server';
+DROP USER plug;
+# 
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+DROP USER plug;
+#
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--error ER_CANNOT_USER
+CREATE USER plug IDENTIFIED BY 'plug_dest_passwd';
+DROP USER plug;
+#
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+DROP USER plug,plug_dest;
+#
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest 
+                        IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+DROP USER plug,plug_dest;
+# 
+
+--echo ========== test 1.1.1.1/1.1.2.1/1.1.1.5 ====================
+
+SET NAMES utf8;
+# 
+CREATE USER plüg IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plüg;
+CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plüg_dest;
+
+SET NAMES ascii;
+# 
+CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER 'plüg';
+CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER 'plüg_dest';
+
+SET NAMES latin1;
+# 
+--echo ========== test 1.1.1.5 ====================================
+--error ER_PLUGIN_IS_NOT_LOADED
+CREATE USER 'plüg' IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
+CREATE USER 'plug' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER 'plug';
+CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER 'plüg_dest';
+
+SET NAMES utf8;
+# 
+--error ER_PLUGIN_IS_NOT_LOADED
+CREATE USER plüg IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
+CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER 'plüg';
+CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER 'plüg_dest';
+
+CREATE USER plüg IDENTIFIED WITH test_plugin_server AS 'plüg_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plüg_dest;
+
+--echo ========== test 1.1.1.2/1.1.2.2=============================
+
+SET @auth_name= 'test_plugin_server';
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH @auth_name AS 'plug_dest';
+
+SET @auth_string= 'plug_dest';
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH test_plugin_server AS @auth_string;
+
+--echo ========== test 1.1.1.3/1.1.2.3=============================
+
+--error ER_PLUGIN_IS_NOT_LOADED
+CREATE USER plug IDENTIFIED WITH 'hh''s_test_plugin_server' AS 'plug_dest';
+
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'hh''s_plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug;
+CREATE USER 'hh''s_plug_dest' IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER 'hh''s_plug_dest';
+
+--echo ========== test 1.1.1.4 ====================================
+
+--error ER_PARSE_ERROR
+CREATE USER plug IDENTIFIED WITH hh''s_test_plugin_server AS 'plug_dest';
+
+--echo ========== test 1.1.3.1 ====================================
+
+GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+CREATE USER plug_dest; 
+DROP USER plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER grant_user,plug_dest;
+#
+set @save_sql_mode= @@sql_mode;
+SET @@sql_mode=no_auto_create_user;
+GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+CREATE USER plug_dest; 
+DROP USER plug_dest;
+--error ER_PASSWORD_NO_MATCH
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest;
+DROP USER grant_user;
+#
+GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; 
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+DROP USER plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_user_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+DROP USER grant_user,plug_dest;
+set @@sql_mode= @save_sql_mode;
+#
+DROP DATABASE test_user_db;
+UNINSTALL PLUGIN test_plugin_server;
+--exit
+

=== added file 'mysql-test/t/plugin_auth_qa_1-master.opt'
--- a/mysql-test/t/plugin_auth_qa_1-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/plugin_auth_qa_1-master.opt	2010-06-24 08:55:18 +0000
@@ -0,0 +1 @@
+--plugin_dir=../plugin/auth/.libs

=== added file 'mysql-test/t/plugin_auth_qa_1.test'
--- a/mysql-test/t/plugin_auth_qa_1.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/plugin_auth_qa_1.test	2010-06-24 08:55:18 +0000
@@ -0,0 +1,328 @@
+# The numbers represent test cases of the test plan.
+
+#--source include/have_plugin_auth.inc
+--source include/not_embedded.inc
+
+INSTALL PLUGIN test_plugin_server SONAME 'auth_test_plugin.so';
+CREATE DATABASE test_user_db;
+
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+
+--echo ========== test 1.1.3.2 ====================================
+
+# CREATE...WITH/CREATE...BY/GRANT
+CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
+REVOKE PROXY ON plug_dest FROM plug_user;
+--error 1
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
+DROP USER plug_user,plug_dest;
+#
+# GRANT...WITH
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
+  IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+GRANT PROXY ON plug_dest TO plug_user IDENTIFIED BY 'plug_dest_passwd';
+--echo 1)
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user'
+                         IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+--echo 2)
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
+REVOKE PROXY ON plug_dest FROM plug_user;
+--echo 3)
+--error 1
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
+DROP USER plug_user;
+#
+# GRANT...WITH/CREATE...BY
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
+  IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--echo 1)
+--error 1
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
+GRANT PROXY ON plug_dest TO plug_user;
+--echo 2)
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user'
+                         IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+#REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_dest'
+#                         IDENTIFIED BY 'plug_dest_passwd';
+DROP USER plug_user,plug_dest;
+
+--echo ========== test 1.2 ========================================
+
+# GRANT...WITH/CREATE...BY
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
+  IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
+RENAME USER plug_dest TO new_dest;
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
+GRANT PROXY ON new_dest TO plug_user;
+--error 1
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs --password=new_dest -e "SELECT current_user();SELECT user();" 2>&1
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug_user,new_dest;
+
+# CREATE...WITH/CREATE...BY
+CREATE USER plug_user
+  IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--error 1
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
+GRANT PROXY ON plug_dest TO plug_user;
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
+RENAME USER plug_dest TO new_dest;
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
+GRANT PROXY ON new_dest TO plug_user;
+--error 1
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs --password=new_dest -e "SELECT current_user();SELECT user();" 2>&1
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug_user,new_dest;
+# CREATE...WITH
+CREATE USER plug_user
+  IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+GRANT PROXY ON plug_dest TO plug_user;
+--echo connect(plug_user,localhost,plug_user,plug_dest);
+connect(plug_user,localhost,plug_user,plug_dest);
+select USER(),CURRENT_USER();
+--echo connection default;
+connection default;
+--echo disconnect plug_user;
+disconnect plug_user;
+RENAME USER plug_user TO new_user;
+--echo connect(plug_user,localhost,new_user,plug_dest);
+connect(plug_user,localhost,new_user,plug_dest);
+select USER(),CURRENT_USER();
+--echo connection default;
+connection default;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+--echo disconnect plug_user;
+disconnect plug_user;
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+UPDATE mysql.user SET user='plug_user' WHERE user='new_user';
+FLUSH PRIVILEGES;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+DROP USER plug_dest,plug_user;
+--echo ========== test 1.3 ========================================
+
+#
+CREATE USER plug_user
+  IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+GRANT PROXY ON plug_dest TO plug_user;
+--echo connect(plug_user,localhost,plug_user,plug_dest);
+connect(plug_user,localhost,plug_user,plug_dest);
+select USER(),CURRENT_USER();
+--echo connection default;
+connection default;
+--echo disconnect plug_user;
+disconnect plug_user;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+UPDATE mysql.user SET user='new_user' WHERE user='plug_user';
+FLUSH PRIVILEGES;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+UPDATE mysql.user SET authentication_string='new_dest' WHERE user='new_user';
+FLUSH PRIVILEGES;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+UPDATE mysql.user SET plugin='new_plugin_server' WHERE user='new_user';
+FLUSH PRIVILEGES;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+--echo connect(plug_user,localhost,new_user,new_dest);
+--disable_query_log
+--error ER_PLUGIN_IS_NOT_LOADED
+connect(plug_user,localhost,new_user,new_dest);
+--enable_query_log
+UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user';
+FLUSH PRIVILEGES;
+GRANT PROXY ON new_dest TO new_user;
+--echo connect(plug_user,localhost,new_user,new_dest);
+connect(plug_user,localhost,new_user,new_dest);
+select USER(),CURRENT_USER();
+--echo connection default;
+connection default;
+--echo disconnect plug_user;
+disconnect plug_user;
+CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+GRANT ALL PRIVILEGES ON test.* TO new_user;
+--echo connect(plug_user,localhost,new_dest,new_dest_passwd);
+connect(plug_user,localhost,new_dest,new_dest_passwd);
+select USER(),CURRENT_USER();
+--echo connection default;
+connection default;
+--echo disconnect plug_user;
+disconnect plug_user;
+DROP USER new_user,new_dest;
+
+--echo ========== test 2, 2.1, 2.2 ================================
+
+CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
+CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+--echo connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+--echo ========== test 2.2.1 ======================================
+SELECT @@proxy_user;
+--echo connection default;
+connection default;
+--echo disconnect proxy_con;
+disconnect proxy_con;
+--echo connect(proxy_con,localhost,proxy_user,proxied_user);
+--disable_query_log
+--error ER_ACCESS_DENIED_ERROR : this should fail : no grant
+connect(proxy_con,localhost,proxy_user,proxied_user);
+--enable_query_log
+GRANT PROXY ON proxied_user TO ''@'';
+--echo connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+--echo connection default;
+connection default;
+--echo disconnect proxy_con;
+disconnect proxy_con;
+--echo connect(proxy_con,localhost,proxy_user,proxied_user);
+connect(proxy_con,localhost,proxy_user,proxied_user);
+SELECT USER(),CURRENT_USER();
+--echo ========== test 2.2.1 ======================================
+SELECT @@proxy_user;
+--echo connection default;
+connection default;
+--echo disconnect proxy_con;
+disconnect proxy_con;
+DROP USER ''@'',proxied_user;
+#
+GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'' 
+                     IDENTIFIED WITH test_plugin_server AS 'proxied_user';
+CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+--echo connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+SELECT @@proxy_user;
+--echo connection default;
+connection default;
+--echo disconnect proxy_con;
+disconnect proxy_con;
+--echo connect(proxy_con,localhost,proxy_user,proxied_user);
+--disable_query_log
+--error ER_ACCESS_DENIED_ERROR : this should fail : no grant
+connect(proxy_con,localhost,proxy_user,proxied_user);
+--enable_query_log
+GRANT PROXY ON proxied_user TO ''@'';
+--echo connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+--echo connection default;
+connection default;
+--echo disconnect proxy_con;
+disconnect proxy_con;
+--echo connect(proxy_con,localhost,proxy_user,proxied_user);
+connect(proxy_con,localhost,proxy_user,proxied_user);
+SELECT USER(),CURRENT_USER();
+SELECT @@proxy_user;
+--echo connection default;
+connection default;
+--echo disconnect proxy_con;
+disconnect proxy_con;
+DROP USER ''@'',proxied_user;
+#
+CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
+CREATE USER proxied_user_1 IDENTIFIED BY 'proxied_user_1_pwd';
+CREATE USER proxied_user_2 IDENTIFIED BY 'proxied_user_2_pwd';
+CREATE USER proxied_user_3 IDENTIFIED BY 'proxied_user_3_pwd';
+CREATE USER proxied_user_4 IDENTIFIED BY 'proxied_user_4_pwd';
+CREATE USER proxied_user_5 IDENTIFIED BY 'proxied_user_5_pwd';
+GRANT PROXY ON proxied_user_1 TO ''@'';
+GRANT PROXY ON proxied_user_2 TO ''@'';
+GRANT PROXY ON proxied_user_3 TO ''@'';
+GRANT PROXY ON proxied_user_4 TO ''@'';
+GRANT PROXY ON proxied_user_5 TO ''@'';
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+--echo connect(proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd');
+connect(proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd');
+--echo connect(proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd);
+connect(proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd);
+--echo connect(proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd);
+connect(proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd);
+--echo connect(proxy_con_4,localhost,proxied_user_4,proxied_user_4_pwd);
+connect(proxy_con_4,localhost,proxied_user_4,proxied_user_4_pwd);
+--echo connect(proxy_con_5,localhost,proxied_user_5,proxied_user_5_pwd);
+connect(proxy_con_5,localhost,proxied_user_5,proxied_user_5_pwd);
+--echo connection proxy_con_1;
+connection proxy_con_1;
+SELECT USER(),CURRENT_USER();
+SELECT @@proxy_user;
+--echo connection proxy_con_2;
+connection proxy_con_2;
+SELECT USER(),CURRENT_USER();
+SELECT @@proxy_user;
+--echo connection proxy_con_3;
+connection proxy_con_3;
+SELECT USER(),CURRENT_USER();
+SELECT @@proxy_user;
+--echo connection proxy_con_4;
+connection proxy_con_4;
+SELECT USER(),CURRENT_USER();
+SELECT @@proxy_user;
+--echo connection proxy_con_5;
+connection proxy_con_5;
+SELECT USER(),CURRENT_USER();
+SELECT @@proxy_user;
+--echo connection default;
+connection default;
+--echo disconnect proxy_con_1;
+disconnect proxy_con_1;
+--echo disconnect proxy_con_2;
+disconnect proxy_con_2;
+--echo disconnect proxy_con_3;
+disconnect proxy_con_3;
+--echo disconnect proxy_con_4;
+disconnect proxy_con_4;
+--echo disconnect proxy_con_5;
+disconnect proxy_con_5;
+DROP USER ''@'',proxied_user_1,proxied_user_2,proxied_user_3,proxied_user_4,proxied_user_5;
+
+--echo ========== test 3 ==========================================
+
+GRANT ALL PRIVILEGES ON *.* TO plug_user
+  IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+FLUSH PRIVILEGES;
+
+# Not working with the patch.
+
+#--replace_result $MYSQLADMIN MYSQLADMIN $MASTER_MYPORT MYPORT $MASTER_MYSOCK MYSOCK
+#--exec $MYSQLADMIN -h localhost -P $MASTER_MYPORT -S $MASTER_MYSOCK -u plug_dest --password=plug_dest_passwd ping 2>&1
+#--replace_result $MYSQLADMIN MYSQLADMIN $MASTER_MYPORT MYPORT $MASTER_MYSOCK MYSOCK
+#--exec $MYSQLADMIN --plugin_dir=../plugin/auth/.libs -h localhost -P $MASTER_MYPORT -S $MASTER_MYSOCK -u plug_user --password=plug_dest ping 2>&1
+#--replace_result $MYSQL_CHECK MYSQL_CHECK $MASTER_MYPORT MYPORT
+#--exec $MYSQL_CHECK --plugin_dir=../plugin/auth/.libs -h localhost -P $MASTER_MYPORT  -u plug_user --password=plug_dest test
+#--replace_result $MYSQL_DUMP MYSQL_DUMP $MASTER_MYPORT MYPORT
+#--exec $MYSQL_DUMP -h localhost -P $MASTER_MYPORT --plugin_dir=../plugin/auth/.libs -u plug_user --password=plug_dest test
+#--replace_result $MYSQL_SHOW MYSQL_SHOW $MASTER_MYPORT MYPORT
+#--exec $MYSQL_SHOW --plugin_dir=../plugin/auth/.libs -h localhost -P $MASTER_MYPORT --plugin_dir=../plugin/auth/.libs -u plug_user --password=plug_dest 2>&1
+DROP USER plug_user, plug_dest;
+DROP DATABASE test_user_db;
+UNINSTALL PLUGIN test_plugin_server;
+--exit

=== added file 'mysql-test/t/plugin_auth_qa_2-master.opt'
--- a/mysql-test/t/plugin_auth_qa_2-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/plugin_auth_qa_2-master.opt	2010-06-24 08:55:18 +0000
@@ -0,0 +1 @@
+--plugin_dir=../plugin/auth/.libs

=== added file 'mysql-test/t/plugin_auth_qa_2.test'
--- a/mysql-test/t/plugin_auth_qa_2.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/plugin_auth_qa_2.test	2010-06-24 08:55:18 +0000
@@ -0,0 +1,35 @@
+# The numbers represent test cases of the test plan.
+
+#--source include/have_plugin_auth.inc
+--source include/not_embedded.inc
+
+# qa_test_2.so works like test_plugin.c, but info->authenticated_as is an empty string.
+
+INSTALL PLUGIN qa_test_null SONAME 'qa_test_2.so';
+CREATE DATABASE test_user_db;
+
+--echo ========== test 1.1.3.2 ====================================
+
+# CREATE...WITH/CREATE...BY/GRANT
+CREATE USER plug_user IDENTIFIED WITH qa_test_null AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest identified by 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+SELECT @@proxy_user;
+SELECT @@external_user;
+
+--error 1
+--exec $MYSQL --plugin_dir=../plugin/auth/.libs -h localhost -P $MASTER_MYPORT -u plug_user --password=plug_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+
+--error 1
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs -e "SELECT current_user();SELECT user();"
+
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_dest --password=plug_dest_passwd --plugin_dir=../plugin/auth/.libs -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;"
+
+DROP USER plug_user, plug_dest;
+DROP DATABASE test_user_db;
+UNINSTALL PLUGIN qa_test_null;
+--exit
+

=== added file 'mysql-test/t/plugin_auth_qa_3-master.opt'
--- a/mysql-test/t/plugin_auth_qa_3-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/plugin_auth_qa_3-master.opt	2010-06-24 08:55:18 +0000
@@ -0,0 +1 @@
+--plugin_dir=../plugin/auth/.libs

=== added file 'mysql-test/t/plugin_auth_qa_3.test'
--- a/mysql-test/t/plugin_auth_qa_3.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/plugin_auth_qa_3.test	2010-06-24 08:55:18 +0000
@@ -0,0 +1,35 @@
+# The numbers represent test cases of the test plan.
+
+#--source include/have_plugin_auth.inc
+--source include/not_embedded.inc
+
+# Like test_plugin.c, but info->external_user is an empty string.
+
+INSTALL PLUGIN qa_test_null SONAME 'qa_test_3.so';
+CREATE DATABASE test_user_db;
+
+--echo ========== test 1.1.3.2 ====================================
+
+# CREATE...WITH/CREATE...BY/GRANT
+CREATE USER plug_user IDENTIFIED WITH qa_test_null AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest identified by 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+SELECT @@proxy_user;
+SELECT @@external_user;
+
+#--error 1
+--exec $MYSQL --plugin_dir=../plugin/auth/.libs -h localhost -P $MASTER_MYPORT -u plug_user --password=plug_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+
+--error 1
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs -e "SELECT current_user();SELECT user();"
+
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_dest --password=plug_dest_passwd --plugin_dir=../plugin/auth/.libs -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;"
+
+DROP USER plug_user, plug_dest;
+DROP DATABASE test_user_db;
+UNINSTALL PLUGIN qa_test_null;
+--exit
+

=== added file 'mysql-test/t/plugin_auth_qa_4-master.opt'
--- a/mysql-test/t/plugin_auth_qa_4-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/plugin_auth_qa_4-master.opt	2010-06-24 08:55:18 +0000
@@ -0,0 +1 @@
+--plugin_dir=../plugin/auth/.libs

=== added file 'mysql-test/t/plugin_auth_qa_4.test'
--- a/mysql-test/t/plugin_auth_qa_4.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/plugin_auth_qa_4.test	2010-06-24 08:55:18 +0000
@@ -0,0 +1,34 @@
+# The numbers represent test cases of the test plan.
+
+#--source include/have_plugin_auth.inc
+--source include/not_embedded.inc
+
+# Like test_plugin.c, but info->auth_string is an empty string.
+
+INSTALL PLUGIN qa_test_null SONAME 'qa_test_4.so';
+CREATE DATABASE test_user_db;
+
+--echo ========== test 1.1.3.2 ====================================
+
+# CREATE...WITH/CREATE...BY/GRANT
+CREATE USER plug_user IDENTIFIED WITH qa_test_null AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest identified by 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+SELECT @@proxy_user;
+SELECT @@external_user;
+
+--error 1
+--exec $MYSQL --plugin_dir=../plugin/auth/.libs -h localhost -P $MASTER_MYPORT -u plug_user --password=plug_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+
+--error 1
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs -e "SELECT current_user();SELECT user();"
+
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_dest --password=plug_dest_passwd --plugin_dir=../plugin/auth/.libs -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;"
+
+DROP USER plug_user, plug_dest;
+DROP DATABASE test_user_db;
+UNINSTALL PLUGIN qa_test_null;
+--exit
+

=== added file 'mysql-test/t/plugin_auth_qa_5-master.opt'
--- a/mysql-test/t/plugin_auth_qa_5-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/plugin_auth_qa_5-master.opt	2010-06-24 08:55:18 +0000
@@ -0,0 +1 @@
+--plugin_dir=../plugin/auth/.libs

=== added file 'mysql-test/t/plugin_auth_qa_5.test'
--- a/mysql-test/t/plugin_auth_qa_5.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/plugin_auth_qa_5.test	2010-06-24 08:55:18 +0000
@@ -0,0 +1,33 @@
+# The numbers represent test cases of the test plan.
+
+#--source include/have_plugin_auth.inc
+--source include/not_embedded.inc
+
+# Like test_plugin.c, but info->user_name is an empty string.
+
+INSTALL PLUGIN qa_test_null SONAME 'qa_test_5.so';
+CREATE DATABASE test_user_db;
+
+--echo ========== test 1.1.3.2 ====================================
+
+# CREATE...WITH/CREATE...BY/GRANT
+CREATE USER plug_user IDENTIFIED WITH qa_test_null AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest identified by 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+--sorted_result
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+SELECT @@proxy_user;
+SELECT @@external_user;
+
+--exec $MYSQL --plugin_dir=../plugin/auth/.libs -h localhost -P $MASTER_MYPORT -u plug_user --password=plug_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+
+--error 1
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_user --plugin_dir=../plugin/auth/.libs -e "SELECT current_user();SELECT user();"
+
+--exec $MYSQL -S var/tmp/mysqld.1.sock -u plug_dest --password=plug_dest_passwd --plugin_dir=../plugin/auth/.libs -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;"
+
+DROP USER plug_user, plug_dest;
+DROP DATABASE test_user_db;
+UNINSTALL PLUGIN qa_test_null;
+--exit

=== modified file 'plugin/auth/CMakeLists.txt'
--- a/plugin/auth/CMakeLists.txt	2010-04-30 10:15:32 +0000
+++ b/plugin/auth/CMakeLists.txt	2010-06-24 08:55:18 +0000
@@ -15,7 +15,20 @@
 
 MYSQL_ADD_PLUGIN(auth dialog.c 
   MODULE_ONLY)
-MYSQL_ADD_PLUGIN(auth_test_plugin test_plugin.c 
+MYSQL_ADD_PLUGIN(auth_test_plugin test_plugin.c
+  MODULE_ONLY)
+
+MYSQL_ADD_PLUGIN(qa_test_2 qa_test_2.c
+  MODULE_ONLY)
+MYSQL_ADD_PLUGIN(qa_test_3 qa_test_3.c
+  MODULE_ONLY)
+MYSQL_ADD_PLUGIN(qa_test_4 qa_test_4.c
+  MODULE_ONLY)
+MYSQL_ADD_PLUGIN(qa_test_5 qa_test_5.c
+  MODULE_ONLY)
+MYSQL_ADD_PLUGIN(qa_test_6 qa_test_6.c
+  MODULE_ONLY)
+MYSQL_ADD_PLUGIN(qa_test_7 qa_test_7.c
   MODULE_ONLY)
 
 CHECK_CXX_SOURCE_COMPILES(

=== modified file 'plugin/auth/Makefile.am'
--- a/plugin/auth/Makefile.am	2010-04-30 10:15:32 +0000
+++ b/plugin/auth/Makefile.am	2010-06-24 08:55:18 +0000
@@ -1,16 +1,24 @@
+SUBDIRS = . 
 pkgplugindir=$(pkglibdir)/plugin
 
 AM_LDFLAGS=-module -rpath $(pkgplugindir)
 AM_CPPFLAGS=-DMYSQL_DYNAMIC_PLUGIN -Wno-pointer-sign -I$(top_srcdir)/include
 
-pkgplugin_LTLIBRARIES=  auth.la auth_test_plugin.la
+pkgplugin_LTLIBRARIES=  auth.la auth_test_plugin.la qa_test_2.la qa_test_3.la qa_test_4.la\
+                                                    qa_test_5.la qa_test_6.la qa_test_7.la
 auth_la_SOURCES= dialog.c
 auth_test_plugin_la_SOURCES= test_plugin.c
 
+qa_test_2_la_SOURCES= qa_test_2.c
+qa_test_3_la_SOURCES= qa_test_3.c
+qa_test_4_la_SOURCES= qa_test_4.c
+qa_test_5_la_SOURCES= qa_test_5.c
+qa_test_6_la_SOURCES= qa_test_6.c
+qa_test_7_la_SOURCES= qa_test_7.c
+
 if HAVE_PEERCRED
 pkgplugin_LTLIBRARIES+= auth_socket.la
 auth_socket_la_SOURCES= auth_socket.c
 endif
 
-EXTRA_DIST= plug.in
-
+EXTRA_DIST = CMakeLists.txt

=== added file 'plugin/auth/qa_test_2.c'
--- a/plugin/auth/qa_test_2.c	1970-01-01 00:00:00 +0000
+++ b/plugin/auth/qa_test_2.c	2010-06-24 08:55:18 +0000
@@ -0,0 +1,133 @@
+/* Copyright (C) 2010 Sun Microsystems, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+/* Like test_plugin.c, but info->authenticated_as is empty.
+*/
+
+#include <my_global.h>
+#include <mysql/plugin_auth.h>
+#include <mysql/client_plugin.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define ORDINARY_QUESTION       "\2"
+#define LAST_QUESTION           "\3"
+#define LAST_PASSWORD           "\4"
+#define PASSWORD_QUESTION       "\5"
+
+/********************* SERVER SIDE ****************************************/
+
+static int auth_test_plugin(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
+{
+  unsigned char *pkt;
+  int pkt_len;
+  /* send a password question */
+  if (vio->write_packet(vio, PASSWORD_QUESTION, 1))
+    return CR_ERROR;
+
+  /* read the answer */
+  if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
+    return CR_ERROR;
+
+  info->password_used = 1;
+
+  /* fail if the password is wrong */
+  if (strcmp(pkt, info->auth_string))
+    return CR_ERROR;
+  /* copy auth string as a destination name to check it */
+  strcpy (info->authenticated_as, info->auth_string);
+  strcpy (info->authenticated_as, "");
+  /* copy something into the external user name */
+  strcpy (info->external_user, info->auth_string);
+  
+  return CR_OK;
+}
+
+static struct st_mysql_auth auth_test_handler=
+{
+  MYSQL_AUTHENTICATION_INTERFACE_VERSION,
+  "auth_test_plugin", /* requires test_plugin client's plugin */
+  auth_test_plugin
+};
+
+mysql_declare_plugin(test_plugin)
+{
+  MYSQL_AUTHENTICATION_PLUGIN,
+  &auth_test_handler,
+  "qa_test_null",
+  "Georgi Kodinov",
+  "plugin API test plugin",
+  PLUGIN_LICENSE_GPL,
+  NULL,
+  NULL,
+  0x0100,
+  NULL,
+  NULL,
+  NULL
+}
+mysql_declare_plugin_end;
+
+/********************* CLIENT SIDE ***************************************/
+/*
+  client plugin used for testing the plugin API
+*/
+#include <mysql.h>
+
+static int test_plugin_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
+{
+  unsigned char *pkt, cmd= 0;
+  int pkt_len, res;
+  char *reply;
+  do
+  {
+    /* read the prompt */
+    pkt_len= vio->read_packet(vio, &pkt);
+    if (pkt_len < 0)
+      return CR_ERROR;
+    
+if (pkt == 0)
+    {
+      reply= mysql->passwd;
+    }
+    else
+    {
+      cmd= *pkt++;
+      if (cmd == 0 || cmd == 254)
+        return CR_OK_HANDSHAKE_COMPLETE; /* yes. we're done */
+      if ((cmd == LAST_PASSWORD[0] || cmd == PASSWORD_QUESTION[0]) && *pkt == 0)
+        reply= mysql->passwd;
+      else
+        return CR_ERROR;
+    }
+    if (!reply)
+      return CR_ERROR;
+    res= vio->write_packet(vio, reply, strlen(reply)+1);
+    if (res)
+      return CR_ERROR;
+  } while (cmd != LAST_QUESTION[0] && cmd != PASSWORD_QUESTION[0]);
+  return CR_OK;
+}
+
+
+mysql_declare_client_plugin(AUTHENTICATION)
+  "qa_test_null",
+  "Georgi Kodinov",
+  "Dialog Client Authentication Plugin",
+  {0,1,0},
+  NULL,
+  NULL,
+  test_plugin_client
+mysql_end_client_plugin;

=== added file 'plugin/auth/qa_test_3.c'
--- a/plugin/auth/qa_test_3.c	1970-01-01 00:00:00 +0000
+++ b/plugin/auth/qa_test_3.c	2010-06-24 08:55:18 +0000
@@ -0,0 +1,133 @@
+/* Copyright (C) 2010 Sun Microsystems, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+/* Like test_plugin.c, but info->external_user is empty.
+*/
+
+#include <my_global.h>
+#include <mysql/plugin_auth.h>
+#include <mysql/client_plugin.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define ORDINARY_QUESTION       "\2"
+#define LAST_QUESTION           "\3"
+#define LAST_PASSWORD           "\4"
+#define PASSWORD_QUESTION       "\5"
+
+/********************* SERVER SIDE ****************************************/
+
+static int auth_test_plugin(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
+{
+  unsigned char *pkt;
+  int pkt_len;
+  /* send a password question */
+  if (vio->write_packet(vio, PASSWORD_QUESTION, 1))
+    return CR_ERROR;
+
+  /* read the answer */
+  if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
+    return CR_ERROR;
+
+  info->password_used = 1;
+
+  /* fail if the password is wrong */
+  if (strcmp(pkt, info->auth_string))
+    return CR_ERROR;
+  /* copy auth string as a destination name to check it */
+  strcpy (info->authenticated_as, info->auth_string);
+  /* copy something into the external user name */
+  strcpy (info->external_user, info->auth_string);
+  strcpy (info->external_user, "");
+
+  return CR_OK;
+}
+
+static struct st_mysql_auth auth_test_handler=
+{
+  MYSQL_AUTHENTICATION_INTERFACE_VERSION,
+  "auth_test_plugin", /* requires test_plugin client's plugin */
+  auth_test_plugin
+};
+
+mysql_declare_plugin(test_plugin)
+{
+  MYSQL_AUTHENTICATION_PLUGIN,
+  &auth_test_handler,
+  "qa_test_null",
+  "Georgi Kodinov",
+  "plugin API test plugin",
+  PLUGIN_LICENSE_GPL,
+  NULL,
+  NULL,
+  0x0100,
+  NULL,
+  NULL,
+  NULL
+}
+mysql_declare_plugin_end;
+
+/********************* CLIENT SIDE ***************************************/
+/*
+  client plugin used for testing the plugin API
+*/
+#include <mysql.h>
+
+static int test_plugin_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
+{
+  unsigned char *pkt, cmd= 0;
+  int pkt_len, res;
+  char *reply;
+  do
+  {
+    /* read the prompt */
+    pkt_len= vio->read_packet(vio, &pkt);
+    if (pkt_len < 0)
+      return CR_ERROR;
+    
+if (pkt == 0)
+    {
+      reply= mysql->passwd;
+    }
+    else
+    {
+      cmd= *pkt++;
+      if (cmd == 0 || cmd == 254)
+        return CR_OK_HANDSHAKE_COMPLETE; /* yes. we're done */
+      if ((cmd == LAST_PASSWORD[0] || cmd == PASSWORD_QUESTION[0]) && *pkt == 0)
+        reply= mysql->passwd;
+      else
+        return CR_ERROR;
+    }
+    if (!reply)
+      return CR_ERROR;
+    res= vio->write_packet(vio, reply, strlen(reply)+1);
+    if (res)
+      return CR_ERROR;
+  } while (cmd != LAST_QUESTION[0] && cmd != PASSWORD_QUESTION[0]);
+  return CR_OK;
+}
+
+
+mysql_declare_client_plugin(AUTHENTICATION)
+  "qa_test_null",
+  "Georgi Kodinov",
+  "Dialog Client Authentication Plugin",
+  {0,1,0},
+  NULL,
+  NULL,
+  test_plugin_client
+mysql_end_client_plugin;

=== added file 'plugin/auth/qa_test_4.c'
--- a/plugin/auth/qa_test_4.c	1970-01-01 00:00:00 +0000
+++ b/plugin/auth/qa_test_4.c	2010-06-24 08:55:18 +0000
@@ -0,0 +1,135 @@
+/* Copyright (C) 2010 Sun Microsystems, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+/* Like test_plugin.c, but info->auth_string is empty.
+*/
+
+#include <my_global.h>
+#include <mysql/plugin_auth.h>
+#include <mysql/client_plugin.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define ORDINARY_QUESTION       "\2"
+#define LAST_QUESTION           "\3"
+#define LAST_PASSWORD           "\4"
+#define PASSWORD_QUESTION       "\5"
+
+/********************* SERVER SIDE ****************************************/
+
+static int auth_test_plugin(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
+{
+  unsigned char *pkt;
+  int pkt_len;
+  /* send a password question */
+  if (vio->write_packet(vio, PASSWORD_QUESTION, 1))
+    return CR_ERROR;
+
+  /* read the answer */
+  if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
+    return CR_ERROR;
+
+  info->password_used = 1;
+
+  /* fail if the password is wrong */
+  if (strcmp(pkt, info->auth_string))
+    return CR_ERROR;
+  info->auth_string= "";
+  info->auth_string_length= 20;
+  /* copy auth string as a destination name to check it */
+  strcpy (info->authenticated_as, info->auth_string);
+  /* copy something into the external user name */
+  strcpy (info->external_user, info->auth_string);
+  strcpy (info->user_name, "");
+  
+  return CR_OK;
+}
+
+static struct st_mysql_auth auth_test_handler=
+{
+  MYSQL_AUTHENTICATION_INTERFACE_VERSION,
+  "auth_test_plugin", /* requires test_plugin client's plugin */
+  auth_test_plugin
+};
+
+mysql_declare_plugin(test_plugin)
+{
+  MYSQL_AUTHENTICATION_PLUGIN,
+  &auth_test_handler,
+  "qa_test_null",
+  "Georgi Kodinov",
+  "plugin API test plugin",
+  PLUGIN_LICENSE_GPL,
+  NULL,
+  NULL,
+  0x0100,
+  NULL,
+  NULL,
+  NULL
+}
+mysql_declare_plugin_end;
+
+/********************* CLIENT SIDE ***************************************/
+/*
+  client plugin used for testing the plugin API
+*/
+#include <mysql.h>
+
+static int test_plugin_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
+{
+  unsigned char *pkt, cmd= 0;
+  int pkt_len, res;
+  char *reply;
+  do
+  {
+    /* read the prompt */
+    pkt_len= vio->read_packet(vio, &pkt);
+    if (pkt_len < 0)
+      return CR_ERROR;
+    
+if (pkt == 0)
+    {
+      reply= mysql->passwd;
+    }
+    else
+    {
+      cmd= *pkt++;
+      if (cmd == 0 || cmd == 254)
+        return CR_OK_HANDSHAKE_COMPLETE; /* yes. we're done */
+      if ((cmd == LAST_PASSWORD[0] || cmd == PASSWORD_QUESTION[0]) && *pkt == 0)
+        reply= mysql->passwd;
+      else
+        return CR_ERROR;
+    }
+    if (!reply)
+      return CR_ERROR;
+    res= vio->write_packet(vio, reply, strlen(reply)+1);
+    if (res)
+      return CR_ERROR;
+  } while (cmd != LAST_QUESTION[0] && cmd != PASSWORD_QUESTION[0]);
+  return CR_OK;
+}
+
+
+mysql_declare_client_plugin(AUTHENTICATION)
+  "qa_test_null",
+  "Georgi Kodinov",
+  "Dialog Client Authentication Plugin",
+  {0,1,0},
+  NULL,
+  NULL,
+  test_plugin_client
+mysql_end_client_plugin;

=== added file 'plugin/auth/qa_test_5.c'
--- a/plugin/auth/qa_test_5.c	1970-01-01 00:00:00 +0000
+++ b/plugin/auth/qa_test_5.c	2010-06-24 08:55:18 +0000
@@ -0,0 +1,134 @@
+/* Copyright (C) 2010 Sun Microsystems, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+/* Like test_plugin.c, but info->user_name is empty.
+*/
+
+#include <my_global.h>
+#include <mysql/plugin_auth.h>
+#include <mysql/client_plugin.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define ORDINARY_QUESTION       "\2"
+#define LAST_QUESTION           "\3"
+#define LAST_PASSWORD           "\4"
+#define PASSWORD_QUESTION       "\5"
+
+/********************* SERVER SIDE ****************************************/
+
+static int auth_test_plugin(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
+{
+  unsigned char *pkt;
+  int pkt_len;
+  /* send a password question */
+  if (vio->write_packet(vio, PASSWORD_QUESTION, 1))
+    return CR_ERROR;
+
+  /* read the answer */
+  if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
+    return CR_ERROR;
+
+  info->password_used = 1;
+
+  /* fail if the password is wrong */
+  if (strcmp(pkt, info->auth_string))
+    return CR_ERROR;
+  /* copy auth string as a destination name to check it */
+  strcpy (info->authenticated_as, info->auth_string);
+  /* copy something into the external user name */
+  strcpy (info->external_user, info->auth_string);
+  strcpy (info->user_name, "");
+  info->user_name_length= 20;
+  
+  return CR_OK;
+}
+
+static struct st_mysql_auth auth_test_handler=
+{
+  MYSQL_AUTHENTICATION_INTERFACE_VERSION,
+  "auth_test_plugin", /* requires test_plugin client's plugin */
+  auth_test_plugin
+};
+
+mysql_declare_plugin(test_plugin)
+{
+  MYSQL_AUTHENTICATION_PLUGIN,
+  &auth_test_handler,
+  "qa_test_null",
+  "Georgi Kodinov",
+  "plugin API test plugin",
+  PLUGIN_LICENSE_GPL,
+  NULL,
+  NULL,
+  0x0100,
+  NULL,
+  NULL,
+  NULL
+}
+mysql_declare_plugin_end;
+
+/********************* CLIENT SIDE ***************************************/
+/*
+  client plugin used for testing the plugin API
+*/
+#include <mysql.h>
+
+static int test_plugin_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
+{
+  unsigned char *pkt, cmd= 0;
+  int pkt_len, res;
+  char *reply;
+  do
+  {
+    /* read the prompt */
+    pkt_len= vio->read_packet(vio, &pkt);
+    if (pkt_len < 0)
+      return CR_ERROR;
+    
+if (pkt == 0)
+    {
+      reply= mysql->passwd;
+    }
+    else
+    {
+      cmd= *pkt++;
+      if (cmd == 0 || cmd == 254)
+        return CR_OK_HANDSHAKE_COMPLETE; /* yes. we're done */
+      if ((cmd == LAST_PASSWORD[0] || cmd == PASSWORD_QUESTION[0]) && *pkt == 0)
+        reply= mysql->passwd;
+      else
+        return CR_ERROR;
+    }
+    if (!reply)
+      return CR_ERROR;
+    res= vio->write_packet(vio, reply, strlen(reply)+1);
+    if (res)
+      return CR_ERROR;
+  } while (cmd != LAST_QUESTION[0] && cmd != PASSWORD_QUESTION[0]);
+  return CR_OK;
+}
+
+
+mysql_declare_client_plugin(AUTHENTICATION)
+  "qa_test_null",
+  "Georgi Kodinov",
+  "Dialog Client Authentication Plugin",
+  {0,1,0},
+  NULL,
+  NULL,
+  test_plugin_client
+mysql_end_client_plugin;

=== added file 'plugin/auth/qa_test_6.c'
--- a/plugin/auth/qa_test_6.c	1970-01-01 00:00:00 +0000
+++ b/plugin/auth/qa_test_6.c	2010-06-24 08:55:18 +0000
@@ -0,0 +1,133 @@
+/* Copyright (C) 2010 Sun Microsystems, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+/* Like test_plugin.c, but info->external_user is empty.
+*/
+
+#include <my_global.h>
+#include <mysql/plugin_auth.h>
+#include <mysql/client_plugin.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define ORDINARY_QUESTION       "\2"
+#define LAST_QUESTION           "\3"
+#define LAST_PASSWORD           "\4"
+#define PASSWORD_QUESTION       "\5"
+
+/********************* SERVER SIDE ****************************************/
+
+static int auth_test_plugin(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
+{
+  unsigned char *pkt;
+  int pkt_len;
+  /* send a password question */
+  if (vio->write_packet(vio, PASSWORD_QUESTION, 1))
+    return CR_ERROR;
+
+  /* read the answer */
+  if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
+    return CR_ERROR;
+
+  info->password_used = 1;
+
+  /* fail if the password is wrong */
+  if (strcmp(pkt, info->auth_string))
+    return CR_ERROR;
+  /* copy auth string as a destination name to check it */
+  strcpy (info->authenticated_as, info->auth_string);
+  /* copy something into the external user name */
+  strcpy (info->external_user, info->auth_string);
+//  strcpy (info->host_or_ip, "");
+  
+  return CR_OK;
+}
+
+static struct st_mysql_auth auth_test_handler=
+{
+  MYSQL_AUTHENTICATION_INTERFACE_VERSION,
+  "auth_test_plugin", /* requires test_plugin client's plugin */
+  auth_test_plugin
+};
+
+mysql_declare_plugin(test_plugin)
+{
+  MYSQL_AUTHENTICATION_PLUGIN,
+  &auth_test_handler,
+  "qa_test_null",
+  "Georgi Kodinov",
+  "plugin API test plugin",
+  PLUGIN_LICENSE_GPL,
+  NULL,
+  NULL,
+  0x0100,
+  NULL,
+  NULL,
+  NULL
+}
+mysql_declare_plugin_end;
+
+/********************* CLIENT SIDE ***************************************/
+/*
+  client plugin used for testing the plugin API
+*/
+#include <mysql.h>
+
+static int test_plugin_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
+{
+  unsigned char *pkt, cmd= 0;
+  int pkt_len, res;
+  char *reply;
+  do
+  {
+    /* read the prompt */
+    pkt_len= vio->read_packet(vio, &pkt);
+    if (pkt_len < 0)
+      return CR_ERROR;
+    
+if (pkt == 0)
+    {
+      reply= mysql->passwd;
+    }
+    else
+    {
+      cmd= *pkt++;
+      if (cmd == 0 || cmd == 254)
+        return CR_OK_HANDSHAKE_COMPLETE; /* yes. we're done */
+      if ((cmd == LAST_PASSWORD[0] || cmd == PASSWORD_QUESTION[0]) && *pkt == 0)
+        reply= mysql->passwd;
+      else
+        return CR_ERROR;
+    }
+    if (!reply)
+      return CR_ERROR;
+    res= vio->write_packet(vio, reply, strlen(reply)+1);
+    if (res)
+      return CR_ERROR;
+  } while (cmd != LAST_QUESTION[0] && cmd != PASSWORD_QUESTION[0]);
+  return CR_OK;
+}
+
+
+mysql_declare_client_plugin(AUTHENTICATION)
+  "qa_test_null",
+  "Georgi Kodinov",
+  "Dialog Client Authentication Plugin",
+  {0,1,0},
+  NULL,
+  NULL,
+  test_plugin_client
+mysql_end_client_plugin;

=== added file 'plugin/auth/qa_test_7.c'
--- a/plugin/auth/qa_test_7.c	1970-01-01 00:00:00 +0000
+++ b/plugin/auth/qa_test_7.c	2010-06-24 08:55:18 +0000
@@ -0,0 +1,133 @@
+/* Copyright (C) 2010 Sun Microsystems, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+/* Like test_plugin.c, but info->external_user is empty.
+*/
+
+#include <my_global.h>
+#include <mysql/plugin_auth.h>
+#include <mysql/client_plugin.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define ORDINARY_QUESTION       "\2"
+#define LAST_QUESTION           "\3"
+#define LAST_PASSWORD           "\4"
+#define PASSWORD_QUESTION       "\5"
+
+/********************* SERVER SIDE ****************************************/
+
+static int auth_test_plugin(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
+{
+  unsigned char *pkt;
+  int pkt_len;
+  /* send a password question */
+  if (vio->write_packet(vio, PASSWORD_QUESTION, 1))
+    return CR_ERROR;
+
+  /* read the answer */
+  if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
+    return CR_ERROR;
+
+  info->password_used = 1;
+
+  /* fail if the password is wrong */
+  if (strcmp(pkt, info->auth_string))
+    return CR_ERROR;
+  /* copy auth string as a destination name to check it */
+  strcpy (info->authenticated_as, info->auth_string);
+  /* copy something into the external user name */
+  strcpy (info->external_user, info->auth_string);
+  strcpy (info->user_name, "");
+  
+  return CR_OK;
+}
+
+static struct st_mysql_auth auth_test_handler=
+{
+  MYSQL_AUTHENTICATION_INTERFACE_VERSION,
+  "auth_test_plugin", /* requires test_plugin client's plugin */
+  auth_test_plugin
+};
+
+mysql_declare_plugin(test_plugin)
+{
+  MYSQL_AUTHENTICATION_PLUGIN,
+  &auth_test_handler,
+  "qa_test_null",
+  "Georgi Kodinov",
+  "plugin API test plugin",
+  PLUGIN_LICENSE_GPL,
+  NULL,
+  NULL,
+  0x0100,
+  NULL,
+  NULL,
+  NULL
+}
+mysql_declare_plugin_end;
+
+/********************* CLIENT SIDE ***************************************/
+/*
+  client plugin used for testing the plugin API
+*/
+#include <mysql.h>
+
+static int test_plugin_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
+{
+  unsigned char *pkt, cmd= 0;
+  int pkt_len, res;
+  char *reply;
+  do
+  {
+    /* read the prompt */
+    pkt_len= vio->read_packet(vio, &pkt);
+    if (pkt_len < 0)
+      return CR_ERROR;
+    
+if (pkt == 0)
+    {
+      reply= mysql->passwd;
+    }
+    else
+    {
+      cmd= *pkt++;
+      if (cmd == 0 || cmd == 254)
+        return CR_OK_HANDSHAKE_COMPLETE; /* yes. we're done */
+      if ((cmd == LAST_PASSWORD[0] || cmd == PASSWORD_QUESTION[0]) && *pkt == 0)
+        reply= mysql->passwd;
+      else
+        return CR_ERROR;
+    }
+    if (!reply)
+      return CR_ERROR;
+    res= vio->write_packet(vio, reply, strlen(reply)+1);
+    if (res)
+      return CR_ERROR;
+  } while (cmd != LAST_QUESTION[0] && cmd != PASSWORD_QUESTION[0]);
+  return CR_OK;
+}
+
+
+mysql_declare_client_plugin(AUTHENTICATION)
+  "qa_test_null",
+  "Georgi Kodinov",
+  "Dialog Client Authentication Plugin",
+  {0,1,0},
+  NULL,
+  NULL,
+  test_plugin_client
+mysql_end_client_plugin;

Attachment: [text/bzr-bundle] bzr/horst.hunger@sun.com-20100624085518-cszxgcs001zsbel2.bundle
Thread
bzr commit into mysql-next-mr-wl1054 branch (horst.hunger:2965) WL#1054Horst.Hunger24 Jun