| 216 | */ |
| 217 | |
| 218 | int |
| 219 | auth_timeok(login_cap_t *lc, time_t t) |
| 220 | { |
| 221 | int rc = 1; /* Default is ok */ |
| 222 | |
| 223 | if (lc != NULL && t != (time_t)0 && t != (time_t)-1) { |
| 224 | struct tm *tptr; |
| 225 | |
| 226 | static int ltimesno = 0; |
| 227 | static struct login_time *ltimes = NULL; |
| 228 | |
| 229 | if ((tptr = localtime(&t)) != NULL) { |
| 230 | struct login_time *lt; |
| 231 | |
| 232 | lt = login_timelist(lc, "times.allow", <imesno, <imes); |
| 233 | if (lt != NULL && in_ltms(lt, tptr, NULL) == -1) |
| 234 | rc = 0; /* not in allowed times list */ |
| 235 | else { |
| 236 | |
| 237 | lt = login_timelist(lc, "times.deny", <imesno, <imes); |
| 238 | if (lt != NULL && in_ltms(lt, tptr, NULL) != -1) |
| 239 | rc = 0; /* in deny times list */ |
| 240 | } |
| 241 | if (ltimes) { |
| 242 | free(ltimes); |
| 243 | ltimes = NULL; |
| 244 | ltimesno = 0; |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | return rc; |
| 250 | } |
nothing calls this directly
no test coverage detected