pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ludek Finstrle <luf@pzkagis.cz>
To: pgsql-odbc@postgresql.org
Subject: patch for [ psqlodbc-Bugs-1000522 ] Enabling logging breaks ODBC for non administrators
Date: Tue, 10 Jan 2006 23:19:33 +0100
Message-ID: <20060110221933.GA8448@soptik.pzkagis.cz> (raw)

> 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=1000522&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

Attachments:

psqlodbc-log_check.diff (text/plain, 1.4K) download 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)

Message-ID: <20060110221933.GA8448@soptik.pzkagis.cz>
Permalink:  ../20060110221933.GA8448@soptik.pzkagis.cz/
Also on:    postgresql.org/message-id/20060110221933.GA8448@soptik.pzkagis.cz

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: luf@pzkagis.cz
  Subject: Re: patch for [ psqlodbc-Bugs-1000522 ] Enabling logging breaks ODBC for non administrators
  In-Reply-To: <20060110221933.GA8448@soptik.pzkagis.cz>
  References: <20060110221933.GA8448@soptik.pzkagis.cz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox