diff options
author | Volker Lendecke <vl@samba.org> | 2007-12-15 22:00:39 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2007-12-15 22:09:37 +0100 |
commit | 14ef4cdec1ab6be55c97d0f32780cbddbcdde218 (patch) | |
tree | e7cb94297496f758a7935aaec62c7dd772e96f3a /source3/passdb | |
parent | d899b8c56ad6556baf2d2374704cc8cd1b15d5ad (diff) | |
download | samba-14ef4cdec1ab6be55c97d0f32780cbddbcdde218.tar.gz samba-14ef4cdec1ab6be55c97d0f32780cbddbcdde218.tar.xz samba-14ef4cdec1ab6be55c97d0f32780cbddbcdde218.zip |
Replace sid_string_static with sid_to_string
This adds 28 fstrings on the stack, but I think an fstring on the stack is
still far better than a static one.
(This used to be commit c7c885078be8fd3024c186044ac28275d7609679)
Diffstat (limited to 'source3/passdb')
-rw-r--r-- | source3/passdb/pdb_interface.c | 3 | ||||
-rw-r--r-- | source3/passdb/pdb_ldap.c | 14 |
2 files changed, 11 insertions, 6 deletions
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); |