winbindd: Use dom_sid_str_buf
authorVolker Lendecke <vl@samba.org>
Fri, 14 Dec 2018 20:09:51 +0000 (21:09 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 20 Dec 2018 22:40:25 +0000 (23:40 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
25 files changed:
source3/winbindd/idmap_ad.c
source3/winbindd/idmap_autorid.c
source3/winbindd/idmap_hash/idmap_hash.c
source3/winbindd/idmap_ldap.c
source3/winbindd/idmap_rid.c
source3/winbindd/idmap_rw.c
source3/winbindd/wb_lookupsid.c
source3/winbindd/wb_xids2sids.c
source3/winbindd/winbindd_ads.c
source3/winbindd/winbindd_cache.c
source3/winbindd/winbindd_dual_srv.c
source3/winbindd/winbindd_getgrgid.c
source3/winbindd/winbindd_getgrnam.c
source3/winbindd/winbindd_getgroups.c
source3/winbindd/winbindd_getpwnam.c
source3/winbindd/winbindd_getpwsid.c
source3/winbindd/winbindd_getpwuid.c
source3/winbindd/winbindd_getusersids.c
source3/winbindd/winbindd_irpc.c
source3/winbindd/winbindd_lookuprids.c
source3/winbindd/winbindd_lookupsid.c
source3/winbindd/winbindd_msrpc.c
source3/winbindd/winbindd_pam.c
source3/winbindd/winbindd_samr.c
source3/winbindd/winbindd_util.c

index 9e6510f43d34a9159f2f6f25deab6396be718570..a93c61f54d1a16d434494f29b2d219f0d9ebe627 100644 (file)
@@ -847,6 +847,7 @@ static NTSTATUS idmap_ad_sids_to_unixids(struct idmap_domain *dom,
                bool ok;
                uint64_t account_type, xid;
                enum id_type type;
+               struct dom_sid_buf buf;
 
                if (tldap_msg_type(msg) != TLDAP_RES_SEARCH_ENTRY) {
                        continue;
@@ -872,7 +873,6 @@ static NTSTATUS idmap_ad_sids_to_unixids(struct idmap_domain *dom,
                        }
                }
                if (map == NULL) {
-                       struct dom_sid_buf buf;
                        DBG_DEBUG("Got unexpected sid %s from object %s\n",
                                  dom_sid_str_buf(&sid, &buf),
                                  dn);
@@ -915,7 +915,8 @@ static NTSTATUS idmap_ad_sids_to_unixids(struct idmap_domain *dom,
                map->xid.id = xid;
                map->status = ID_MAPPED;
 
-               DEBUG(10, ("Mapped %s -> %lu (%d)\n", sid_string_dbg(map->sid),
+               DEBUG(10, ("Mapped %s -> %lu (%d)\n",
+                          dom_sid_str_buf(map->sid, &buf),
                           (unsigned long)map->xid.id, map->xid.type));
        }
 
index cb7dcba1a5f224d7e83ddea72c9a4c81691e1c48..6e38a57805b850eccd35fad8e480e9c614143903 100644 (file)
@@ -453,6 +453,7 @@ static NTSTATUS idmap_autorid_sid_to_id_alloc_action(
        ctx = (struct idmap_autorid_sid_to_id_alloc_ctx *)private_data;
 
        if (idmap_autorid_sid_is_special(ctx->map->sid)) {
+               struct dom_sid_buf buf;
                NTSTATUS ret;
 
                ret = idmap_autorid_sid_to_id_special(ctx->dom, ctx->map);
@@ -465,7 +466,7 @@ static NTSTATUS idmap_autorid_sid_to_id_alloc_action(
 
                DEBUG(10, ("Sepecial sid %s not mapped. falling back to "
                           "regular allocation\n",
-                          sid_string_dbg(ctx->map->sid)));
+                          dom_sid_str_buf(ctx->map->sid, &buf)));
        }
 
        return idmap_tdb_common_new_mapping(ctx->dom, ctx->map);
@@ -481,6 +482,7 @@ static NTSTATUS idmap_autorid_sid_to_id_alloc(
 {
        NTSTATUS ret;
        struct idmap_autorid_sid_to_id_alloc_ctx alloc_ctx;
+       struct dom_sid_buf buf;
 
        map->status = ID_UNKNOWN;
 
@@ -495,19 +497,21 @@ static NTSTATUS idmap_autorid_sid_to_id_alloc(
        /* bad things happened */
        if (!NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED)) {
                DEBUG(1, ("Looking up SID->ID mapping for %s failed: %s\n",
-                         sid_string_dbg(map->sid), nt_errstr(ret)));
+                         dom_sid_str_buf(map->sid, &buf),
+                         nt_errstr(ret)));
                return ret;
        }
 
        if (dom->read_only) {
                DEBUG(3, ("Not allocating new mapping for %s, because backend "
-                         "is read-only\n", sid_string_dbg(map->sid)));
+                         "is read-only\n",
+                         dom_sid_str_buf(map->sid, &buf)));
                map->status = ID_UNMAPPED;
                return NT_STATUS_NONE_MAPPED;
        }
 
        DEBUG(10, ("Creating new mapping in pool for %s\n",
-                  sid_string_dbg(map->sid)));
+                  dom_sid_str_buf(map->sid, &buf)));
 
        alloc_ctx.dom = dom;
        alloc_ctx.map = map;
@@ -546,25 +550,26 @@ static NTSTATUS idmap_autorid_sid_to_id(struct idmap_tdb_common_context *common,
        struct autorid_range_config range;
        uint32_t rid;
        struct dom_sid domainsid;
+       struct dom_sid_buf buf;
        NTSTATUS ret;
 
        ZERO_STRUCT(range);
        map->status = ID_UNKNOWN;
 
-       DEBUG(10, ("Trying to map %s\n", sid_string_dbg(map->sid)));
+       DEBUG(10, ("Trying to map %s\n", dom_sid_str_buf(map->sid, &buf)));
 
        sid_copy(&domainsid, map->sid);
        if (!sid_split_rid(&domainsid, &rid)) {
                DEBUG(4, ("Could not determine domain SID from %s, "
                          "ignoring mapping request\n",
-                         sid_string_dbg(map->sid)));
+                         dom_sid_str_buf(map->sid, &buf)));
                map->status = ID_UNMAPPED;
                return NT_STATUS_NONE_MAPPED;
        }
 
        if (idmap_autorid_domsid_is_for_alloc(&domainsid)) {
                DEBUG(10, ("SID %s is for ALLOC range.\n",
-                          sid_string_dbg(map->sid)));
+                          dom_sid_str_buf(map->sid, &buf)));
 
                return idmap_autorid_sid_to_id_alloc(common, dom, map);
        }
@@ -709,9 +714,10 @@ static NTSTATUS idmap_autorid_sids_to_unixids(struct idmap_domain *dom,
                ret = idmap_autorid_sid_to_id(commoncfg, dom, ids[i]);
                if ((!NT_STATUS_IS_OK(ret)) &&
                    (!NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED))) {
+                       struct dom_sid_buf buf;
                        /* some fatal error occurred, log it */
                        DEBUG(3, ("Unexpected error resolving a SID (%s)\n",
-                                 sid_string_dbg(ids[i]->sid)));
+                                 dom_sid_str_buf(ids[i]->sid, &buf)));
                        return ret;
                }
 
index 0f4b0b8b0642fa502a2fe39b1a1dc1dfaa0b35c7..1747b7c56c11082136af7a0446a50042c8fbd5f8 100644 (file)
@@ -144,6 +144,7 @@ static NTSTATUS idmap_hash_initialize(struct idmap_domain *dom)
        /* create the hash table of domain SIDs */
 
        for (i=0; i<num_domains; i++) {
+               struct dom_sid_buf buf;
                uint32_t hash;
 
                if (is_null_sid(&dom_list[i].sid))
@@ -166,7 +167,7 @@ static NTSTATUS idmap_hash_initialize(struct idmap_domain *dom)
 
                DBG_INFO("Adding %s (%s) -> %d\n",
                         dom_list[i].domain_name,
-                        sid_string_dbg(&dom_list[i].sid),
+                        dom_sid_str_buf(&dom_list[i].sid, &buf),
                         hash);
 
                hashed_domains[hash].sid = talloc(hashed_domains, struct dom_sid);
index b86652343253a845de16e7c06b5758c4a410209a..17cc7404f1238467a486907c412f7012fa5b5d8d 100644 (file)
@@ -724,6 +724,7 @@ again:
                enum id_type type;
                struct id_map *map;
                uint32_t id;
+               struct dom_sid_buf buf;
 
                if (i == 0) { /* first entry */
                        entry = ldap_first_entry(
@@ -797,7 +798,10 @@ again:
                        DEBUG(1, ("WARNING: duplicate %s mapping in LDAP. "
                              "overwriting mapping %u -> %s with %u -> %s\n",
                              (type == ID_TYPE_UID) ? "UID" : "GID",
-                             id, sid_string_dbg(map->sid), id, sidstr));
+                             id,
+                             dom_sid_str_buf(map->sid, &buf),
+                             id,
+                             sidstr));
                }
 
                TALLOC_FREE(sidstr);
@@ -805,7 +809,8 @@ again:
                /* mapped */
                map->status = ID_MAPPED;
 
-               DEBUG(10, ("Mapped %s -> %lu (%d)\n", sid_string_dbg(map->sid),
+               DEBUG(10, ("Mapped %s -> %lu (%d)\n",
+                          dom_sid_str_buf(map->sid, &buf),
                           (unsigned long)map->xid.id, map->xid.type));
        }
 
@@ -940,6 +945,7 @@ again:
                enum id_type type;
                struct id_map *map;
                struct dom_sid sid;
+               struct dom_sid_buf buf;
                uint32_t id;
 
                if (i == 0) { /* first entry */
@@ -1024,8 +1030,10 @@ again:
                map->xid.id = id;
                map->status = ID_MAPPED;
 
-               DEBUG(10, ("Mapped %s -> %lu (%d)\n", sid_string_dbg(map->sid),
-                          (unsigned long)map->xid.id, map->xid.type));
+               DEBUG(10, ("Mapped %s -> %lu (%d)\n",
+                          dom_sid_str_buf(map->sid, &buf),
+                          (unsigned long)map->xid.id,
+                          map->xid.type));
        }
 
        /* free the ldap results */
index b066ba3c50f102fa73a512cf403e091ad727462a..e5bb1fa856ce3f90ffaba08e920c22c9d4ef2e92 100644 (file)
@@ -158,9 +158,10 @@ static NTSTATUS idmap_rid_sids_to_unixids(struct idmap_domain *dom, struct id_ma
 
                if (( ! NT_STATUS_IS_OK(ret)) &&
                    ( ! NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED))) {
+                       struct dom_sid_buf buf;
                        /* some fatal error occurred, log it */
                        DEBUG(3, ("Unexpected error resolving a SID (%s)\n",
-                                 sid_string_dbg(ids[i]->sid)));
+                                 dom_sid_str_buf(ids[i]->sid, &buf)));
                }
        }
 
index f0f06f9f66726e36408670c0b74eafb372e48dbf..700a946fc62f5f8f37b4730e6acd139869bf08de 100644 (file)
@@ -23,6 +23,7 @@
 #include "winbindd.h"
 #include "idmap.h"
 #include "idmap_rw.h"
+#include "libcli/security/dom_sid.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_IDMAP
@@ -31,6 +32,7 @@ NTSTATUS idmap_rw_new_mapping(struct idmap_domain *dom,
                              struct idmap_rw_ops *ops,
                              struct id_map *map)
 {
+       struct dom_sid_buf buf;
        NTSTATUS status;
 
        if (map == NULL) {
@@ -53,7 +55,7 @@ NTSTATUS idmap_rw_new_mapping(struct idmap_domain *dom,
        }
 
        DEBUG(10, ("Setting mapping: %s <-> %s %lu\n",
-                  sid_string_dbg(map->sid),
+                  dom_sid_str_buf(map->sid, &buf),
                   (map->xid.type == ID_TYPE_UID) ? "UID" : "GID",
                   (unsigned long)map->xid.id));
 
@@ -63,7 +65,7 @@ NTSTATUS idmap_rw_new_mapping(struct idmap_domain *dom,
        if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
                struct id_map *ids[2];
                DEBUG(5, ("Mapping for %s exists - retrying to map sid\n",
-                         sid_string_dbg(map->sid)));
+                         dom_sid_str_buf(map->sid, &buf)));
                ids[0] = map;
                ids[1] = NULL;
                status = dom->methods->sids_to_unixids(dom, ids);
index 8873ebb42ce27032767f5a117d98e25e5cb01f4e..3db4e3266594cba2ca0bbe7136f87bcf5e04b835 100644 (file)
@@ -49,8 +49,9 @@ struct tevent_req *wb_lookupsid_send(TALLOC_CTX *mem_ctx,
 
        state->lookup_domain = find_lookup_domain_from_sid(sid);
        if (state->lookup_domain == NULL) {
+               struct dom_sid_buf buf;
                DEBUG(5, ("Could not find domain for sid %s\n",
-                         sid_string_dbg(sid)));
+                         dom_sid_str_buf(sid, &buf)));
                tevent_req_nterror(req, NT_STATUS_NONE_MAPPED);
                return tevent_req_post(req, ev);
        }
index 0d21e55c25dbbfc033ab392cddfc77e7aa446807..fa4ba983720c70e95dcc28cdb2f69e046f57bdf3 100644 (file)
@@ -221,9 +221,12 @@ static void wb_xids2sids_init_dom_maps_lookupname_done(
        }
 
        if (type != SID_NAME_DOMAIN) {
+               struct dom_sid_buf buf;
+
                DBG_WARNING("SID %s for idmap domain name '%s' "
                            "not a domain SID\n",
-                           sid_string_dbg(&dom_maps[state->dom_idx].sid),
+                           dom_sid_str_buf(&dom_maps[state->dom_idx].sid,
+                                           &buf),
                            dom_maps[state->dom_idx].name);
 
                ZERO_STRUCT(dom_maps[state->dom_idx].sid);
index b350bf0c565a7b45c5d64d5ab66884c0bb4dc4d7..4076f8227cbf1c04a50f14534510eda8575b9188 100644 (file)
@@ -835,6 +835,7 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
        uint32_t primary_group_rid;
        NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
        uint32_t num_groups = 0;
+       struct dom_sid_buf buf;
 
        DEBUG(3,("ads: lookup_usergroups\n"));
        *p_num_groups = 0;
@@ -867,7 +868,9 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
        if (!ADS_ERR_OK(rc)) {
                status = ads_ntstatus(rc);
                DEBUG(1, ("lookup_usergroups(sid=%s) ads_search tokenGroups: "
-                         "%s\n", sid_string_dbg(sid), ads_errstr(rc)));
+                         "%s\n",
+                         dom_sid_str_buf(sid, &buf),
+                         ads_errstr(rc)));
                goto done;
        }
 
@@ -876,13 +879,14 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
                status = NT_STATUS_UNSUCCESSFUL;
                DEBUG(1,("lookup_usergroups(sid=%s) ads_search tokenGroups: "
                         "invalid number of results (count=%d)\n", 
-                        sid_string_dbg(sid), count));
+                        dom_sid_str_buf(sid, &buf),
+                        count));
                goto done;
        }
 
        if (!msg) {
                DEBUG(1,("lookup_usergroups(sid=%s) ads_search tokenGroups: NULL msg\n", 
-                        sid_string_dbg(sid)));
+                        dom_sid_str_buf(sid, &buf)));
                status = NT_STATUS_UNSUCCESSFUL;
                goto done;
        }
@@ -895,7 +899,8 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
 
        if (!ads_pull_uint32(ads, msg, "primaryGroupID", &primary_group_rid)) {
                DEBUG(1,("%s: No primary group for sid=%s !?\n", 
-                        domain->name, sid_string_dbg(sid)));
+                        domain->name,
+                        dom_sid_str_buf(sid, &buf)));
                goto done;
        }
 
@@ -961,7 +966,7 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
        status = (*user_sids != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;
 
        DEBUG(3,("ads lookup_usergroups (tokenGroups) succeeded for sid=%s\n",
-                sid_string_dbg(sid)));
+                dom_sid_str_buf(sid, &buf)));
 done:
        TALLOC_FREE(user_dn);
        ads_msgfree(ads, msg);
@@ -1085,9 +1090,10 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
        uint32_t num_nocache = 0;
        TALLOC_CTX *tmp_ctx = NULL;
        uint32_t rid;
+       struct dom_sid_buf buf;
 
        DEBUG(10,("ads: lookup_groupmem %s sid=%s\n", domain->name,
-                 sid_string_dbg(group_sid)));
+                 dom_sid_str_buf(group_sid, &buf)));
 
        *num_names = 0;
 
@@ -1213,7 +1219,8 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
                if (lookup_cached_sid(mem_ctx, &sid, &domain_name, &name,
                    &name_type)) {
                        DEBUG(10,("ads: lookup_groupmem: got sid %s from "
-                                 "cache\n", sid_string_dbg(&sid)));
+                                 "cache\n",
+                                 dom_sid_str_buf(&sid, &buf)));
                        sid_copy(&(*sid_mem)[*num_names], &sid);
                        (*names)[*num_names] = fill_domain_username_talloc(
                                                        *names,
@@ -1226,7 +1233,8 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
                }
                else {
                        DEBUG(10, ("ads: lookup_groupmem: sid %s not found in "
-                                  "cache\n", sid_string_dbg(&sid)));
+                                  "cache\n",
+                                  dom_sid_str_buf(&sid, &buf)));
                        sid_copy(&(sid_mem_nocache)[num_nocache], &sid);
                        num_nocache++;
                }
@@ -1302,7 +1310,7 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
 
        status = NT_STATUS_OK;
        DEBUG(3,("ads lookup_groupmem for sid=%s succeeded\n",
-                sid_string_dbg(group_sid)));
+                dom_sid_str_buf(group_sid, &buf)));
 
 done:
 
index 0ca683e8d9dea3897cc25d02f8efaf99b430c95c..c686089d5175b9ed0171b181eb91af3419dfe916 100644 (file)
@@ -1280,7 +1280,7 @@ NTSTATUS wcache_get_creds(struct winbindd_domain *domain,
        struct cache_entry *centry = NULL;
        NTSTATUS status;
        uint32_t rid;
-       struct dom_sid_buf tmp;
+       struct dom_sid_buf sidstr;
 
        if (!cache->tdb) {
                return NT_STATUS_INTERNAL_DB_ERROR;
@@ -1298,10 +1298,10 @@ NTSTATUS wcache_get_creds(struct winbindd_domain *domain,
           fall back to an unsalted cred. */
 
        centry = wcache_fetch(cache, domain, "CRED/%s",
-                             dom_sid_str_buf(sid, &tmp));
+                             dom_sid_str_buf(sid, &sidstr));
        if (!centry) {
                DEBUG(10,("wcache_get_creds: entry for [CRED/%s] not found\n", 
-                         sid_string_dbg(sid)));
+                         dom_sid_str_buf(sid, &sidstr)));
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
        }
 
@@ -1319,7 +1319,6 @@ NTSTATUS wcache_get_creds(struct winbindd_domain *domain,
 
        *cached_nt_pass = (const uint8_t *)centry_hash16(centry, mem_ctx);
        if (*cached_nt_pass == NULL) {
-               struct dom_sid_buf sidstr;
 
                dom_sid_str_buf(sid, &sidstr);
 
@@ -1347,7 +1346,8 @@ NTSTATUS wcache_get_creds(struct winbindd_domain *domain,
        status = centry->status;
 
        DEBUG(10,("wcache_get_creds: [Cached] - cached creds for user %s status: %s\n",
-                 sid_string_dbg(sid), nt_errstr(status) ));
+                 dom_sid_str_buf(sid, &sidstr),
+                 nt_errstr(status) ));
 
        centry_free(centry);
        return status;
index e912cba7a41ce84d51f31c121b07681597a711c4..62224bf313ee4fb0eadf3254d14cfdf6ea2f5b46 100644 (file)
@@ -167,8 +167,10 @@ NTSTATUS _wbint_Sids2UnixIDs(struct pipes_struct *p,
 
        dom = idmap_find_domain_with_sid(d->name.string, d->sid);
        if (dom == NULL) {
+               struct dom_sid_buf buf;
                DEBUG(10, ("idmap domain %s:%s not found\n",
-                          d->name.string, sid_string_dbg(d->sid)));
+                          d->name.string,
+                          dom_sid_str_buf(d->sid, &buf)));
 
                for (i=0; i<num_ids; i++) {
 
index 49a24dee7a47b4468169deaf8f04b1848ccc2662..aa99e6e25610afbf53a2e2132d3ba4a729105f84 100644 (file)
@@ -115,8 +115,10 @@ NTSTATUS winbindd_getgrgid_recv(struct tevent_req *req,
        char *buf;
 
        if (tevent_req_is_nterror(req, &status)) {
+               struct dom_sid_buf sidbuf;
                DEBUG(5, ("Could not convert sid %s: %s\n",
-                         sid_string_dbg(state->sid), nt_errstr(status)));
+                         dom_sid_str_buf(state->sid, &sidbuf),
+                         nt_errstr(status)));
                return status;
        }
 
index db53848055aeaba69a0e39d878591fdb2554af1d..d43fc3042b55a4d21ef274b593ed8fddb2b3f6b9 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "includes.h"
 #include "winbindd.h"
+#include "libcli/security/dom_sid.h"
 
 struct winbindd_getgrnam_state {
        struct tevent_context *ev;
@@ -168,8 +169,10 @@ NTSTATUS winbindd_getgrnam_recv(struct tevent_req *req,
        char *buf;
 
        if (tevent_req_is_nterror(req, &status)) {
+               struct dom_sid_buf sidbuf;
                DEBUG(5, ("Could not convert sid %s: %s\n",
-                         sid_string_dbg(&state->sid), nt_errstr(status)));
+                         dom_sid_str_buf(&state->sid, &sidbuf),
+                         nt_errstr(status)));
                return status;
        }
 
index 39a8c3556cff6a53e5eb5a25a1d348b8ed011fcb..63206c28134ec31edf86ddd3093f0b6b65174c83 100644 (file)
@@ -246,8 +246,10 @@ NTSTATUS winbindd_getgroups_recv(struct tevent_req *req,
        NTSTATUS status;
 
        if (tevent_req_is_nterror(req, &status)) {
+               struct dom_sid_buf buf;
                DEBUG(5, ("Could not convert sid %s: %s\n",
-                         sid_string_dbg(&state->sid), nt_errstr(status)));
+                         dom_sid_str_buf(&state->sid, &buf),
+                         nt_errstr(status)));
                return status;
        }
 
index 63274cab5a054fa037a64ecff9bf7a3f00a3f4d6..6f49ea9b356f6726cf3477d4d3c24fca83d8aa03 100644 (file)
@@ -20,6 +20,7 @@
 #include "includes.h"
 #include "winbindd.h"
 #include "passdb/lookup_sid.h" /* only for LOOKUP_NAME_NO_NSS flag */
+#include "libcli/security/dom_sid.h"
 
 struct winbindd_getpwnam_state {
        struct tevent_context *ev;
@@ -136,8 +137,10 @@ NTSTATUS winbindd_getpwnam_recv(struct tevent_req *req,
        NTSTATUS status;
 
        if (tevent_req_is_nterror(req, &status)) {
+               struct dom_sid_buf buf;
                DEBUG(5, ("Could not convert sid %s: %s\n",
-                         sid_string_dbg(&state->sid), nt_errstr(status)));
+                         dom_sid_str_buf(&state->sid, &buf),
+                         nt_errstr(status)));
                return status;
        }
        response->data.pw = state->pw;
index f12d52960044687a99ca6614d3b116954670b2ff..adf287fb478408cbbcc85b705cabb6e1bff50f2e 100644 (file)
@@ -87,8 +87,10 @@ NTSTATUS winbindd_getpwsid_recv(struct tevent_req *req,
        NTSTATUS status;
 
        if (tevent_req_is_nterror(req, &status)) {
+               struct dom_sid_buf buf;
                DEBUG(5, ("Could not convert sid %s: %s\n",
-                         sid_string_dbg(&state->sid), nt_errstr(status)));
+                         dom_sid_str_buf(&state->sid, &buf),
+                         nt_errstr(status)));
                return status;
        }
        response->data.pw = state->pw;
index 319f2f71ad96d18ba317695e9654ca3d65a85c72..937c214e936e3bf222907cfdd6e8d7e501699d5d 100644 (file)
@@ -110,8 +110,10 @@ NTSTATUS winbindd_getpwuid_recv(struct tevent_req *req,
        NTSTATUS status;
 
        if (tevent_req_is_nterror(req, &status)) {
+               struct dom_sid_buf buf;
                DEBUG(5, ("Could not convert sid %s: %s\n",
-                         sid_string_dbg(state->sid), nt_errstr(status)));
+                         dom_sid_str_buf(state->sid, &buf),
+                         nt_errstr(status)));
                return status;
        }
        response->data.pw = state->pw;
index 9a6a24107b9653a9a48acba9180a0ffd4d554c05..3924d4933e5a9130e34114ea1da0555ef2d90070 100644 (file)
@@ -88,13 +88,15 @@ NTSTATUS winbindd_getusersids_recv(struct tevent_req *req,
 {
        struct winbindd_getusersids_state *state = tevent_req_data(
                req, struct winbindd_getusersids_state);
+       struct dom_sid_buf sidbuf;
        NTSTATUS status;
        int i;
        char *result;
 
        if (tevent_req_is_nterror(req, &status)) {
                DEBUG(5, ("Could not convert sid %s: %s\n",
-                         sid_string_dbg(&state->sid), nt_errstr(status)));
+                         dom_sid_str_buf(&state->sid, &sidbuf),
+                         nt_errstr(status)));
                return status;
        }
 
@@ -104,7 +106,6 @@ NTSTATUS winbindd_getusersids_recv(struct tevent_req *req,
        }
 
        for (i=0; i<state->num_sids; i++) {
-               struct dom_sid_buf sidbuf;
                result = talloc_asprintf_append_buffer(
                        result,
                        "%s\n",
index 2ac4f9bc422cb530872e6a52b156c375d688ab44..8cbb0b9308619c82fd6ebb11ac2c27d068a96b46 100644 (file)
@@ -602,6 +602,7 @@ static void wb_irpc_lsa_LookupNames4_done(struct tevent_req *subreq)
        struct wb_irpc_lsa_LookupNames4_state *state =
                talloc_get_type_abort(nstate->state,
                struct wb_irpc_lsa_LookupNames4_state);
+       struct dom_sid_buf buf;
        NTSTATUS status;
 
        SMB_ASSERT(state->num_pending > 0);
@@ -619,7 +620,8 @@ static void wb_irpc_lsa_LookupNames4_done(struct tevent_req *subreq)
                                   &nstate->authority_sid, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_ERR("dom_sid_split_rid(%s) failed - %s\n",
-                        sid_string_dbg(&nstate->sid), nt_errstr(status));
+                       dom_sid_str_buf(&nstate->sid, &buf),
+                       nt_errstr(status));
                irpc_send_reply(state->msg, status);
                return;
        }
@@ -630,7 +632,8 @@ static void wb_irpc_lsa_LookupNames4_done(struct tevent_req *subreq)
                                         &state->num_domain_sids);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_ERR("add_sid_to_array_unique(%s) failed - %s\n",
-                        sid_string_dbg(nstate->authority_sid), nt_errstr(status));
+                       dom_sid_str_buf(nstate->authority_sid, &buf),
+                       nt_errstr(status));
                irpc_send_reply(state->msg, status);
                return;
        }
index ed5d951e7de973fc159086070cc53bf695471214..1e80b78a92eca91eabd5eb171f9724d3ec011af5 100644 (file)
@@ -64,8 +64,9 @@ struct tevent_req *winbindd_lookuprids_send(TALLOC_CTX *mem_ctx,
 
        domain = find_lookup_domain_from_sid(&state->domain_sid);
        if (domain == NULL) {
+               struct dom_sid_buf buf;
                DEBUG(5, ("Domain for sid %s not found\n",
-                         sid_string_dbg(&state->domain_sid)));
+                         dom_sid_str_buf(&state->domain_sid, &buf)));
                tevent_req_nterror(req, NT_STATUS_NO_SUCH_DOMAIN);
                return tevent_req_post(req, ev);
        }
index 6c76afb0b0ddf7ec07a0933d17958314cebdb49f..e1e35232c2ee6f3861df71ee861590ef0d49e4f1 100644 (file)
@@ -89,8 +89,10 @@ NTSTATUS winbindd_lookupsid_recv(struct tevent_req *req,
        NTSTATUS status;
 
        if (tevent_req_is_nterror(req, &status)) {
+               struct dom_sid_buf buf;
                DEBUG(5, ("Could not lookup sid %s: %s\n",
-                         sid_string_dbg(&state->sid), nt_errstr(status)));
+                         dom_sid_str_buf(&state->sid, &buf),
+                         nt_errstr(status)));
                return status;
        }
 
index eb400f0ebf3ec76f2ed251b0bff80e5fed35b0d6..203fbc6b56a9d018041ec4cfbb9525744925ca3d 100644 (file)
@@ -289,9 +289,11 @@ static NTSTATUS msrpc_sid_to_name(struct winbindd_domain *domain,
        NTSTATUS result;
        NTSTATUS name_map_status = NT_STATUS_UNSUCCESSFUL;
        char *mapped_name = NULL;
+       struct dom_sid_buf buf;
 
-       DEBUG(3, ("msrpc_sid_to_name: %s for domain %s\n", sid_string_dbg(sid),
-                domain->name ));
+       DEBUG(3, ("msrpc_sid_to_name: %s for domain %s\n",
+                 dom_sid_str_buf(sid, &buf),
+                 domain->name));
 
        result = winbindd_lookup_sids(mem_ctx,
                                      domain,
@@ -403,11 +405,13 @@ static NTSTATUS msrpc_lookup_usergroups(struct winbindd_domain *domain,
        struct rpc_pipe_client *samr_pipe;
        struct policy_handle dom_pol;
        struct dom_sid *user_grpsids = NULL;
+       struct dom_sid_buf buf;
        uint32_t num_groups = 0;
        TALLOC_CTX *tmp_ctx;
        NTSTATUS status;
 
-       DEBUG(3,("msrpc_lookup_usergroups sid=%s\n", sid_string_dbg(user_sid)));
+       DEBUG(3,("msrpc_lookup_usergroups sid=%s\n",
+                dom_sid_str_buf(user_sid, &buf)));
 
        *pnum_groups = 0;
 
@@ -549,9 +553,10 @@ static NTSTATUS msrpc_lookup_groupmem(struct winbindd_domain *domain,
        unsigned int orig_timeout;
        struct samr_RidAttrArray *rids = NULL;
        struct dcerpc_binding_handle *b;
+       struct dom_sid_buf buf;
 
        DEBUG(3,("msrpc_lookup_groupmem: %s sid=%s\n", domain->name,
-                 sid_string_dbg(group_sid)));
+                dom_sid_str_buf(group_sid, &buf)));
 
        if ( !winbindd_can_contact_domain( domain ) ) {
                DEBUG(10,("lookup_groupmem: No incoming trust for domain %s\n",
index a82046a0040c5a32ae3066a4dfcbce35e33350fc..b81f2722c420917a30310aa5a336bc9f2f41c1a2 100644 (file)
@@ -375,8 +375,10 @@ static NTSTATUS check_info3_in_group(struct netr_SamInfo3 *info3,
        security_token_debug(DBGC_CLASS, 10, token);
 
        for (i=0; i<num_require_membership_of_sid; i++) {
-               DEBUG(10, ("Checking SID %s\n", sid_string_dbg(
-                                  &require_membership_of_sid[i])));
+               struct dom_sid_buf buf;
+               DEBUG(10, ("Checking SID %s\n",
+                          dom_sid_str_buf(&require_membership_of_sid[i],
+                                          &buf)));
                if (nt_token_check_sid(&require_membership_of_sid[i],
                                       token)) {
                        DEBUG(10, ("Access ok\n"));
@@ -3046,6 +3048,7 @@ NTSTATUS winbindd_pam_auth_pac_verify(struct winbindd_cli_state *state,
                                info3_copy->base.logon_domain.string);
                if (domain && domain->primary ) {
                        struct dom_sid user_sid;
+                       struct dom_sid_buf buf;
 
                        sid_compose(&user_sid,
                                info3_copy->base.domain_sid,
@@ -3060,7 +3063,7 @@ NTSTATUS winbindd_pam_auth_pac_verify(struct winbindd_cli_state *state,
                        DBG_INFO("PAC for user %s\\%s SID %s primed cache\n",
                                info3_copy->base.logon_domain.string,
                                info3_copy->base.account_name.string,
-                               sid_string_dbg(&user_sid));
+                               dom_sid_str_buf(&user_sid, &buf));
                }
        }
 
index 31720d54997082b4847d5fd6bdf1923ff3c8cf39..3727e8fa39f79c7ded62baa0270ce55570a309d5 100644 (file)
@@ -668,8 +668,10 @@ static NTSTATUS sam_sid_to_name(struct winbindd_domain *domain,
            !sid_check_is_in_unix_groups(sid) &&
            !sid_check_is_unix_groups(sid) &&
            !sid_check_is_in_wellknown_domain(sid)) {
+               struct dom_sid_buf buf;
                DEBUG(0, ("sam_sid_to_name: possible deadlock - trying to "
-                         "lookup SID %s\n", sid_string_dbg(sid)));
+                         "lookup SID %s\n",
+                         dom_sid_str_buf(sid, &buf)));
                return NT_STATUS_NONE_MAPPED;
        }
 
@@ -746,8 +748,10 @@ static NTSTATUS sam_rids_to_names(struct winbindd_domain *domain,
            !sid_check_is_unix_users(domain_sid) &&
            !sid_check_is_unix_groups(domain_sid) &&
            !sid_check_is_in_wellknown_domain(domain_sid)) {
+               struct dom_sid_buf buf;
                DEBUG(0, ("sam_rids_to_names: possible deadlock - trying to "
-                         "lookup SID %s\n", sid_string_dbg(domain_sid)));
+                         "lookup SID %s\n",
+                         dom_sid_str_buf(domain_sid, &buf)));
                return NT_STATUS_NONE_MAPPED;
        }
 
index 75d2f31b55f208d53b9a743ff3df1c885315b344..d266eb3048efcc85ca34205c76b8824eb1db0713 100644 (file)
@@ -126,6 +126,7 @@ static NTSTATUS add_trusted_domain(const char *domain_name,
        const char **ignored_domains = NULL;
        const char **dom = NULL;
        int role = lp_server_role();
+       struct dom_sid_buf buf;
 
        if (is_null_sid(sid)) {
                DBG_ERR("Got null SID for domain [%s]\n", domain_name);
@@ -169,7 +170,8 @@ static NTSTATUS add_trusted_domain(const char *domain_name,
                if (check_domain != NULL) {
                        DBG_ERR("SID [%s] already used by domain [%s], "
                                "expected [%s]\n",
-                               sid_string_dbg(sid), check_domain->name,
+                               dom_sid_str_buf(sid, &buf),
+                               check_domain->name,
                                domain->name);
                        return NT_STATUS_INVALID_PARAMETER;
                }
@@ -292,7 +294,7 @@ static NTSTATUS add_trusted_domain(const char *domain_name,
 
        DBG_NOTICE("Added domain [%s] [%s] [%s]\n",
                   domain->name, domain->alt_name,
-                  sid_string_dbg(&domain->sid));
+                  dom_sid_str_buf(&domain->sid, &buf));
 
        *_d = domain;
        return NT_STATUS_OK;
@@ -1455,7 +1457,9 @@ struct winbindd_domain *find_default_route_domain(void)
 
 struct winbindd_domain *find_lookup_domain_from_sid(const struct dom_sid *sid)
 {
-       DBG_DEBUG("SID [%s]\n", sid_string_dbg(sid));
+       struct dom_sid_buf buf;
+
+       DBG_DEBUG("SID [%s]\n", dom_sid_str_buf(sid, &buf));
 
        /*
         * SIDs in the S-1-22-{1,2} domain and well-known SIDs should be handled