fixed
This commit is contained in:
parent
04ff3cf8e7
commit
0306c4319b
3 changed files with 32 additions and 15 deletions
7
src/su.c
7
src/su.c
|
@ -60,23 +60,24 @@ static int password(const struct passwd *pw) {
|
|||
fflush(stdout);
|
||||
|
||||
if (hide_input(STDIN_FILENO, 1)) {
|
||||
fprintf(stderr, "su: %s\n", strerror(errno));
|
||||
fprintf(stderr, "\nsu: %s\n", strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
off_t ret = 0;
|
||||
if ((ret = read(STDIN_FILENO, psswd, sizeof(psswd))) <= 0) {
|
||||
fprintf(stderr, "su: %s\n", strerror(errno));
|
||||
fprintf(stderr, "\nsu: %s\n", strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
putchar('\n');
|
||||
|
||||
psswd[ret - 1] = '\0';
|
||||
if (pw_check("su", pw, psswd)) {
|
||||
memset(psswd, '\0', sizeof(psswd));
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
memset(psswd, '\0', sizeof(psswd));
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue