From 2e07c2ade89f4ff281c61f74cb88e09990cf5f46 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 15 Dec 2007 22:47:30 +0100 Subject: s/sid_to_string/sid_to_fstring/ least surprise for callers (This used to be commit eb523ba77697346a365589101aac379febecd546) --- source3/winbindd/idmap_cache.c | 2 +- source3/winbindd/idmap_tdb.c | 10 ++++----- source3/winbindd/winbindd_async.c | 12 +++++------ source3/winbindd/winbindd_cache.c | 45 ++++++++++++++++++++++----------------- source3/winbindd/winbindd_group.c | 4 ++-- source3/winbindd/winbindd_idmap.c | 10 ++++----- source3/winbindd/winbindd_misc.c | 4 ++-- source3/winbindd/winbindd_pam.c | 4 ++-- source3/winbindd/winbindd_sid.c | 2 +- source3/winbindd/winbindd_util.c | 2 +- 10 files changed, 50 insertions(+), 45 deletions(-) (limited to 'source3/winbindd') diff --git a/source3/winbindd/idmap_cache.c b/source3/winbindd/idmap_cache.c index 4e286f88c0..cf46196ebe 100644 --- a/source3/winbindd/idmap_cache.c +++ b/source3/winbindd/idmap_cache.c @@ -80,7 +80,7 @@ NTSTATUS idmap_cache_build_sidkey(TALLOC_CTX *ctx, char **sidkey, const struct i fstring sidstr; *sidkey = talloc_asprintf(ctx, "IDMAP/SID/%s", - sid_to_string(sidstr, id->sid)); + sid_to_fstring(sidstr, id->sid)); if ( ! *sidkey) { DEBUG(1, ("failed to build sidkey, OOM?\n")); return NT_STATUS_NO_MEMORY; diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c index d693c357f7..e5f605361b 100644 --- a/source3/winbindd/idmap_tdb.c +++ b/source3/winbindd/idmap_tdb.c @@ -86,7 +86,7 @@ static int convert_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA data, void *state sid_copy(&sid, &domain->sid); sid_append_rid(&sid, rid); - sid_to_string(keystr, &sid); + sid_to_fstring(keystr, &sid); key2 = string_term_tdb_data(keystr); if (tdb_store(tdb, key2, data, TDB_INSERT) != 0) { @@ -714,8 +714,8 @@ static NTSTATUS idmap_tdb_sid_to_id(struct idmap_tdb_context *ctx, struct id_map unsigned long rec_id = 0; fstring tmp; - if ((keystr = talloc_asprintf(ctx, "%s", - sid_to_string(tmp, map->sid))) == NULL) { + if ((keystr = talloc_asprintf( + ctx, "%s", sid_to_fstring(tmp, map->sid))) == NULL) { DEBUG(0, ("Out of memory!\n")); ret = NT_STATUS_NO_MEMORY; goto done; @@ -909,7 +909,7 @@ static NTSTATUS idmap_tdb_set_mapping(struct idmap_domain *dom, const struct id_ } if ((ksidstr = talloc_asprintf( - ctx, "%s", sid_to_string(tmp, map->sid))) == NULL) { + ctx, "%s", sid_to_fstring(tmp, map->sid))) == NULL) { DEBUG(0, ("Out of memory!\n")); ret = NT_STATUS_NO_MEMORY; goto done; @@ -1024,7 +1024,7 @@ static NTSTATUS idmap_tdb_remove_mapping(struct idmap_domain *dom, const struct } if ((ksidstr = talloc_asprintf( - ctx, "%s", sid_to_string(tmp, map->sid))) == NULL) { + ctx, "%s", sid_to_fstring(tmp, map->sid))) == NULL) { DEBUG(0, ("Out of memory!\n")); ret = NT_STATUS_NO_MEMORY; goto done; diff --git a/source3/winbindd/winbindd_async.c b/source3/winbindd/winbindd_async.c index 0971476f44..76724582a1 100644 --- a/source3/winbindd/winbindd_async.c +++ b/source3/winbindd/winbindd_async.c @@ -175,7 +175,7 @@ static void lookupsid_recv(TALLOC_CTX *mem_ctx, bool success, ZERO_STRUCT(request); request.cmd = WINBINDD_LOOKUPSID; - sid_to_string(request.data.sid, &s->sid); + sid_to_fstring(request.data.sid, &s->sid); do_async_domain(mem_ctx, root_domain, &request, lookupsid_recv2, (void *)cont, s); @@ -209,7 +209,7 @@ void winbindd_lookupsid_async(TALLOC_CTX *mem_ctx, const DOM_SID *sid, ZERO_STRUCT(request); request.cmd = WINBINDD_LOOKUPSID; - sid_to_string(request.data.sid, sid); + sid_to_fstring(request.data.sid, sid); if ( (s = TALLOC_ZERO_P(mem_ctx, struct lookupsid_state)) == NULL ) { DEBUG(0, ("winbindd_lookupsid_async: talloc failed\n")); @@ -443,7 +443,7 @@ enum winbindd_result winbindd_dual_lookupname(struct winbindd_domain *domain, return WINBINDD_ERROR; } - sid_to_string(state->response.data.sid.sid, &sid); + sid_to_fstring(state->response.data.sid.sid, &sid); state->response.data.sid.type = type; return WINBINDD_OK; @@ -460,7 +460,7 @@ bool print_sidlist(TALLOC_CTX *mem_ctx, const DOM_SID *sids, for (i=0; i %s (%s)\n", sid_string, name, nt_errstr(status))); centry_free(centry); @@ -902,7 +902,8 @@ static void wcache_save_user(struct winbindd_domain *domain, NTSTATUS status, WI centry_put_uint32(centry, info->primary_gid); centry_put_sid(centry, &info->user_sid); centry_put_sid(centry, &info->group_sid); - centry_end(centry, "U/%s", sid_to_string(sid_string, &info->user_sid)); + centry_end(centry, "U/%s", sid_to_fstring(sid_string, + &info->user_sid)); DEBUG(10,("wcache_save_user: %s (acct_name %s)\n", sid_string, info->acct_name)); centry_free(centry); } @@ -966,7 +967,7 @@ NTSTATUS wcache_cached_creds_exist(struct winbindd_domain *domain, const DOM_SID return NT_STATUS_INVALID_SID; } - fstr_sprintf(key_str, "CRED/%s", sid_to_string(tmp, sid)); + fstr_sprintf(key_str, "CRED/%s", sid_to_fstring(tmp, sid)); data = tdb_fetch(cache->tdb, string_tdb_data(key_str)); if (!data.dptr) { @@ -1009,7 +1010,7 @@ NTSTATUS wcache_get_creds(struct winbindd_domain *domain, fall back to an unsalted cred. */ centry = wcache_fetch(cache, domain, "CRED/%s", - sid_to_string(tmp, sid)); + sid_to_fstring(tmp, sid)); if (!centry) { DEBUG(10,("wcache_get_creds: entry for [CRED/%s] not found\n", sid_string_dbg(sid))); @@ -1027,7 +1028,7 @@ NTSTATUS wcache_get_creds(struct winbindd_domain *domain, if (*cached_nt_pass == NULL) { fstring sidstr; - sid_to_string(sidstr, sid); + sid_to_fstring(sidstr, sid); /* Bad (old) cred cache. Delete and pretend we don't have it. */ @@ -1095,7 +1096,7 @@ 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_string(sid_string, sid)); + centry_end(centry, "CRED/%s", sid_to_fstring(sid_string, sid)); DEBUG(10,("wcache_save_creds: %s\n", sid_string)); @@ -1470,7 +1471,8 @@ static NTSTATUS sid_to_name(struct winbindd_domain *domain, if (!cache->tdb) goto do_query; - centry = wcache_fetch(cache, domain, "SN/%s", sid_to_string(sid_string, sid)); + centry = wcache_fetch(cache, domain, "SN/%s", + sid_to_fstring(sid_string, sid)); if (!centry) goto do_query; @@ -1565,7 +1567,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain, } centry = wcache_fetch(cache, domain, "SN/%s", - sid_to_string(tmp, &sid)); + sid_to_fstring(tmp, &sid)); if (!centry) { goto do_query; } @@ -1687,7 +1689,7 @@ static NTSTATUS query_user(struct winbindd_domain *domain, goto do_query; centry = wcache_fetch(cache, domain, "U/%s", - sid_to_string(tmp, user_sid)); + sid_to_fstring(tmp, user_sid)); /* If we have an access denied cache entry and a cached info3 in the samlogon cache then do a query. This will force the rpc back end @@ -1759,7 +1761,8 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain, if (!cache->tdb) goto do_query; - centry = wcache_fetch(cache, domain, "UG/%s", sid_to_string(sid_string, user_sid)); + centry = wcache_fetch(cache, domain, "UG/%s", + sid_to_fstring(sid_string, user_sid)); /* If we have an access denied cache entry and a cached info3 in the samlogon cache then do a query. This will force the rpc back end @@ -1826,7 +1829,7 @@ do_query: centry_put_sid(centry, &(*user_gids)[i]); } - centry_end(centry, "UG/%s", sid_to_string(sid_string, user_sid)); + centry_end(centry, "UG/%s", sid_to_fstring(sid_string, user_sid)); centry_free(centry); skip_save: @@ -1859,7 +1862,7 @@ static NTSTATUS lookup_useraliases(struct winbindd_domain *domain, for (i=0; itdb) goto do_query; - centry = wcache_fetch(cache, domain, "GM/%s", sid_to_string(sid_string, group_sid)); + centry = wcache_fetch(cache, domain, "GM/%s", + sid_to_fstring(sid_string, group_sid)); if (!centry) goto do_query; @@ -1999,7 +2003,7 @@ do_query: centry_put_string(centry, (*names)[i]); centry_put_uint32(centry, (*name_types)[i]); } - centry_end(centry, "GM/%s", sid_to_string(sid_string, group_sid)); + centry_end(centry, "GM/%s", sid_to_fstring(sid_string, group_sid)); centry_free(centry); skip_save: @@ -2480,7 +2484,8 @@ bool lookup_cached_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, return False; } - centry = wcache_fetch(cache, domain, "SN/%s", sid_to_string(tmp, sid)); + centry = wcache_fetch(cache, domain, "SN/%s", + sid_to_fstring(tmp, sid)); if (centry == NULL) { return False; } @@ -2690,7 +2695,7 @@ NTSTATUS wcache_remove_oldest_cached_creds(struct winbindd_domain *domain, const DEBUG(11,("we already have an entry, deleting that\n")); - fstr_sprintf(key_str, "CRED/%s", sid_to_string(tmp, sid)); + fstr_sprintf(key_str, "CRED/%s", sid_to_fstring(tmp, sid)); tdb_delete(cache->tdb, string_tdb_data(key_str)); @@ -3544,7 +3549,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, - sid_to_string(tmp, &domains[i].sid), + sid_to_fstring(tmp, &domains[i].sid), domains[i].trust_flags, domains[i].trust_attribs, domains[i].trust_type ); @@ -3825,7 +3830,7 @@ static void wcache_save_user_pwinfo(struct winbindd_domain *domain, centry_put_string( centry, gecos ); centry_put_uint32( centry, gid ); - centry_end(centry, "NSS/PWINFO/%s", sid_to_string(tmp, user_sid) ); + centry_end(centry, "NSS/PWINFO/%s", sid_to_fstring(tmp, user_sid) ); DEBUG(10,("wcache_save_user_pwinfo: %s\n", sid_string_dbg(user_sid) )); @@ -3848,7 +3853,7 @@ NTSTATUS nss_get_info_cached( struct winbindd_domain *domain, goto do_query; centry = wcache_fetch(cache, domain, "NSS/PWINFO/%s", - sid_to_string(tmp, user_sid)); + sid_to_fstring(tmp, user_sid)); if (!centry) goto do_query; diff --git a/source3/winbindd/winbindd_group.c b/source3/winbindd/winbindd_group.c index 49562a112c..140943cc2c 100644 --- a/source3/winbindd/winbindd_group.c +++ b/source3/winbindd/winbindd_group.c @@ -1649,7 +1649,7 @@ static void getusersids_recv(void *private_data, bool success, DOM_SID *sids, /* work out the response size */ for (i = 0; i < num_sids; i++) { fstring s; - sid_to_string(s, &sids[i]); + sid_to_fstring(s, &sids[i]); ret_size += strlen(s) + 1; } @@ -1663,7 +1663,7 @@ static void getusersids_recv(void *private_data, bool success, DOM_SID *sids, ofs = 0; for (i = 0; i < num_sids; i++) { fstring s; - sid_to_string(s, &sids[i]); + sid_to_fstring(s, &sids[i]); safe_strcpy(ret + ofs, s, ret_size - ofs - 1); ofs += strlen(ret+ofs) + 1; } diff --git a/source3/winbindd/winbindd_idmap.c b/source3/winbindd/winbindd_idmap.c index ebea6a7495..3c7aa2d0c2 100644 --- a/source3/winbindd/winbindd_idmap.c +++ b/source3/winbindd/winbindd_idmap.c @@ -84,7 +84,7 @@ void winbindd_set_mapping_async(TALLOC_CTX *mem_ctx, const struct id_map *map, request.cmd = WINBINDD_DUAL_SET_MAPPING; request.data.dual_idmapset.id = map->xid.id; request.data.dual_idmapset.type = map->xid.type; - sid_to_string(request.data.dual_idmapset.sid, map->sid); + sid_to_fstring(request.data.dual_idmapset.sid, map->sid); do_async(mem_ctx, idmap_child(), &request, winbindd_set_mapping_recv, (void *)cont, private_data); @@ -301,7 +301,7 @@ void winbindd_sid2uid_async(TALLOC_CTX *mem_ctx, const DOM_SID *sid, struct winbindd_request request; ZERO_STRUCT(request); request.cmd = WINBINDD_DUAL_SID2UID; - sid_to_string(request.data.dual_sid2id.sid, sid); + sid_to_fstring(request.data.dual_sid2id.sid, sid); do_async(mem_ctx, idmap_child(), &request, winbindd_sid2uid_recv, (void *)cont, private_data); } @@ -357,7 +357,7 @@ void winbindd_sid2gid_async(TALLOC_CTX *mem_ctx, const DOM_SID *sid, struct winbindd_request request; ZERO_STRUCT(request); request.cmd = WINBINDD_DUAL_SID2GID; - sid_to_string(request.data.dual_sid2id.sid, sid); + sid_to_fstring(request.data.dual_sid2id.sid, sid); DEBUG(7,("winbindd_sid2gid_async: Resolving %s to a gid\n", request.data.dual_sid2id.sid)); @@ -444,7 +444,7 @@ enum winbindd_result winbindd_dual_uid2sid(struct winbindd_domain *domain, result = idmap_uid_to_sid(&sid, state->request.data.uid); if (NT_STATUS_IS_OK(result)) { - sid_to_string(state->response.data.sid.sid, &sid); + sid_to_fstring(state->response.data.sid.sid, &sid); state->response.data.sid.type = SID_NAME_USER; return WINBINDD_OK; } @@ -501,7 +501,7 @@ enum winbindd_result winbindd_dual_gid2sid(struct winbindd_domain *domain, result = idmap_gid_to_sid(&sid, state->request.data.gid); if (NT_STATUS_IS_OK(result)) { - sid_to_string(state->response.data.sid.sid, &sid); + sid_to_fstring(state->response.data.sid.sid, &sid); DEBUG(10, ("[%5lu]: retrieved sid: %s\n", (unsigned long)state->pid, state->response.data.sid.sid)); diff --git a/source3/winbindd/winbindd_misc.c b/source3/winbindd/winbindd_misc.c index 2771faf152..8c3ef5bb6f 100644 --- a/source3/winbindd/winbindd_misc.c +++ b/source3/winbindd/winbindd_misc.c @@ -466,7 +466,7 @@ void winbindd_domain_info(struct winbindd_cli_state *state) domain->name); fstrcpy(state->response.data.domain_info.alt_name, domain->alt_name); - sid_to_string(state->response.data.domain_info.sid, &domain->sid); + sid_to_fstring(state->response.data.domain_info.sid, &domain->sid); state->response.data.domain_info.native_mode = domain->native_mode; @@ -498,7 +498,7 @@ static void domain_info_init_recv(void *private_data, bool success) domain->name); fstrcpy(state->response.data.domain_info.alt_name, domain->alt_name); - sid_to_string(state->response.data.domain_info.sid, &domain->sid); + sid_to_fstring(state->response.data.domain_info.sid, &domain->sid); state->response.data.domain_info.native_mode = domain->native_mode; diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c index 8a372a3a8c..5133239258 100644 --- a/source3/winbindd/winbindd_pam.c +++ b/source3/winbindd/winbindd_pam.c @@ -51,7 +51,7 @@ static NTSTATUS append_info3_as_txt(TALLOC_CTX *mem_ctx, state->response.data.auth.info3.user_rid = info3->user_rid; state->response.data.auth.info3.group_rid = info3->group_rid; - sid_to_string(str_sid, &(info3->dom_sid.sid)); + sid_to_fstring(str_sid, &(info3->dom_sid.sid)); fstrcpy(state->response.data.auth.info3.dom_sid, str_sid); state->response.data.auth.info3.num_groups = info3->num_groups; @@ -187,7 +187,7 @@ static NTSTATUS append_afs_token(TALLOC_CTX *mem_ctx, sid_copy(&user_sid, &info3->dom_sid.sid); sid_append_rid(&user_sid, info3->user_rid); - sid_to_string(sidstr, &user_sid); + sid_to_fstring(sidstr, &user_sid); afsname = talloc_string_sub(mem_ctx, afsname, "%s", sidstr); } diff --git a/source3/winbindd/winbindd_sid.c b/source3/winbindd/winbindd_sid.c index 302460c942..0e8e6ca00b 100644 --- a/source3/winbindd/winbindd_sid.c +++ b/source3/winbindd/winbindd_sid.c @@ -118,7 +118,7 @@ static void lookupname_recv(void *private_data, bool success, return; } - sid_to_string(state->response.data.sid.sid, sid); + sid_to_fstring(state->response.data.sid.sid, sid); state->response.data.sid.type = type; request_ok(state); return; diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c index 5ac1eb64da..70468b6bcd 100644 --- a/source3/winbindd/winbindd_util.c +++ b/source3/winbindd/winbindd_util.c @@ -668,7 +668,7 @@ enum winbindd_result winbindd_dual_init_connection(struct winbindd_domain *domai fstrcpy(state->response.data.domain_info.name, domain->name); fstrcpy(state->response.data.domain_info.alt_name, domain->alt_name); - sid_to_string(state->response.data.domain_info.sid, &domain->sid); + sid_to_fstring(state->response.data.domain_info.sid, &domain->sid); state->response.data.domain_info.native_mode = domain->native_mode; -- cgit