| 174 | */ |
| 175 | |
| 176 | int |
| 177 | login_hostok(login_cap_t *lc, const char *host, const char *ip, |
| 178 | const char *allowcap, const char *denycap) |
| 179 | { |
| 180 | int rc = 1; /* Default is ok */ |
| 181 | |
| 182 | if (lc != NULL && |
| 183 | ((host != NULL && *host != '\0') || (ip != NULL && *ip != '\0'))) { |
| 184 | const char **hl; |
| 185 | |
| 186 | hl = login_getcaplist(lc, allowcap, NULL); |
| 187 | if (hl != NULL && !login_str2inlist(hl, host, ip, FNM_CASEFOLD)) |
| 188 | rc = 0; /* host or IP not in allow list */ |
| 189 | else { |
| 190 | |
| 191 | hl = login_getcaplist(lc, denycap, NULL); |
| 192 | if (hl != NULL && login_str2inlist(hl, host, ip, FNM_CASEFOLD)) |
| 193 | rc = 0; /* host or IP in deny list */ |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | return rc; |
| 198 | } |
| 199 | |
| 200 | |
| 201 | /* |
no test coverage detected