s3: fix guest auth when winbindd is running
authorSteven Danneman <steven.danneman@isilon.com>
Fri, 27 Feb 2009 16:35:18 +0000 (08:35 -0800)
committerKarolin Seeger <kseeger@samba.org>
Fri, 27 Mar 2009 12:06:51 +0000 (13:06 +0100)
commitf816072e3f8b92886b891a3101f4e50ffb727c6f
tree25656abe8c5a248e9805cd91c288aa7c183984c9
parent55af8687bcdddfb7295268f3c988a0b05ad8bf68
s3: fix guest auth when winbindd is running

This fix is very subtle.  If a server is configured with "security = share"
and "guest ok = yes" and winbindd is running authorization will fail during
tree connect.

This is due to our inability to map the guest sid S-1-5-21-X-501 to a uid
through sid_to_uid().  Winbindd is unaware of the hard coded mapping
between this sid and whatever uid the name in lp_guestaccount() is assigned.
So sid_to_uid() fails and we exit create_token_from_username() without
ever calling pdb_getsampwsid() which IS aware of the hard coded mapping.

This patch just reorganizes the code, moving sid_to_uid() down to the
block of code in which it is needed, avoiding this early failure.
(cherry picked from commit 671812696217fe1337562b661d5131be79797f1c)
source/auth/auth_util.c