Issue 8233 - config parser accepts lines with unbalanced quotes
Summary: config parser accepts lines with unbalanced quotes
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-01 00:09 UTC by Howard Chu
Modified: 2016-01-29 20:30 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Howard Chu 2015-09-01 00:09:17 UTC
Full_Name: Howard Chu
Version: 2.4
OS: 
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (50.232.101.67)
Submitted by: hyc


We were tripped up by a misbehaving syncrepl consumer, that was always
connecting as plain syncrepl even though it was intended to use delta-sync.

The config had been pasted out of an email and the mail client had turned some
(but not all) ASCII double-quotes into UTF-8 smart quotes. As such, the syncrepl
stanza ended at
   logfilter="xxxxx

and this wasn't flagged as an error because
  1) the config parser doesn't care if double quotes get terminated or not
  2) the syncrepl config parser doesn't look at logfilter if logbase wasn't
configured. The logbase token was swallowed up in the logfilter.

The parser should be fixed to reject lines with unbalanced quotes.
Comment 1 Howard Chu 2015-09-01 00:10:44 UTC
changed notes
changed state Open to Test
moved from Incoming to Software Bugs
Comment 2 Michael Ströder 2015-09-23 11:11:26 UTC
Howard Chu wrote:
> Howard Chu wrote:
>> Michael Ströder wrote:
>>> But then I would expect slapd to remove the backslash(es) used for quoting:
>>
>> Good point. OK, there's some more work needed in here somewhere.
> 
> Fixed. Closing this ITS. If you have any other problems regarding this,
> followup to ITS#8233. We don't open new ITSs for unreleased code.

Sorry, but still I see the same problem with commit
23953716c76ab36fab7d5f6dea335bf9bdea6323.

Example from ITS#8251 repeated here:

In slapd.conf:

---------------------------------- snip ----------------------------------
attributetype ( 1.3.6.1.4.1.5427.1.389.42.3
      DESC 'Test attribute type with \"double quotes\" in DESC'
      SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
---------------------------------- snip ----------------------------------

Returned via LDAP in subschema subentry (as LDIF):

---------------------------------- snip ----------------------------------
attributeTypes: ( 1.3.6.1.4.1.5427.1.389.42.3 DESC 'Test attribute type with
  \"double quotes\" in DESC' SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
---------------------------------- snip ----------------------------------

But regarding your comment in [1] I wonder what counts as an "argument"?
Reading the section slapd.conf(5) more carefully it could mean that also all
schema descriptions (containing spaces) count as one argument and therefore
should be enclosed in double quotes (which is not the case also for all
.schema files installed by OpenLDAP).

Another example is:

index foo,bar eq,sub

Does the the config parser handle "foo,bar" and "eq,sub" as two separate
arguments for directive "index"? Does the argument parsing depend on the
configuration directive?

[1] https://www.openldap.org/its/index.cgi?findid=8251#followup9

Ciao, Michael.


Comment 3 Howard Chu 2015-09-23 14:39:14 UTC
Michael Ströder wrote:
> Howard Chu wrote:
>> Howard Chu wrote:
>>> Michael Ströder wrote:
>>>> But then I would expect slapd to remove the backslash(es) used for quoting:
>>>
>>> Good point. OK, there's some more work needed in here somewhere.
>>
>> Fixed. Closing this ITS. If you have any other problems regarding this,
>> followup to ITS#8233. We don't open new ITSs for unreleased code.
>
> Sorry, but still I see the same problem with commit
> 23953716c76ab36fab7d5f6dea335bf9bdea6323.
>
> Example from ITS#8251 repeated here:
>
> In slapd.conf:
>
> ---------------------------------- snip ----------------------------------
> attributetype ( 1.3.6.1.4.1.5427.1.389.42.3
>        DESC 'Test attribute type with \"double quotes\" in DESC'
>        SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
> ---------------------------------- snip ----------------------------------
>
> Returned via LDAP in subschema subentry (as LDIF):
>
> ---------------------------------- snip ----------------------------------
> attributeTypes: ( 1.3.6.1.4.1.5427.1.389.42.3 DESC 'Test attribute type with
>    \"double quotes\" in DESC' SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
> ---------------------------------- snip ----------------------------------

True, and irrelevant. This behavior is unchanged from any previous OpenLDAP 
releases.

The regression you reported has been fixed, that is all.

> But regarding your comment in [1] I wonder what counts as an "argument"?
> Reading the section slapd.conf(5) more carefully it could mean that also all
> schema descriptions (containing spaces) count as one argument and therefore
> should be enclosed in double quotes (which is not the case also for all
> .schema files installed by OpenLDAP).
>
> Another example is:
>
> index foo,bar eq,sub
>
> Does the the config parser handle "foo,bar" and "eq,sub" as two separate
> arguments for directive "index"? Does the argument parsing depend on the
> configuration directive?

Yes, the argument parsing depends on the config directive. All of the 
schema-related elements (attributetype, objectclass, syntax, ditcontentrule) 
have their own parsers and (some of) the normal slapd.conf rules don't apply 
to them.

> [1] https://www.openldap.org/its/index.cgi?findid=8251#followup9
>
> Ciao, Michael.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 4 OpenLDAP project 2016-01-29 20:30:08 UTC
fixed in master
fixed in RE25
fixed in RE24 (2.4.43)
Comment 5 Quanah Gibson-Mount 2016-01-29 20:30:08 UTC
changed notes
changed state Test to Closed