Page MenuHomeFreeBSD

NS_RETURN incorrectly excluded from terminal states with custom status return rules
Needs ReviewPublic

Authored by david_crossfamilyweb.com on Oct 23 2024, 3:22 AM.
Tags
None
Referenced Files
F141994680: D47261.id145378.diff
Wed, Jan 14, 3:45 PM
F141994597: D47261.id.diff
Wed, Jan 14, 3:43 PM
Unknown Object (File)
Wed, Jan 14, 12:14 PM
Unknown Object (File)
Wed, Dec 31, 11:25 PM
Unknown Object (File)
Nov 17 2025, 7:33 PM
Unknown Object (File)
Nov 9 2025, 11:18 AM
Unknown Object (File)
Nov 4 2025, 11:40 AM
Unknown Object (File)
Nov 3 2025, 1:15 AM
Subscribers

Details

Reviewers
markj
Summary

If you use the standard rules in nsswitch.conf then "NS_SUCCESS | NS_RETURN" are mapped to terminal states and everything else continues to the net source (notfound, unavailable, tryagain).

If you specify a custom status code handler, like [notfound = return] then the default flags are ONLY NS_SUCCESS. This means nsdispatch(3) routines returning NS_RETURN (for example for ERANGE to get more memory), instead fallback to the next source. This is incorrect behavior. for 3 reasons.

  1. NS_RETURN is explicit, it is to return, not fall back.
  2. there is no way to restore this behavior, 'return' is not a documented status code in nsswitch.conf or as far as I can see the parser to restore this behavior
  3. NS_RETURN's intent is to signal that there is SOMETHING there, but you may need to take additional action; by having the system fall through this completely hides this behavior from clients.

This fix sets the default for ALL to be NS_SUCCESS and NS_RETURN. I think there MAY be another bug where you cannot set NS_SUCCESS to continue (for last match semantics). but I will investigate that at a later time.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped