17 Mar
2011
17 Mar
'11
3:27 p.m.
On Thu, 2011-03-17 at 14:16 +0100, Petter Urkedal wrote:
I think there is a better solution. It seems that getpwnam_r is POSIX and does the right thing.
Oh, weird. I knew about that function but I never realized it fixed the error handling problem. Also everything I saw discussing the getpwnam() error problems never bothered to mention getpwnam_r().
The attached patch adds a feature-check for getpwnam_r and, if present, uses it in userdb-passwd.c in place of the problematic getpwnam. I've not some light testing on a non-production server.
I think I'll do a bit larger change here that replaces all getpwnam(), getpwuid() and maybe other calls. Dovecot doesn't need thread-safe getpw*() so I can do an easier to use wrapper function.