1 #include <string.h>
2
3 #include "fileapi.h"
4 #include "variables.h"
5 #include "config.h"
6 #include "core.h"
7 #include "mystring.h"
8
is_trusted(const char * list)9 int is_trusted(const char *list)
10 {
11 FILE *infile;
12 char filename[BIG_BUF], buffer[BIG_BUF];
13 int found;
14
15 buffer_printf(filename, sizeof(filename) - 1, "%s/SITEDATA/trusted", get_string("lists-root"));
16
17 found = 0;
18
19 if ((infile = open_file(filename,"r")) == NULL) {
20 return 0;
21 }
22
23 while (read_file(buffer, sizeof(buffer), infile) && !found) {
24 if (buffer[strlen(buffer) - 1] == '\n')
25 buffer[strlen(buffer) - 1] = 0;
26
27 if (strcasecmp(buffer,list) == 0) {
28 found = 1;
29 }
30 }
31 close_file(infile);
32
33 return found;
34 }
35
init_restricted_vars()36 void init_restricted_vars()
37 {
38 FILE *infile;
39 char filename[BIG_BUF], buffer[BIG_BUF];
40 buffer_printf(filename, sizeof(filename) - 1, "%s/SITEDATA/restrictvars", get_string("lists-root"));
41
42 if ((infile = open_file(filename,"r")) == NULL) {
43 return;
44 }
45
46 while (read_file(buffer, sizeof(buffer), infile)) {
47 if (buffer[strlen(buffer) - 1] == '\n')
48 buffer[strlen(buffer) - 1] = 0;
49
50 restrict_var(buffer);
51 }
52 close_file(infile);
53 }
54