| 319 | */ |
| 320 | |
| 321 | login_cap_t * |
| 322 | login_getpwclass(const struct passwd *pwd) |
| 323 | { |
| 324 | const char *cls = NULL; |
| 325 | |
| 326 | if (pwd != NULL) { |
| 327 | cls = pwd->pw_class; |
| 328 | if (cls == NULL || *cls == '\0') |
| 329 | cls = (pwd->pw_uid == 0) ? LOGIN_DEFROOTCLASS : LOGIN_DEFCLASS; |
| 330 | } |
| 331 | /* |
| 332 | * XXX: pwd should be unused by login_getclassbyname() unless cls is `me', |
| 333 | * so NULL can be passed instead of pwd for more safety. |
| 334 | */ |
| 335 | return login_getclassbyname(cls, pwd); |
| 336 | } |
| 337 | |
| 338 | |
| 339 | /* |
no test coverage detected