26 |
char *home = NULL; |
char *home = NULL; |
27 |
|
|
28 |
if (!cfg) { |
if (!cfg) { |
29 |
cfg = (char *) malloc(PATH_MAX * sizeof(char)); |
cfg = (char *) xmalloc(PATH_MAX * sizeof(char)); |
|
|
|
30 |
|
|
31 |
home = getenv("HOME"); |
home = getenv("HOME"); |
32 |
|
|
71 |
strerror(errno)); |
strerror(errno)); |
72 |
return ERROR_TRIVIAL; |
return ERROR_TRIVIAL; |
73 |
} |
} |
|
|
|
74 |
if (!S_ISREG(fs.st_mode)) { |
if (!S_ISREG(fs.st_mode)) { |
75 |
error("imapfilter: file %s not a regular file\n", cfg); |
error("imapfilter: file %s not a regular file\n", cfg); |
76 |
return ERROR_TRIVIAL; |
return ERROR_TRIVIAL; |
77 |
} |
} |
|
|
|
78 |
if ((fs.st_mode & 00777) != (S_IRUSR | S_IWUSR)) { |
if ((fs.st_mode & 00777) != (S_IRUSR | S_IWUSR)) { |
79 |
error("imapfilter: warning: improper config file %s permissions\n" |
error("imapfilter: warning: improper config file %s permissions\n" |
80 |
"imapfilter: warning: file's mode should be 600 not %o\n", |
"imapfilter: warning: file's mode should be 600 not %o\n", |
81 |
cfg, fs.st_mode & 00777); |
cfg, fs.st_mode & 00777); |
82 |
return ERROR_TRIVIAL; |
return ERROR_TRIVIAL; |
83 |
} |
} |
|
|
|
84 |
return 0; |
return 0; |
85 |
} |
} |
86 |
#endif |
#endif |
125 |
else if (!regexec(&creg[4], line, 5, match, 0)) |
else if (!regexec(&creg[4], line, 5, match, 0)) |
126 |
r = set_action(line, match); |
r = set_action(line, match); |
127 |
else if (!regexec(&creg[5], line, 7, match, 0) || |
else if (!regexec(&creg[5], line, 7, match, 0) || |
128 |
!regexec(&creg[6], line, 7, match, 0) || |
!regexec(&creg[6], line, 7, match, 0) || |
129 |
!regexec(&creg[7], line, 7, match, 0) || |
!regexec(&creg[7], line, 7, match, 0) || |
130 |
!regexec(&creg[8], line, 7, match, 0)) |
!regexec(&creg[8], line, 7, match, 0)) |
131 |
r = set_mask(line, match); |
r = set_mask(line, match); |
132 |
else if (!regexec(&creg[9], line, 3, match, 0)) |
else if (!regexec(&creg[9], line, 3, match, 0)) |
133 |
r = set_job(line, match); |
r = set_job(line, match); |
134 |
else if (!regexec(&creg[10], line, 2, match, 0)) |
else if (!regexec(&creg[10], line, 2, match, 0)) |
135 |
set_options(line, match); |
set_options(line, match); |
136 |
else |
else |
137 |
return row; |
return row; |
138 |
|
|
139 |
if (r == ERROR_CONFIG_PARSE) |
if (r == ERROR_CONFIG_PARSE) |
140 |
return row; |
return row; |
141 |
} |
} |
142 |
|
|
143 |
for (i = 0; i < 11; i++) |
for (i = 0; i < 11; i++) |
144 |
regfree(&creg[i]); |
regfree(&creg[i]); |
145 |
|
|
146 |
destroy_data(); |
destroy_data(); |
147 |
|
|
148 |
return 0; |
return 0; |