Skip to content

Conversation

@liggitt
Copy link
Contributor

@liggitt liggitt commented Nov 22, 2015

Fixes #28

  • adds support for extensible match sequence (both in CompileFilter and DecompileFilter)
  • switched the filter parse to a simple state machine, rather than keying off whether the packet was nil, since attribute parsing could transition to extension matching rule or filter value
  • simplified "nextRune" handling to check "currentRune" for performance, then do simple HasPrefix checks. Needed to check variable length prefixes like ":dn:=", ":dn:", etc.
  • Fixed encoding of substring match strings and added tests.

Fixes #39

  • In cases where we got non-escaped content in the condition, we were iterating on bytes, not runes
  • Fixed incorrect multi-byte testcases, and verified byte output matches actual bytes for those characters

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactored so that substring and extensible match filters can reuse this

@liggitt
Copy link
Contributor Author

liggitt commented Nov 22, 2015

@johnweldon please take a look

@liggitt
Copy link
Contributor Author

liggitt commented Nov 23, 2015

Tested against a live LDAP server with the following extensions:

    ( 1.3.6.1.4.1.1466.109.114.1 NAME 'caseExactIA5Match'
      SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

    ( 1.3.6.1.4.1.1466.109.114.2 NAME 'caseIgnoreIA5Match'
      SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )

Search filters were accepted as valid, and behavior indicated extension was passed successfully

// case-sensitive match, 1 result returned
(uid:1.3.6.1.4.1.1466.109.114.1:=myuid)

// no match, zero results returned
(uid:1.3.6.1.4.1.1466.109.114.1:=MYUID)

// case-insensitive match, 1 result returned
(uid:1.3.6.1.4.1.1466.109.114.2:=MYUID)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in case you want to verify the old bytes were wrong, and the new bytes are right: http://play.golang.org/p/GeNmpuSEs7

@liggitt liggitt changed the title Add extensibleMatch filter support Add extensibleMatch filter support, fix multi-byte filters Nov 23, 2015
@stevekuznetsov
Copy link
Contributor

What behavior will this have for nested groups?

@liggitt
Copy link
Contributor Author

liggitt commented Nov 23, 2015

It lets you tell the AD server you want it to flatten membership for you, rather than recursing yourself

@johnweldon
Copy link
Member

LGTM, :shipit:

liggitt added a commit that referenced this pull request Nov 23, 2015
Add extensibleMatch filter support, fix multi-byte filters
@liggitt liggitt merged commit e9a325d into go-ldap:master Nov 23, 2015
@liggitt liggitt deleted the extensible_match branch November 23, 2015 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

filter failed with chinese language filter by memberOf + nested groups

3 participants