| 57 | #endif |
| 58 | |
| 59 | static int in_domain(const char *domain, const char *what) |
| 60 | { |
| 61 | int dl = strlen(domain); |
| 62 | int wl = strlen(what); |
| 63 | |
| 64 | if ((wl - dl) >= 0) { |
| 65 | if (strcasecmp(domain, &what[wl - dl]) != 0) { |
| 66 | return 0; |
| 67 | } |
| 68 | |
| 69 | /* Make sure we matched an *entire* subdomain --- if the user |
| 70 | * said 'allow from good.com', we don't want people from nogood.com |
| 71 | * to be able to get in. |
| 72 | */ |
| 73 | |
| 74 | if (wl == dl) { |
| 75 | return 1; /* matched whole thing */ |
| 76 | } |
| 77 | else { |
| 78 | return (domain[0] == '.' || what[wl - dl - 1] == '.'); |
| 79 | } |
| 80 | } |
| 81 | else { |
| 82 | return 0; |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | static const char *ip_parse_config(cmd_parms *cmd, |
| 87 | const char *require_line, |
no outgoing calls
no test coverage detected