mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-08 21:17:47 +03:00
Merge pull request #19531 from poettering/nss-systemd-fixes
nss-systemd: two minor fixes
This commit is contained in:
commit
2a9cfe6b07
@ -348,7 +348,7 @@ enum nss_status _nss_systemd_setgrent(int stayopen) {
|
||||
_l = pthread_mutex_lock_assert(&getgrent_data.mutex);
|
||||
|
||||
getgrent_data.iterator = userdb_iterator_free(getgrent_data.iterator);
|
||||
getpwent_data.by_membership = false;
|
||||
getgrent_data.by_membership = false;
|
||||
|
||||
/* See _nss_systemd_setpwent() for an explanation why we use USERDB_DONT_SYNTHESIZE here */
|
||||
r = groupdb_all(nss_glue_userdb_flags() | USERDB_DONT_SYNTHESIZE, &getgrent_data.iterator);
|
||||
@ -441,7 +441,7 @@ enum nss_status _nss_systemd_getgrent_r(
|
||||
getgrent_data.iterator = userdb_iterator_free(getgrent_data.iterator);
|
||||
|
||||
r = membershipdb_all(nss_glue_userdb_flags(), &getgrent_data.iterator);
|
||||
if (r < 0) {
|
||||
if (r < 0 && r != -ESRCH) {
|
||||
UNPROTECT_ERRNO;
|
||||
*errnop = -r;
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
@ -454,7 +454,7 @@ enum nss_status _nss_systemd_getgrent_r(
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
} else if (!STR_IN_SET(gr->group_name, root_group.gr_name, nobody_group.gr_name)) {
|
||||
r = membershipdb_by_group_strv(gr->group_name, nss_glue_userdb_flags(), &members);
|
||||
if (r < 0) {
|
||||
if (r < 0 && r != -ESRCH) {
|
||||
UNPROTECT_ERRNO;
|
||||
*errnop = -r;
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
@ -465,6 +465,9 @@ enum nss_status _nss_systemd_getgrent_r(
|
||||
if (getgrent_data.by_membership) {
|
||||
_cleanup_(_nss_systemd_unblockp) bool blocked = false;
|
||||
|
||||
if (!getgrent_data.iterator)
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
|
||||
for (;;) {
|
||||
_cleanup_free_ char *user_name = NULL, *group_name = NULL;
|
||||
|
||||
|
@ -216,7 +216,7 @@ enum nss_status userdb_getgrnam(
|
||||
}
|
||||
|
||||
r = membershipdb_by_group_strv(name, nss_glue_userdb_flags(), &members);
|
||||
if (r < 0) {
|
||||
if (r < 0 && r != -ESRCH) {
|
||||
*errnop = -r;
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
@ -309,7 +309,7 @@ enum nss_status userdb_getgrgid(
|
||||
from_nss = false;
|
||||
|
||||
r = membershipdb_by_group_strv(g->group_name, nss_glue_userdb_flags(), &members);
|
||||
if (r < 0) {
|
||||
if (r < 0 && r != -ESRCH) {
|
||||
*errnop = -r;
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user