Re: stderr & win32 admin check - Mailing list pgsql-patches

From Magnus Hagander
Subject Re: stderr & win32 admin check
Date
Msg-id 6BCB9D8A16AC4241919521715F4D8BCE34BCE8@algol.sollentuna.se
Whole thread Raw
In response to stderr & win32 admin check  ("Magnus Hagander" <mha@sollentuna.net>)
List pgsql-patches
You probably would've been a lot less confused if I had actually
included the *patch* along with the C file..

Sorry!


//Magnus


>-----Original Message-----
>From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
>Sent: den 20 juni 2004 20:27
>To: Magnus Hagander
>Cc: Tom Lane; pgsql-patches@postgresql.org
>Subject: Re: [PATCHES] stderr & win32 admin check
>
>
>
>I am confused.  There are no hooks to call this function right now.  Is
>it called by Claudio's patch?
>
>---------------------------------------------------------------
>------------
>
>Magnus Hagander wrote:
>> Attached is the updated version of this patch, which now
>includes proper
>> testing for win32 service running. This is tested and verified with
>> Claudios service wrapper pg_ctl patch (including the parts I
>added and
>> sent in a short while ago).
>>
>> security.c goes in backend/port/win32/
>>
>> //Magnus
>>
>>
>> >-----Original Message-----
>> >From: Magnus Hagander
>> >Sent: den 19 juni 2004 13:55
>> >To: Bruce Momjian
>> >Cc: Tom Lane; pgsql-patches@postgresql.org
>> >Subject: Re: [PATCHES] stderr & win32 admin check
>> >
>> >
>> >I plan to resubmit this patch shortly (hopefully during the weekend)
>> >including supprot for detecting if running as a service
>(and thus pick
>> >eventlog support). From what I can tell, the rest should be Ok
>> >to go, so
>> >expect a new one shortly.
>> >
>> >//Magnus
>> >
>> >>-----Original Message-----
>> >>From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
>> >>
>> >>
>> >>
>> >>Magnus, where are we on this refactoring process.
>> >>
>> >>---------------------------------------------------------------
>> >>------------
>> >>
>> >>Magnus Hagander wrote:
>> >>> >> * 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.
>> >>> >
>> >>> >I'm not sure this is a good idea.  The remaining uses of
>> >stderr were
>> >>> >that way for a reason, not because someone had forgot to
>> >change them
>> >>> >into elog calls.  It would be a lot less invasive to
>just move the
>> >>> >privilege check as you originally intended.
>> >>>
>> >>>
>> >>> I figured as long as nothing "dangerous" (e.g. using memory
>> >>allocations
>> >>> etc) is done in the function, it should be just as safe as
>> >>fprintf. On
>> >>> Unix, it does nothing more than a simple fprintf anyway (one call
>> >>> deeper). The only difference in practice is that we can put
>> >>them in the
>> >>> eventlog on win32 (again, only using calls that are safe in this
>> >>> context). If we do it the other way, we are going to lose
>> >these other
>> >>> messages when running as a service on win32 (since we
>> >>specifically are
>> >>> not using ereport(), per what you say above).
>> >>>
>> >>> Also, this would remove the check so you could do initdb
>and other
>> >>> operations that are blocked today (that don't go through
>> >>postmaster.c)
>> >>> when being root, I assumed that was not good either...
>> >>>
>> >>> //Magnus
>> >>>
>> >>> ---------------------------(end of
>> >>broadcast)---------------------------
>> >>> TIP 1: subscribe and unsubscribe commands go to
>> >>majordomo@postgresql.org
>> >>>
>> >>
>> >>--
>> >>  Bruce Momjian                        |  http://candle.pha.pa.us
>> >>  pgman@candle.pha.pa.us               |  (610) 359-1001
>> >>  +  If your life is a hard drive,     |  13 Roberts Road
>> >>  +  Christ can be your backup.        |  Newtown Square,
>> >>Pennsylvania 19073
>> >>
>> >
>> >---------------------------(end of
>> >broadcast)---------------------------
>> >TIP 8: explain analyze is your friend
>> >
>
>Content-Description: security.c
>
>[ Attachment, skipping... ]
>
>--
>  Bruce Momjian                        |  http://candle.pha.pa.us
>  pgman@candle.pha.pa.us               |  (610) 359-1001
>  +  If your life is a hard drive,     |  13 Roberts Road
>  +  Christ can be your backup.        |  Newtown Square,
>Pennsylvania 19073
>

Attachment

pgsql-patches by date:

Previous
From: "Magnus Hagander"
Date:
Subject: Re: Cancel/Kill backend functions -- docs
Next
From: Bruce Momjian
Date:
Subject: Re: stderr & win32 admin check