summaryrefslogtreecommitdiff
path: root/src/passwd
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-12-28 16:54:13 -0500
committerRich Felker <dalias@aerifal.cx>2018-12-28 16:54:13 -0500
commitde7dc1318f493184b20f7661bc12b1829b957b67 (patch)
tree25a67195220b5213a70255be22185489824f3826 /src/passwd
parent9db81b862d95326d43af7c7fae9078ad9ff5bd6f (diff)
downloadmusl-de7dc1318f493184b20f7661bc12b1829b957b67.tar.gz
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.
Diffstat (limited to 'src/passwd')
-rw-r--r--src/passwd/getspnam_r.c2
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)