Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Varied fixes #19

Closed
wants to merge 7 commits into from
Closed

Varied fixes #19

wants to merge 7 commits into from

Conversation

ericonr
Copy link
Contributor

@ericonr ericonr commented Jun 26, 2021

Each one should be explained clearly in the commit message, can be improved if necessary. Initial clean up from things noticed while gearing up to implement caching.

There was a macro for PW_LEN already; the literal value was correct, so
this is only a style fix.
dlclose is a noop on musl, so this being there isn't an actual issue,
but it's still not supposed to be there: since we are using functions
from the DSO, it should remain open. The mod_passwd block above doesn't
dloclose its DSO.
- use sizeof(object) instead of repeating a computation
- make a non exported function static
- add comments for the buffer memory handling
The outer if block was only entered if ret == ERANGE, so ret can't be
EAGAIN.
The swap variable was never being set to 1, so the functions to answer
requests would never swap integers. Add a comment explaning the
conditional.
int retval = NSS_STATUS_UNAVAIL;
struct initgroups_res *initgroups_res;

if(ISPWREQ(reqtype)) assert(mod_passwd);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a comment above it explaining that this is for debugging only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment now.

Instead of having to cast the void *fn pointer, simply pass the
mod_{passwd,group} structs to nss_getkey and allow it to find the
function it needs.

Add assertions to guarantee the function is being used correctly.

Simplifying this function and its usage is important because it allows
us to call nss_getkey directly with less setup around it.
We are tracking if the request uses mod_passwd or mod_group in different
ways across functions in this file; create a variable to track it
explicitly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants