[unixODBC-dev] ODBC-api hooking problem

jon pounder jonp at inline.net
Wed Apr 10 16:51:01 BST 2013

On 04/10/2013 11:45 AM, Динар Рахимбаев wrote:

I don't know for sure but I am guessing having 2 instances of the dm 
loaded in the same process is causing trouble since there is only one 
odbc environment per process.

you should be able to simply call the dbms driver from within your own 
driver though, every function do your special stuff then call the same 
func in the driver - thats basically what the dm does now.

> 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!
> _______________________________________________
> unixODBC-dev mailing list
> unixODBC-dev at mailman.unixodbc.org
> http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev

More information about the unixODBC-dev mailing list