commit bd4b6f4e47ae91b9d9c7a47874be5f4847e6a63b
Author: sin <[email protected]>
Date:   Tue Jun 3 12:09:25 2014 +0100

    Add /etc/passwd support to su(1)

diff --git a/su.c b/su.c
index a274aae..2c32338 100644
--- a/su.c
+++ b/su.c
@@ -58,42 +58,66 @@ main(int argc, char *argv[])
        srand(time(NULL));
 
        errno = 0;
-       spw = getspnam(usr);
+       pw = getpwnam(usr);
        if (errno)
-               eprintf("getspnam: %s:", usr);
-       else if (!spw)
+               eprintf("getpwnam: %s:", usr);
+       else if (!pw)
                eprintf("who are you?
");
 
-       switch (spw->sp_pwdp[0]) {
+       switch (pw->pw_passwd[0]) {
        case '!':
        case '*':
                eprintf("denied
");
        }
 
+       /* Empty password? Su now */
+       if (pw->pw_passwd[0] == '

Reply via email to