linux-audit / audit-userspace

Linux audit userspace repository
GNU General Public License v2.0
589 stars 206 forks source link

lib: use thread-safe passwd and group lookup #348

Closed cgzones closed 8 months ago

cgzones commented 8 months ago

Use getpwuid_r(3) and getgrnam_r(3) instead of their non thread-safe version to protect against concurrent usage, not necessarily within libaudit.

stevegrubb commented 8 months ago

To my knowledge, these functions are only used by auditctl. Since the kernel only knows numbers, we convert names/groups in the rules to numbers. I'm wondering if I should mark a bunch of these functions deprecated and then pull them into a private library some time in the future?

cgzones commented 8 months ago

There seem to be several third-party users of audit_rule_fieldpair_data(3):

stevegrubb commented 8 months ago

Thanks for the info. I never would have guessed. :-) I'll review this more tomorrow.

stevegrubb commented 8 months ago

OK, looks good to me. Thanks!