Example #1
0
static void
check_never_mail(uschar **listptr, uschar *never_mail)
{
uschar *s = *listptr;

while (*s != 0)
  {
  uschar *error, *next;
  uschar *e = parse_find_address_end(s, FALSE);
  int terminator = *e;
  int start, end, domain, rc;

  /* Temporarily terminate the string at the address end while extracting
  the operative address within. */

  *e = 0;
  next = parse_extract_address(s, &error, &start, &end, &domain, FALSE);
  *e = terminator;

  /* If there is some kind of syntax error, just give up on this header
  line. */

  if (next == NULL) break;

  /* See if the address is on the never_mail list */

  rc = match_address_list(next,         /* address to check */
                          TRUE,         /* start caseless */
                          FALSE,        /* don't expand the list */
                          &never_mail,  /* the list */
                          NULL,         /* no caching */
                          -1,           /* no expand setup */
                          0,            /* separator from list */
                          NULL);        /* no lookup value return */

  if (rc == OK)                         /* Remove this address */
    {
    DEBUG(D_transport)
      debug_printf("discarding recipient %s (matched never_mail)\n", next);
    if (terminator == ',') e++;
    memmove(s, e, Ustrlen(e) + 1);
    }
  else                                  /* Skip over this address */
    {
    s = e;
    if (terminator == ',') s++;
    }
  }

/* Check to see if we removed the last address, leaving a terminating comma
that needs to be removed */

s = *listptr + Ustrlen(*listptr);
while (s > *listptr && (isspace(s[-1]) || s[-1] == ',')) s--;
*s = 0;

/* Check to see if there any addresses left; if not, set NULL */

s = *listptr;
while (s != 0 && isspace(*s)) s++;
if (*s == 0) *listptr = NULL;
}
Example #2
0
File: lss.c Project: Chaohua/exim
int
lss_match_address(uschar *address, uschar *list, BOOL caseless)
{
return match_address_list(CUS address, caseless, TRUE, CUSS &list, NULL, -1, 0, NULL);
}