Re: BUG #13854: SSPI authentication failure: wrong realm name used

Поиск
Список
Период
Сортировка
От Christian Ullrich
Тема Re: BUG #13854: SSPI authentication failure: wrong realm name used
Дата
Msg-id AM3PR06MB06966DD9FC34CE9643020DF9D4820@AM3PR06MB0696.eurprd06.prod.outlook.com
обсуждение исходный текст
Ответ на Re: BUG #13854: SSPI authentication failure: wrong realm name used  (Christian Ullrich <chris@chrullrich.net>)
Список pgsql-hackers
* From: Christian Ullrich

> * From: Robbie Harwood [mailto:rharwood@redhat.com]
>
> > Christian Ullrich <chris@chrullrich.net> writes:

> > > +     /* Replace domainname with realm name. */
> > > +     if (upnamerealmsize > domainnamesize)
> > > +     {
> > > +         pfree(upname);
> > > +         ereport(LOG,
> > > +                 (errcode(ERRCODE_INVALID_ROLE_SPECIFICATION),
> > > +                  errmsg("realm name too long")));
> > > +                  return STATUS_ERROR;
> > > +     }
> > > +
> > > +     /* Length is now safe. */
> > > +     strcpy(domainname, p+1);
> >
> > Is this an actual fail state or something born out of convenience?  A
> > naive reading of this code doesn't explain why it's forbidden for the
> > upn realm to be longer than the domain name.
>
> Because it's copied *into* domainname right there on the last line.
>
> That said, sizeof(domainname) is MAXPGPATH, which is 1024, so there is
> absolutely no chance that the realm could be longer -- it would need an
> AD forest at least 16 domains deep.

Oh, sorry, I misunderstood the question. Yes, it's due to convenience, but
a) it *is* rather convenient given the plentiful buffer I get, and
b) doing it differently involves char** inout parameters and potential
trouble with pointer aliasing in the caller, both things I'd rather avoid.

--
Christian




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Show dropped users' backends in pg_stat_activity
Следующее
От: Tom Lane
Дата:
Сообщение: Re: NOT EXIST for PREPARE