Re: Case insensitive usernames

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Case insensitive usernames
Date: 2005-05-10 08:18:55
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE6C745A@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > Another way to help in this particular case would be to
> have libpq on
> > win32 only force-lowercase the username IF it was retreived
> from the
> > system (but not when manually specified).
>
> Well, I personally don't care how bizarrely the Win32 port
> behaves ;-) so I won't complain if something like that
> happens. You should think twice though about whether
> introducing this inconsistency is going to be a net win, or
> whether it'll just move the confusion someplace else.

Windows is case-insensitive to usernames. Always has been, and I really
don't think it's about to change considering M$'s deal with backwards
compatiblity. I doubt if this would surprise anybody - at least anybody
on the win32 platform.

Actualyl, what usually surprises people is that GetUserName() returns
the case of the username *as the user entered it at login*, and *NOT* as
the administrator entered it in the Active Directory. Which can be said
to be a bug depending on how you look at it, but from a "username is
case insensitive" perspective it doesn't matter.

Note that we wouldn't case-change a userid that is actually specified by
the user (in the connectino string, on the commandline to psql).

> > Then if this was done the
> > kerberos username-matching code would just have to be relaxed to be
> > case insensitive (which it really should be, because AFAIK
> kerberos is
> > supposed to be case insensitive),
>
> This however bothers me; it seems like a potential security
> hole (create kerberos principal FOO, use it to break into
> Foo's account).

Actually, to be specific, if you case-fold it he could get into "foo"
but not "Foo".

> Or does kerberos guarantee FOO and Foo are the same?

Did some further checking, and it turns out this depends on the KDC. All
KDCs are required to be case sensitive no the *REALM*. But I can't find
any documented requirements on the principal - just signs that different
KDCs treat it differently. Windows AD KDC for example is insensitive,
whereas I think it looks like MIT is case sensitive.

Which brings me back to thinking a GUC is the way to deal with that -
you'll definitly know what kind of KDC you have when you set up
Kerberos. But perhaps this GUC should be for "permit case-insensitive
kerberos principals" and not "case-insensitive usernames". And it would
just control the comparison between kerberos principal and user-supplied
username. The user-supplied username would still be what's used in any
access to the database, regardless of case.

Reasonable?

//Magnus

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Hallgren 2005-05-10 08:29:18 Re: Oracle Style packages on postgres
Previous Message palanivel.kumaran 2005-05-10 07:54:11 Please clarify