52 |
#ifdef DEBUG |
#ifdef DEBUG |
53 |
fprintf(stderr, "debug: configuration file: '%s'\n", cfg); |
fprintf(stderr, "debug: configuration file: '%s'\n", cfg); |
54 |
#endif |
#endif |
55 |
#ifdef CHECK_PERMISSIONS |
|
|
check_file_perms(cfg, S_IRUSR | S_IWUSR); |
|
|
#endif |
|
56 |
fd = fopen(cfg, "r"); |
fd = fopen(cfg, "r"); |
57 |
if (fd == NULL) |
if (fd == NULL) |
58 |
fatal(ERROR_FILE_OPEN, "opening config file %s; %s\n", cfg, |
fatal(ERROR_FILE_OPEN, "opening config file %s; %s\n", cfg, |
67 |
|
|
68 |
fclose(fd); |
fclose(fd); |
69 |
|
|
70 |
|
check_file_perms(cfg, S_IRUSR | S_IWUSR); |
71 |
|
|
72 |
#ifdef DEBUG |
#ifdef DEBUG |
73 |
fprintf(stderr, "debug: options: %0#10x '%s'\n", options, charset); |
fprintf(stderr, "debug: options: %0#10x '%s'\n", options, charset); |
74 |
#endif |
#endif |
142 |
"[[:blank:]]*\n$", |
"[[:blank:]]*\n$", |
143 |
|
|
144 |
"^[[:blank:]]*(SET[[:blank:]])?[[:blank:]]*(ERRORS|EXPUNGE|" |
"^[[:blank:]]*(SET[[:blank:]])?[[:blank:]]*(ERRORS|EXPUNGE|" |
145 |
"HEADERS|NAMESPACE|PEEK|SUBSCRIBE)[[:blank:]]*=[[:blank:]]*" |
"HEADERS|NAMESPACE|PEEK|PERMISSIONS|PROTOCOL|SUBSCRIBE)" |
146 |
"(YES|NO)[[:blank:]]*\n$", |
"[[:blank:]]*=[[:blank:]]*(YES|NO)[[:blank:]]*\n$", |
147 |
|
|
148 |
"^[[:blank:]]*(SET[[:blank:]])?[[:blank:]]*(DAEMON|TIMEOUT)" |
"^[[:blank:]]*(SET[[:blank:]])?[[:blank:]]*(DAEMON|TIMEOUT)" |
149 |
"[[:blank:]]*=[[:blank:]]*([[:digit:]]+)\n$" |
"[[:blank:]]*=[[:blank:]]*([[:digit:]]+)\n$" |
275 |
options |= OPTION_PEEK; |
options |= OPTION_PEEK; |
276 |
else |
else |
277 |
options &= ~(OPTION_PEEK); |
options &= ~(OPTION_PEEK); |
278 |
|
} else if (!strncasecmp(line + m[2].rm_so, "permissions", 8)) { |
279 |
|
if (!strncasecmp(line + m[3].rm_so, "yes", 3)) |
280 |
|
options |= OPTION_PERMISSIONS; |
281 |
|
else |
282 |
|
options &= ~(OPTION_PERMISSIONS); |
283 |
} else if (!strncasecmp(line + m[2].rm_so, "subscribe", 9)) { |
} else if (!strncasecmp(line + m[2].rm_so, "subscribe", 9)) { |
284 |
if (!strncasecmp(line + m[3].rm_so, "yes", 3)) |
if (!strncasecmp(line + m[3].rm_so, "yes", 3)) |
285 |
options |= OPTION_SUBSCRIBE; |
options |= OPTION_SUBSCRIBE; |
326 |
if (!exists_file(pwfile)) |
if (!exists_file(pwfile)) |
327 |
return ERROR_FILE_OPEN; |
return ERROR_FILE_OPEN; |
328 |
|
|
|
#ifdef CHECK_PERMISSIONS |
|
329 |
check_file_perms(pwfile, S_IRUSR | S_IWUSR); |
check_file_perms(pwfile, S_IRUSR | S_IWUSR); |
|
#endif |
|
330 |
|
|
331 |
fd = fopen(pwfile, "r"); |
fd = fopen(pwfile, "r"); |
332 |
if (fd == NULL) |
if (fd == NULL) |