Replace sid_string_static with sid_to_string
authorVolker Lendecke <vl@samba.org>
Sat, 15 Dec 2007 21:00:39 +0000 (22:00 +0100)
committerVolker Lendecke <vl@samba.org>
Sat, 15 Dec 2007 21:09:37 +0000 (22:09 +0100)
This adds 28 fstrings on the stack, but I think an fstring on the stack is
still far better than a static one.

13 files changed:
source/groupdb/mapping_tdb.c
source/lib/privileges.c
source/lib/substitute.c
source/libads/ldap.c
source/libsmb/samlogon_cache.c
source/passdb/pdb_interface.c
source/passdb/pdb_ldap.c
source/rpc_server/srv_lsa_nt.c
source/winbindd/idmap_cache.c
source/winbindd/idmap_tdb.c
source/winbindd/winbindd_async.c
source/winbindd/winbindd_cache.c
source/winbindd/winbindd_group.c

index 3e0ea61e9fca97ab591467a628aba154bbc29be3..ad8ed0d34d3dd0d35149f8cbdca2166fc9f6e916 100644 (file)
@@ -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);
 
index 3e2c756849c085e3b292f1a09a7224abfa655967..9f155acd8b94e0a79efc4ea62103f029ab5d93ce 100644 (file)
@@ -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 */
        
index b456b9b9923db31110164c9ae2b3a1656101947d..3fbdd2859e78a2bd9d0ec1e52190f11210c0f5a0 100644 (file)
@@ -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"));
index a4532cd2ea3a978c64de726bf97c93c6d366c39d..c3dd9154debeb26e16624dea05dd3e7d830f512c 100644 (file)
@@ -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));
        }
 }
 
index b1d6c8d8f3d019cfb04d802fce21b3fd02ec52c6..a15a3b228d60e6a6688c86fbbc04674f1528a546 100644 (file)
@@ -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 );
        
index d455b7636c7fae18305e178f0c30512425f8bcf3..6a75732de75bfca67f2fce4e2706b5546cf23fda 100644 (file)
@@ -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);
 }
 
index b6f8c2d92e6304abc29973104a5c5b7e0ea89ff0..466222da800ea94b0a093b3e426143d188c19e42 100644 (file)
@@ -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);
index 43e4648fa8a6f02daf1273b5dc6310b6d8e3247c..02f7f090a4b1ace1dccbeb723e5c7696f89af366 100644 (file)
@@ -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;
                        }
index 6455f5ee69f06644181b953630823f4749322cc0..4e286f88c038a0b7f7be10d29dda5b89438ad6ab 100644 (file)
@@ -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;
index 1ec7085a3be0ae63acacdb76f4579e4aa1474027..d693c357f727812b51eafd290db0e652d6f93e38 100644 (file)
@@ -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;
index 1c30558058f6c32ca92b732487b08738567ecbb4..0971476f440c04db23f2dd6545bf9185cc48d88a 100644 (file)
@@ -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)) {
index c4554a2ad4f7cae8b7a476c2eaf26a7d943e9538..31747dd4c8793817cda959e27dbe8e3b9f75f2d6 100644 (file)
@@ -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;
index dc8cebf92fb682965b5e5541e121502a2241c245..49562a112c3d9f42d7d872e83425e39637dd023c 100644 (file)
@@ -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;
        }