Re: BUG #5304: psql using conninfo fails in connecting to the server

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #5304: psql using conninfo fails in connecting to the server
Дата
Msg-id 14396.1265163057@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #5304: psql using conninfo fails in connecting to the server  (Fujii Masao <masao.fujii@gmail.com>)
Ответы Re: BUG #5304: psql using conninfo fails in connecting to the server
Список pgsql-bugs
Fujii Masao <masao.fujii@gmail.com> writes:
> On Wed, Feb 3, 2010 at 10:05 AM, Joe Conway <mail@joeconway.com> wrote:
>> Objections?

> I think that PQconnectdbParams() rather than psql should handle the
> dbname containing "=". Otherwise whenever we use PQconnectdbParams(),
> we would have to check for the content of the dbname before calling
> it in the future application. Which looks very messy for me.

Yeah, I just complained about the same thing.  However I don't think
we should make PQconnectdbParams do that unconditionally.  In a lot of
applications, it is a key advantage of PQconnectdbParams that there's
no possibility of funny characters in the arguments resulting in "SQL
injection", ie, somebody being able to set connection parameters they
weren't supposed to.  Even without any malicious intent, having to
think about quoting and so forth destroys a lot of the value.

Since we haven't yet released PQconnectdbParams, it's not too late
to twiddle its API.  What I'm thinking about is an additional
boolean parameter "expand_dbname", which only if true would enable
treating an equal-sign-containing dbname like a conninfo string.
Passing true would be okay for command-line apps where the user is
supposed to control all the conn parameters anyway, but apps that
want more security would pass false.

We should also give more than zero thought to how values coming from the
expanded dbname should interact with values from other arguments to
PQconnectdbParams --- which should override which?  And should there be
an order dependency?

            regards, tom lane

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

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: BUG #5304: psql using conninfo fails in connecting to the server
Следующее
От: Joe Conway
Дата:
Сообщение: Re: BUG #5304: psql using conninfo fails in connecting to the server