[unixODBC-support] ODBC-api hooking problem

Динар Рахимбаев rakhimbaev at cg.ru
Wed Apr 10 16:45:16 BST 2013


Good afternoon!

I have a problem of hooking ODBC-api calls to perform some authority 
check of SQL-requests. I decided that it is possible if I developed my 
own driver, which would pass calls from driver manager  to the next 
DBMS-specific driver, or again to the driver manager(driver manager then 
would call DBMS specific driver) after authority check.
I decided to implement my custom driver by the second way (i.e. driver 
passes calls to the driver manager), because the driver manager performs 
many routine work of managing environment and connections. So my custom 
driver loads the driver manager (libodbc.so) using dlmopen(), extracts 
the entry points using dlsym(), then just passes calls to the 
corresponding functions of newly loaded driver manager.

I'm getting SIGSEGV when my driver passes the call to driver manager's 
SQLConnect() function.

So my question is: is it possible at all to use the driver manager in a 
such scheme?

/****************************************************

Applicaion -> Driver manager 1 -> My custom driver(hook) -> Driver 
manager 2 -> DBMS specific driver.

****************************************************/

If not, maybe you have some ideas on how to do it using ODBC? Saying 
again: I need to perform authority check of SQL-requests before requests 
are passed to DBMS. Moreover, I must be able to reject unauthorized 
requests.

Thank you for attention!


More information about the unixODBC-support mailing list