[hackers] [ubase] Add /etc/passwd support to su(1) || sin

From: <git_AT_suckless.org>
Date: Tue, 03 Jun 2014 13:15:40 +0200

commit bd4b6f4e47ae91b9d9c7a47874be5f4847e6a63b
Author: sin <sin_AT_2f30.org>
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
_AT_@ -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] == '
Received on Tue Jun 03 2014 - 13:15:40 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 03 2014 - 13:24:07 CEST