Review Request: sieve variables extension (dev/cassell/for-review-sieve-variables-rev0)

James Cassell fedoraproject at
Tue Nov 11 11:12:17 EST 2014


I've made some significant progress on the sieve variables extension.  I
would appreciate any reviews.

What works:
- setting variables using the SET action
- match variables are set when the :matches match-type is used (${0},
${1}, etc)
  - did this by overloading the comprock, which had been null for
  :matches test
    - should I do this differently?
- most of the places that you would normally use a string, you can also
add variables to your strings

What doesn't work:
- modifiers to the set action
- the STRING test
- :regex match-type
  - Ken, I might need your help on this one

What I don't know how to do:
- evaluate for UTF-8 support
- regex support

What I'd like reviewed:
- the code
- the above stuff that I don't know
- security issues due to VARIABLES interaction with sieve actions
- anything else you can think of

Also, I believe the first five patches are acceptable for master.  (I
won't push them, though, until I've given people a chance to look them
over if they want.)

I look forward to any reviews!


James Cassell

The following changes since commit

  [sieve] varlist.c: remove unnecessary include (2014-11-10 20:56:07

are available in the git repository at:


for you to fetch changes up to f6eb730a17ce0a434d6558f896104ea584a9e94d:

  Revert "temp" (2014-11-11 10:48:48 -0500)

James Cassell (33):
      [sieve] bc_eval.c: allow {add,set,remove}flag actions with reject
      [sieve] change imap4flags variable names to support VARIABLES
      [sieve] use central variable_list_t to hold action flag lists
      [sieve] bc_eval.c: do all imap4flags processing in bc_eval.c
      [sieve] remove do_{{add,set,remove}flag,{un,}mark}() functions
      [sieve] sieve.y: define tokens for VARIABLES extension
      [sieve] sieve-lex.l: teach lexer VARIABLES tokens
      [sieve] add VARIABLES reference
      [sieve] enable awareness of the variables extension
      [sieve] add parser support for string test
      [sieve] add parser support for SET action
      [sieve] bytecode.h: add codepoints required by variables base spec
      [sieve] bc_generate.c: variables base spec support
      [sieve] bc_dump.c: variables base spec support
      [sieve] bc_emit.c: variables base spec support
      sieve test script
      [sieve] sieved.c: variables base spec support
      [sieve] store require'd extensions in the bytecode
      [sieve] implement parse_string() to parse strings for variables
      [sieve] special variables for storing match vars and parsed
      [sieve] implement variables SET action
      debug printf
      [sieve] bc_eval.c: pass variables to eval_bc_test()
      [sieve] add support for match variables to :matches match-type
      [sieve] grammar.c: parse_string(): Allow parsing of match
      [sieve] bc_eval.c: parse strings for variables when reading
      [sieve] bc_eval.c: attempt proper variables support in imap4flags
      break line to avoid horiz scrolling
      BC_STRING maps to BC_HASFLAG
      test script changes
      printf() statements for debugging
      Revert "temp"                                        |   2 +
 doc/specs.html                                     |   2 +
 lib/imapoptions                                    |   2 +-
 sieve/README                                       |   3 +
 sieve/bc_dump.c                                    |  33 +-
 sieve/bc_emit.c                                    |  64 +++-
 sieve/bc_eval.c                                    | 342
 sieve/bc_generate.c                                |  71 ++++-
 sieve/bytecode.h                                   |  22 +-
 sieve/comparator.c                                 |  82 ++++-
 sieve/grammar.c                                    | 140 +++++++++
 sieve/grammar.h                                    |  18 ++
 sieve/message.c                                    |  84 -----
 sieve/script.c                                     |  66 +---
 sieve/script.h                                     |   1 +
 sieve/sieve-lex.l                                  |   8 +
 sieve/sieve.y                                      | 172 ++++++++++-
 sieve/sieve_interface.h                            |   1 +
 sieve/sieved.c                                     |  23 ++
 .../actionExtensions/uberExtensionActionScript.s   |  76 +++--
 .../tests/testExtension/uberExtensionTestScript.s  |  21 +-
 sieve/tree.h                                       |  10 +-
 sieve/varlist.h                                    |   2 +
 23 files changed, 990 insertions(+), 255 deletions(-)
 create mode 100644 sieve/grammar.c
 create mode 100644 sieve/grammar.h

More information about the Cyrus-devel mailing list