X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 122FD9DC85F for ; Tue, 10 Jan 2006 18:19:47 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06653-07 for ; Tue, 10 Jan 2006 18:19:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.pzkagis.cz (gis6.netbox.cz [83.240.30.214]) by postgresql.org (Postfix) with ESMTP id 17DA69DC827 for ; Tue, 10 Jan 2006 18:19:41 -0400 (AST) Received: from soptik.pzkagis.cz (localhost.localdomain [127.0.0.1]) by smtp.pzkagis.cz (8.13.1/8.13.1) with ESMTP id k0AMJXvi008471 for ; Tue, 10 Jan 2006 23:19:33 +0100 Received: (from luf@localhost) by soptik.pzkagis.cz (8.13.1/8.13.1/Submit) id k0AMJXhe008470 for pgsql-odbc@postgresql.org; Tue, 10 Jan 2006 23:19:33 +0100 Date: Tue, 10 Jan 2006 23:19:33 +0100 From: Ludek Finstrle To: pgsql-odbc@postgresql.org Subject: patch for [ psqlodbc-Bugs-1000522 ] Enabling logging breaks ODBC for non administrators Message-ID: <20060110221933.GA8448@soptik.pzkagis.cz> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="fdj2RfSjLxBAspz7" Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Virus-Scanned: ClamAV version 0.87.1, clamav-milter version 0.87 on smtp.pzkagis.cz X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.069 required=5 tests=[AWL=0.069] X-Spam-Score: 0.069 X-Spam-Level: X-Archive-Number: 200601/103 X-Sequence-Number: 6918 --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=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 --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--