K 10 svn:author V 5 markj K 8 svn:date V 27 2021-02-20T16:36:50.880025Z K 7 svn:log V 1020 libc/nss: Restore iterator state when doing passwd/group lookups The getpwent(3) and getgrent(3) implementations maintain some internal iterator state. Interleaved calls to functions which do passwd/group lookups using a key, such as getpwnam(3), would in some cases clobber this state, causing a subsequent getpwent() or getgrent() call to restart iteration from the beginning of the database or to terminate early. This is particularly troublesome in programming environments where execution of green threads is interleaved within a single OS thread. Take care to restore any iterator state following a keyed lookup. The "files" provider for the passwd database was already handling this correctly, but "compat" was not, and both providers had this problem when accessing the group database. PR: 252094 Submitted by: Viktor Dukhovni (cherry picked from commit 5619d49e07d3942e438f3d06269f3c1c466cf5b7) Git Hash: a8499077ab1b23c432c251874cf931e1025d8636 Git Author: markj@FreeBSD.org END