From: | Hari Babu <haribabu(dot)kommi(at)huawei(dot)com> |
---|---|
To: | "'Boszormenyi Zoltan'" <zb(at)cybertec(dot)at>, "'Magnus Hagander'" <magnus(at)hagander(dot)net> |
Cc: | "'PostgreSQL-development'" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: pg_basebackup with -R option and start standby have problems with escaped password |
Date: | 2013-02-19 10:05:47 |
Message-ID: | 004601ce0e88$b0b7f4f0$1227ded0$@kommi@huawei.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Monday, February 18, 2013 8:06 PM Boszormenyi Zoltan wrote:
>On 2013-01-29 11:15 keltezéssel, Magnus Hagander írta:
>> On Thu, Jan 24, 2013 at 7:04 AM, Hari Babu wrote:
>>> On Wed, Jan 23, 2013 11:48 PM, Magnus Hagander wrote:
>>>> On Wed, Jan 23, 2013 at 10:18 AM, Hari Babu wrote:
>>>>> Test scenario to reproduce:
>>>>> 1. Start the server
>>>>> 2. create the user as follows
>>>>> ./psql postgres -c "create user user1 superuser
>>>>> login password 'use''1'"
>>>>>
>>>>> 3. Take the backup with -R option as follows.
>>>>> ./pg_basebackup -D ../../data1 -R -U user1 -W
>>>>>
>>>>> The following errors are occurring when the new standby on the
>>>>> backup database starts.
>>>>>
>>>>> FATAL: could not connect to the primary server: missing "=" after
"1'"
>>> in
>>>>> connection info string
>>>> What does the resulting recovery.conf file look like?
>>> The recovery.conf which is generated is as follows
>>>
>>> standby_mode = 'on'
>>> primary_conninfo = 'user=''user1'' password=''use''1'' port=''5432'' '
>>>
>>>
>>> I observed the problem is while reading primary_conninfo from the
>>> recovery.conf file the function "GUC_scanstr" removes the quotes of
>>> the string and also makes the continuos double quote('') as single
>>> quote(').
>>>
>>> By using the same connection string while connecting to primary
>>> server the function "conninfo_parse" the escape quotes are not able
>>> to parse properly and it is leading to problem.
>>>
>>> please correct me if any thing wrong in my observation.
>> Well, it's clearly broken at least :O
>
>So, there is a bug in generating recovery.conf by not double-escaping the
values and another bug >in parsing the connection string in libpq when the
parameter value starts with a single-quote >character.
>
>Attached are two patches to fix these two bugs, the libpq part can be
back-patched.
With the attached patches I tested the defect and it is fixed.
Regards,
Hari babu.
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2013-02-19 10:08:34 | Re: PATCH: Split stats file per database WAS: autovacuum stress-testing our system |
Previous Message | Christoph Berg | 2013-02-19 09:25:52 | Re: Call for Google Summer of Code mentors, admins |