[Dovecot] Configuration of LMTP Reject Code

Petter Urkedal urkedal at nbi.dk
Thu Mar 17 15:49:20 EET 2011

On 2011-03-17, Timo Sirainen wrote:
> 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().

Yeah, that's odd.  I don't have the POSIX standard, but my reading a few
of the top Google matches for "getpwnam_r POSIX", suggests it returns 0
on "not found".  My testing is for RHEL-6 using sssd.

> > 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.

Sounds good.

More information about the dovecot mailing list