annotate src/context.cpp @ 88:7245c45cef7a

fix for missing default return value in CONTEXT::acceptable_content()
author carl
date Mon, 01 Aug 2005 19:32:03 -0700
parents c1280cd3e248
children 962a1f8f1d9f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
1 /*
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
2
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
3 Copyright (c) 2004 Carl Byington - 510 Software Group, released under
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
4 the GPL version 2 or any later version at your choice available at
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
5 http://www.fsf.org/licenses/gpl.txt
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
6
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
7 */
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
8
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
9 #include "includes.h"
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
10
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
11 static char* context_version="$Id$";
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
12
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
13 char *token_black;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
14 char *token_content;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
15 char *token_context;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
16 char *token_dccfrom;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
17 char *token_dccto;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
18 char *token_default;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
19 char *token_dnsbl;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
20 char *token_dnsbll;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
21 char *token_envfrom;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
22 char *token_envto;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
23 char *token_filter;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
24 char *token_host_limit;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
25 char *token_html_limit;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
26 char *token_html_tags;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
27 char *token_ignore;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
28 char *token_include;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
29 char *token_inherit;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
30 char *token_lbrace;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
31 char *token_mailhost;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
32 char *token_many;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
33 char *token_off;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
34 char *token_ok2;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
35 char *token_ok;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
36 char *token_on;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
37 char *token_rbrace;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
38 char *token_semi;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
39 char *token_soft;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
40 char *token_substitute;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
41 char *token_tld;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
42 char *token_unknown;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
43 char *token_white;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
44
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
45 string_set all_strings; // owns all the strings, only modified by the config loader thread
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
46 const int maxlen = 1000;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
47
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
48 DNSBL::DNSBL(char *n, char *s, char *m) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
49 name = n;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
50 suffix = s;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
51 message = m;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
52 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
53
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
54
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
55 bool DNSBL::operator==(const DNSBL &rhs) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
56 return (strcmp(name, rhs.name) == 0) &&
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
57 (strcmp(suffix, rhs.suffix) == 0) &&
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
58 (strcmp(message, rhs.message) == 0);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
59 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
60
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
61
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
62 CONFIG::CONFIG() {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
63 reference_count = 0;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
64 generation = 0;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
65 load_time = 0;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
66 default_context = NULL;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
67 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
68
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
69
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
70 CONFIG::~CONFIG() {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
71 for (context_list::iterator i=contexts.begin(); i!=contexts.end(); i++) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
72 CONTEXT *c = *i;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
73 delete c;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
74 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
75 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
76
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
77
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
78 void CONFIG::add_context(CONTEXTP con) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
79 contexts.push_back(con);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
80 if (!default_context && !con->get_parent()) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
81 // first global context
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
82 default_context = con;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
83 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
84 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
85
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
86
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
87 void CONFIG::add_to(char *to, CONTEXTP con) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
88 context_map::iterator i = env_to.find(to);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
89 if (i != env_to.end()) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
90 CONTEXTP c = (*i).second;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
91 int s = strlen(to);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
92 bool at = s && (to[s-1] == '@');
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
93 if (at && con->is_parent(c->get_parent())) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
94 if (debug_syslog) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
95 char oldname[maxlen];
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
96 char newname[maxlen];
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
97 char *oldn = c->get_full_name(oldname, maxlen);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
98 char *newn = con->get_full_name(newname, maxlen);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
99 char buf[maxlen*3];
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
100 snprintf(buf, maxlen*3, "both %s and %s claim envelope to %s, the first one wins", oldn, newn, to);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
101 my_syslog(buf);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
102 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
103 return; // don't take over user@ entries from your ancestors children
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
104 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
105 if ((c != con) && (c != con->get_parent())) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
106 if (debug_syslog) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
107 char oldname[maxlen];
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
108 char newname[maxlen];
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
109 char *oldn = c->get_full_name(oldname, maxlen);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
110 char *newn = con->get_full_name(newname, maxlen);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
111 char buf[maxlen*3];
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
112 snprintf(buf, maxlen*3, "both %s and %s claim envelope to %s, the second one wins", oldn, newn, to);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
113 my_syslog(buf);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
114 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
115 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
116 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
117 env_to[to] = con;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
118 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
119
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
120
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
121 CONTEXTP CONFIG::find_context(char *to) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
122 context_map::iterator i = env_to.find(to);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
123 if (i != env_to.end()) return (*i).second; // found user@domain.tld key
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
124 char *x = strchr(to, '@');
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
125 if (x) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
126 x++;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
127 i = env_to.find(x);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
128 if (i != env_to.end()) return (*i).second; // found domain.tld key
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
129 char y = *x;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
130 *x = '\0';
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
131 i = env_to.find(to);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
132 *x = y;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
133 if (i != env_to.end()) return (*i).second; // found user@ key
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
134 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
135 return default_context;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
136 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
137
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
138
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
139 void CONFIG::dump() {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
140 if (default_context) default_context->dump();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
141 for (context_list::iterator i=contexts.begin(); i!=contexts.end(); i++) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
142 CONTEXTP c = *i;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
143 CONTEXTP p = c->get_parent();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
144 if (!p && (c != default_context)) c->dump();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
145 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
146 char buf[maxlen];
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
147 for (context_map::iterator i=env_to.begin(); i!=env_to.end(); i++) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
148 char *to = (*i).first;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
149 CONTEXTP con = (*i).second;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
150 printf("// envelope to %s \t-> context %s \n", to, con->get_full_name(buf,maxlen));
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
151 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
152 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
153
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
154
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
155 CONTEXT::CONTEXT(CONTEXTP parent_, char *name_) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
156 parent = parent_;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
157 name = name_;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
158 env_from_default = (parent) ? token_inherit : token_unknown;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
159 content_filtering = (parent) ? parent->content_filtering : false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
160 content_suffix = NULL;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
161 content_message = NULL;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
162 host_limit = (parent) ? parent->host_limit : 0;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
163 host_limit_message = NULL;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
164 host_random = (parent) ? parent->host_random : false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
165 tag_limit = (parent) ? parent->tag_limit : 0;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
166 tag_limit_message = NULL;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
167 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
168
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
169
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
170 CONTEXT::~CONTEXT() {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
171 for (dnsblp_map::iterator i=dnsbl_names.begin(); i!=dnsbl_names.end(); i++) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
172 DNSBLP d = (*i).second;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
173 // delete the underlying DNSBL objects.
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
174 delete d;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
175 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
176 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
177
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
178
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
179 bool CONTEXT::is_parent(CONTEXTP p) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
180 if (p == parent) return true;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
181 if (!parent) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
182 return parent->is_parent(p);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
183 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
184
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
185
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
186 char *CONTEXT::get_full_name(char *buffer, int size) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
187 if (!parent) return name;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
188 char buf[maxlen];
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
189 snprintf(buffer, size, "%s.%s", parent->get_full_name(buf, maxlen), name);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
190 return buffer;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
191 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
192
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
193
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
194 bool CONTEXT::cover_env_to(char *to) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
195 char buffer[maxlen];
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
196 char *x = strchr(to, '@');
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
197 if (x) x++;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
198 else x = to;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
199 if (*x == '\0') return true; // always allow covering addresses with no domain name, eg abuse@
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
200 string_set::iterator i = env_to.find(x);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
201 if (i != env_to.end()) return true;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
202 return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
203 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
204
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
205
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
206 char *CONTEXT::find_from(char *from) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
207 char *rc = token_inherit;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
208 string_map::iterator i = env_from.find(from);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
209 if (i != env_from.end()) rc = (*i).second; // found user@domain.tld key
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
210 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
211 char *x = strchr(from, '@');
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
212 if (x) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
213 x++;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
214 i = env_from.find(x);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
215 if (i != env_from.end()) rc = (*i).second; // found domain.tld key
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
216 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
217 char y = *x;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
218 *x = '\0';
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
219 i = env_from.find(from);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
220 *x = y;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
221 if (i != env_from.end()) rc = (*i).second; // found user@ key
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
222 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
223 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
224 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
225 if (rc == token_inherit) rc = env_from_default;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
226 if ((rc == token_inherit) && parent) return parent->find_from(from);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
227 return (rc == token_inherit) ? token_unknown : rc;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
228 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
229
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
230
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
231 CONTEXTP CONTEXT::find_context(char *from) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
232 context_map::iterator i = env_from_context.find(from);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
233 if (i != env_from_context.end()) return (*i).second; // found user@domain.tld key
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
234 char *x = strchr(from, '@');
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
235 if (x) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
236 x++;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
237 i = env_from_context.find(x);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
238 if (i != env_from_context.end()) return (*i).second; // found domain.tld key
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
239 char y = *x;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
240 *x = '\0';
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
241 i = env_from_context.find(from);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
242 *x = y;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
243 if (i != env_from_context.end()) return (*i).second; // found user@ key
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
244 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
245 return this;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
246 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
247
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
248
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
249 CONTEXTP CONTEXT::find_from_context_name(char *name) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
250 context_map::iterator i = children.find(name);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
251 if (i != children.end()) return (*i).second;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
252 return NULL;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
253 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
254
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
255
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
256 DNSBLP CONTEXT::find_dnsbl(char *name) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
257 dnsblp_map::iterator i = dnsbl_names.find(name);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
258 if (i != dnsbl_names.end()) return (*i).second;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
259 if (parent) return parent->find_dnsbl(name);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
260 return NULL;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
261 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
262
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
263
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
264 char* CONTEXT::get_content_suffix() {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
265 if (!content_suffix && parent) return parent->get_content_suffix();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
266 return content_suffix;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
267 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
268
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
269
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
270 char* CONTEXT::get_content_message() {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
271 if (!content_message && parent) return parent->get_content_message();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
272 return content_message;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
273 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
274
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
275
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
276 string_set& CONTEXT::get_content_host_ignore() {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
277 if (content_host_ignore.empty() && parent) return parent->get_content_host_ignore();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
278 return content_host_ignore;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
279 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
280
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
281
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
282 string_set& CONTEXT::get_content_tlds() {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
283 if (content_tlds.empty() && parent) return parent->get_content_tlds();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
284 return content_tlds;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
285 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
286
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
287
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
288 string_set& CONTEXT::get_html_tags() {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
289 if (html_tags.empty() && parent) return parent->get_html_tags();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
290 return html_tags;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
291 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
292
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
293
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
294 dnsblp_list& CONTEXT::get_dnsbl_list() {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
295 if (dnsbl_list.empty() && parent) return parent->get_dnsbl_list();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
296 return dnsbl_list;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
297 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
298
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
299
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
300 bool CONTEXT::acceptable_content(recorder &memory, char *&msg) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
301 if (memory.excessive_bad_tags(tag_limit)) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
302 msg = tag_limit_message;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
303 return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
304 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
305 if (!host_random && memory.excessive_hosts(host_limit)) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
306 msg = host_limit_message;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
307 return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
308 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
309 return true;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
310 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
311
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
312
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
313 void CONTEXT::dump(int level) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
314 char indent[maxlen];
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
315 int i = min(maxlen-1, level*4);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
316 memset(indent, ' ', i);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
317 indent[i] = '\0';
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
318 char buf[maxlen];
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
319 char *fullname = get_full_name(buf,maxlen);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
320 printf("%s context %s { \t// %s\n", indent, name, fullname);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
321
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
322 for (dnsblp_map::iterator i=dnsbl_names.begin(); i!=dnsbl_names.end(); i++) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
323 char *n = (*i).first;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
324 DNSBL &d = *(*i).second;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
325 printf("%s dnsbl %s %s \"%s\"; \n", indent, n, d.suffix, d.message);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
326 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
327
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
328 if (!dnsbl_list.empty()) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
329 printf("%s dnsbl_list", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
330 for (dnsblp_list::iterator i=dnsbl_list.begin(); i!=dnsbl_list.end(); i++) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
331 DNSBL &d = *(*i);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
332 printf(" %s", d.name);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
333 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
334 printf("; \n");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
335 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
336
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
337 if (content_filtering) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
338 printf("%s content on { \n", indent, env_from_default);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
339 if (content_suffix) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
340 printf("%s filter %s \"%s\"; \n", indent, content_suffix, content_message);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
341 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
342 if (!content_host_ignore.empty()) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
343 printf("%s ignore { \n", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
344 for (string_set::iterator i=content_host_ignore.begin(); i!=content_host_ignore.end(); i++) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
345 printf("%s %s; \n", indent, *i);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
346 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
347 printf("%s }; \n", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
348 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
349 if (!content_tlds.empty()) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
350 printf("%s tld { \n", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
351 printf("%s ", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
352 for (string_set::iterator i=content_tlds.begin(); i!=content_tlds.end(); i++) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
353 printf("%s; ", *i);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
354 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
355 printf("\n%s }; \n", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
356 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
357 if (!html_tags.empty()) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
358 printf("%s html_tags { \n", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
359 printf("%s ", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
360 for (string_set::iterator i=html_tags.begin(); i!=html_tags.end(); i++) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
361 printf("%s; ", *i);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
362 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
363 printf("\n%s }; \n", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
364 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
365 if (host_limit_message) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
366 printf("%s host_limit on %d \"%s\"; \n", indent, host_limit, host_limit_message);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
367 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
368 else if (host_random) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
369 printf("%s host_limit soft %d; \n", indent, host_limit);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
370 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
371 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
372 printf("%s host_limit off; \n", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
373 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
374 if (tag_limit_message) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
375 printf("%s html_limit on %d \"%s\"; \n", indent, tag_limit, tag_limit_message);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
376 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
377 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
378 printf("%s html_limit off; \n", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
379 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
380 printf("%s }; \n", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
381 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
382 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
383 printf("%s content off {}; \n", indent, env_from_default);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
384 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
385
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
386 printf("%s env_to { \t// %s\n", indent, fullname);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
387 for (string_set::iterator i=env_to.begin(); i!=env_to.end(); i++) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
388 printf("%s %s; \n", indent, *i);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
389 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
390 printf("%s }; \n", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
391
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
392 for (context_map::iterator i=children.begin(); i!=children.end(); i++) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
393 CONTEXTP c = (*i).second;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
394 c->dump(level+1);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
395 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
396
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
397 printf("%s env_from %s { \t// %s\n", indent, env_from_default, fullname);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
398 if (!env_from.empty()) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
399 printf("%s // white/black/unknown \n", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
400 for (string_map::iterator i=env_from.begin(); i!=env_from.end(); i++) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
401 char *f = (*i).first;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
402 char *t = (*i).second;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
403 printf("%s %s \t%s; \n", indent, f, t);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
404 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
405 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
406 if (!env_from_context.empty()) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
407 printf("%s // child contexts \n", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
408 for (context_map::iterator j=env_from_context.begin(); j!=env_from_context.end(); j++) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
409 char *f = (*j).first;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
410 CONTEXTP t = (*j).second;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
411 printf("%s %s \t%s; \n", indent, f, t->name);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
412 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
413 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
414 printf("%s }; \n", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
415
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
416 printf("%s }; \n", indent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
417 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
418
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
419
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
420 ////////////////////////////////////////////////
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
421 // helper to discard the strings held by a string_set
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
422 //
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
423 void discard(string_set &s) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
424 for (string_set::iterator i=s.begin(); i!=s.end(); i++) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
425 free(*i);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
426 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
427 s.clear();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
428 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
429
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
430
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
431 ////////////////////////////////////////////////
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
432 // helper to register a string in a string set
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
433 //
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
434 char* register_string(string_set &s, char *name) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
435 string_set::iterator i = s.find(name);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
436 if (i != s.end()) return *i;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
437 char *x = strdup(name);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
438 s.insert(x);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
439 return x;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
440 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
441
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
442
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
443 ////////////////////////////////////////////////
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
444 // register a global string
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
445 //
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
446 char* register_string(char *name) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
447 return register_string(all_strings, name);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
448 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
449
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
450
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
451 ////////////////////////////////////////////////
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
452 //
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
453 bool tsa(TOKEN &tok, char *token);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
454 bool tsa(TOKEN &tok, char *token) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
455 char *have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
456 if (have == token) return true;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
457 tok.token_error(token, have);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
458 return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
459 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
460
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
461
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
462 ////////////////////////////////////////////////
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
463 //
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
464 bool parse_dnsbl(TOKEN &tok, CONFIG &dc, CONTEXT &me);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
465 bool parse_dnsbl(TOKEN &tok, CONFIG &dc, CONTEXT &me) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
466 char *name = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
467 char *suf = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
468 char *msg = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
469 if (!tsa(tok, token_semi)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
470 DNSBLP dnsnew = new DNSBL(name, suf, msg);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
471 DNSBLP dnsold = me.find_dnsbl(name);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
472 if (dnsold && (*dnsold == *dnsnew)) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
473 // duplicate redefinition, ignore it
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
474 delete dnsnew;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
475 return true;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
476 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
477 me.add_dnsbl(name, dnsnew);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
478 return true;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
479 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
480
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
481
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
482 ////////////////////////////////////////////////
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
483 //
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
484 bool parse_dnsbll(TOKEN &tok, CONFIG &dc, CONTEXT &me);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
485 bool parse_dnsbll(TOKEN &tok, CONFIG &dc, CONTEXT &me) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
486 while (true) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
487 char *have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
488 if (!have) break;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
489 if (have == token_semi) break;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
490 DNSBLP dns = me.find_dnsbl(have);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
491 if (dns) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
492 me.add_dnsbl(dns);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
493 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
494 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
495 tok.token_error("dnsbl name", have);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
496 return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
497 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
498 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
499 return true;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
500 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
501
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
502
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
503 ////////////////////////////////////////////////
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
504 //
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
505 bool parse_content(TOKEN &tok, CONFIG &dc, CONTEXT &me);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
506 bool parse_content(TOKEN &tok, CONFIG &dc, CONTEXT &me) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
507 char *setting = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
508 if (setting == token_on) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
509 me.set_content_filtering(true);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
510 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
511 else if (setting == token_off) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
512 me.set_content_filtering(false);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
513 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
514 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
515 tok.token_error("on/off", setting);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
516 return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
517 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
518 if (!tsa(tok, token_lbrace)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
519 while (true) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
520 char *have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
521 if (!have) break;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
522 if (have == token_filter) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
523 char *suffix = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
524 char *messag = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
525 me.set_content_suffix(suffix);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
526 me.set_content_message(messag);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
527 if (!tsa(tok, token_semi)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
528 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
529 else if (have == token_ignore) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
530 if (!tsa(tok, token_lbrace)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
531 while (true) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
532 if (!have) break;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
533 char *have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
534 if (have == token_rbrace) break; // done
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
535 me.add_ignore(have);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
536 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
537 if (!tsa(tok, token_semi)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
538 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
539 else if (have == token_tld) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
540 if (!tsa(tok, token_lbrace)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
541 while (true) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
542 char *have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
543 if (!have) break;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
544 if (have == token_rbrace) break; // done
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
545 me.add_tld(have);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
546 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
547 if (!tsa(tok, token_semi)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
548 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
549 else if (have == token_html_limit) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
550 have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
551 if (have == token_on) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
552 me.set_tag_limit(tok.nextint());
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
553 me.set_tag_message(tok.next());
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
554 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
555 else if (have == token_off) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
556 me.set_tag_limit(0);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
557 me.set_tag_message(NULL);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
558 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
559 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
560 tok.token_error("on/off", have);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
561 return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
562 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
563 if (!tsa(tok, token_semi)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
564 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
565 else if (have == token_html_tags) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
566 if (!tsa(tok, token_lbrace)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
567 while (true) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
568 char *have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
569 if (!have) break;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
570 if (have == token_rbrace) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
571 break; // done
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
572 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
573 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
574 me.add_tag(have); // base version
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
575 char buf[200];
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
576 snprintf(buf, sizeof(buf), "/%s", have);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
577 me.add_tag(register_string(buf)); // leading /
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
578 snprintf(buf, sizeof(buf), "%s/", have);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
579 me.add_tag(register_string(buf)); // trailing /
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
580 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
581 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
582 if (!tsa(tok, token_semi)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
583 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
584 else if (have == token_host_limit) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
585 have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
586 if (have == token_on) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
587 me.set_host_limit(tok.nextint());
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
588 me.set_host_message(tok.next());
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
589 me.set_host_random(false);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
590 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
591 else if (have == token_off) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
592 me.set_host_limit(0);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
593 me.set_host_message(NULL);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
594 me.set_host_random(false);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
595 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
596 else if (have == token_soft) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
597 me.set_host_limit(tok.nextint());
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
598 me.set_host_message(NULL);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
599 me.set_host_random(true);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
600 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
601 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
602 tok.token_error("on/off/soft", have);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
603 return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
604 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
605 if (!tsa(tok, token_semi)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
606 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
607 else if (have == token_rbrace) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
608 break; // done
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
609 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
610 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
611 tok.token_error("content keyword", have);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
612 return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
613 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
614 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
615 return tsa(tok, token_semi);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
616 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
617
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
618
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
619 ////////////////////////////////////////////////
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
620 //
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
621 bool parse_envto(TOKEN &tok, CONFIG &dc, CONTEXT &me);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
622 bool parse_envto(TOKEN &tok, CONFIG &dc, CONTEXT &me) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
623 if (!tsa(tok, token_lbrace)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
624 while (true) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
625 char *have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
626 if (!have) break;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
627 if (have == token_rbrace) break;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
628 if (have == token_semi) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
629 // optional separators
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
630 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
631 else if (have == token_dccto) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
632 char *flavor = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
633 if (!tsa(tok, token_lbrace)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
634 bool keeping = false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
635 while (true) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
636 char *have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
637 if (!have) break;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
638 if (have == token_rbrace) break;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
639 if (have == flavor) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
640 keeping = true;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
641 continue;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
642 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
643 else if ((have == token_ok) || (have == token_ok2) || (have == token_many)) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
644 keeping = false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
645 continue;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
646 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
647 if (have == token_envto) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
648 have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
649 if (keeping) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
650 if (me.allow_env_to(have)) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
651 me.add_to(have);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
652 dc.add_to(have, &me);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
653 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
654 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
655 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
656 else if (have == token_substitute) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
657 if (tok.next() == token_mailhost) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
658 have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
659 if (keeping) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
660 if (me.allow_env_to(have)) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
661 me.add_to(have);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
662 dc.add_to(have, &me);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
663 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
664 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
665 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
666 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
667 tok.skipeol();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
668 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
669 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
670 else if (me.allow_env_to(have)) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
671 me.add_to(have);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
672 dc.add_to(have, &me);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
673 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
674 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
675 tok.token_error("user@ or user@domain.tld or domain.tld where domain.tld allowed by parent context", have);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
676 return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
677 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
678 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
679 return tsa(tok, token_semi);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
680 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
681
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
682
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
683 ////////////////////////////////////////////////
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
684 //
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
685 bool parse_envfrom(TOKEN &tok, CONFIG &dc, CONTEXT &me);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
686 bool parse_envfrom(TOKEN &tok, CONFIG &dc, CONTEXT &me) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
687 char *st = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
688 if ((st == token_black) || (st == token_white) || (st == token_unknown) || (st == token_inherit)) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
689 me.set_from_default(st);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
690 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
691 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
692 tok.push(st);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
693 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
694 if (!tsa(tok, token_lbrace)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
695 while (true) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
696 char *have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
697 if (!have) break;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
698 if (have == token_rbrace) break;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
699 if (have == token_semi) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
700 // optional separators
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
701 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
702 else if (have == token_dccfrom) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
703 if (!tsa(tok, token_lbrace)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
704 bool keeping = false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
705 bool many = false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
706 while (true) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
707 char *have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
708 if (!have) break;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
709 if (have == token_rbrace) break;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
710 if (have == token_ok) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
711 keeping = true;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
712 many = false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
713 continue;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
714 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
715 else if (have == token_many) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
716 keeping = true;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
717 many = true;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
718 continue;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
719 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
720 else if (have == token_ok2) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
721 keeping = false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
722 continue;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
723 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
724 if (have == token_envfrom) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
725 have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
726 if (keeping) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
727 me.add_from(have, (many) ? token_black : token_white);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
728 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
729 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
730 else if (have == token_substitute) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
731 if (tok.next() == token_mailhost) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
732 have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
733 me.add_from(have, (many) ? token_black : token_white);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
734 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
735 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
736 tok.skipeol();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
737 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
738 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
739 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
740 // may be a valid email address or domain name
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
741 char *st = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
742 if ((st == token_black) || (st == token_white) || (st == token_unknown)) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
743 me.add_from(have, st);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
744 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
745 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
746 CONTEXTP con = me.find_from_context_name(st);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
747 if (con) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
748 me.add_from_context(have, con);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
749 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
750 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
751 tok.token_error("white/black/unknown or child context name", st);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
752 return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
753 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
754 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
755 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
756 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
757 return tsa(tok, token_semi);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
758 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
759
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
760
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
761 ////////////////////////////////////////////////
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
762 //
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
763 bool parse_context(TOKEN &tok, CONFIG &dc, CONTEXTP parent);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
764 bool parse_context(TOKEN &tok, CONFIG &dc, CONTEXTP parent) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
765 char *name = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
766 if (!tsa(tok, token_lbrace)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
767 CONTEXTP con = new CONTEXT(parent, name);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
768
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
769 while (true) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
770 char *have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
771 if (!have) break;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
772 if (have == token_rbrace) break; // done
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
773 if (have == token_dnsbl) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
774 if (!parse_dnsbl(tok, dc, *con)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
775 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
776 else if (have == token_dnsbll) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
777 if (!parse_dnsbll(tok, dc, *con)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
778 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
779 else if (have == token_content) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
780 if (!parse_content(tok, dc, *con)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
781 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
782 else if (have == token_envto) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
783 if (!parse_envto(tok, dc, *con)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
784 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
785 else if (have == token_envfrom) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
786 if (!parse_envfrom(tok, dc, *con)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
787 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
788 else if (have == token_context) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
789 if (!parse_context(tok, dc, con)) return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
790 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
791 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
792 tok.token_error("context keyword", have);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
793 return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
794 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
795 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
796
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
797 if (!tsa(tok, token_semi)) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
798 delete con;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
799 return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
800 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
801 dc.add_context(con);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
802 if (parent) parent->add_context(con);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
803 return true;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
804 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
805
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
806
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
807 ////////////////////////////////////////////////
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
808 // parse a config file
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
809 //
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
810 bool load_conf(CONFIG &dc, char *fn) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
811 TOKEN tok(fn, &dc.config_files);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
812 while (true) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
813 char *have = tok.next();
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
814 if (!have) break;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
815 if (have == token_context) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
816 if (!parse_context(tok, dc, NULL)) {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
817 return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
818 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
819 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
820 else {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
821 tok.token_error(token_context, have);
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
822 return false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
823 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
824 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
825 return (dc.default_context) ? true : false;
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
826 }
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
827
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
828
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
829 ////////////////////////////////////////////////
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
830 // init the tokens
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
831 //
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
832 void token_init() {
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
833 token_black = register_string("black");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
834 token_content = register_string("content");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
835 token_context = register_string("context");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
836 token_dccfrom = register_string("dcc_from");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
837 token_dccto = register_string("dcc_to");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
838 token_default = register_string("default");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
839 token_dnsbl = register_string("dnsbl");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
840 token_dnsbll = register_string("dnsbl_list");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
841 token_envfrom = register_string("env_from");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
842 token_envto = register_string("env_to");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
843 token_filter = register_string("filter");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
844 token_host_limit = register_string("host_limit");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
845 token_html_limit = register_string("html_limit");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
846 token_html_tags = register_string("html_tags");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
847 token_ignore = register_string("ignore");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
848 token_include = register_string("include");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
849 token_inherit = register_string("inherit");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
850 token_lbrace = register_string("{");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
851 token_mailhost = register_string("mail_host");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
852 token_many = register_string("many");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
853 token_off = register_string("off");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
854 token_ok = register_string("ok");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
855 token_ok2 = register_string("ok2");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
856 token_on = register_string("on");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
857 token_rbrace = register_string("}");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
858 token_semi = register_string(";");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
859 token_soft = register_string("soft");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
860 token_substitute = register_string("substitute");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
861 token_tld = register_string("tld");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
862 token_unknown = register_string("unknown");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
863 token_white = register_string("white");
7245c45cef7a fix for missing default return value in CONTEXT::acceptable_content()
carl
parents: 86
diff changeset
864 }