ubase

suckless linux base utils
git clone git://git.2f30.org/ubase
Log | Files | Refs | README | LICENSE

commit 86566f4cebaeaccf58b711b02432bf443ebb64f7
parent 56ce9e8bffe8eba7f6b1f09309f1a1250bb04da6
Author: sin <sin@2f30.org>
Date:   Fri, 18 Oct 2013 10:25:39 +0100

Only try to ask for a password and check if uid is != 0

Diffstat:
Msu.c | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/su.c b/su.c @@ -61,16 +61,16 @@ main(int argc, char **argv) pass = getpass("Password: "); if (!pass) eprintf("getpass:"); - } - cryptpass = crypt(pass, spw->sp_pwdp); - for (i = 0; pass[i]; i++) - pass[i] = '\0'; - if (!cryptpass) - eprintf("crypt:"); + 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"); + if (strcmp(cryptpass, spw->sp_pwdp) != 0) + enprintf(EXIT_FAILURE, "Denied\n"); + } errno = 0; pw = getpwnam(usr);