Changeset 5345ea7


Ignore:
Timestamp:
Mar 29, 2009, 10:55:56 AM (15 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
owl
Children:
924ee11
Parents:
b310c0e
Message:
fix zuserfilt
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    rfa00c5c r5345ea7  
    25392539{
    25402540  owl_filter *f;
    2541   char *argbuff, *longuser, *shortuser, *filtname;
     2541  char *argbuff, *longuser, *esclonguser, *shortuser, *filtname;
    25422542
    25432543  /* stick the local realm on if it's not there */
     
    25462546
    25472547  /* name for the filter */
    2548   filtname=owl_malloc(strlen(shortuser)+20);
    2549   sprintf(filtname, "user-%s", shortuser);
     2548  filtname=owl_sprintf("user-%s", shortuser);
    25502549
    25512550  /* if it already exists then go with it.  This lets users override */
     
    25572556  f=owl_malloc(sizeof(owl_filter));
    25582557
    2559   argbuff=owl_malloc(strlen(longuser)+1000);
    2560   sprintf(argbuff, "( type ^zephyr$ and ( class ^message$ and instance ^personal$ and ");
    2561   sprintf(argbuff, "%s ( ( direction ^in$ and sender ^%s$ ) or ( direction ^out$ and recipient ^%s$ ) ) )", argbuff, longuser, longuser);
    2562   sprintf(argbuff, "%s or ( ( class ^login$ ) and ( sender ^%s$ ) ) )", argbuff, longuser);
     2558  esclonguser = owl_text_quote(longuser, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
     2559
     2560  argbuff=owl_sprintf("( type ^zephyr$ and filter personal and "
     2561      "( ( direction ^in$ and sender ^%1$s$ ) or ( direction ^out$ and "
     2562      "recipient ^%1$s$ ) ) ) or ( ( class ^login$ ) and ( sender ^%1$s$ ) )",
     2563      esclonguser);
    25632564
    25642565  owl_filter_init_fromstring(f, filtname, argbuff);
     
    25702571  owl_free(argbuff);
    25712572  owl_free(longuser);
     2573  owl_free(esclonguser);
    25722574  owl_free(shortuser);
    25732575
Note: See TracChangeset for help on using the changeset viewer.