Page MenuHomeFreeBSD

nscd corretly handle end of stream for getent
Needs ReviewPublic

Authored by david_crossfamilyweb.com on Oct 18 2024, 10:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 2, 1:52 AM
Unknown Object (File)
Nov 12 2024, 9:27 PM
Unknown Object (File)
Oct 23 2024, 6:58 AM
Subscribers

Details

Reviewers
markj
Summary

The current handling in the caching routine for getent style calls does not sufficiently maintain state.

At the end of the mp-read when it detects end of stream it resets its state to the initial state; this has the effect that subsequent calls to 'getent' will just automatically rewind to the head of the state, in the case of the cache daemon this means that you will iterate through the entire cache, then get a single record of the next datasource, and then loop through the entire cache AGAIN, get the next datatsource, etc.

The fix here is to NOT reset to the initial state at detected end of stream but record the fact that you are at the end of the stream. The existing 'setent' routines which are designed to rewind the stream then correctly reset the state.

Note this diff is taken after the 'nscd step 7' diff as this bug is made more manifest by correctly handling getent in the first place.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped