s3: Add debug messages to the lookup name process
authorVolker Lendecke <vl@samba.org>
Thu, 8 Sep 2011 08:44:53 +0000 (10:44 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 11 Oct 2011 13:21:08 +0000 (15:21 +0200)
source3/passdb/lookup_sid.c
source3/winbindd/winbindd_lookupname.c

index 5cf391f11c7376c87d9d32413039f64bf63c82ab..a8c30835d172038156eb66f6fd7757fdef36b71a 100644 (file)
@@ -55,6 +55,8 @@ bool lookup_name(TALLOC_CTX *mem_ctx,
                return false;
        }
 
+       DEBUG(10, ("lookup_name called with [%s]\n", full_name));
+
        p = strchr_m(full_name, '\\');
 
        if (p != NULL) {
@@ -79,6 +81,7 @@ bool lookup_name(TALLOC_CTX *mem_ctx,
        if ((flags & LOOKUP_NAME_DOMAIN) &&
            strequal(domain, get_global_sam_name()))
        {
+               DEBUG(10, ("%s is our own domain\n", domain));
 
                /* It's our own domain, lookup the name in passdb */
                if (lookup_global_sam_name(name, flags, &rid, &type)) {
@@ -92,6 +95,8 @@ bool lookup_name(TALLOC_CTX *mem_ctx,
        if ((flags & LOOKUP_NAME_BUILTIN) &&
            strequal(domain, builtin_domain_name()))
        {
+               DEBUG(10, ("%s is the builtin domain\n", domain));
+
                if (strlen(name) == 0) {
                        /* Swap domain and name */
                        tmp = name; name = domain; domain = tmp;
@@ -116,6 +121,7 @@ bool lookup_name(TALLOC_CTX *mem_ctx,
        if ((domain[0] != '\0') &&
            (flags & ~(LOOKUP_NAME_DOMAIN|LOOKUP_NAME_ISOLATED)) &&
            (winbind_lookup_name(domain, name, &sid, &type))) {
+               DEBUG(10, ("%s\\%s was looked up by winbind\n", domain, name));
                        goto ok;
        }
 
@@ -144,6 +150,8 @@ bool lookup_name(TALLOC_CTX *mem_ctx,
                return false;
        }
 
+       DEBUG(10, ("guesswork for domain [%s] begins\n", domain));
+
        /* Now the guesswork begins, we haven't been given an explicit
         * domain. Try the sequence as documented on
         * http://msdn.microsoft.com/library/en-us/secmgmt/security/lsalookupnames.asp
@@ -154,6 +162,7 @@ bool lookup_name(TALLOC_CTX *mem_ctx,
        if ((flags & LOOKUP_NAME_WKN) &&
            lookup_wellknown_name(tmp_ctx, name, &sid, &domain))
        {
+               DEBUG(10, ("%s is a well known name\n", full_name));
                type = SID_NAME_WKN_GRP;
                goto ok;
        }
@@ -163,6 +172,7 @@ bool lookup_name(TALLOC_CTX *mem_ctx,
        if ((flags & (LOOKUP_NAME_BUILTIN|LOOKUP_NAME_REMOTE)) &&
            strequal(name, builtin_domain_name()))
        {
+               DEBUG(10, ("%s is a builtin name\n", full_name));
                /* Swap domain and name */
                tmp = name; name = domain; domain = tmp;
                sid_copy(&sid, &global_sid_Builtin);
@@ -180,6 +190,7 @@ bool lookup_name(TALLOC_CTX *mem_ctx,
                        TALLOC_FREE(tmp_ctx);
                        return false;
                }
+               DEBUG(10, ("%s is a global sam name\n", full_name));
                /* Swap domain and name */
                tmp = name; name = domain; domain = tmp;
                type = SID_NAME_DOMAIN;
@@ -196,6 +207,7 @@ bool lookup_name(TALLOC_CTX *mem_ctx,
                        TALLOC_FREE(tmp_ctx);
                        return false;
                }
+               DEBUG(10, ("%s is our primary domain name\n", full_name));
                /* Swap domain and name */
                tmp = name; name = domain; domain = tmp;
                type = SID_NAME_DOMAIN;
@@ -208,6 +220,7 @@ bool lookup_name(TALLOC_CTX *mem_ctx,
        if ((flags & LOOKUP_NAME_REMOTE) && IS_DC &&
            (pdb_get_trusteddom_pw(name, NULL, &sid, NULL)))
        {
+               DEBUG(10, ("%s is a trusted domain name\n", full_name));
                /* Swap domain and name */
                tmp = name; name = domain; domain = tmp;
                type = SID_NAME_DOMAIN;
@@ -219,6 +232,7 @@ bool lookup_name(TALLOC_CTX *mem_ctx,
        if ((flags & LOOKUP_NAME_BUILTIN) &&
            lookup_builtin_name(name, &rid))
        {
+               DEBUG(10, ("%s is a builtin alias\n", full_name));
                domain = talloc_strdup(tmp_ctx, builtin_domain_name());
                sid_compose(&sid, &global_sid_Builtin, rid);
                type = SID_NAME_ALIAS;
@@ -233,6 +247,7 @@ bool lookup_name(TALLOC_CTX *mem_ctx,
        if ((flags & LOOKUP_NAME_DOMAIN) &&
            lookup_global_sam_name(name, flags, &rid, &type))
        {
+               DEBUG(10, ("%s is a global sam name\n", full_name));
                domain = talloc_strdup(tmp_ctx, get_global_sam_name());
                sid_compose(&sid, get_global_sam_sid(), rid);
                goto ok;
@@ -250,6 +265,8 @@ bool lookup_name(TALLOC_CTX *mem_ctx,
 
        if (!IS_DC &&
            (winbind_lookup_name(lp_workgroup(), name, &sid, &type))) {
+               DEBUG(10, ("%s was converted by winbind with our workgroup "
+                          "name\n", full_name));
                domain = talloc_strdup(tmp_ctx, lp_workgroup());
                goto ok;
        }
index 1be29fd85c8da0d9422f43314c1ed662ed7443e5..4298e5956861c7037d58bb6ec679d82a5dc92d53 100644 (file)
@@ -49,6 +49,10 @@ struct tevent_req *winbindd_lookupname_send(TALLOC_CTX *mem_ctx,
                sizeof(request->data.name.dom_name)-1]='\0';
        request->data.name.name[sizeof(request->data.name.name)-1]='\0';
 
+       DEBUG(10, ("lookupname dom_name=[%s], name=[%s]\n",
+                  request->data.name.dom_name,
+                  request->data.name.name));
+
        /* cope with the name being a fully qualified name */
        p = strstr(request->data.name.name, lp_winbind_separator());
        if (p) {