Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
shrapnel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
shrapnel
Commits
2d2b0319
Commit
2d2b0319
authored
Mar 19, 2015
by
Sam Rushing
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mulitbyte-tag' of github.com:ironport/shrapnel into mulitbyte-tag
parents
24144b0f
454a6a4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
18 deletions
+17
-18
coro/ldap/query.pyx
coro/ldap/query.pyx
+17
-18
No files found.
coro/ldap/query.pyx
View file @
2d2b0319
...
...
@@ -78,11 +78,11 @@ cdef parse_expression (bytes x, int pos, int depth):
expression
,
pos
=
parse_expression
(
x
,
pos
,
depth
+
1
)
expressions
.
append
(
expression
)
if
kind
==
c
'|'
:
return
_TLV
(
_CHOICE
(
FILTER_OR
,
1
)
,
expressions
),
pos
+
1
return
_TLV
(
FILTER_OR
,
FLAGS_CONTEXT
|
FLAGS_STRUCTURED
,
expressions
),
pos
+
1
elif
kind
==
c
'&'
:
return
_TLV
(
_CHOICE
(
FILTER_AND
,
1
)
,
expressions
),
pos
+
1
return
_TLV
(
FILTER_AND
,
FLAGS_CONTEXT
|
FLAGS_STRUCTURED
,
expressions
),
pos
+
1
elif
kind
==
c
'!'
:
return
_TLV
(
_CHOICE
(
FILTER_NOT
,
1
)
,
expressions
[:
1
]),
pos
+
1
return
_TLV
(
FILTER_NOT
,
FLAGS_CONTEXT
|
FLAGS_STRUCTURED
,
expressions
[:
1
]),
pos
+
1
else
:
# comparison
attr
,
is_substring
,
pos
=
parse_name
(
x
,
pos
)
...
...
@@ -95,27 +95,26 @@ cdef parse_expression (bytes x, int pos, int depth):
if
is_substring
:
if
value
==
'*'
and
operator
==
FILTER_EQUALITY_MATCH
:
# (tag=*)
return
_TLV
(
_CHOICE
(
FILTER_PRESENT
,
0
),
# unstructured
(
attr
,)
# tag implied by CHOICE
),
pos
+
1
return
_TLV
(
FILTER_PRESENT
,
FLAGS_CONTEXT
,
(
attr
,)),
pos
+
1
elif
operator
==
FILTER_EQUALITY_MATCH
:
# (tag=sub*strin*g*)
return
_TLV
(
_CHOICE
(
FILTER_SUBSTRINGS
,
1
),
(
FILTER_SUBSTRINGS
,
FLAGS_CONTEXT
|
FLAGS_STRUCTURED
,
(
_OCTET_STRING
(
attr
),
_SEQUENCE
(
parse_substring
(
value
,
0
,
len
(
value
)))
)
),
pos
+
1
)
),
pos
+
1
else
:
raise
QuerySyntaxError
,
"invalid wildcard syntax"
else
:
return
_TLV
(
_CHOICE
(
operator
,
1
),
(
operator
,
FLAGS_CONTEXT
|
FLAGS_STRUCTURED
,
(
_OCTET_STRING
(
attr
),
_OCTET_STRING
(
unescape
(
value
)),
)
),
pos
+
1
)
),
pos
+
1
cdef
parse_operator
(
bytes
x
,
int
pos
):
cdef
char
*
s
=
x
...
...
@@ -146,7 +145,7 @@ cdef object parse_substring (char * s, int pos, int slen):
if
start
!=
i
:
# final
result
.
append
(
_TLV
(
_CHOICE
(
SUBSTRING_FINAL
,
0
)
,
(
unescape
(
s
[
start
:]),))
_TLV
(
SUBSTRING_FINAL
,
FLAGS_CONTEXT
,
(
unescape
(
s
[
start
:]),))
)
return
result
elif
s
[
i
]
==
c
'*'
:
...
...
@@ -154,13 +153,13 @@ cdef object parse_substring (char * s, int pos, int slen):
if
i
>
0
:
# initial
result
.
append
(
_TLV
(
_CHOICE
(
SUBSTRING_INITIAL
,
0
)
,
(
unescape
(
s
[
0
:
i
]),))
)
_TLV
(
SUBSTRING_INITIAL
,
FLAGS_CONTEXT
,
(
unescape
(
s
[
0
:
i
]),))
)
else
:
# any
result
.
append
(
_TLV
(
_CHOICE
(
SUBSTRING_ANY
,
0
)
,
(
unescape
(
s
[
start
:
i
]),))
)
_TLV
(
SUBSTRING_ANY
,
FLAGS_CONTEXT
,
(
unescape
(
s
[
start
:
i
]),))
)
# next bit will start *after* the splat
start
=
i
+
1
i
=
i
+
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment