From 0c1cbaede8818929abe7a6cc3ff930dd18d74c86 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Mon, 13 Feb 2012 20:32:00 +0000 Subject: [PATCH] 2012-02-13 Mike Frysinger * src/passwd.c: (non PAM flavour) Report permission denied when access to /etc/shadow fails with EACCES. --- ChangeLog | 5 +++++ src/passwd.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index d3b178be..ae8ad73f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-02-13 Mike Frysinger + + * src/passwd.c: (non PAM flavour) Report permission denied when + access to /etc/shadow fails with EACCES. + 2012-02-13 Mike Frysinger * lib/nscd.c: Add missing newline to error message. diff --git a/src/passwd.c b/src/passwd.c index d3a9f195..ac90aa30 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -1057,6 +1057,12 @@ int main (int argc, char **argv) */ sp = getspnam (name); /* !USE_PAM, no need for xgetspnam */ if (NULL == sp) { + if (errno == EACCES) { + (void) fprintf (stderr, + _("%s: Permission denied.\n"), + Prog); + exit (E_NOPERM); + } sp = pwd_to_spwd (pw); }