stderr & win32 admin check

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: <pgsql-patches(at)postgresql(dot)org>
Subject: stderr & win32 admin check
Date: 2004-06-14 20:49:23
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE34BC69@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Per previous patch, win32 required the check for admin privs to be moved
from main.c into postmaster.c, because elog was not available at this
time. While working on fixing that all the way (moving the unix one as
well), I realised this wasn't good, and did it this way instead:

* Created function write_stderr(const char *fmt, ...), used before elog
can be used. This function will write to stderr on unix and on win32
fconsole. It will write to the eventlog on win32 when running as a
service.
* Changed all (most? I think I got all) fprintf(stderr,...) to use this
function instead. That way, we gain the ability to put all the other
preivously-stderr-messages to the eventlog as well.
* This also removes postmaster_error(), since it's mostly duplicate code
with write_stderr().

This patch implements this, as well as adds the win32 check for admin
privs to main.c. Attached file security.c goes in backend/port/win32.

The patch makes the "if user is admin" check on win32 abort startup,
similar to unix. I know several people have said they think this is
wrong, since the last discussion. So if someone wants to re-open that
discussion, go ahead :-) The behaviour can easily be adapted (just
remove an exit(1) at a later date changing the message to a warning).

//Magnus


<<stderr.patch>>

Attachment Content-Type Size
security.c application/octet-stream 1.9 KB
stderr.patch application/octet-stream 18.5 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2004-06-14 21:07:46 Re: stderr & win32 admin check
Previous Message Gary Doades 2004-06-14 17:59:34 Re: [HACKERS] [PATCHES] Compiling libpq with VisualC