commit e18d071f3cc8912b9bfb6fb392689dc7394355dd from: Stefan Sperling date: Sun Nov 20 14:01:04 2022 UTC getpwuid() returns NULL without setting errno if no user is found pointed out by millert@ commit - 4cad5be9f88baeb0583b4b63a546f5815929a270 commit + e18d071f3cc8912b9bfb6fb392689dc7394355dd blob - 03cfa9264e97a034a49d4be7da221944cb1eda34 blob + ed5bbd87051a58c687b26b3585c2a1e3714d65f3 --- gotd/auth.c +++ gotd/auth.c @@ -120,8 +120,12 @@ gotd_auth_check(struct gotd_access_rule_list *rules, c int ngroups = NGROUPS_MAX; pw = getpwuid(euid); - if (pw == NULL) - return got_error_from_errno("getpwuid"); + if (pw == NULL) { + if (errno) + return got_error_from_errno("getpwuid"); + else + return got_error_set_errno(EACCES, repo_name); + } if (getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups) == -1) log_warnx("group membership list truncated");