Req #68281 [NEW]: mariadb server with dialog auth method
| From: | roberto at spadim dot com dot br | Date: | Wed, 22 Oct 2014 05:58:55 +0000 |
| Subject: | Req #68281 [NEW]: mariadb server with dialog auth method | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-188247@lists.php.net to get a copy of this message | ||
From: roberto at spadim dot com dot br
Operating system: any
PHP version: Irrelevant
Package: MySQL related
Bug Type: Feature/Change Request
Bug description:mariadb server with dialog auth method
Description:
------------
Hi guys, i'm testing mysql connect with a mariadb server using a dialog
auth plugin (server side)
i didn't found functions to execute dialog with server
a full example of what i want but using heidisql can be found here:
http://www.heidisql.com/forum.php?t=9752
---
here the php files (download only .php files):
https://github.com/rspadim/server/blob/otp_plugin/plugin/auth_otp/
here the today output using mysql_connect: (using otp_auth_example.php
php file)
==============================
MYSQL_CONNECT:
PHP Warning: mysql_connect(): The server requested authentication
method unknown to the client [dialog] in
C:\GIT\mariadb-tmp\server\plugin\auth_otp\otp_auth_e
xample.php on line 50
Warning: mysql_connect(): The server requested authentication method
unknown to the client [dialog] in
C:\GIT\mariadb-tmp\server\plugin\auth_otp\otp_auth_exampl
e.php on line 50
PHP Warning: mysql_connect(): The server requested authentication
method umknown to the client in
C:\GIT\mariadb-tmp\server\plugin\auth_otp\otp_auth_example.ph
p on line 50
Warning: mysql_connect(): The server requested authentication method
umknown to the client in
C:\GIT\mariadb-tmp\server\plugin\auth_otp\otp_auth_example.php on
line 50
Error: The server requested authentication method >>>umknown<<< to the
client (CHECK A TYPO ERROR)
==============================
MYSQI_CONNECT:
C:\GIT\mariadb-tmp\server\plugin\auth_otp>php otp_auth_example.php
PHP Warning: mysqli_connect(): The server requested authentication
method unknown to the client [dialog] in
C:\GIT\mariadb-tmp\server\plugin\auth_otp\otp_auth_
example.php on line 60
Warning: mysqli_connect(): The server requested authentication method
unknown to the client [dialog] in
C:\GIT\mariadb-tmp\server\plugin\auth_otp\otp_auth_examp
le.php on line 60
PHP Warning: mysqli_connect(): (HY000/2054): The server requested
authentication method umknown to the client in
C:\GIT\mariadb-tmp\server\plugin\auth_otp\otp_
auth_example.php on line 60
Warning: mysqli_connect(): (HY000/2054): The server requested
authentication method umknown to the client in
C:\GIT\mariadb-tmp\server\plugin\auth_otp\otp_auth_
example.php on line 60
PHP Warning: mysqli_error() expects parameter 1 to be mysqli, boolean
given in C:\GIT\mariadb-tmp\server\plugin\auth_otp\otp_auth_example.php
on line 62
Warning: mysqli_error() expects parameter 1 to be mysqli, boolean
given in C:\GIT\mariadb-tmp\server\plugin\auth_otp\otp_auth_example.php
on line 62
Error:
===============================
PDO:
C:\GIT\mariadb-tmp\server\plugin\auth_otp>php otp_auth_example.php
PHP Warning: PDO::__construct(): The server requested authentication
method unknown to the client [dialog] in
C:\GIT\mariadb-tmp\server\plugin\auth_otp\otp_aut
h_example.php on line 68
Warning: PDO::__construct(): The server requested authentication
method unknown to the client [dialog] in
C:\GIT\mariadb-tmp\server\plugin\auth_otp\otp_auth_exa
mple.php on line 68
Error: SQLSTATE[HY000] [2054] The server requested authentication
method umknown to the client
Test script:
---------------
https://github.com/rspadim/server/blob/otp_plugin/plugin/auth_otp/
download all .php files
otp_auth_example.php
at mariadb server:
INSTALL PLUGIN three_attempts SONAME 'dialog_examples.so';
CREATE USER test_dialog IDENTIFIED VIA three_attempts USING 'SECRET';
try to connect using username = test_dialog, and password='SECRET'
Expected result:
----------------
implement a new feature of dialog connection
three functions must be implemented for <mysql> and <mysqli> extension:
mysql_auth_dialog_received()
mysql_auth_dialog_receive()
mysql_auth_dialog_send()
and maybe at mysql_connect we will need a parameter to call a mysql
function, for example
$link = mysql_connect($HOST, $USER, $PASSWORD);
if(mysql_auth_dialog_received($link)){
$tmp=mysql_auth_dialog_receive($link); /*
array(type=>'pass/text',message=>'any message') */
mysql_auth_dialog_send($link,"any message");
}
if($link){
// ok good connection
}else{
// die("can't connect");
}
-------------
with mysqli we could use mysqli_init, mysqli_options,
mysqli_realconnect
$db = mysqli_init();
$test = $db->options(MYSQLI_DIALOG_FUNCTION,function(){});
or
$test = $db->options(MYSQLI_DIALOG_FUNCTION,"an_callback_function");
function an_callback_function($db,$type,$message){
return true; /* wait other message */
return false; /* disconnect */
mysqli_auth_dialog_send($db,"message");
}
------------
PDO:
$dbh = new PDO("mysql:host=$HOST;port=$HOST_PORT;dbname=$DB", $USER,
$PASSWORD, array( "MYSQL_DIALOG_AUTH_CALLBACK_FUNCTION" => function(){}
));
or
$dbh = new PDO("mysql:host=$HOST;port=$HOST_PORT;dbname=$DB", $USER,
$PASSWORD, array( "MYSQL_DIALOG_AUTH_CALLBACK_FUNCTION" =>
"an_callback_function" ));
function an_callback_function($db,$type,$message){
return true; /* wait other message */
return false; /* disconnect */
$db->mysqli_auth_dialog_send($db,"message");
}
Actual result:
--------------
no client side auth dialog interface
--
Edit bug report at https://bugs.php.net/bug.php?id=68281&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68281&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68281&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68281&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68281&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68281&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68281&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68281&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68281&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68281&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68281&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68281&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68281&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68281&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68281&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68281&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68281&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68281&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68281&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68281&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68281&r=mysqlcfg