Bug #77228 Add _login and _hostname as connection attribute. (contribution)
Submitted: 2 Jun 2015 15:53 Modified: 3 Jun 2015 5:12
Reporter: OCA Admin (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[2 Jun 2015 15:53] OCA Admin
Description:
This bug tracks a contribution by Daniël van Eeden (Github user: dveeden) as described in http://github.com/mysql/mysql-server/pull/10

How to repeat:
See description

Suggested fix:
See contribution code attached
[2 Jun 2015 15:53] OCA Admin
Contribution submitted via Github - Add _login and _hostname as connection attribute. 
(*) Contribution by Daniël van Eeden (Github dveeden, mysql-server/pull/10#issuecomment-107830752): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: git_patch_36616742.txt (text/plain), 1.72 KiB.

[3 Jun 2015 5:12] Umesh Shastry
Hello Daniël,

Thank you for the report and contribution.

Thanks,
Umesh
[4 Jun 2015 16:02] Igor Solodovnikov
Posted by developer:
 
I don't think proposed patch can be merged in unchanged state. There are several issues:

- It will not compile on Windows. There is no geteuid and getpwuid functions on Windows. Quick search shown that there is portable get_current_os_user function in client/mysql.cc. I think in this patch we need to use similar approach.

- register storage class is used in the proposed patch. I don't think it is necessary. BTW it is deprecated in C++.

- in the comment to the original bug #77190 Shane Bester said that adding this data to the connection attributes may create a security issue. I am not sure if he is right or not.
[12 Jul 2015 15:54] Daniël van Eeden
Patch 1/1

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: 0001-Add-_login-and-_hostname-as-connection-attribute.patch (text/x-patch), 1.74 KiB.

[12 Jul 2015 15:54] Daniël van Eeden
Patch 2/2

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: 0002-Update-_login-and-_hostname-attributes.patch (text/x-patch), 1.85 KiB.

[12 Jul 2015 15:55] Daniël van Eeden
@Igor
- Removed the register storage class
- Added Windows support (not tested or compiled as I don't have a windows machine)