diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2002-11-14 07:22:39 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2002-11-14 07:22:39 +0000 |
commit | 27058287811ca0afe7f95c6f1fcde1577596e841 (patch) | |
tree | 96e67fc1e92a6d604319a243b3606143f29b703a /sieve | |
parent | f13d2dd4180fb8c553808fb06bebbd1b8091695d (diff) | |
download | mailutils-27058287811ca0afe7f95c6f1fcde1577596e841.tar.gz mailutils-27058287811ca0afe7f95c6f1fcde1577596e841.tar.bz2 |
Removed
Diffstat (limited to 'sieve')
-rw-r--r-- | sieve/AUTHORS | 6 | ||||
-rw-r--r-- | sieve/COPYING | 25 | ||||
-rw-r--r-- | sieve/NEWS | 75 | ||||
-rw-r--r-- | sieve/README | 54 | ||||
-rw-r--r-- | sieve/addr-lex.l | 66 | ||||
-rw-r--r-- | sieve/addr.y | 94 | ||||
-rw-r--r-- | sieve/comparator.c | 221 | ||||
-rw-r--r-- | sieve/comparator.h | 46 | ||||
-rw-r--r-- | sieve/gram-sieve.y | 108 | ||||
-rw-r--r-- | sieve/imparse.c | 213 | ||||
-rw-r--r-- | sieve/imparse.h | 52 | ||||
-rw-r--r-- | sieve/interp.c | 222 | ||||
-rw-r--r-- | sieve/interp.h | 61 | ||||
-rw-r--r-- | sieve/message.c | 596 | ||||
-rw-r--r-- | sieve/message.h | 130 | ||||
-rw-r--r-- | sieve/parseaddr.c | 368 | ||||
-rw-r--r-- | sieve/parseaddr.h | 69 | ||||
-rw-r--r-- | sieve/script.c | 1091 | ||||
-rw-r--r-- | sieve/script.h | 60 | ||||
-rw-r--r-- | sieve/sieve-gram.y | 707 | ||||
-rw-r--r-- | sieve/sieve-lex.l | 169 | ||||
-rw-r--r-- | sieve/sieve.h | 96 | ||||
-rw-r--r-- | sieve/sieve_err.c | 50 | ||||
-rw-r--r-- | sieve/sieve_err.h | 17 | ||||
-rw-r--r-- | sieve/sieve_interface.h | 162 | ||||
-rw-r--r-- | sieve/sv.h | 138 | ||||
-rw-r--r-- | sieve/svcb.c | 482 | ||||
-rw-r--r-- | sieve/svctx.c | 201 | ||||
-rw-r--r-- | sieve/svfield.c | 165 | ||||
-rw-r--r-- | sieve/svfield.h | 46 | ||||
-rw-r--r-- | sieve/svutil.c | 73 | ||||
-rw-r--r-- | sieve/tree.c | 232 | ||||
-rw-r--r-- | sieve/tree.h | 131 | ||||
-rw-r--r-- | sieve/util.c | 47 | ||||
-rw-r--r-- | sieve/util.h | 29 |
35 files changed, 0 insertions, 6302 deletions
diff --git a/sieve/AUTHORS b/sieve/AUTHORS deleted file mode 100644 index b6d39a184..000000000 --- a/sieve/AUTHORS +++ /dev/null @@ -1,6 +0,0 @@ -Larry Greenfield <leg+sieve@andrew.cmu.edu> wrote the first pass. - -Alexy Melnikov <mel@taxxi.com> submitted some bug fixes and improvements. - -Ken Murchison <ken@oceana.com> took the ball, added more extensions -than existed in the known world, and overall improved the code mightily. diff --git a/sieve/COPYING b/sieve/COPYING deleted file mode 100644 index a61cd3424..000000000 --- a/sieve/COPYING +++ /dev/null @@ -1,25 +0,0 @@ -/* cmu-sieve - * Larry Greenfield - */ -/*********************************************************** - Copyright 1998 by Carnegie Mellon University - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Carnegie Mellon -University not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO -THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR -ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -******************************************************************/ diff --git a/sieve/NEWS b/sieve/NEWS deleted file mode 100644 index c07a73f8e..000000000 --- a/sieve/NEWS +++ /dev/null @@ -1,75 +0,0 @@ -$Id$ - -CMU Sieve 2.0 -------------- - -- Compliant with draft-showalter-sieve-11.txt and - draft-showalter-sieve-vacation-03.txt. - -- Added support for the regex, imapflags, notify and subaddress extensions. - See README for references. - -- Verifies email addresses in redirect and vacation actions are syntactically - correct (compliant with RFC822). - -- Run-time error reporting. - -- Changed callback interface to use callback contexts instead of individual - parameters. Also added an error string buffer for run-time error reporting. - -- Vacation will not reply to any message containing an "auto-submitted" - header containing anything other than "no". - -CMU Sieve 1.4 -------------- - -Now included with imapd distribution (hell, why not?). - -Error returning and recovering: - added error recovering to the parser (but not much!) - added error messages to the parser - -Working on error returning and error recovering. - run-time errors - detect some errors in lexer? - -Working on even better parsing: - verify addresses could be addresses - verify mailboxes could be mailboxes - verify outgoing headers can be headers - -CMU Sieve 1.3 -------------- - -Changed for integration with cyrus deliver. - -CMU Sieve 1.2 -------------- - -Added additional callbacks (ok, so I want to make my integration with deliver -easier) and envelope and vacation support. - -Made it compile without libcyrus. -It should compile without libcyrus, but then it does not implement the -"address" test. That's just too much work to do when I have a neato -library to do it for me. - -Todo: -- regex matching - -CMU Sieve 1.1 -------------- - -- Updated to draft-showalter-sieve-07bis.txt - -- Simple API (see sieve_interface.h; currently mostly undocumented) - -- Implements all of the optional features except "envelope" - -- Maintains "if it parses, it probably runs" behavior. (Goal: minimize - run-time errors.) - -CMU Sieve 1.0 -------------- - -- prototype implementation diff --git a/sieve/README b/sieve/README deleted file mode 100644 index b3319ede1..000000000 --- a/sieve/README +++ /dev/null @@ -1,54 +0,0 @@ -$Id$ - -CMU Sieve 2.0 -------------- - -This code is typically distributed as part of Cyrus imapd 1.6 and higher. -This code will be configured and compiled from the cyrus-imapd directory. - -Notes on implementation ------------------------ - -This is an implementation of a simple Sieve API. This API is -well-suited for incorporating in other programs, but is not -extensible. (If there is interest, we may implement an extensible API -in the future.) - -If you wish to compile Sieve without compiling all of imapd, you'll -have to create a Makefile for it. I recommend you use Makefile.in as -a guide. - -It should compile without libcyrus, but then it does not implement the -"address" test. That's just too much work to do when I have a neato -library to do it for me. - -There's a simple "test" application included, which is not built by -default (type "make test" to build it). It expects: - -test <message> <script> - -And prints out the actions taken or errors encountered. (This -implementation will attempt all the actions or no actions.) - -Questions and comments to: -Larry Greenfield (leg+sieve@andrew.cmu.edu) - -References: - -[SIEVE] Showalter, T., "Sieve: A Mail Filtering Language", -draft-showalter-sieve-11.txt, May, 2000. - -[VACATION] Showalter, T., "Sieve: Vacation Extension", -draft-showalter-sieve-vacation-03.txt, May, 2000. - -[IMAPFLAGS] Melnikov, A., "Sieve -- IMAP flag extension", -draft-melnikov-sieve-imapflags-02.txt, June, 1999. - -[NOTIFY] Martin, T., "Sieve -- An extension for providing instant -notifications", draft-ietf-sieve-notify-00.txt, February, 2000. - -[REGEX] Murchison, K., "Sieve: Regular Expression Extension", -draft-murchison-sieve-regex-01.txt, March, 2000. - -[SUBADDR] Murchison, K., "Sieve: Subaddress Extension", -draft-murchison-sieve-subaddress-00.txt, March, 2000. diff --git a/sieve/addr-lex.l b/sieve/addr-lex.l deleted file mode 100644 index ecb1c3c63..000000000 --- a/sieve/addr-lex.l +++ /dev/null @@ -1,66 +0,0 @@ -%{ -/* - * addr-lex.l -- RFC 822 address lexer - */ - -#include "addr.h" -#include <string.h> - -#undef YY_INPUT -#define YY_INPUT(b, r, ms) (r = addrinput(b, ms)) - -int addrinput(char *buf, int max_size); -void addrerror(const char *); - -static int ncom; /* number of open comments */ -%} - -%option noyywrap -%x QSTRING DOMAINLIT COMMENT - -%% - -\" { BEGIN QSTRING; return yytext[0]; } -\[ { BEGIN DOMAINLIT; return yytext[0]; } -\( { ncom = 1; BEGIN COMMENT; } -\) { addrerror("address parse error, " - "unexpected `')'' " - "(unbalanced comment)"); - yyterminate(); } - -[^\(\)<>@,;:\\".\[\] \n\r]+ return ATOM; - -[\t \n\r]+ /* ignore whitespace */ -. return yytext[0]; - -<QSTRING>([^\n\r"\\]|\\.)* return QTEXT; -<QSTRING>\" { BEGIN INITIAL; return yytext[0]; } - -<DOMAINLIT>([^\[\]\n\r\\]|\\.)* return DTEXT; -<DOMAINLIT>\] { BEGIN INITIAL; return yytext[0]; } - -<COMMENT>([^\(\)\n\0\\]|\\.)* /* ignore comments */ -<COMMENT>\( ncom++; -<COMMENT>\) { ncom--; if (ncom == 0) BEGIN INITIAL; } -<COMMENT><<EOF>> { addrerror("address parse error, " - "expecting `')'' " - "(unterminated comment)"); - yyterminate(); } - -%% - -/* take input from address string provided by sieve parser */ -int addrinput(char *buf, int max_size) -{ - extern char *addrptr; /* current position in address string */ - int n; /* number of characters to read from string */ - - (void) addrunput; - - n = strlen(addrptr) < max_size ? strlen(addrptr) : max_size; - if (n > 0) { - memcpy(buf, addrptr, n); - addrptr += n; - } - return n; -} diff --git a/sieve/addr.y b/sieve/addr.y deleted file mode 100644 index 7c77a1338..000000000 --- a/sieve/addr.y +++ /dev/null @@ -1,94 +0,0 @@ -%{ -/* - * addr.y -- RFC 822 address parser - */ - -#include <stdlib.h> -#include <string.h> - -#include "addr.h" - -int yyerror(char *msg); -extern int yylex(void); - -#define yyparse addrparse -#define yyerror addrerror - -#define YYERROR_VERBOSE /* i want better error messages! */ -%} - -%token ATOM QTEXT DTEXT - -%start sieve_address - -%% -address: mailbox /* one addressee */ - | group /* named list */ - ; - -group: phrase ':' ';' - | phrase ':' mailboxes ';' - ; - -mailboxes: mailbox - | mailbox ',' mailboxes - ; - -mailbox: addrspec /* simple address */ - | phrase routeaddr /* name & addr-spec */ - ; - -routeaddr: '<' addrspec '>' - | '<' route ':' addrspec '>' - ; - -route: '@' domain /* path-relative */ - | '@' domain ',' route - ; - -sieve_address: addrspec /* simple address */ - | phrase '<' addrspec '>' /* name & addr-spec */ - ; - -addrspec: localpart '@' domain /* global-address */ - ; - -localpart: word /* uninterpreted, case-preserved */ - | word '.' localpart - ; - -domain: subdomain - | subdomain '.' domain - ; - -subdomain: domainref - | domainlit - ; - -domainref: ATOM /* symbolic reference */ - ; - -domainlit: '[' DTEXT ']' - ; - -phrase: word - | word phrase - ; - -word: ATOM - | qstring - ; - -qstring: '"' QTEXT '"' - ; - -%% - -/* copy address error message into buffer provided by sieve parser */ -int yyerror(char *s) -{ -extern char addrerr[]; - - strcpy(addrerr, s); - return 0; -} diff --git a/sieve/comparator.c b/sieve/comparator.c deleted file mode 100644 index 41f25a4f7..000000000 --- a/sieve/comparator.c +++ /dev/null @@ -1,221 +0,0 @@ -/* comparator.c -- comparator functions - * Larry Greenfield - * $Id$ - */ -/*********************************************************** - Copyright 1999 by Carnegie Mellon University - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Carnegie Mellon -University not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO -THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR -ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdlib.h> -#include <ctype.h> -#include <string.h> -#include <fnmatch.h> -#ifdef HAVE_STRINGS_H -# include <strings.h> -#endif - -#include "comparator.h" -#include "tree.h" -#include "sieve-gram.h" - -/* --- i;octet comparators --- */ - -/* just compare the two; these should be NULL terminated */ -static int octet_is(const char *pat, const char *text) -{ - int sl; - sl = strlen(pat); - - return (sl == strlen(text)) && !memcmp(pat, text, sl); -} - -/* we implement boyer-moore for hell of it, since this is probably - not very useful for sieve */ -#if 0 -int boyer_moore(char *pat, char *text) -{ - int i, j; /* indexes */ - int M = strlen(pat); /* length of pattern */ - int N = strlen(text); /* length of text */ - int skip[256]; /* table of how much to skip, based on each character */ - - /* initialize skip table */ - for (i = 0; i < 256; i++) - skip[i] = M; - for (i = 0; i < M; i++) - skip[(int) pat[i]] = M-i-1; - - /* look for pat in text */ - i = j = M-1; - do { - if (pat[j] == text[i]) { - i--; - j--; - } else { - if (M-j > skip[(int) text[i]]) { - i = i + M - j; - } else { - i = i + skip[(int) text[i]]; - } - j = M-1; - } - } while (!((j < 0) || (i >= N))); - /* i+1 is the position of the match if i < N */ - return (i < N) ? 1 : 0; -} -#endif - -/* we do a brute force attack */ -static int octet_contains(const char *pat, const char *text) -{ - return (strstr(text, pat) != NULL); -} - -static int octet_matches(const char *pat, const char *text) -{ - return !fnmatch(pat, text, 0); -} - -#ifdef ENABLE_REGEX -static int octet_regex(const char *pat, const char *text) -{ - return (!regexec((regex_t *) pat, text, 0, NULL, 0)); -} -#endif - - -/* --- i;ascii-casemap comparators --- */ - -static int ascii_casemap_is(const char *pat, const char *text) -{ - int sl; - sl = strlen(pat); - - return (sl == strlen(text)) && !strncasecmp(pat, text, sl); -} - -/* sheer brute force */ -static int ascii_casemap_contains(const char *pat, const char *text) -{ - int N = strlen(text); - int M = strlen(pat); - int i, j; - - i = 0, j = 0; - while ((j < M) && (i < N)) { - if (toupper(text[i]) == toupper(pat[j])) { - i++; j++; - } else { - i = i - j + 1; - j = 0; - } - } - return (j == M); /* we found a match! */ -} - -static int ascii_casemap_matches(const char *pat, const char *text) -{ - int ret; - char *p, *t; - int i; - - /* sigh, i'll just make local copies of these guys */ - p = strdup(pat); t = strdup(text); - for (i = 0; p[i] != '\0'; i++) - p[i] = toupper(p[i]); - for (i = 0; t[i] != '\0'; i++) - t[i] = toupper(t[i]); - - ret = !fnmatch(p, t, 0); - free(p); free(t); - - return ret; -} - -/* i;ascii-numeric; only supports "is" - equality: numerically equal, or both not numbers */ -static int ascii_numeric_is(const char *pat, const char *text) -{ - if (isdigit((int) *pat)) { - if (isdigit((int) *text)) { - return (atoi(pat) == atoi(text)); - } else { - return 0; - } - } else if (isdigit((int) *text)) return 0; - else return 1; /* both not digits */ -} - -comparator_t *lookup_comp(const char *comp, int mode) -{ - comparator_t *ret; - - ret = NULL; - if (!strcmp(comp, "i;octet")) { - switch (mode) { - case IS: - ret = &octet_is; - break; - case CONTAINS: - ret = &octet_contains; - break; - case MATCHES: - ret = &octet_matches; - break; -#ifdef ENABLE_REGEX - case REGEX: - ret = &octet_regex; - break; -#endif - } - } else if (!strcmp(comp, "i;ascii-casemap")) { - switch (mode) { - case IS: - ret = &ascii_casemap_is; - break; - case CONTAINS: - ret = &ascii_casemap_contains; - break; - case MATCHES: - ret = &ascii_casemap_matches; - break; -#ifdef ENABLE_REGEX - case REGEX: - /* the ascii-casemap destinction is made during - the compilation of the regex in verify_regex() */ - ret = &octet_regex; - break; -#endif - } - } else if (!strcmp(comp, "i;ascii-numeric")) { - switch (mode) { - case IS: - ret = &ascii_numeric_is; - break; - } - } - return ret; -} diff --git a/sieve/comparator.h b/sieve/comparator.h deleted file mode 100644 index 726d1905c..000000000 --- a/sieve/comparator.h +++ /dev/null @@ -1,46 +0,0 @@ -/* comparator.h - * Larry Greenfield - */ -/*********************************************************** - Copyright 1999 by Carnegie Mellon University - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Carnegie Mellon -University not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO -THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR -ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -******************************************************************/ - -#ifndef COMPARATOR_H -#define COMPARATOR_H - -#ifdef ENABLE_REGEX -#ifdef HAVE_RX -#include <rxposix.h> -#else -#include <sys/types.h> -#include <regex.h> -#endif -#endif - -/* compares pat to text; returns 1 if it's true, 0 otherwise - first arg is pat, second arg is text */ -typedef int comparator_t(const char *, const char *); - -/* returns a pointer to a comparator function given it's name */ -comparator_t *lookup_comp(const char *comp, int mode); - -#endif diff --git a/sieve/gram-sieve.y b/sieve/gram-sieve.y deleted file mode 100644 index 3b7644575..000000000 --- a/sieve/gram-sieve.y +++ /dev/null @@ -1,108 +0,0 @@ -%{ -/* GNU mailutils - a suite of utilities for electronic mail - Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Library Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -%} - -%token SIEVE_ADDRESS SIEVE_ALL SIEVE_ALLOF SIEVE_ANYOF SIEVE_COMPARATOR -%token SIEVE_CONTAINS SIEVE_DISCARD SIEVE_DOMAIN SIEVE_ELSE SIEVE_ELSIF -%token SIEVE_ENVELOPE SIEVE_EXISTS SIEVE_FALSE SIEVE_FILEINTO SIEVE_HEADER -%token SIEVE_IF SIEVE_IS SIEVE_KEEP SIEVE_LOCALPART SIEVE_MATCHES -%token SIEVE_NOT SIEVE_NUMBER SIEVE_OVER SIEVE_STRING -%token SIEVE_REDIRECT SIEVE_REJECT SIEVE_REQUIRE SIEVE_SIZE SIEVE_STOP -%token SIEVE_TEST SIEVE_TRUE SIEVE_UNDER - -%% - -commands : command | command commands ; - -command : action_command | control_command | test_command ; - -block : '{' commands '}' | '{' /* Empty block. */ '}' ; - -action_command : action ';' ; - -action : discard | fileinto | keep | redirect | require | reject | stop ; - -control_command : SIEVE_IF test_command block else_part - | SIEVE_IF test_command block - ; -else_part : SIEVE_ELSIF test_command block else_part - | SIEVE_ELSE block - -test_command : test_address | test_allof | test_anyof | test_envelope - | test_exists | test_false | test_header | test_not - | test_size | test_true ; - -fileinto : SIEVE_FILEINTO string_list ; - -stop : SIEVE_STOP ; - -discard : SIEVE_DISCARD ; - -keep : SIEVE_KEEP ; - -redirect : SIEVE_REDIRECT string_list ; - -reject : SIEVE_REJECT SIEVE_STRING ; - -require : SIEVE_REQUIRE string_list ; - -test_list : '(' tests ')' ; - -tests : test | test ',' tests ; - -test : test_address | test_anyof | test_envelope | test_false | test_exists - | test_header | test_not | test_size | test_true ; - -test_address : SIEVE_ADDRESS address_part match_type - | SIEVE_ADDRESS address_part string_list ; - -test_allof : SIEVE_ALLOF test_list ; - -test_anyof : SIEVE_ANYOF test_list ; - -test_envelope : SIEVE_ENVELOPE ':' comparator | SIEVE_ENVELOPE ':' match_type ; - -test_exists : SIEVE_EXISTS string_list ; - -test_false : SIEVE_FALSE ; - -test_header : SIEVE_HEADER comparator - | SIEVE_HEADER match_type - | SIEVE_HEADER string_list ; - -test_not : SIEVE_NOT test | SIEVE_NOT '(' test ')' ; - -test_size : SIEVE_SIZE ':' SIEVE_OVER SIEVE_NUMBER - | SIEVE_SIZE ':' SIEVE_UNDER SIEVE_NUMBER ; - -test_true : SIEVE_TRUE ; - -comparator : ':' SIEVE_COMPARATOR SIEVE_STRING SIEVE_STRING - -match_type : ':' SIEVE_IS string_list string_list - | ':' SIEVE_CONTAINS string_list string_list - | ':' SIEVE_MATCHES string_list string_list ; - -address_part : ':' SIEVE_DOMAIN ; - | ':' SIEVE_LOCALPART ; - | ':' SIEVE_ALL ; - -strings : SIEVE_STRING | SIEVE_STRING ',' strings - -string_list : '[' strings ']' | SIEVE_STRING ; diff --git a/sieve/imparse.c b/sieve/imparse.c deleted file mode 100644 index c1806e8f7..000000000 --- a/sieve/imparse.c +++ /dev/null @@ -1,213 +0,0 @@ -/* imparse.c -- IMxP client-side parsing routines - $Id$ - - * Copyright (c) 1998-2000 Carnegie Mellon University. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The name "Carnegie Mellon University" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For permission or any other legal - * details, please contact - * Office of Technology Transfer - * Carnegie Mellon University - * 5000 Forbes Avenue - * Pittsburgh, PA 15213-3890 - * (412) 268-4387, fax: (412) 268-7395 - * tech-transfer@andrew.cmu.edu - * - * 4. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by Computing Services - * at Carnegie Mellon University (http://www.cmu.edu/computing/)." - * - * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE - * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * - */ -#include <config.h> -#include <stdio.h> -#include <ctype.h> - -#include "imparse.h" - -/* - * Parse a word from the string starting at the pointer pointed to by 's'. - * Places a pointer to the parsed word in the pointer at 'retval', - * returns the character following the word, and modifies the pointer at - * 's' to point after the returned character. Modifies the input buffer. - */ -int imparse_word(s, retval) -char **s; -char **retval; -{ - int c; - - *retval = *s; - for (;;) { - c = *(*s)++; - if (!c || isspace(c) || c == '(' || c == ')' || c == '\"') { - (*s)[-1] = '\0'; - return c; - } - } -} - -/* - * Parse an astring from the string starting at the pointer pointed to - * by 's'. On success, places a pointer to the parsed word in the - * pointer at 'retval', returns the character following the word, and - * modifies the pointer at 's' to point after the returned character. - * On failure, returns EOF, modifies the pointer at 'retval' to point - * at the empty string, and modifies 's' to point around the syntax error. - * Modifies the input buffer. - */ -int imparse_astring(s, retval) -char **s; -char **retval; -{ - int c; - char *d; - int len = 0; - int sawdigit = 0; - - switch (**s) { - case '\0': - case ' ': - case '(': - case ')': - case '\r': - case '\n': - /* Invalid starting character */ - *retval = ""; - return EOF; - - default: - /* - * Atom -- parser is liberal in accepting specials other - * than whitespace, parens, or double quotes - */ - return imparse_word(s, retval); - - case '\"': - /* - * Quoted-string. Parser is liberal in accepting qspecials - * other than double-quote, CR, and LF. - */ - *retval = d = ++(*s); - for (;;) { - c = *(*s)++; - if (c == '\\') { - c = *(*s)++; - } - else if (c == '\"') { - *d = '\0'; - return *(*s)++; - } - else if (c == '\0' || c == '\r' || c == '\n') { - *retval = ""; - return EOF; - } - *d++ = c; - } - - case '{': - /* Literal */ - (*s)++; - while (isdigit(c = *(*s)++)) { - sawdigit = 1; - len = len*10 + c - '0'; - } - if (!sawdigit || c != '}' || *(*s)++ != '\r' || *(*s)++ != '\n') { - *retval = ""; - return EOF; |