diff options
author | Siddhesh Poyarekar <siddhesh@redhat.com> | 2014-01-02 10:03:12 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2014-01-02 10:04:21 +0530 |
commit | d41242129ba693cdbc8db85b846fcaccf9f0b7c4 (patch) | |
tree | 6134954f6153a4ada1c1785e7423c327615f56af /nscd | |
parent | ac49ddc4958009fb05ee759be3dfe731d041ca3e (diff) | |
download | glibc-d41242129ba693cdbc8db85b846fcaccf9f0b7c4.zip glibc-d41242129ba693cdbc8db85b846fcaccf9f0b7c4.tar.gz glibc-d41242129ba693cdbc8db85b846fcaccf9f0b7c4.tar.bz2 |
Fix infinite loop in nscd when netgroup is empty (bz #16365)
Currently, when a user looks up a netgroup that does not have any
members, nscd goes into an infinite loop trying to find members in the
group. This is because it does not handle cases when getnetgrent
returns an NSS_STATUS_NOTFOUND (which is what it does on empty group).
Fixed to handle this in the same way as NSS_STATUS_RETURN, similar to
what getgrent does by itself.
Diffstat (limited to 'nscd')
-rw-r--r-- | nscd/netgroupcache.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c index baebdd7..50936ee 100644 --- a/nscd/netgroupcache.c +++ b/nscd/netgroupcache.c @@ -180,9 +180,10 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req, int e; status = getfct.f (&data, buffer + buffilled, buflen - buffilled, &e); - if (status == NSS_STATUS_RETURN) - /* This was the last one for this group. Look - at next group if available. */ + if (status == NSS_STATUS_RETURN + || status == NSS_STATUS_NOTFOUND) + /* This was either the last one for this group or the + group was empty. Look at next group if available. */ break; if (status == NSS_STATUS_SUCCESS) { |