Page MenuHomeFreeBSD

nscd step4
Needs ReviewPublic

Authored by david_crossfamilyweb.com on Oct 16 2024, 2:26 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Feb 9, 5:51 AM
Unknown Object (File)
Sat, Feb 8, 5:38 AM
Unknown Object (File)
Sat, Feb 8, 12:01 AM
Unknown Object (File)
Thu, Feb 6, 8:08 AM
Unknown Object (File)
Sun, Feb 2, 12:58 PM
Unknown Object (File)
Fri, Jan 17, 7:55 PM
Unknown Object (File)
Dec 13 2024, 4:17 AM
Unknown Object (File)
Oct 23 2024, 12:06 AM
Subscribers

Details

Reviewers
markj
Summary

Fix password agent not being threadsafe by using reentrant functions.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

usr.sbin/nscd/agents/passwd.c
74

Please remove the extra newline before each return statement. It's inconsistent with the code styles used elsewhere in nscd (and in FreeBSD generally).

89

It'd be a bit more efficient to use realloc() in these loops.

96

This assignment to errno should happen right before returning from this function. It may get clobbered by free(), for example.

235
283

There should be a newline after variable declarations, and here there's an extra newline before the declaration.

This one looks good to me, I just made one suggestion that should simplify error handling a bit.

usr.sbin/nscd/agents/passwd.c
240

A suggestion which would simplify this patch a bit: don't use errno to pass error numbers between these internal subroutines. Instead, add an extra parameter of type int * to getpw(), and modify getpw() to use it to return an error number instead of (ab)using errno.