| 213 | }; |
| 214 | |
| 215 | static int in_domain(const char *domain, const char *what) |
| 216 | { |
| 217 | int dl = strlen(domain); |
| 218 | int wl = strlen(what); |
| 219 | |
| 220 | if ((wl - dl) >= 0) { |
| 221 | if (strcasecmp(domain, &what[wl - dl]) != 0) { |
| 222 | return 0; |
| 223 | } |
| 224 | |
| 225 | /* Make sure we matched an *entire* subdomain --- if the user |
| 226 | * said 'allow from good.com', we don't want people from nogood.com |
| 227 | * to be able to get in. |
| 228 | */ |
| 229 | |
| 230 | if (wl == dl) { |
| 231 | return 1; /* matched whole thing */ |
| 232 | } |
| 233 | else { |
| 234 | return (domain[0] == '.' || what[wl - dl - 1] == '.'); |
| 235 | } |
| 236 | } |
| 237 | else { |
| 238 | return 0; |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | static int find_allowdeny(request_rec *r, apr_array_header_t *a, int method) |
| 243 | { |