You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/http.c
+21-9Lines changed: 21 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -134,25 +134,37 @@ http_callback_404(httpd *webserver, request *r, int error_code)
134
134
free(mac);
135
135
}
136
136
137
-
debug(LOG_INFO, "Check host %s is in whitelist or not", r->request.host); // eg. www.example.com
137
+
// if host is not in whitelist, maybe not in conf or domain'IP changed, it will go to here.
138
+
debug(LOG_INFO, "Check host %s is in whitelist or not", r->request.host); // e.g. www.example.com
138
139
t_firewall_rule*rule;
139
-
//eg. example.com is in whitelist
140
+
//e.g. example.com is in whitelist
141
+
// if request http://www.example.com/, it's not equal example.com.
140
142
for (rule=get_ruleset("global"); rule!=NULL; rule=rule->next) {
141
-
// if request http://www.example.com/, it's not equal example.com. if request http://example.com, it will not go to here, it had been added into "iptables allow" when wifidog start.
142
-
if (strstr(r->request.host, rule->mask)) {
143
-
inthost_length=strlen(r->request.host);
144
-
intmask_length=strlen(rule->mask);
143
+
debug(LOG_INFO, "rule mask %s", rule->mask);
144
+
if (strstr(r->request.host, rule->mask) ==NULL) {
145
+
debug(LOG_INFO, "host %s is not in %s, contiue", r->request.host, rule->mask);
146
+
continue;
147
+
}
148
+
inthost_length=strlen(r->request.host);
149
+
intmask_length=strlen(rule->mask);
150
+
if (host_length!=mask_length) {
145
151
charprefix[1024] = {0};
146
-
// must be *.example.com, if not have ".", maybe Phishing. eg. phishingexample.com
// e.g. "example.com" is in conf, so it had been parse to IP and added into "iptables allow" when wifidog start. but then its' A record(IP) changed, it will go to here.
164
+
debug(LOG_INFO, "allow domain again, because IP changed");
0 commit comments