[hackers] [ubase] If root starts passwd don't ask for current password || sin

From: <git_AT_suckless.org>
Date: Mon, 09 Jun 2014 13:37:58 +0200

commit 834279b4a9d52fa12c379b85812e781c01531e13
Author: sin <sin_AT_2f30.org>
Date: Mon Jun 9 12:33:15 2014 +0100

    If root starts passwd don't ask for current password

diff --git a/passwd.c b/passwd.c
index 8427e12..a69ce1e 100644
--- a/passwd.c
+++ b/passwd.c
_AT_@ -25,6 +25,7 @@ main(int argc, char *argv[])
         char *cryptpass1 = NULL, *cryptpass2 = NULL, *cryptpass3 = NULL;
         char *p;
         char template[] = "/tmp/pw.XXXXXX";
+ uid_t uid;
         struct passwd *pw;
         int ffd, tfd;
         int r;
_AT_@ -44,6 +45,10 @@ main(int argc, char *argv[])
         else if (!pw)
                 eprintf("who are you?
");
 
+ uid = getuid();
+ if (uid == 0)
+ goto newpass;
+
         switch (pw->pw_passwd[0]) {
         case '!':
         case '*':
Received on Mon Jun 09 2014 - 13:37:58 CEST

This archive was generated by hypermail 2.3.0 : Mon Jun 09 2014 - 13:48:07 CEST