patch for [ psqlodbc-Bugs-1000522 ] Enabling logging breaks ODBC for non administrators
am 10.01.2006 23:19:33 von Ludek Finstrle--fdj2RfSjLxBAspz7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
> Bugs item #1000522, was opened at 2006-01-07 18:52
> You can respond by visiting:
> http://pgfoundry.org/tracker/?func=detail&atid=538&aid=10005 22&group_id=1000125
> Initial Comment:
> Steps to reproduce (tested on windows 2003)
>
> 1. Create a user DSN logged in as a non-admin user
> 2. Create another user DSN logged in as admin user. As this user, enable logging ("mylog")
> 3. Try to configure the DSN logged in as a non admin user. The ODBC driver crashes with error 998.
>
> This is probably because it can't write to the logfile? Which brings up two points:
>
> 1) There should be error checking for that :-) If that's exactly what it is.
>
> 2) The logfiles are completely usless for non-administrative users, since they are hardcoded to c:\. This should be configurable, or if it's hardcode dit should at least be hardcoded to the temp directory (as set in the environment), not to c:\. This is true even if my assumption that this permissions issue is what causes the problem specified.
>
> ------------------------------------------------------------ ----------
Here is the patch for mail archive. It use the easiest way. It isn't
possible for user without write permission to C:\ to enable logs.
I think we need time for developing new version more then better solution
for this.
Please review and comment
Luf
--fdj2RfSjLxBAspz7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="psqlodbc-log_check.diff"
diff -c psqlodbc.orig\misc.c psqlodbc\misc.c
*** psqlodbc.orig\misc.c Wed Nov 30 13:44:24 2005
--- psqlodbc\misc.c Tue Jan 10 23:53:39 2006
***************
*** 139,145 ****
filedes = open(filebuf, O_WRONLY | O_APPEND | O_CREAT, S_IWUSR | S_IRUSR);
LOGFP = fdopen(filedes, PG_BINARY_A);
#endif
! setbuf(LOGFP, NULL);
}
#ifdef WIN_MULTITHREAD_SUPPORT
--- 139,148 ----
filedes = open(filebuf, O_WRONLY | O_APPEND | O_CREAT, S_IWUSR | S_IRUSR);
LOGFP = fdopen(filedes, PG_BINARY_A);
#endif
! if (LOGFP)
! setbuf(LOGFP, NULL);
! else
! mylog_on = 0;
}
#ifdef WIN_MULTITHREAD_SUPPORT
***************
*** 188,199 ****
{
generate_filename(QLOGDIR, QLOGFILE, filebuf);
#ifdef WIN32
! LOGFP = fopen(filebuf, PG_BINARY_A);
#else
! filedes = open(filebuf, O_WRONLY | O_APPEND | O_CREAT, S_IWUSR | S_IRUSR);
! LOGFP = fdopen(filedes, PG_BINARY_A);
#endif
! setbuf(LOGFP, NULL);
}
if (LOGFP)
--- 191,205 ----
{
generate_filename(QLOGDIR, QLOGFILE, filebuf);
#ifdef WIN32
! LOGFP = fopen(filebuf, PG_BINARY_A);
#else
! filedes = open(filebuf, O_WRONLY | O_APPEND | O_CREAT, S_IWUSR | S_IRUSR);
! LOGFP = fdopen(filedes, PG_BINARY_A);
#endif
! if (LOGFP)
! setbuf(LOGFP, NULL);
! else
! qlog_on = 0;
}
if (LOGFP)
--fdj2RfSjLxBAspz7
Content-Type: text/plain
Content-Disposition: inline
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend
--fdj2RfSjLxBAspz7--