commit 834279b4a9d52fa12c379b85812e781c01531e13
parent 4c38dffadee9bd29fa85dffef3ea4b63d6704183
Author: sin <sin@2f30.org>
Date: Mon, 9 Jun 2014 12:33:15 +0100
If root starts passwd don't ask for current password
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/passwd.c b/passwd.c
@@ -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;
@@ -44,6 +45,10 @@ main(int argc, char *argv[])
else if (!pw)
eprintf("who are you?\n");
+ uid = getuid();
+ if (uid == 0)
+ goto newpass;
+
switch (pw->pw_passwd[0]) {
case '!':
case '*':