1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00
samba-mirror/libcli/wsp/wscript_build

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
1.2 KiB
Plaintext
Raw Normal View History

libcli/wsp: Add support for simplified Advanced Query Syntax Add support to parse AQS-like (Advanced query syntax) AQS - see https://learn.microsoft.com/en-gb/windows/win32/search/-search-3x-advancedquerysyntax The basic (AQS) syntax is supported e.g. a query is built of a sequence of queries connected by AND, OR and NOT where the query elements are essentially restrictions defined by a property. There are some limitations on the operators supported[1] and additionally some things like enumerated ranges are not supported at all and range values are not delimited as specified [2]. Some special cases that you see in the windows search UI are exceptions [3] which are handled more or less as keywords Some examples: The following are all exactly the same query just expressed using different variations of the syntax 'ALL:($<p403 OR $<p404) AND System.Kind:picture AND Scope:"FILE://somemachine/someshare" AND > System.Size:10241-102401' 'ALL:$<p403 OR ALL:$<p404 AND System.Kind:picture AND Scope:"FILE://somemachine/someshare" AND > System.Size:>=10241 AND System.Size:<102401' 'ALL:$<p403 OR ALL:$<p404 AND System.Kind:picture AND Scope:"FILE://somemachine/someshare" AND > System.Size:small' The queries above by default select the property System.ItemUrl as the one and only column returned, the query parameter however accepts a variation to the AQS like syntax to allow arbitrary columns to be selected e.g. 'SELECT System.ItemName, System.ItemURL, System.Size WHERE ALL:$<p403 OR ALL:$<p404 AND System.Kind:picture AND Scope:"FILE://somemachine/someshare" AND System.Size:small' [1] supported operators ------------------- = Equals != Not Equals > Greater than < Less than >= Greater than or equals <= Less than or equals $= equals $< starts with [2] ranges are specified as value-value instead of value..value (seems my flex/bison skills are not good enough and couldn't get that to work with '..' [3] The windows UI has shortcut ranges (presumably represented as enumerated ranges) providing date ranges like 'today', 'tomorrow', 'lastweek' etc. and similarly sizes like "empty, tiny, small, large..." These are supported (but implemented as keywords) Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-06-29 11:29:54 +01:00
#!/usr/bin/env python
#default flex recepie doesn't create a header file
bld.SAMBA_GENERATOR('wsp_flex',
source='wsp_aqs_lexer.l',
target='wsp_aqs_lexer.h wsp_aqs_lexer.c',
group='build_source',
rule='${FLEX} --header-file=${TGT[0].abspath(env)} --outfile=${TGT[1].abspath(env)} ${SRC[0].abspath(env)}',
enabled=bld.env.with_wsp
)
# With centos7-o3 CI job (and gcc 4.8.5) we get
# an error with -Wstrict-overflow.
# Same code is good with gcc version
# gcc 8.5.0 (centos8) and whatever versions of
# gcc we have in the other XXXX-o3 images.
# We turn off strict-overflow just for this generated
# file
parser_cflags=''
if bld.CONFIG_SET('HAVE_WNO_STRICT_OVERFLOW'):
parser_cflags += ' -Wno-strict-overflow'
bld.SAMBA_SUBSYSTEM('LIBSAMBA_WSP_PARSER',
source='wsp_aqs_parser.y',
deps='talloc wsp_flex',
cflags_end=parser_cflags,
enabled=bld.env.with_wsp
)
bld.SAMBA_SUBSYSTEM('LIBSAMBA_WSP',
source='wsp_aqs.c wsp_aqs_lexer.c',
public_deps='LIBSAMBA_WSP_PARSER',
enabled=bld.env.with_wsp
)
bld.SAMBA_BINARY('test_wsp_parser',
source='test_wsp_parser.c',
deps= 'dcerpc CMDLINE_S3 LIBSAMBA_WSP NDR_WSP NDR_WSP_DATA WSP_UTIL cmocka',
enabled=bld.env.with_wsp,
install=False
)