diff options
-rw-r--r-- | source3/groupdb/mapping_tdb.c | 3 | ||||
-rw-r--r-- | source3/lib/privileges.c | 8 | ||||
-rw-r--r-- | source3/lib/substitute.c | 3 | ||||
-rw-r--r-- | source3/libads/ldap.c | 3 | ||||
-rw-r--r-- | source3/libsmb/samlogon_cache.c | 8 | ||||
-rw-r--r-- | source3/passdb/pdb_interface.c | 3 | ||||
-rw-r--r-- | source3/passdb/pdb_ldap.c | 14 | ||||
-rw-r--r-- | source3/rpc_server/srv_lsa_nt.c | 4 | ||||
-rw-r--r-- | source3/winbindd/idmap_cache.c | 5 | ||||
-rw-r--r-- | source3/winbindd/idmap_tdb.c | 12 | ||||
-rw-r--r-- | source3/winbindd/winbindd_async.c | 3 | ||||
-rw-r--r-- | source3/winbindd/winbindd_cache.c | 36 | ||||
-rw-r--r-- | source3/winbindd/winbindd_group.c | 6 |
13 files changed, 71 insertions, 37 deletions
diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c index 3e0ea61e9fc..ad8ed0d34d3 100644 --- a/source3/groupdb/mapping_tdb.c +++ b/source3/groupdb/mapping_tdb.c @@ -389,6 +389,7 @@ static bool enum_group_mapping(const DOM_SID *domsid, enum lsa_SidType sid_name_ static NTSTATUS one_alias_membership(const DOM_SID *member, DOM_SID **sids, size_t *num) { + fstring tmp; fstring key; char *string_sid; TDB_DATA dbuf; @@ -396,7 +397,7 @@ static NTSTATUS one_alias_membership(const DOM_SID *member, TALLOC_CTX *frame; slprintf(key, sizeof(key), "%s%s", MEMBEROF_PREFIX, - sid_string_static(member)); + sid_to_string(tmp, member)); dbuf = tdb_fetch_bystring(tdb, key); diff --git a/source3/lib/privileges.c b/source3/lib/privileges.c index 3e2c756849c..9f155acd8b9 100644 --- a/source3/lib/privileges.c +++ b/source3/lib/privileges.c @@ -40,7 +40,7 @@ typedef struct { static bool get_privileges( const DOM_SID *sid, SE_PRIV *mask ) { TDB_CONTEXT *tdb = get_account_pol_tdb(); - fstring keystr; + fstring tmp, keystr; TDB_DATA data; /* Fail if the admin has not enable privileges */ @@ -54,7 +54,7 @@ static bool get_privileges( const DOM_SID *sid, SE_PRIV *mask ) /* PRIV_<SID> (NULL terminated) as the key */ - fstr_sprintf( keystr, "%s%s", PRIVPREFIX, sid_string_static(sid) ); + fstr_sprintf(keystr, "%s%s", PRIVPREFIX, sid_to_string(tmp, sid)); data = tdb_fetch_bystring( tdb, keystr ); @@ -79,7 +79,7 @@ static bool get_privileges( const DOM_SID *sid, SE_PRIV *mask ) static bool set_privileges( const DOM_SID *sid, SE_PRIV *mask ) { TDB_CONTEXT *tdb = get_account_pol_tdb(); - fstring keystr; + fstring tmp, keystr; TDB_DATA data; if ( !lp_enable_privileges() ) @@ -95,7 +95,7 @@ static bool set_privileges( const DOM_SID *sid, SE_PRIV *mask ) /* PRIV_<SID> (NULL terminated) as the key */ - fstr_sprintf( keystr, "%s%s", PRIVPREFIX, sid_string_static(sid) ); + fstr_sprintf(keystr, "%s%s", PRIVPREFIX, sid_to_string(tmp, sid)); /* no packing. static size structure, just write it out */ diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index b456b9b9923..3fbdd2859e7 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -302,13 +302,14 @@ static char * realloc_expand_env_var(char *str, char *p) static char *longvar_domainsid( void ) { DOM_SID sid; + fstring tmp; char *sid_string; if ( !secrets_fetch_domain_sid( lp_workgroup(), &sid ) ) { return NULL; } - sid_string = SMB_STRDUP( sid_string_static( &sid ) ); + sid_string = SMB_STRDUP( sid_to_string( tmp, &sid ) ); if ( !sid_string ) { DEBUG(0,("longvar_domainsid: failed to dup SID string!\n")); diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index a4532cd2ea3..c3dd9154deb 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -1847,8 +1847,9 @@ static void dump_sid(ADS_STRUCT *ads, const char *field, struct berval **values) int i; for (i=0; values[i]; i++) { DOM_SID sid; + fstring tmp; sid_parse(values[i]->bv_val, values[i]->bv_len, &sid); - printf("%s: %s\n", field, sid_string_static(&sid)); + printf("%s: %s\n", field, sid_to_string(tmp, &sid)); } } diff --git a/source3/libsmb/samlogon_cache.c b/source3/libsmb/samlogon_cache.c index b1d6c8d8f3d..a15a3b228d6 100644 --- a/source3/libsmb/samlogon_cache.c +++ b/source3/libsmb/samlogon_cache.c @@ -107,7 +107,7 @@ void netsamlogon_clear_cached_user(TDB_CONTEXT *tdb, NET_USER_INFO_3 *user) bool netsamlogon_cache_store( const char *username, NET_USER_INFO_3 *user ) { TDB_DATA data; - fstring keystr; + fstring keystr, tmp; prs_struct ps; bool result = False; DOM_SID user_sid; @@ -124,7 +124,7 @@ bool netsamlogon_cache_store( const char *username, NET_USER_INFO_3 *user ) sid_append_rid( &user_sid, user->user_rid ); /* Prepare key as DOMAIN-SID/USER-RID string */ - slprintf(keystr, sizeof(keystr), "%s", sid_string_static(&user_sid)); + slprintf(keystr, sizeof(keystr), "%s", sid_to_string(tmp, &user_sid)); DEBUG(10,("netsamlogon_cache_store: SID [%s]\n", keystr)); @@ -177,7 +177,7 @@ NET_USER_INFO_3* netsamlogon_cache_get( TALLOC_CTX *mem_ctx, const DOM_SID *user NET_USER_INFO_3 *user = NULL; TDB_DATA data; prs_struct ps; - fstring keystr; + fstring keystr, tmp; uint32 t; if (!netsamlogon_cache_init()) { @@ -186,7 +186,7 @@ NET_USER_INFO_3* netsamlogon_cache_get( TALLOC_CTX *mem_ctx, const DOM_SID *user } /* Prepare key as DOMAIN-SID/USER-RID string */ - slprintf(keystr, sizeof(keystr), "%s", sid_string_static(user_sid)); + slprintf(keystr, sizeof(keystr), "%s", sid_to_string(tmp, user_sid)); DEBUG(10,("netsamlogon_cache_get: SID [%s]\n", keystr)); data = tdb_fetch_bystring( netsamlogon_tdb, keystr ); diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index d455b7636c7..6a75732de75 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -578,6 +578,7 @@ static NTSTATUS pdb_default_create_dom_group(struct pdb_methods *methods, { DOM_SID group_sid; struct group *grp; + fstring tmp; grp = getgrnam(name); @@ -605,7 +606,7 @@ static NTSTATUS pdb_default_create_dom_group(struct pdb_methods *methods, sid_compose(&group_sid, get_global_sam_sid(), *rid); - return add_initial_entry(grp->gr_gid, sid_string_static(&group_sid), + return add_initial_entry(grp->gr_gid, sid_to_string(tmp, &group_sid), SID_NAME_DOM_GRP, name, NULL); } diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index b6f8c2d92e6..466222da800 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -2577,11 +2577,12 @@ static NTSTATUS ldapsam_getgrsid(struct pdb_methods *methods, GROUP_MAP *map, { char *filter = NULL; NTSTATUS status; + fstring tmp; if (asprintf(&filter, "(&(objectClass=%s)(%s=%s))", LDAP_OBJ_GROUPMAP, get_attr_key2string(groupmap_attr_list, LDAP_ATTR_GROUP_SID), - sid_string_static(&sid)) < 0) { + sid_to_string(tmp, &sid)) < 0) { return NT_STATUS_NO_MEMORY; } @@ -3545,6 +3546,7 @@ static NTSTATUS ldapsam_modify_aliasmem(struct pdb_methods *methods, LDAPMod **mods = NULL; int rc; enum lsa_SidType type = SID_NAME_USE_NONE; + fstring tmp; char *filter = NULL; @@ -3564,7 +3566,7 @@ static NTSTATUS ldapsam_modify_aliasmem(struct pdb_methods *methods, if (asprintf(&filter, "(&(objectClass=%s)(sambaSid=%s)(sambaGroupType=%d))", - LDAP_OBJ_GROUPMAP, sid_string_static(alias), + LDAP_OBJ_GROUPMAP, sid_to_string(tmp, alias), type) < 0) { return NT_STATUS_NO_MEMORY; } @@ -3612,7 +3614,7 @@ static NTSTATUS ldapsam_modify_aliasmem(struct pdb_methods *methods, smbldap_set_mod(&mods, modop, get_attr_key2string(groupmap_attr_list, LDAP_ATTR_SID_LIST), - sid_string_static(member)); + sid_to_string(tmp, member)); rc = smbldap_modify(ldap_state->smbldap_state, dn, mods); @@ -3665,6 +3667,7 @@ static NTSTATUS ldapsam_enum_aliasmem(struct pdb_methods *methods, char *filter = NULL; size_t num_members = 0; enum lsa_SidType type = SID_NAME_USE_NONE; + fstring tmp; *pp_members = NULL; *p_num_members = 0; @@ -3685,7 +3688,7 @@ static NTSTATUS ldapsam_enum_aliasmem(struct pdb_methods *methods, if (asprintf(&filter, "(&(objectClass=%s)(sambaSid=%s)(sambaGroupType=%d))", - LDAP_OBJ_GROUPMAP, sid_string_static(alias), + LDAP_OBJ_GROUPMAP, sid_to_string(tmp, alias), type) < 0) { return NT_STATUS_NO_MEMORY; } @@ -4724,6 +4727,7 @@ static bool ldapsam_search_grouptype(struct pdb_methods *methods, struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)methods->private_data; struct ldap_search_state *state; + fstring tmp; state = TALLOC_P(search->mem_ctx, struct ldap_search_state); if (state == NULL) { @@ -4739,7 +4743,7 @@ static bool ldapsam_search_grouptype(struct pdb_methods *methods, state->filter = talloc_asprintf(search->mem_ctx, "(&(objectclass=sambaGroupMapping)" "(sambaGroupType=%d)(sambaSID=%s*))", - type, sid_string_static(sid)); + type, sid_to_string(tmp, sid)); state->attrs = talloc_attrs(search->mem_ctx, "cn", "sambaSid", "displayName", "description", "sambaGroupType", NULL); diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c index 43e4648fa8a..02f7f090a4b 100644 --- a/source3/rpc_server/srv_lsa_nt.c +++ b/source3/rpc_server/srv_lsa_nt.c @@ -861,6 +861,7 @@ static NTSTATUS _lsa_lookup_sids_internal(pipes_struct *p, struct lsa_name_info *name = &name_infos[i]; if (name->type == SID_NAME_UNKNOWN) { + fstring tmp; name->dom_idx = -1; /* Unknown sids should return the string * representation of the SID. Windows 2003 behaves @@ -869,7 +870,8 @@ static NTSTATUS _lsa_lookup_sids_internal(pipes_struct *p, * SID. We (Jerry/VL) could not figure out which the * hard cases are, so leave it with the SID. */ name->name = talloc_asprintf(p->mem_ctx, "%s", - sid_string_static(sids[i])); + sid_to_string(tmp, + sids[i])); if (name->name == NULL) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/winbindd/idmap_cache.c b/source3/winbindd/idmap_cache.c index 6455f5ee69f..4e286f88c03 100644 --- a/source3/winbindd/idmap_cache.c +++ b/source3/winbindd/idmap_cache.c @@ -77,7 +77,10 @@ void idmap_cache_shutdown(struct idmap_cache_ctx *cache) NTSTATUS idmap_cache_build_sidkey(TALLOC_CTX *ctx, char **sidkey, const struct id_map *id) { - *sidkey = talloc_asprintf(ctx, "IDMAP/SID/%s", sid_string_static(id->sid)); + fstring sidstr; + + *sidkey = talloc_asprintf(ctx, "IDMAP/SID/%s", + sid_to_string(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 1ec7085a3be..d693c357f72 100644 --- a/source3/winbindd/idmap_tdb.c +++ b/source3/winbindd/idmap_tdb.c @@ -712,8 +712,10 @@ static NTSTATUS idmap_tdb_sid_to_id(struct idmap_tdb_context *ctx, struct id_map TDB_DATA data; char *keystr; unsigned long rec_id = 0; + fstring tmp; - if ((keystr = talloc_asprintf(ctx, "%s", sid_string_static(map->sid))) == NULL) { + if ((keystr = talloc_asprintf(ctx, "%s", + sid_to_string(tmp, map->sid))) == NULL) { DEBUG(0, ("Out of memory!\n")); ret = NT_STATUS_NO_MEMORY; goto done; @@ -864,6 +866,7 @@ static NTSTATUS idmap_tdb_set_mapping(struct idmap_domain *dom, const struct id_ NTSTATUS ret; TDB_DATA ksid, kid, data; char *ksidstr, *kidstr; + fstring tmp; /* make sure we initialized */ if ( ! dom->initialized) { @@ -905,7 +908,8 @@ static NTSTATUS idmap_tdb_set_mapping(struct idmap_domain *dom, const struct id_ goto done; } - if ((ksidstr = talloc_asprintf(ctx, "%s", sid_string_static(map->sid))) == NULL) { + if ((ksidstr = talloc_asprintf( + ctx, "%s", sid_to_string(tmp, map->sid))) == NULL) { DEBUG(0, ("Out of memory!\n")); ret = NT_STATUS_NO_MEMORY; goto done; @@ -977,6 +981,7 @@ static NTSTATUS idmap_tdb_remove_mapping(struct idmap_domain *dom, const struct NTSTATUS ret; TDB_DATA ksid, kid, data; char *ksidstr, *kidstr; + fstring tmp; /* make sure we initialized */ if ( ! dom->initialized) { @@ -1018,7 +1023,8 @@ static NTSTATUS idmap_tdb_remove_mapping(struct idmap_domain *dom, const struct goto done; } - if ((ksidstr = talloc_asprintf(ctx, "%s", sid_string_static(map->sid))) == NULL) { + if ((ksidstr = talloc_asprintf( + ctx, "%s", sid_to_string(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 1c30558058f..0971476f440 100644 --- a/source3/winbindd/winbindd_async.c +++ b/source3/winbindd/winbindd_async.c @@ -458,8 +458,9 @@ bool print_sidlist(TALLOC_CTX *mem_ctx, const DOM_SID *sids, *len = 0; *result = NULL; for (i=0; i<num_sids; i++) { + fstring tmp; sprintf_append(mem_ctx, result, len, &buflen, - "%s\n", sid_string_static(&sids[i])); + "%s\n", sid_to_string(tmp, &sids[i])); } if ((num_sids != 0) && (*result == NULL)) { diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index c4554a2ad4f..31747dd4c87 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -951,7 +951,7 @@ NTSTATUS wcache_cached_creds_exist(struct winbindd_domain *domain, const DOM_SID { struct winbind_cache *cache = get_cache(domain); TDB_DATA data; - fstring key_str; + fstring key_str, tmp; uint32 rid; if (!cache->tdb) { @@ -966,7 +966,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_string_static(sid)); + fstr_sprintf(key_str, "CRED/%s", sid_to_string(tmp, sid)); data = tdb_fetch(cache->tdb, string_tdb_data(key_str)); if (!data.dptr) { @@ -991,6 +991,7 @@ NTSTATUS wcache_get_creds(struct winbindd_domain *domain, NTSTATUS status; time_t t; uint32 rid; + fstring tmp; if (!cache->tdb) { return NT_STATUS_INTERNAL_DB_ERROR; @@ -1007,7 +1008,8 @@ NTSTATUS wcache_get_creds(struct winbindd_domain *domain, /* Try and get a salted cred first. If we can't fall back to an unsalted cred. */ - centry = wcache_fetch(cache, domain, "CRED/%s", sid_string_static(sid)); + centry = wcache_fetch(cache, domain, "CRED/%s", + sid_to_string(tmp, sid)); if (!centry) { DEBUG(10,("wcache_get_creds: entry for [CRED/%s] not found\n", sid_string_dbg(sid))); @@ -1555,6 +1557,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain, for (i=0; i<num_rids; i++) { DOM_SID sid; struct cache_entry *centry; + fstring tmp; if (!sid_compose(&sid, domain_sid, rids[i])) { result = NT_STATUS_INTERNAL_ERROR; @@ -1562,7 +1565,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain, } centry = wcache_fetch(cache, domain, "SN/%s", - sid_string_static(&sid)); + sid_to_string(tmp, &sid)); if (!centry) { goto do_query; } @@ -1678,11 +1681,13 @@ static NTSTATUS query_user(struct winbindd_domain *domain, struct winbind_cache *cache = get_cache(domain); struct cache_entry *centry = NULL; NTSTATUS status; + fstring tmp; if (!cache->tdb) goto do_query; - centry = wcache_fetch(cache, domain, "U/%s", sid_string_static(user_sid)); + centry = wcache_fetch(cache, domain, "U/%s", + sid_to_string(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 @@ -1852,8 +1857,9 @@ static NTSTATUS lookup_useraliases(struct winbindd_domain *domain, * resulting might come from any of the SIDs. */ for (i=0; i<num_sids; i++) { + fstring tmp; sidlist = talloc_asprintf(mem_ctx, "%s/%s", sidlist, - sid_string_static(&sids[i])); + sid_to_string(tmp, &sids[i])); if (sidlist == NULL) return NT_STATUS_NO_MEMORY; } @@ -2461,6 +2467,7 @@ bool lookup_cached_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, struct winbind_cache *cache; struct cache_entry *centry = NULL; NTSTATUS status; + fstring tmp; domain = find_lookup_domain_from_sid(sid); if (domain == NULL) { @@ -2473,7 +2480,7 @@ bool lookup_cached_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, return False; } - centry = wcache_fetch(cache, domain, "SN/%s", sid_string_static(sid)); + centry = wcache_fetch(cache, domain, "SN/%s", sid_to_string(tmp, sid)); if (centry == NULL) { return False; } @@ -2679,11 +2686,11 @@ NTSTATUS wcache_remove_oldest_cached_creds(struct winbindd_domain *domain, const /* we possibly already have an entry */ if (sid && NT_STATUS_IS_OK(wcache_cached_creds_exist(domain, sid))) { - fstring key_str; + fstring key_str, tmp; DEBUG(11,("we already have an entry, deleting that\n")); - fstr_sprintf(key_str, "CRED/%s", sid_string_static(sid)); + fstr_sprintf(key_str, "CRED/%s", sid_to_string(tmp, sid)); tdb_delete(cache->tdb, string_tdb_data(key_str)); @@ -3526,6 +3533,8 @@ static int pack_tdc_domains( struct winbindd_tdc_domain *domains, /* now pack each domain trust record */ for ( i=0; i<num_domains; i++ ) { + fstring tmp; + if ( buflen > 0 ) { DEBUG(10,("pack_tdc_domains: Packing domain %s (%s)\n", domains[i].domain_name, @@ -3535,7 +3544,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_string_static(&domains[i].sid), + sid_to_string(tmp, &domains[i].sid), domains[i].trust_flags, domains[i].trust_attribs, domains[i].trust_type ); @@ -3806,6 +3815,7 @@ static void wcache_save_user_pwinfo(struct winbindd_domain *domain, uint32 gid) { struct cache_entry *centry; + fstring tmp; if ( (centry = centry_start(domain, status)) == NULL ) return; @@ -3815,7 +3825,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_string_static(user_sid) ); + centry_end(centry, "NSS/PWINFO/%s", sid_to_string(tmp, user_sid) ); DEBUG(10,("wcache_save_user_pwinfo: %s\n", sid_string_dbg(user_sid) )); @@ -3832,11 +3842,13 @@ NTSTATUS nss_get_info_cached( struct winbindd_domain *domain, struct winbind_cache *cache = get_cache(domain); struct cache_entry *centry = NULL; NTSTATUS nt_status; + fstring tmp; if (!cache->tdb) goto do_query; - centry = wcache_fetch(cache, domain, "NSS/PWINFO/%s", sid_string_static(user_sid)); + centry = wcache_fetch(cache, domain, "NSS/PWINFO/%s", + sid_to_string(tmp, user_sid)); if (!centry) goto do_query; diff --git a/source3/winbindd/winbindd_group.c b/source3/winbindd/winbindd_group.c index dc8cebf92fb..49562a112c3 100644 --- a/source3/winbindd/winbindd_group.c +++ b/source3/winbindd/winbindd_group.c @@ -1648,7 +1648,8 @@ static void getusersids_recv(void *private_data, bool success, DOM_SID *sids, /* work out the response size */ for (i = 0; i < num_sids; i++) { - const char *s = sid_string_static(&sids[i]); + fstring s; + sid_to_string(s, &sids[i]); ret_size += strlen(s) + 1; } @@ -1661,7 +1662,8 @@ static void getusersids_recv(void *private_data, bool success, DOM_SID *sids, } ofs = 0; for (i = 0; i < num_sids; i++) { - const char *s = sid_string_static(&sids[i]); + fstring s; + sid_to_string(s, &sids[i]); safe_strcpy(ret + ofs, s, ret_size - ofs - 1); ofs += strlen(ret+ofs) + 1; } |