소스 검색

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.
Rich Felker 6 년 전
부모
커밋
de7dc1318f
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      src/passwd/getspnam_r.c

+ 2 - 0
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)