24 |
|
|
25 |
|
|
26 |
/* |
/* |
|
* Allocate memory of the appropriate size for a new node. |
|
|
*/ |
|
|
void *create_node(size_t size) |
|
|
{ |
|
|
void *ptr; |
|
|
|
|
|
ptr = (void *) malloc(size); |
|
|
|
|
|
if (!ptr) |
|
|
fatal(ERROR_MEMORY_ALLOCATION, |
|
|
"imapfilter: allocating memory; %s\n", strerror(errno)); |
|
|
|
|
|
return ptr; |
|
|
} |
|
|
|
|
|
|
|
|
/* |
|
27 |
* Set new account's variables to safe values. |
* Set new account's variables to safe values. |
28 |
*/ |
*/ |
29 |
void init_account(account_t * node) |
void init_account(account_t * node) |
461 |
return ERROR_CONFIG_PARSE; |
return ERROR_CONFIG_PARSE; |
462 |
|
|
463 |
s = match[1].rm_eo - match[1].rm_so; |
s = match[1].rm_eo - match[1].rm_so; |
464 |
fltr = (char *) malloc(s + 1); |
fltr = (char *) xmalloc(s + 1); |
|
|
|
|
if (!fltr) |
|
|
fatal(ERROR_MEMORY_ALLOCATION, "imapfilter: allocating memory; %s", |
|
|
strerror(errno)); |
|
465 |
|
|
466 |
f = strncpy(fltr, line + match[1].rm_so, s); |
f = strncpy(fltr, line + match[1].rm_so, s); |
467 |
f[s] = 0; |
f[s] = 0; |
468 |
|
|
469 |
s = match[2].rm_eo - match[2].rm_so; |
s = match[2].rm_eo - match[2].rm_so; |
470 |
mbgrp = (char *) malloc(s + 1); |
mbgrp = (char *) xmalloc(s + 1); |
|
|
|
|
if (!mbgrp) |
|
|
fatal(ERROR_MEMORY_ALLOCATION, "imapfilter: allocating memory; %s", |
|
|
strerror(errno)); |
|
471 |
|
|
472 |
/* Go through filters. */ |
/* Go through filters. */ |
473 |
while ((ftok = strsep(&f, delim))) { |
while ((ftok = strsep(&f, delim))) { |
558 |
int i; |
int i; |
559 |
|
|
560 |
for (i = 0; i < size; i++) |
for (i = 0; i < size; i++) |
561 |
*(str + i) = toupper(*(str + i)); |
if (islower(*(str + i))) |
562 |
|
*(str + i) = toupper(*(str + i)); |
563 |
} |
} |