s3:lib: validate domain name in lookup_wellknown_name()
commit9f4f2af72056f7cc96bff45f9baa9f5a0202abf5
authorRalph Boehme <slow@samba.org>
Thu, 15 Oct 2015 10:35:26 +0000 (15 12:35 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 20 Oct 2015 06:48:17 +0000 (20 08:48 +0200)
tree2e0cac89f74d8161d3cc4a7ef9c4ed8e913e33d8
parenta83021fe900dbda5058f9a5f2f8c3dd8cd9f04db
s3:lib: validate domain name in lookup_wellknown_name()

If domain argument is not an empty string, only search the matching
wellknown domain name.

As the only wellknown domain with a name is "NT Authority", passing ""
to lookup_wellknown_name() will search all domains inlcuding "NT
Authority".

Passing "NT Authority" otoh will obviously only search that domain.

This change makes lookup_wellknown_name() behave like this:

in domain         | in name       | ok | out sid | out domain
========================================================
                    Dialup          +    S-1-5-1   NT Authority
NT Authority        Dialup          +    S-1-5-1   NT Authority
Creator Authority   Dialup          -    -         -
                    Creator Owner   +    S-1-3-0   ""
Creator Authority   Creator Owner   -    -         -
NT Authority        Creator Owner   -    -         -

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11555

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
(cherry picked from commit 23f674488a1f62fcc58bb94bed0abed98078b96d)
source3/lib/util_wellknown.c