From: Volker Lendecke Date: Sat, 15 Dec 2007 20:10:58 +0000 (+0100) Subject: Use sid_string_talloc where we have a tmp talloc ctx X-Git-Tag: samba-3.2.0pre2~223 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=f00ab810d2540679bec109498ac89e1eafe18f03;p=samba.git Use sid_string_talloc where we have a tmp talloc ctx --- diff --git a/source/auth/auth_util.c b/source/auth/auth_util.c index c0a9e9bc846..0d4caecb2df 100644 --- a/source/auth/auth_util.c +++ b/source/auth/auth_util.c @@ -586,12 +586,12 @@ static NTSTATUS log_nt_token(TALLOC_CTX *tmp_ctx, NT_USER_TOKEN *token) for (i=1; inum_sids; i++) { group_sidstr = talloc_asprintf( tmp_ctx, "%s %s", group_sidstr, - sid_string_static(&token->user_sids[i])); + sid_string_talloc(tmp_ctx, &token->user_sids[i])); } command = talloc_string_sub( tmp_ctx, lp_log_nt_token_command(), - "%s", sid_string_static(&token->user_sids[0])); + "%s", sid_string_talloc(tmp_ctx, &token->user_sids[0])); command = talloc_string_sub(tmp_ctx, command, "%t", group_sidstr); if (command == NULL) { diff --git a/source/passdb/pdb_ldap.c b/source/passdb/pdb_ldap.c index 205ca68fe3e..750b71fb1c8 100644 --- a/source/passdb/pdb_ldap.c +++ b/source/passdb/pdb_ldap.c @@ -2248,7 +2248,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, struct s "(&(%s=%s)(|(objectClass=%s)(objectClass=%s)))", get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_USER_SID), - sid_to_string(sid_string, sid), + sid_string_talloc(ctx, sid), LDAP_OBJ_IDMAP_ENTRY, LDAP_OBJ_SID_ENTRY); if (!filter) { @@ -2700,7 +2700,7 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods, "(sambaSID=%s))", LDAP_OBJ_POSIXGROUP, LDAP_OBJ_GROUPMAP, - sid_string_static(group)); + sid_string_talloc(mem_ctx, group)); if (filter == NULL) { ret = NT_STATUS_NO_MEMORY; goto done; @@ -3124,7 +3124,7 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods, } filter = talloc_asprintf(mem_ctx, "(sambaSid=%s)", - sid_string_static(&map->sid)); + sid_string_talloc(mem_ctx, &map->sid)); if (filter == NULL) { result = NT_STATUS_NO_MEMORY; goto done; @@ -3191,7 +3191,7 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods, * the best we can get out of LDAP. */ dn = talloc_asprintf(mem_ctx, "sambaSid=%s,%s", - sid_string_static(&map->sid), + sid_string_talloc(mem_ctx, &map->sid), lp_ldap_group_suffix()); if (dn == NULL) { result = NT_STATUS_NO_MEMORY; @@ -3206,7 +3206,7 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods, "sambaGroupMapping"); smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, NULL, &mods, "sambaSid", - sid_string_static(&map->sid)); + sid_string_talloc(mem_ctx, &map->sid)); smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, NULL, &mods, "sambaGroupType", talloc_asprintf(mem_ctx, "%d", map->sid_name_use)); smbldap_make_mod(ldap_state->smbldap_state->ldap_struct, NULL, &mods, "displayName", @@ -3259,8 +3259,8 @@ static NTSTATUS ldapsam_update_group_mapping_entry(struct pdb_methods *methods, "(sambaSid=%s)(gidNumber=%u)" "(sambaGroupType=%d))", LDAP_OBJ_GROUPMAP, - sid_string_static(&map->sid), map->gid, - map->sid_name_use); + sid_string_talloc(mem_ctx, &map->sid), + map->gid, map->sid_name_use); if (filter == NULL) { result = NT_STATUS_NO_MEMORY; goto done; @@ -3338,7 +3338,7 @@ static NTSTATUS ldapsam_delete_group_mapping_entry(struct pdb_methods *methods, filter = talloc_asprintf(mem_ctx, "(&(objectClass=%s)(%s=%s))", LDAP_OBJ_GROUPMAP, LDAP_ATTRIBUTE_SID, - sid_string_static(&sid)); + sid_string_talloc(mem_ctx, &sid)); if (filter == NULL) { result = NT_STATUS_NO_MEMORY; goto done; @@ -3797,7 +3797,8 @@ static NTSTATUS ldapsam_alias_memberships(struct pdb_methods *methods, for (i=0; isid)); + sid_string_talloc(memctx, ids[0]->sid)); CHECK_ALLOC_DONE(filter); DEBUG(10, ("Filter: [%s]\n", filter)); } else { @@ -1187,7 +1187,8 @@ again: for (i = 0; (i < IDMAP_LDAP_MAX_IDS) && ids[idx]; i++, idx++) { filter = talloc_asprintf_append_buffer(filter, "(%s=%s)", LDAP_ATTRIBUTE_SID, - sid_string_static(ids[idx]->sid)); + sid_string_talloc(memctx, + ids[idx]->sid)); CHECK_ALLOC_DONE(filter); } filter = talloc_asprintf_append_buffer(filter, "))"); @@ -1385,7 +1386,7 @@ static NTSTATUS idmap_ldap_set_mapping(struct idmap_domain *dom, id_str = talloc_asprintf(memctx, "%lu", (unsigned long)map->xid.id); CHECK_ALLOC_DONE(id_str); - sid = talloc_strdup(memctx, sid_string_static(map->sid)); + sid = talloc_strdup(memctx, sid_string_talloc(memctx, map->sid)); CHECK_ALLOC_DONE(sid); dn = talloc_asprintf(memctx, "%s=%s,%s",