[Maria-developers] Obtaining usernames in MariaDB UDFs
Hello guys, I am building a set of MariaDB UDFs that require to know a name of a user who called them in each and every call. Users should not be able to pretend as someone else, hence usernames as an argument cannot be used. I compile UDFs against MariaDB headers and I was able to obtain the current_thd, but the security_ctx pointer inside is NULL. Could somebody give me a hint what I am doing wrong? Thank you for your answers! Best regards, Denis Scherbakov
Hi, Denis! On Jul 31, Denis Scherbakov wrote:
Hello guys,
I am building a set of MariaDB UDFs that require to know a name of a user who called them in each and every call. Users should not be able to pretend as someone else, hence usernames as an argument cannot be used.
I compile UDFs against MariaDB headers and I was able to obtain the current_thd, but the security_ctx pointer inside is NULL.
Could somebody give me a hint what I am doing wrong?
Thank you for your answers!
Can you show a stack trace from where you see security_ctx being NULL in your UDF? Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org
Hello Sergei, Thank you for your clarification question. I thought about it and came to a conclusion that having security_ctx empty is an unusual case that lead me to thinking that MariaDB version was the cause. I upgraded my server version from 5.5.65 to 10.5.4 and the UDFs started to work, security_ctx was no longer empty and I could extract a username. Thank you! Best regards, Denis On 2020-07-31 18:07, Sergei Golubchik wrote:
Hi, Denis!
On Jul 31, Denis Scherbakov wrote:
Hello guys,
I am building a set of MariaDB UDFs that require to know a name of a user who called them in each and every call. Users should not be able to pretend as someone else, hence usernames as an argument cannot be used.
I compile UDFs against MariaDB headers and I was able to obtain the current_thd, but the security_ctx pointer inside is NULL.
Could somebody give me a hint what I am doing wrong?
Thank you for your answers!
Can you show a stack trace from where you see security_ctx being NULL in your UDF?
Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org
participants (2)
-
Denis Scherbakov
-
Sergei Golubchik