|
Lines 643-654
Link Here
|
| 643 |
*p = '\0'; |
643 |
*p = '\0'; |
| 644 |
if (!*line) |
644 |
if (!*line) |
| 645 |
errx(EX_DATAERR, "empty password read on file descriptor %d", fd); |
645 |
errx(EX_DATAERR, "empty password read on file descriptor %d", fd); |
| 646 |
lc = login_getpwclass(pwd); |
646 |
/* check for encrypted/literal password in file descriptor */ |
| 647 |
if (lc == NULL || |
647 |
if (((arg = getarg(args, 'w')) != NULL) && |
| 648 |
login_setcryptfmt(lc, "md5", NULL) == NULL) |
648 |
(boolean_val(arg->val, cnf->default_password) == -3)) { |
| 649 |
warn("setting crypt(3) format"); |
649 |
int i; |
| 650 |
login_close(lc); |
650 |
/* password is encrypted - check for ':' in password */ |
| 651 |
pwd->pw_passwd = pw_pwcrypt(line); |
651 |
for (i = 0; i < strlen(line); i++) { |
|
|
652 |
if (line[i] == ':') |
| 653 |
return EX_DATAERR; |
| 654 |
} |
| 655 |
pwd->pw_passwd = line; |
| 656 |
} else { |
| 657 |
lc = login_getpwclass(pwd); |
| 658 |
if (lc == NULL || |
| 659 |
login_setcryptfmt(lc, "md5", NULL) == NULL) |
| 660 |
warn("setting crypt(3) format"); |
| 661 |
login_close(lc); |
| 662 |
pwd->pw_passwd = pw_pwcrypt(line); |
| 663 |
} |
| 652 |
edited = 1; |
664 |
edited = 1; |
| 653 |
} |
665 |
} |
| 654 |
} |
666 |
} |