Thread: Re: [BUGS] More SSL questions..

Re: [BUGS] More SSL questions..

From
"Dave Page"
Date:

> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: 07 January 2005 22:36
> To: Dave Page
> Cc: Bruce Momjian; Magnus Hagander;
> pgsql-hackers-win32@postgresql.org; Matthew T. O'Connor;
> Andrew Dunstan; T.J.
> Subject: Re: [pgsql-hackers-win32] [BUGS] More SSL questions..
>
> So .cfg wouldn't allow the file to be auto-opened?  Hardly worth it
> then.  Seems like it's .txt or nothing.

Yup :-(

> If opening with notepad is an actively bad idea (for instance
> because it
> will auto-wrap lines in the file) then I'd agree we don't want .txt.
> But if notepad is a usable tool, I don't think that making it
> harder for
> people to open the files is any improvement.  If they don't understand
> the format of the files then they will get themselves in
> trouble anyway.

I just checked in my clean test VM, and notepad doesn't seem to wrap by
default (even when it does, it's only a visual thing - it doesn't alter
the file). Notepad is a festering pile of garbage, but it is vaguely
useable :-)

Regards, Dave.

Re: [BUGS] More SSL questions..

From
"T.J."
Date:
Has anyone else tested out the use of client certs with the new win
code? Rebuilt the latest from scratch and I started getting SSL SYSCALL,
so I went into fe-secure.c, and commented out line 842 (again), and now
it works (again). Any ideas why commenting that line is such a
penicillin? Or rather, why that if statement is causing such problems.
Anyways, just curious if anyone has got it to work w/out modifications?


Re: [BUGS] More SSL questions..

From
Tom Lane
Date:
"T.J." <tjtoocool@phreaker.net> writes:
> Has anyone else tested out the use of client certs with the new win
> code? Rebuilt the latest from scratch and I started getting SSL SYSCALL,
> so I went into fe-secure.c, and commented out line 842 (again), and now
> it works (again). Any ideas why commenting that line is such a
> penicillin? Or rather, why that if statement is causing such problems.

Doh --- isn't fstat's st_ino a meaningless value on Windows?

            regards, tom lane

Re: [BUGS] More SSL questions..

From
Andrew Dunstan
Date:

Tom Lane wrote:

>"T.J." <tjtoocool@phreaker.net> writes:
>
>
>>Has anyone else tested out the use of client certs with the new win
>>code? Rebuilt the latest from scratch and I started getting SSL SYSCALL,
>>so I went into fe-secure.c, and commented out line 842 (again), and now
>>it works (again). Any ideas why commenting that line is such a
>>penicillin? Or rather, why that if statement is causing such problems.
>>
>>
>
>Doh --- isn't fstat's st_ino a meaningless value on Windows?
>
>


Pretty much, yes. See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__fstat.2c_._fstati64.asp
and

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__stat.2c_._wstat.2c_._stati64.2c_._wstati64.asp

The latter states:  "The inode, and therefore *st_ino*, has no meaning
in the FAT, HPFS, or NTFS file systems." The fstat page doesn't even
refer to it at all.

cheers

andrew


Re: [BUGS] More SSL questions..

From
Tom Lane
Date:
Andrew Dunstan <andrew@dunslane.net> writes:
> Tom Lane wrote:
>> Doh --- isn't fstat's st_ino a meaningless value on Windows?

> Pretty much, yes.

The minimum change to fix it would be to ifdef out the fstat call and
ino/dev test on WIN32.  However, I'm wondering why the code does it that
way in the first place.  The proper way to enforce the security check,
if we're worried about race conditions, is to apply the file
ownership/permissions test to the fstat result.  It's not clear to me
that the stat call before fopen is worth anything at all.  Thoughts?

            regards, tom lane