Changeset 1d12db24


Ignore:
Timestamp:
Dec 6, 2008, 12:04:44 AM (12 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
3645317
Parents:
9375f8c
Message:
Zephyr: Escape interpolated variables in regexes using owl_text_quote().
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r9a2ae6c r1d12db24  
    26152615{
    26162616  owl_filter *f;
    2617   char *argbuff, *longuser, *shortuser, *filtname;
     2617  char *argbuff, *longuser, *esclonguser, *shortuser, *filtname;
    26182618
    26192619  /* stick the local realm on if it's not there */
     
    26322632  f=owl_malloc(sizeof(owl_filter));
    26332633
     2634  esclonguser = owl_text_quote(longuser, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
     2635
    26342636  argbuff=owl_sprintf("( type ^zephyr$ and filter personal and "
    26352637      "( ( direction ^in$ and sender ^%1$s$ ) or ( direction ^out$ and "
    26362638      "recipient ^%1$s$ ) ) ) or ( ( class ^login$ ) and ( sender ^%1$s$ ) )",
    2637       longuser);
     2639      esclonguser);
    26382640
    26392641  owl_filter_init_fromstring(f, filtname, argbuff);
     
    26452647  owl_free(argbuff);
    26462648  owl_free(longuser);
     2649  owl_free(esclonguser);
    26472650  owl_free(shortuser);
    26482651
     
    26952698{
    26962699  owl_filter *f;
    2697   char *argbuff, *filtname;
     2700  char *argbuff, *filtname, *esctype;
    26982701
    26992702  /* name for the filter */
     
    27082711  f=owl_malloc(sizeof(owl_filter));
    27092712
    2710   argbuff = owl_sprintf("type ^%s$", type);
     2713  esctype = owl_text_quote(type, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
     2714
     2715  argbuff = owl_sprintf("type ^%s$", esctype);
    27112716
    27122717  owl_filter_init_fromstring(f, filtname, argbuff);
     
    27172722  /* free stuff */
    27182723  owl_free(argbuff);
     2724  owl_free(esctype);
    27192725
    27202726  return filtname;
Note: See TracChangeset for help on using the changeset viewer.