Re: Fwd: Keywords in pg_hba.conf should be field-specific

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Brendan Jurd <direvus(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fwd: Keywords in pg_hba.conf should be field-specific
Date: 2011-06-21 04:59:44
Message-ID: BANLkTikLSh1ehSXOXCrUxTGgkMgk74wHNg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2011/6/21 Brendan Jurd <direvus(at)gmail(dot)com>:
> On 21 June 2011 14:34, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>> I don't understand to using a macro
>>
>> #define token_is_keyword(t, k)  (!t->quoted && strcmp(t->string, k) == 0)
>>
>> because you disallowed a quoting?
>
> Well, a token can only be treated as a special keyword if it is unquoted.
>
> As an example, in the 'database' field, the bare token 'replication'
> is a keyword meaning the pseudo-database for streaming rep.  Whereas
> the quoted token "replication" would mean a real database which is
> called 'replication'.
>
> Likewise, the bare token 'all' in the username field is a keyword --
> it matches any username.  Whereas the quoted token "all" would only
> match a user named 'all'.
>
> Therefore, token_is_keyword only returns true where the token matches
> the given string as is also unquoted.
>
> Does that make sense?

yes - it has a sense. Quoting changes sense from keyword to literal.
But then I see a significant inconsistency - every know keywords
should be only tokens.

else if (strcmp(token, "pamservice") == 0)
- {
- REQUIRE_AUTH_OPTION(uaPAM, "pamservice", "pam");
- parsedline->pamservice = pstrdup(c);
- }

because >>pamservice<< - is known keyword, but 'pamservice' is some
literal without any mean. You should to use a makro token_is_keyword
more often.

??

Regards

Pavel

>
> Cheers,
> BJ
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jaime Casanova 2011-06-21 06:51:11 Re: One-Shot Plans
Previous Message Jesper Krogh 2011-06-21 04:50:44 Re: FOR KEY LOCK foreign keys