From: Volker Lendecke Date: Thu, 6 Dec 2018 17:25:02 +0000 (+0100) Subject: winbindd_cache: Use dom_sid_str_buf X-Git-Url: http://git.samba.org/samba.git/?p=amitay%2Fsamba.git;a=commitdiff_plain;h=263edf7fe96ab7b072bd3733074e44e6ab60a80b;hp=a32564eaf9241d2572ce1a7023b8ceec5846f97d winbindd_cache: Use dom_sid_str_buf Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index 370475a90aa..0ca683e8d9d 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -1241,7 +1241,8 @@ NTSTATUS wcache_cached_creds_exist(struct winbindd_domain *domain, const struct { struct winbind_cache *cache = get_cache(domain); int ret; - fstring key_str, tmp; + struct dom_sid_buf tmp; + fstring key_str; uint32_t rid; if (!cache->tdb) { @@ -1256,7 +1257,7 @@ NTSTATUS wcache_cached_creds_exist(struct winbindd_domain *domain, const struct return NT_STATUS_INVALID_SID; } - fstr_sprintf(key_str, "CRED/%s", sid_to_fstring(tmp, sid)); + fstr_sprintf(key_str, "CRED/%s", dom_sid_str_buf(sid, &tmp)); ret = tdb_exists(cache->tdb, string_tdb_data(key_str)); if (ret != 1) { @@ -1279,7 +1280,7 @@ NTSTATUS wcache_get_creds(struct winbindd_domain *domain, struct cache_entry *centry = NULL; NTSTATUS status; uint32_t rid; - fstring tmp; + struct dom_sid_buf tmp; if (!cache->tdb) { return NT_STATUS_INTERNAL_DB_ERROR; @@ -1297,7 +1298,7 @@ NTSTATUS wcache_get_creds(struct winbindd_domain *domain, fall back to an unsalted cred. */ centry = wcache_fetch(cache, domain, "CRED/%s", - sid_to_fstring(tmp, sid)); + dom_sid_str_buf(sid, &tmp)); if (!centry) { DEBUG(10,("wcache_get_creds: entry for [CRED/%s] not found\n", sid_string_dbg(sid))); @@ -1318,15 +1319,15 @@ NTSTATUS wcache_get_creds(struct winbindd_domain *domain, *cached_nt_pass = (const uint8_t *)centry_hash16(centry, mem_ctx); if (*cached_nt_pass == NULL) { - fstring sidstr; + struct dom_sid_buf sidstr; - sid_to_fstring(sidstr, sid); + dom_sid_str_buf(sid, &sidstr); /* Bad (old) cred cache. Delete and pretend we don't have it. */ DEBUG(0,("wcache_get_creds: bad entry for [CRED/%s] - deleting\n", - sidstr)); - wcache_delete("CRED/%s", sidstr); + sidstr.buf)); + wcache_delete("CRED/%s", sidstr.buf); centry_free(centry); return NT_STATUS_OBJECT_NAME_NOT_FOUND; } @@ -1359,7 +1360,7 @@ NTSTATUS wcache_save_creds(struct winbindd_domain *domain, const uint8_t nt_pass[NT_HASH_LEN]) { struct cache_entry *centry; - fstring sid_string; + struct dom_sid_buf sid_str; uint32_t rid; uint8_t cred_salt[NT_HASH_LEN]; uint8_t salted_hash[NT_HASH_LEN]; @@ -1387,9 +1388,9 @@ NTSTATUS wcache_save_creds(struct winbindd_domain *domain, centry_put_hash16(centry, salted_hash); centry_put_hash16(centry, cred_salt); - centry_end(centry, "CRED/%s", sid_to_fstring(sid_string, sid)); + centry_end(centry, "CRED/%s", dom_sid_str_buf(sid, &sid_str)); - DEBUG(10,("wcache_save_creds: %s\n", sid_string)); + DEBUG(10,("wcache_save_creds: %s\n", sid_str.buf)); centry_free(centry); @@ -2450,9 +2451,11 @@ static char *wcache_make_sidlist(TALLOC_CTX *mem_ctx, uint32_t num_sids, return NULL; } for (i=0; itdb, string_tdb_data(key_str)); @@ -4384,7 +4388,7 @@ static int pack_tdc_domains( struct winbindd_tdc_domain *domains, /* now pack each domain trust record */ for ( i=0; i 0 ) { DEBUG(10,("pack_tdc_domains: Packing domain %s (%s)\n", @@ -4395,7 +4399,7 @@ static int pack_tdc_domains( struct winbindd_tdc_domain *domains, len += tdb_pack( buffer+len, buflen-len, "fffddd", domains[i].domain_name, domains[i].dns_name ? domains[i].dns_name : "", - sid_to_fstring(tmp, &domains[i].sid), + dom_sid_str_buf(&domains[i].sid, &tmp), domains[i].trust_flags, domains[i].trust_attribs, domains[i].trust_type );