Discussion:
odbc.ini must be writable -- bug or feature?
LeBlanc, Alain
2005-12-12 19:31:40 UTC
Permalink
Hi everyone,

I hope this is the proper mailing list. I seemed more appropriate than the
support one.

Anyway, I started using unixODBC with FreeTds and I noticed that I could
connect only when the file pointed to by the ODBCINI environment variable
(odbc.ini, in my case) was writable by the process connecting to the
database. I downloaded the code from sourceforge.net and noticed the
following in the file odbcinst_UserINI.c


if ( bVerify )
{
/*
* create it of it doesn't exist
*/
hFile = uo_fopen( pszFileName, "a" );
if ( hFile )
uo_fclose( hFile );
else
return FALSE;
}

return TRUE;
}


Is there a reason why odbc.ini must be opened in the append mode?

Thanks,

Alain
Nick Gorham
2005-12-12 22:49:10 UTC
Permalink
Post by LeBlanc, Alain
Hi everyone,
I hope this is the proper mailing list. I seemed more appropriate than the
support one.
Anyway, I started using unixODBC with FreeTds and I noticed that I could
connect only when the file pointed to by the ODBCINI environment variable
(odbc.ini, in my case) was writable by the process connecting to the
database. I downloaded the code from sourceforge.net and noticed the
following in the file odbcinst_UserINI.c
Hmm, good point, I will take a look at this. Part of the problem, is the
same ini code is used for reads and updates.
--
Nick
Stefan Radman
2005-12-13 08:55:41 UTC
Permalink
It is actually happening.
Call sequence recently seen in an strace from a debian box:

open("/etc/odbcinst.ini", O_RDONLY) = 3
access("/etc/odbc.ini", F_OK) = 0
open("/etc/odbcinst.ini", O_RDONLY) = 3
open("/root/.odbc.ini", O_WRONLY|O_APPEND|O_CREAT, 0666) = 3
open("/root/.odbc.ini", O_RDONLY) = 3
open("/etc/odbc.ini", O_RDONLY) = 3
open("/etc/odbc.ini", O_RDONLY) = 3

Looking at the trace I was wondering what the purpose of that call was.

Stefan
-----Original Message-----
Sent: Monday, 12 December, 2005 23:49
To: Development issues and topics for unixODBC
Subject: Re: [unixODBC-dev] odbc.ini must be writable -- bug
or feature?
Post by LeBlanc, Alain
Hi everyone,
I hope this is the proper mailing list. I seemed more
appropriate than the
Post by LeBlanc, Alain
support one.
Anyway, I started using unixODBC with FreeTds and I noticed
that I could
Post by LeBlanc, Alain
connect only when the file pointed to by the ODBCINI
environment variable
Post by LeBlanc, Alain
(odbc.ini, in my case) was writable by the process connecting to the
database. I downloaded the code from sourceforge.net and noticed the
following in the file odbcinst_UserINI.c
Hmm, good point, I will take a look at this. Part of the
problem, is the
same ini code is used for reads and updates.
--
Nick
_______________________________________________
unixODBC-dev mailing list
http://mail.easysoft.com/mailman/listinfo/unixodbc-dev
Nick Gorham
2005-12-13 09:25:38 UTC
Permalink
Post by Stefan Radman
It is actually happening.
open("/etc/odbcinst.ini", O_RDONLY) = 3
access("/etc/odbc.ini", F_OK) = 0
open("/etc/odbcinst.ini", O_RDONLY) = 3
open("/root/.odbc.ini", O_WRONLY|O_APPEND|O_CREAT, 0666) = 3
open("/root/.odbc.ini", O_RDONLY) = 3
open("/etc/odbc.ini", O_RDONLY) = 3
open("/etc/odbc.ini", O_RDONLY) = 3
Looking at the trace I was wondering what the purpose of that call was.
Stefan
It should be remembered that this is the USER ini file, so normally will
be in the home directory of the user, so permission will not be a
problem under normal use. By using the ODBCINI variable this can be
pointed elsewhere which is causing the problem. I would normally suggest
using the ODBCSYSINI variable to point to the system odbc.ini and
odbcinst.ini location.
--
Nick
LeBlanc, Alain
2005-12-13 20:19:13 UTC
Permalink
Thanks. It solves my problem. Somehow I missed the part of the docs about
ODBCSYSINI.



Alain





-----Original Message-----
From: Nick Gorham [mailto:***@easysoft.com]
Sent: Tuesday, December 13, 2005 4:26 AM
To: Development issues and topics for unixODBC
Subject: Re: [unixODBC-dev] odbc.ini must be writable -- bug or feature?
Post by Stefan Radman
It is actually happening.
open("/etc/odbcinst.ini", O_RDONLY) = 3
access("/etc/odbc.ini", F_OK) = 0
open("/etc/odbcinst.ini", O_RDONLY) = 3
open("/root/.odbc.ini", O_WRONLY|O_APPEND|O_CREAT, 0666) = 3
open("/root/.odbc.ini", O_RDONLY) = 3
open("/etc/odbc.ini", O_RDONLY) = 3
open("/etc/odbc.ini", O_RDONLY) = 3
Looking at the trace I was wondering what the purpose of that call was.
Stefan
It should be remembered that this is the USER ini file, so normally will
be in the home directory of the user, so permission will not be a
problem under normal use. By using the ODBCINI variable this can be
pointed elsewhere which is causing the problem. I would normally suggest
using the ODBCSYSINI variable to point to the system odbc.ini and
odbcinst.ini location.
--
Nick
_______________________________________________
unixODBC-dev mailing list
unixODBC-***@easysoft.com
http://mail.easysoft.com/mailman/listinfo/unixodbc-dev
<http://mail.easysoft.com/mailman/listinfo/unixodbc-dev>
Loading...