diff options
author | Rich Felker <dalias@aerifal.cx> | 2018-12-28 16:54:13 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018-12-28 16:54:13 -0500 |
commit | de7dc1318f493184b20f7661bc12b1829b957b67 (patch) | |
tree | 25a67195220b5213a70255be22185489824f3826 | |
parent | 9db81b862d95326d43af7c7fae9078ad9ff5bd6f (diff) | |
download | musl-de7dc1318f493184b20f7661bc12b1829b957b67.tar.gz musl-de7dc1318f493184b20f7661bc12b1829b957b67.tar.bz2 musl-de7dc1318f493184b20f7661bc12b1829b957b67.tar.xz musl-de7dc1318f493184b20f7661bc12b1829b957b67.zip |
halt getspnam[_r] search on error accessing TCB shadow
fallback to /etc/shadow should happen only when the entry is not found
in the TCB shadow. otherwise transient errors or permission errors can
cause inconsistent results.
-rw-r--r-- | src/passwd/getspnam_r.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/passwd/getspnam_r.c b/src/passwd/getspnam_r.c index 1b95dbb6..541e8531 100644 --- a/src/passwd/getspnam_r.c +++ b/src/passwd/getspnam_r.c @@ -94,6 +94,8 @@ int getspnam_r(const char *name, struct spwd *sp, char *buf, size_t size, struct return errno; } } else { + if (errno != ENOENT && errno != ENOTDIR) + return errno; f = fopen("/etc/shadow", "rbe"); if (!f) { if (errno != ENOENT && errno != ENOTDIR) |