s3-lsa: allow to lookup BUILTIN\ in lsa_LookupNames.
authorGünther Deschner <gd@samba.org>
Tue, 20 Oct 2009 13:13:56 +0000 (15:13 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 20 Oct 2009 13:28:31 +0000 (15:28 +0200)
Found by RPC-LSA-LOOKUPNAMES torture test.

Guenther

source3/passdb/lookup_sid.c

index 4f8d6a4759dc193a7ba4d14987160c93228f8119..1fcd94c059dd22204a6363bfcccb472a5880d55f 100644 (file)
@@ -86,6 +86,14 @@ bool lookup_name(TALLOC_CTX *mem_ctx,
        if ((flags & LOOKUP_NAME_BUILTIN) &&
            strequal(domain, builtin_domain_name()))
        {
        if ((flags & LOOKUP_NAME_BUILTIN) &&
            strequal(domain, builtin_domain_name()))
        {
+               if (strlen(name) == 0) {
+                       /* Swap domain and name */
+                       tmp = name; name = domain; domain = tmp;
+                       sid_copy(&sid, &global_sid_Builtin);
+                       type = SID_NAME_DOMAIN;
+                       goto ok;
+               }
+
                /* Explicit request for a name in BUILTIN */
                if (lookup_builtin_name(name, &rid)) {
                        sid_copy(&sid, &global_sid_Builtin);
                /* Explicit request for a name in BUILTIN */
                if (lookup_builtin_name(name, &rid)) {
                        sid_copy(&sid, &global_sid_Builtin);