summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-12-18 18:06:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:05:53 -0500
commit28fb5b6f97c17af58ae99be98219de70ee95baba (patch)
tree0b174e5ad07aa1a33dd73bb986e00a9386043b09 /source3/nsswitch
parent0a585102d656b267af723a5bdd258e83f532c3a6 (diff)
downloadsamba-28fb5b6f97c17af58ae99be98219de70ee95baba.tar.gz
samba-28fb5b6f97c17af58ae99be98219de70ee95baba.tar.bz2
samba-28fb5b6f97c17af58ae99be98219de70ee95baba.zip
r12313: Introduce yet another copy of the string_sub function:
talloc_string_sub. Someone with time on his hands could convert all the callers of all_string_sub to this. realloc_string_sub is *only* called from within substitute.c, it could be moved there I think. Volker (This used to be commit be6c9012da174d5d5116e5172a53bbe6486d6c38)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/winbindd_pam.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source3/nsswitch/winbindd_pam.c b/source3/nsswitch/winbindd_pam.c
index e683f397b6..1d9b77afee 100644
--- a/source3/nsswitch/winbindd_pam.c
+++ b/source3/nsswitch/winbindd_pam.c
@@ -419,16 +419,21 @@ done:
if ( NT_STATUS_IS_OK(result) &&
(state->request.flags & WBFLAG_PAM_AFS_TOKEN) ) {
- char *afsname = SMB_STRDUP(lp_afs_username_map());
+ char *afsname = talloc_strdup(state->mem_ctx,
+ lp_afs_username_map());
char *cell;
if (afsname == NULL) {
goto no_token;
}
- afsname = realloc_string_sub(afsname, "%D", name_domain);
- afsname = realloc_string_sub(afsname, "%u", name_user);
- afsname = realloc_string_sub(afsname, "%U", name_user);
+ afsname = talloc_string_sub(state->mem_ctx,
+ lp_afs_username_map(),
+ "%D", name_domain);
+ afsname = talloc_string_sub(state->mem_ctx, afsname,
+ "%u", name_user);
+ afsname = talloc_string_sub(state->mem_ctx, afsname,
+ "%U", name_user);
{
DOM_SID user_sid;
@@ -437,7 +442,8 @@ done:
sid_copy(&user_sid, &info3.dom_sid.sid);
sid_append_rid(&user_sid, info3.user_rid);
sid_to_string(sidstr, &user_sid);
- afsname = realloc_string_sub(afsname, "%s", sidstr);
+ afsname = talloc_string_sub(state->mem_ctx, afsname,
+ "%s", sidstr);
}
if (afsname == NULL) {
@@ -466,7 +472,7 @@ done:
strlen(state->response.extra_data)+1;
no_token:
- SAFE_FREE(afsname);
+ talloc_free(afsname);
}
return NT_STATUS_IS_OK(result) ? WINBINDD_OK : WINBINDD_ERROR;