ubase

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

commit 78192e87d95baa19c1810062c1d3335a0ad3285c
parent 1b6fab85d627114f1a8f7674e47b867e2d00d8a9
Author: sin <sin@2f30.org>
Date:   Mon,  9 Jun 2014 12:53:15 +0100

Simplify a bit pw_check()

Diffstat:
Mutil/passwd.c | 12+++---------
1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/util/passwd.c b/util/passwd.c @@ -17,11 +17,8 @@ pw_check(struct passwd *pw, const char *pass) struct spwd *spw; p = pw->pw_passwd; - switch (pw->pw_passwd[0]) { - case '!': - case '*': + if (p[0] == '!' || p[0] == '*') eprintf("denied\n"); - } if (pw->pw_passwd[0] == '\0') return pass[0] == '\0' ? 1 : 0; @@ -33,12 +30,9 @@ pw_check(struct passwd *pw, const char *pass) eprintf("getspnam: %:", pw->pw_name); else if (!spw) eprintf("who are you?\n"); - switch (spw->sp_pwdp[0]) { - case '!': - case '*': - eprintf("denied\n"); - } p = spw->sp_pwdp; + if (p[0] == '!' || p[0] == '*') + eprintf("denied\n"); } cryptpass = crypt(pass, p);