mirror of git://git.suckless.org/sbase
Only try to ask for a password and check if uid is != 0
This commit is contained in:
parent
56ce9e8bff
commit
86566f4ceb
18
su.c
18
su.c
|
@ -61,17 +61,17 @@ main(int argc, char **argv)
|
||||||
pass = getpass("Password: ");
|
pass = getpass("Password: ");
|
||||||
if (!pass)
|
if (!pass)
|
||||||
eprintf("getpass:");
|
eprintf("getpass:");
|
||||||
|
|
||||||
|
cryptpass = crypt(pass, spw->sp_pwdp);
|
||||||
|
for (i = 0; pass[i]; i++)
|
||||||
|
pass[i] = '\0';
|
||||||
|
if (!cryptpass)
|
||||||
|
eprintf("crypt:");
|
||||||
|
|
||||||
|
if (strcmp(cryptpass, spw->sp_pwdp) != 0)
|
||||||
|
enprintf(EXIT_FAILURE, "Denied\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
cryptpass = crypt(pass, spw->sp_pwdp);
|
|
||||||
for (i = 0; pass[i]; i++)
|
|
||||||
pass[i] = '\0';
|
|
||||||
if (!cryptpass)
|
|
||||||
eprintf("crypt:");
|
|
||||||
|
|
||||||
if (strcmp(cryptpass, spw->sp_pwdp) != 0)
|
|
||||||
enprintf(EXIT_FAILURE, "Denied\n");
|
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
pw = getpwnam(usr);
|
pw = getpwnam(usr);
|
||||||
if (errno)
|
if (errno)
|
||||||
|
|
Loading…
Reference in New Issue