[ I'm sending this to the qmail list because the interaction of this
bug with sub-users in qmail is especially pronounced. ]

I've been chasing down a stupid problem for a few days now, and now I
finally know why user-ext hasn't been working for one of my users on
freebsd.  After figuring out the symptom (getpwnam() doesn't return
correctly in some cases), I got confirmation that getpwnam() in
freebsd-2.2.8 is broken, and it seems to me that qmail is especially
affected by it. This doesn't seem to happen in freebsd-2.2.7.  

>From the freebsd-2.2.8 errata (http://www.freebsd.org/releases/2.2.8R/errata.html):

o    getpwnam(3) semantics are incorrect in some cases.
 
Fix: If passed a string longer than the maximum allowed for a user name,
     getpwnam will incorrectly return an entry for a user that matches the
     initial characters in the string up to the maximum length allowed for a
     user name.  To correct this behaviour, libc needs to be patched and
     recompiled.  The appropriate patch can be obtained from:
     
http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/gen/getpwent.c.diff?r1=1.35.2.2&r2=1.35.2.3

This means that w/ freebsd 2.2.8 if you have a user whose username is
8 characters long and they have a .qmail-ext that they want to deliver
to, qmail-getpw will never return the correct "dash" and "ext" args,
and that user is up the river.

The process of fixing seems like a real PITA to me.  I think I'm just
going to change the user to having a 7 character username, or patch
qmail-getpw to check if str_len(username) > UT_NAMESIZE (currently 8).

-Peter

Reply via email to