Skip to content

Implement a binary cache for OS Login passwd entries.#180

Merged
google-oss-prow[bot] merged 2 commits intoGoogleCloudPlatform:masterfrom
anandadalton:master
Feb 24, 2026
Merged

Implement a binary cache for OS Login passwd entries.#180
google-oss-prow[bot] merged 2 commits intoGoogleCloudPlatform:masterfrom
anandadalton:master

Conversation

@anandadalton
Copy link
Contributor

This change introduces a new binary cache format for storing OS Login passwd information. It includes:

  • OsLoginPasswdCacheWriter: A C++ class to build and write the cache file. It buffers user entries, sorts them, and writes them to a temporary file before atomically renaming it.
  • oslogin_passwd_cache_reader: A C implementation for reading from the cache file using mmap. It provides functions compatible with NSS modules for looking up entries by UID, name, and iterating through all entries.
  • eytzinger_layout.h: A template function to convert a sorted vector into an Eytzinger layout, used for the name index to improve cache locality during lookups.
  • oslogin_index_structs.h: Defines the structures used for the UID and Name indices.
  • New unit tests (eytzinger_layout_test.cc, oslogin_passwd_cache_reader_test.cc, round_trip_test.cc) to validate the cache functionality, including concurrent read access.
  • The Makefile is updated to build and run the new tests. The main function is removed from oslogin_utils_test.cc as gtest_main.cc is now linked.

This change introduces a new binary cache format for storing OS Login passwd information. It includes:
-   `OsLoginPasswdCacheWriter`: A C++ class to build and write the cache file. It buffers user entries, sorts them, and writes them to a temporary file before atomically renaming it.
-   `oslogin_passwd_cache_reader`: A C implementation for reading from the cache file using mmap. It provides functions compatible with NSS modules for looking up entries by UID, name, and iterating through all entries.
-   `eytzinger_layout.h`: A template function to convert a sorted vector into an Eytzinger layout, used for the name index to improve cache locality during lookups.
-   `oslogin_index_structs.h`: Defines the structures used for the UID and Name indices.
-   New unit tests (`eytzinger_layout_test.cc`, `oslogin_passwd_cache_reader_test.cc`, `round_trip_test.cc`) to validate the cache functionality, including concurrent read access.
-   The `Makefile` is updated to build and run the new tests. The `main` function is removed from `oslogin_utils_test.cc` as `gtest_main.cc` is now linked.
@ChaitanyaKulkarni28
Copy link
Member

/packagebuild

@ChaitanyaKulkarni28
Copy link
Member

/approve

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: anandadalton, ChaitanyaKulkarni28

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [ChaitanyaKulkarni28]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ChaitanyaKulkarni28
Copy link
Member

/lgtm

@google-oss-prow google-oss-prow bot added the lgtm label Feb 24, 2026
@google-oss-prow google-oss-prow bot merged commit f9e9234 into GoogleCloudPlatform:master Feb 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants